-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
makeWrapper: quote variables #31497
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
makeWrapper: quote variables #31497
Conversation
Could you post an example of the resulting wrapper before and after this change? |
Before:
After:
|
This swaps no quoting for approximately correct quoting. Please do not add double quotes, use
|
3387d98
to
cfd9693
Compare
Excellent, thank you for the catch! To be honest I didn't know about Can you review this version? It passes my new test for me with the following wrapper:
|
@grahamc Bot forgot to remove old labels after a force-push. |
cfd9693
to
e842566
Compare
How can I quote EDIT: fixed it with a rewording for now. |
e842566
to
6020e18
Compare
@@ -63,9 +63,9 @@ makeWrapper() { | |||
n=$((n + 3)) | |||
if test -n "$value"; then | |||
if test "$p" = "--suffix"; then | |||
echo "export $varName=\$$varName\${$varName:+$separator}$value" >> "$wrapper" | |||
echo "export $varName=\$$varName\${$varName:+'${separator@Q}'}${value@Q}" >> "$wrapper" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These '
should not be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, leftover. Fixed.
This uses Bash ${foo@Q} feature to quote values properly, which allows us to handle values containing spaces, dollars etc. Thanks orivej for the idea!
6020e18
to
29c0591
Compare
I've learnt about it not long ago; before that I'd have suggested to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this looks good. (But I've not tested it.)
I have set up a Hydra cluster and tested this. Thank you! |
Somehow I missed some failures… This is causing a bit of trouble in |
After NixOS#31497 starter quoting all values, there arouse the need to left some values evaluated. `--set-default var value` expands to `export var=${var-value}`, where value is not evaluated and literally assigned to var unless it is already set. `--set-eval var value` expands to `export var=$(eval echo value)`, where value is evaluated by `eval`.
The docs refer to the source files for such details, so I see no direct need to update the manual. It seems too low-level detail for release notes, too, not affecting any "normal" uses of the wrappers. |
Well that explains why a few of my wrappers suddenly stopped working.. |
running pinta after NixOS#31497 results in: ``` Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f' or one of its dependencies. File name: 'glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f' [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f' or one of its dependencies. File name: 'glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f' ```
Motivation for this change
Fix things like
--prefix FOO ' ' 'bar baz'
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)