Skip to content

fix: preserve literal RPM repository URL arguments - #4

Merged
soulteary merged 1 commit into
mainfrom
codex/feat/repository-url-quoting
Oct 5, 2026
Merged

soulteary merged 1 commit into
mainfrom
codex/feat/repository-url-quoting

Conversation

@soulteary

Copy link
Copy Markdown
Owner

A custom DOWNLOAD_URL or REPO_FILE containing spaces or shell metacharacters can split the RPM repository URL into multiple arguments or be interpreted by the inner sh -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

  • Add a small POSIX shell quoting helper and apply it to the three current RPM repository-add commands.
  • Preserve repository filename defaults, mirror precedence, channel handling and package-manager selection.
  • Add an independent offline CI job and document the regression suite.

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:

python3 scripts/test-repository-url-quoting.py
TEST_SHELL=dash python3 scripts/test-repository-url-quoting.py
TEST_SHELL=bash python3 scripts/test-repository-url-quoting.py
sh -n install.sh
bash -n install.sh
make shellcheck STABLE_LATEST=29.4.2 TEST_LATEST=29.4.2 'SHELLCHECK=shellcheck -e SC1091,SC1117,SC2317,SC2329'
git diff --check

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 upstream master; open the upstream comparison for manual submission. No upstream PR has been created.

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>
@soulteary
soulteary merged commit 8054c47 into main Oct 5, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant