Skip to content

treewide: *Flags convert to list from str#194256

Merged
Artturin merged 2 commits intoNixOS:stagingfrom
Artturin:treewides2
Oct 12, 2022
Merged

treewide: *Flags convert to list from str#194256
Artturin merged 2 commits intoNixOS:stagingfrom
Artturin:treewides2

Conversation

@Artturin
Copy link
Member

@Artturin Artturin commented Oct 3, 2022

*Flags implies a list

slightly relevant:

stdenv: start deprecating non-list configureFlags #173172

the makeInstalledTests function in nixos/tests/installed-tests/default.nix isn't available outside of nixpkgs so
it's not a breaking change

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` labels Oct 3, 2022
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member Author

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

@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. labels Oct 3, 2022
@piegamesde
Copy link
Member

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)

@fricklerhandwerk fricklerhandwerk removed their request for review October 4, 2022 07:14
@github-actions github-actions bot removed the 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. label Oct 4, 2022
@github-actions github-actions bot added 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: vim Advanced text editor 6.topic: vscode A free and versatile code editor that supports almost every major programming language. labels Oct 6, 2022
@ofborg ofborg bot requested review from matthuszagh and removed request for FRidh, Ma27, Profpatsch, RaghavSood, aanderse, dasJ, edolstra, globin, jtojnar, limeytexan and nbp October 6, 2022 16:47
Copy link
Member

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?

Copy link
Member Author

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"

Copy link
Member

@jtojnar jtojnar Oct 6, 2022

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

switched

Copy link
Member

Choose a reason for hiding this comment

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

Maybe something like:

Suggested change
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);

Copy link
Member Author

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

*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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: vim Advanced text editor 6.topic: vscode A free and versatile code editor that supports almost every major programming language. 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants