Skip to content

fix: escape shell arguments in wsl-distro bin helpers - #848

Merged
nzbr merged 1 commit into
nix-community:mainfrom
hatch01:fix_extra_bin_path_escape
Nov 19, 2025
Merged

fix: escape shell arguments in wsl-distro bin helpers#848
nzbr merged 1 commit into
nix-community:mainfrom
hatch01:fix_extra_bin_path_escape

Conversation

@hatch01

@hatch01 hatch01 commented Nov 2, 2025

Copy link
Copy Markdown
Contributor

Currently my use case was to add Windows GPG to extraBin; however, the path is "/mnt/c/Program Files (x86)/GnuPG/bin/gpg.exe" which contains spaces and parentheses that need to be escaped.
Without any modification, the string goes as is in the init script, and the cp/ln commands are just broken.
I temporarily fixed it by escaping the chars in the nix string "/mnt/c/Program\ Files\ \(x86\)/GnuPG/bin/gpg.exe".
However, it would, I think, be way better to escape the params at the script generation.

Summarry :

  • Added escapeShellArg to both source and destination arguments in cp and ln commands for entries in config.wsl.extraBin and cfg.extraBin, ensuring safer shell command execution.

@hatch01
hatch01 marked this pull request as ready for review November 2, 2025 16:00
@nzbr

nzbr commented Nov 19, 2025

Copy link
Copy Markdown
Member

Tested it locally and it seems to work as intended. Thanks!

@nzbr
nzbr merged commit da34694 into nix-community:main Nov 19, 2025
89 of 93 checks passed
@nzbr nzbr added the bug Something isn't working label Nov 19, 2025
@nzbr nzbr changed the title fix: Escape shell arguments in wsl-distro bin helpers fix: escape shell arguments in wsl-distro bin helpers Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants