Repository navigation
fix: preserve literal RPM repository URL arguments - #4
Merged
Merged
Conversation
Inspired by docker#449. Apply reliable POSIX shell quoting to the current dnf5, dnf and yum repository commands, with offline execution tests for exact arguments and literal metacharacters. Signed-off-by: Su Yang <soulteary@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A custom
DOWNLOAD_URLorREPO_FILEcontaining spaces or shell metacharacters can split the RPM repository URL into multiple arguments or be interpreted by the innersh -c. Even the existing dnf5 single quotes break when the URL contains an apostrophe.This change quotes the assembled URL as one literal POSIX shell argument for dnf5, dnf and yum-config-manager. Embedded apostrophes, double quotes, dollar expressions and backticks remain part of the argument.
What changed
The implementation is inspired by docker/docker-install#449. It applies the quoting fix to the current code and does not restore the obsolete dnf5 temporary-file workaround.
Verification
The regression suite executes the installer's generated commands through the selected shell into inert package-manager mocks, then compares their exact argument arrays. Host detection is controlled by the harness; repository command generation comes from the installer.
Each run covers 48 cases across dnf5, dnf and yum and both stable/test channels: default and staging URLs, custom URL/repository filename combinations, mirror precedence, whitespace, single/double quotes, literal
$HOME,$(), backticks and newlines. Marker files confirm that the embedded command substitutions are not executed.Passed locally:
The new regression was run before the fix and failed on the dnf5 custom URL containing an apostrophe with an inner-shell syntax error. It passes with the fix. The fixed version values above are offline build fixtures; ShellCheck 0.11.0 was used locally.
These checks made no network requests, installed no packages and changed no host repository files. They verify argument transport; live RPM repository availability and package-manager compatibility require their respective Linux environments. The existing installation CI remains applicable.
Submission
This PR targets
soulteary/docker-install:main. The commit is DCO signed off. A separate branch contains this change without the fork's mirror additions, based on upstreammaster; open the upstream comparison for manual submission. No upstream PR has been created.