-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
Setting -u in stdenv to catch invalid variables #29296
Comments
As I recall this was already proposed but one argument against was the amount of noise required to handle potentially uninitialized variables (i.e., |
Actually we do. I did merge #28057. Careful use of I would be for doing that too, but this will be a significant undertaking. This is probably best paired with Nix defining env vars (it doesn't right now), so that more variables are always defined. |
@Ericson2314 ah, that's the one I was thinking of, I hadn't noticed it ended up being merged, so much has happened with stdenv lately :) |
A first step would be for somebody to find out how many packages do break when |
I wasn't aware of the earlier PR.
Such as? |
A few from memory: |
We need a |
Surely it wouldn't be that noisy to change references to |
@peterhoeg you aren't---I think it's worth it either way. |
Another option would be to use an approach similar to what the hardening guys did so that each derivation can simply disable the "pedanticHook" in case it causes problems. Of course, talk is cheap.... ;-) |
Somebody that isn't me should take the lead on this :). Grep for |
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
Closing as @Ericson2314 is the man! Ref #72347. |
Issue description
I propose we do
set -u
instdenv
to ensure that we catch references to unset variables and blow up accordingly.One example is this fix: 3f56114
Previously the derivation referenced
$pname
which should have been${pname}
. In this case, the impact was rather limited admittedly, but there is in all likelihood a number of bugs lurking because files end up in the wrong directory.Changing this will probably cause a lot of breakage (assuming this is a widespread issue).
Cc: @Ericson2314 @Profpatsch @NeQuissimus @vcunat @LnL7
The text was updated successfully, but these errors were encountered: