Repository navigation
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> (cherry picked from commit 451b222)
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.
- What I did
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. The existing dnf5 single quotes also break when the URL contains an apostrophe.This change quotes the assembled URL as one literal POSIX shell argument for the current dnf5, dnf and yum-config-manager repository-add commands. Apostrophes, double quotes, dollar expressions, backticks and newlines remain part of that argument.
- How I did it
The candidate is based on upstream
masterat 2b324800.- How to verify it
The suite executes the installer's generated commands through the selected shell, including the actual inner
sh -c, into inert package-manager mocks. It then compares exact argument arrays. The harness controls host detection; repository command generation comes from the installer.All 48 cases pass under each of
sh,dashandbash(144 successful cases). Coverage includes dnf5/dnf/yum, 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 embedded command substitutions are not executed.The regression also fails before the fix: an apostrophe in the dnf5 custom URL produces an inner-shell syntax error. The same case passes after quoting is applied.
ShellCheck 0.11.0 passed with the repository's existing exclusions. The fixed version values in the command above are offline build fixtures.
The candidate branch's GitHub Actions run passed in
soulteary/docker-install. This is validation of candidate commite22e1a6in the fork.The offline regression checks make no network requests, install no packages and change no host repository files. They establish exact argument transport and literal shell handling. The custom URL fixtures use mocks and do not validate live RPM repositories or behavior of real package-manager versions with those inputs.
Source and contribution
Inspired by docker/docker-install#449, by thaJeztah. This implementation applies the URL-quoting fix to the current repository-add commands.
The candidate was cherry-picked from 451b2228. Its commit retains the DCO sign-off:
- Description for the changelog
Preserve literal RPM repository URL arguments when executing repository setup commands.