-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
treewide: *Flags convert to list from str #194256
Conversation
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec { | |||
nativeBuildInputs = [ cmake ]; | |||
buildInputs = [ zlib ]; | |||
|
|||
cmakeFlags = lib.optional stdenv.hostPlatform.isStatic [ | |||
cmakeFlags = lib.optionals stdenv.hostPlatform.isStatic [ |
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.
on the other hand this was wrong before and should definitely be changed.
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.
splitting in to a separate pr because i got some ideas
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.
did it in this pr
I'd appreciate some detailed description of the changes including their motivation, preferably in the PR description as well as in the commit messages. Is this change a potentially breaking one? ("API" wise, ignoring mistakes in execution) |
@@ -67,7 +67,7 @@ let | |||
'' + | |||
'' | |||
machine.succeed( | |||
"gnome-desktop-testing-runner ${testRunnerFlags} -d '${tested.installedTests}/share'" | |||
"gnome-desktop-testing-runner ${toString testRunnerFlags} -d '${tested.installedTests}/share'" |
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.
Perhaps use lib.escapeShellArgs
then?
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.
it's already escaped in the execute function of the tester
f"{timeout_str} sh -c {shlex.quote(command)} | (base64 --wrap 0; echo)\n" |
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.
That just ensures that the whole command is passed as a single argument to sh
. But if we accept list of arguments, I would expect them to properly handle arbitrary values, unlike a argument string, where the user is expected to ensure individual arguments are properly escaped (compare Python’s subprocess.run
with and without shell=True
). Though annoyingly, e.g. makeFlags
attribute currently does not follow this and values containing spaces will just break.
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.
switched
@@ -12,7 +12,7 @@ | |||
} @ args : | |||
|
|||
let | |||
mvnFlags = "-Dmaven.repo.local=$M2_REPO ${if doTest then "" else "-Dmaven.test.skip.exec=true"} ${extraMvnFlags}"; | |||
mvnFlags = builtins.toString [ "-Dmaven.repo.local=$M2_REPO" "${if doTest then "" else "-Dmaven.test.skip.exec=true"}" "${extraMvnFlags}" ]; |
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.
Maybe something like:
mvnFlags = builtins.toString [ "-Dmaven.repo.local=$M2_REPO" "${if doTest then "" else "-Dmaven.test.skip.exec=true"}" "${extraMvnFlags}" ]; | |
mvnFlags = builtins.toString ([ | |
"-Dmaven.repo.local=$M2_REPO" | |
(lib.optionalString (!doTest) "-Dmaven.test.skip.exec=true") | |
] ++ extraMvnFlags); |
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.
extraMvnFlags
is a string but github search shows only one non-nixpkgs usage of it so it should be fine to change it to a list
https://github.com/search?p=6&q=extraMvnFlags&type=Code
https://github.com/taktoa/nix-packages/blob/master/packages/kframework/default.nix
@taktoa
a8fe748
to
007b1fc
Compare
*Flags implies a list slightly relevant: > stdenv: start deprecating non-list configureFlags NixOS#173172 the makeInstalledTests function in `nixos/tests/installed-tests/default.nix` isn't available outside of nixpkgs so it's not a breaking change
the argument to optional should not be list
*Flags implies a list
slightly relevant:
the makeInstalledTests function in
nixos/tests/installed-tests/default.nix
isn't available outside of nixpkgs soit's not a breaking change
Description of changes
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes