Skip to content

Make sure -W argument to compgen is escaped#28

Open
ncfavier wants to merge 1 commit intohedning:masterfrom
ncfavier:master
Open

Make sure -W argument to compgen is escaped#28
ncfavier wants to merge 1 commit intohedning:masterfrom
ncfavier:master

Conversation

@ncfavier
Copy link
Copy Markdown

Fixes NixOS/nixpkgs#284162

Shell quoting is honored in the argument to compgen -W, which we approximate by not removing the double quotes from the Nix output.

A more robust solution would be to use nix-instantiate --json and parse the output with jq -r '@sh', but that requires adding an external dependency.

Shell quoting is honored in the argument to `-W`, which we approximate
by not removing the double quotes from the Nix output.

A more robust solution would be to use `nix-instantiate --json` and
parse the output with `jq -r '@sh'`, but that requires adding an external dependency.
Comment thread _nix
Comment on lines -1289 to +1292
COMPREPLY=($(compgen -W "${systems[*]//@(\[|\])/}" -- "$cur"))
COMPREPLY=($(compgen -W "${systems[*]}" -- "$cur"))
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_nix_eval_stdin already removes brackets.

github-merge-queue Bot pushed a commit to NixOS/nixpkgs that referenced this pull request Oct 17, 2025
Apply hedning/nix-bash-completions#26 to
nixpkgs, since upstream seems dead. (PR has been sitting there for 2
years.)

Due to a conflict with
hedning/nix-bash-completions#28, which is
already applied here in nixpkgs, pull 26 cannot be applied as is. I
rebased it and added it locally to nixpkgs.
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.

customization function makeScopeWithSplicing' messes up bash-completion for nix-shell -p

1 participant