-
-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bash aliases set through module aren't escaped #16973
Comments
(triage) is this still reproducible? If yes, would you be willing to prepare a pull request? I can support you if you have questions. |
I confirm that I still can reproduce this issue, but (my apologies) I haven't time to try to fix it. @nagisa: As you also encountered this issue, would you be willing to try to patch it? |
I forgot to add the
|
I think #47471 has fixed the same issue for zsh. |
This patch uses the library function `lib.escapeShellArg` to improve the handling of shell aliases in the NixOS module `bash`, copying the corresponding change made to the `zsh` module in commit 1e211a7 (for which GitHub pull request NixOS#47471 was filed). This patch resolves GitHub issue NixOS#16973. This change presumably also should be copied to the `fish` module, but I don't know `fish` syntax so that won't be done by me. GitHub: Close NixOS#16973.
Huh, I wonder why this ticket didn't close automatically when d8bcd2c was merged. |
Because you have to use certain keywords github understands in either the PR description or the commit message, for example "Fixes #16973" would work. |
I did, and GitHub puts a tooltip on the keyword in its rendering of the commit message that would seem to imply that it understood me. |
True, that is weird. |
Issue description
Bash aliases defined with the
programs.bash.shellAliases
configuration option are defined (1) in/etc/bashrc
as —— where
${k}
and${v}
(which are variables in Nix, not in Bash) correspond to, respectively, the keys and values of the attribute set that is the value ofprograms.bash.shellAliases
.No escaping is performed on these values, so if one uses the apostrophe character in an alias defined in
programs.bash.shellAliases
, such as —— then the
bash
module will emit the following problematic line in/etc/bashrc
—— which is equivalent to —
— which first defines an alias
foo
, then queries the aliasqux
. No such alias exists, so "bash: alias: qux: not found" is printed each time one starts an interactive Bash instance.Steps to reproduce
Use
programs.bash.shellAliases
to define an alias containing an apostrophe, as above.Technical details
16.09pre85931.125ffff (Flounder)
nix-env (Nix) 1.11.2
"16.09pre85931.125ffff"
The text was updated successfully, but these errors were encountered: