-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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: set -u
everywhere
#72347
treewide: set -u
everywhere
#72347
Conversation
This comment has been minimized.
This comment has been minimized.
This should be also mentioned in the release notes as it can break out-of-tree packages. |
set -u
everywhereset -u
everywhere
Wow, is there no way to mark a PR draft after the fact?!?! Embarrising, GitHub. |
7fe5b45
to
b27cf98
Compare
182ce64
to
7a97e90
Compare
Hydra reached the point where the legitimate failures were buried amidst all sorts of spurious failures. This makes it harder to use it. I think it might be ready to go to staging then, at least after this these newer evals get further? @globin @matthewbauer What do you think? |
set -u
everywhereset -u
everywhere
https://hydra.nixos.org/eval/1552118?compare=1551936&full=1#tabs-now-fail here is a comparison to the base commit, which is a nixpkgs-unstable eval. |
My earlier sed missed this because it already had `{..}`.
I don't want to just rebase this away because the original commit is also in #72074.
Darwin fails on the bash-no-undef-vars branch https://hydra.nixos.org/build/105765822 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
qt needs a fix: #73586 (comment) in pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh untested patch: diff --git a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
index 35982e86628..0ad185a16eb 100644
--- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
+++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
@@ -77,6 +77,8 @@ ecmUnseenHostPath() {
ecmHostPathHook() {
ecmUnseenHostPath "$1" || return 0
+ declare -a qtWrapperArgs
+
local xdgConfigDir="$1/etc/xdg"
if [ -d "$xdgConfigDir" ]
then |
Actually my commit could not be enough, but @Mic92's won't work either. The issue is bash says an undefined variable and and undefined variable are the same thing (which is terrible!!!). The direct workaround is awful |
Bash takes an assignment of a string to an array variable: local -a user_args user_args="(foo bar)" to mean appending the string to the array, not parsing the string into an array as is the case when on the same line as the declaration: local -a user_args="(foo bar)" b063340 extracted the declaration before the newly branched code block, causing string makeWrapperArgs being added to the array verbatim. Since local is function scoped, it does not matter if we move it inside each of the branches so we fix it this way.
Hmm, it appears this is not enough. For example In fact, when I comment out nixpkgs/pkgs/stdenv/generic/setup.sh Lines 1307 to 1308 in 4c7a9a0
and try to build
|
Indeed the work isn't done! https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L1307-L1308 needs to be guarded by I should have made an issue earlier when I realized this, but didn't have the time to immediately start fixing it. |
2 years or so ago I made stdenv and cc-wrapper use
set -u
, which enormously helped with debugging. But I didn't want to change all of nixpkgs so I added lots of temporaryset +u
-ing.Well, I think it's now time to bring the benefit to all of nixpkgs. Why? Because we have another big repo-wide refactor going on #72074. This will make that much easier to debug, and hopefully get some momentum going for stdenv tech debt fixing. Everyone chip in!
In particular, I think this is the easiest stdenv refactor we'd like to make, Why? This has the nice property that programs that continue to not fail have the same behavior. [Actually, this is not true with
trap
to catch failures or noset -e
, but we useset -e
and still fail aftertrap
-ing.] That means it's very easy to debug; no getting a bunch of things working only to find some deeper dependency was built wrong and needing to backtrack, and no needing to debug complex failures.I swear there was an issue for thus, but I couldn't find it.
Hydra job: https://hydra.nixos.org/jobset/nixpkgs/bash-no-undef-vars#tabs-evaluations
TODO:
Fix the broken things
Write release notes