-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
terminal-emulators/kitty: Fix ShellCheck lints #148947
terminal-emulators/kitty: Fix ShellCheck lints #148947
Conversation
5902432
to
1fdf6fe
Compare
Agreed.
|
Shouldn't whoever bumps ShellCheck also fix the lints as part of the PR? That way the code is simpler. It just couples the ShellCheck update to the linting, which seems natural. |
I don't really understand that documentation. I'm only up to part 33 of How to Learn Nix, and sentences like "Packages adding a hook should not hard code a specific hook, but rather choose a variable relative to how they are included." are still just gobbledygook to me. Based on the example code I'm guessing I need something like this (thrown together):
and then I need to use |
In theory, sure. In practice, no. Depends entirely on how many fixes (and rebuilds) are needed. Likely this check will just end up being disabled selectively or outright unless it can be introduced in way that isn't going to cause potential problems in the future. Also |
If we start doing this everywhere, we'll effectively require the Haskell toolchain including GHC (which is btw the largest package in e.g. my system closure with ~1.5G) in the build-closure for each package. Also, I fully agree with @zowoq, this will cause even more rebuilds:
I don't really understand why this shouldn't be part of a review/CI process. In theory, we'll only need to check this once when a PR is filed with the build scripts, right? |
That sounds like an excellent compromise. The vast majority of variable substitutions in embedded shell scripts are just paths or very simple strings, so there's probably a low chance of any reasonable configuration change to introduce a lint to a dependent script. How would you get to the various phase scripts from the outside, though? Are they all part of the output? |
1fdf6fe
to
9feffb4
Compare
9feffb4
to
a866e51
Compare
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 changes are ok with me. I'm a bit concerned about tooling and editor support to maintain this moving forward, but otherwise should be safe to merge.
@Artturin Would you be OK to review this? |
@@ -180,9 +180,10 @@ buildPythonApplication rec { | |||
''; | |||
|
|||
installPhase = '' | |||
set -o nounset |
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.
/nix/store/zx2jzw5j0lxigaq34wmyfkcia3n0cvxi-install-shell-files/nix-support/setup-hook: line 100: $1: unbound variable
I don't think this is worth setting like this because if someone changes one of the hooks but doesn't build kitty then the breakage will go undiscovered. Until the channels are updates (like what seems to have happened here)
a better place to start adding these would be pkgs/test/
example
diff --git a/pkgs/test/install-shell-files/default.nix b/pkgs/test/install-shell-files/default.nix
index aef5acc1de6b..27363175cfc3 100644
--- a/pkgs/test/install-shell-files/default.nix
+++ b/pkgs/test/install-shell-files/default.nix
@@ -5,7 +5,7 @@ let
runCommandLocal "install-shell-files--${name}" ({
nativeBuildInputs = [ installShellFiles ];
meta.platforms = lib.platforms.all;
- } // env) buildCommand;
+ } // env) ("set -o nounset\n" + buildCommand);
in
recurseIntoAttrs {
$ nix build ".#tests.install-shell-files.install-completion"
this derivation will be built:
/nix/store/bblpr8v64b153v0p842hv7fp2dvppy59-install-shell-files--install-completion.drv
building '/nix/store/bblpr8v64b153v0p842hv7fp2dvppy59-install-shell-files--install-completion.drv'...
install-shell-files> /nix/store/zx2jzw5j0lxigaq34wmyfkcia3n0cvxi-install-shell-files/nix-support/setup-hook: line 100: $1: unbound variable
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.
I've removed the set -o nounset
line - adding it to a more central test file should probably go into a separate PR. Relatedly:
-
Isn't changing that line going to cause thousands of rebuilds?
-
There are several other useful strictness directives; should we try to introduce several/all of the following?
set -o errexit -o noclobber -o nounset -o pipefail shopt -s failglob inherit_errexit
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.
Changing the tests won't cause many rebuilds but fixing the issue will of course.
set -eu
,set -o pipefail
, and shopt -s inherit_errexit
are already set setup.sh
but for them to be set during the build i guess they should be set in default-builder.sh
a866e51
to
a9a032f
Compare
Motivation for this change
#133088, @Artturin.
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