-
-
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
stdenv: add no-broken-symlinks hook #370750
stdenv: add no-broken-symlinks hook #370750
Conversation
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.
Conceptually LGTM, bash looks roughly OK and I don't trust myself to comment any further than that. Has anyone tried running the data on the number of broken symlinks in the current Hydra outputs?
As with @K900, this looks good to me in theory and I support the idea that a dangling or reflexive symlink is more often than not a bug. I'd love a test. Could you write a few using
|
865fa50
to
7aedd5a
Compare
The PR's base branch is set to staging, but 4 commits from the master branch are included. Make sure you know the right base branch for your changes, then:
|
7aedd5a
to
229fdf0
Compare
Added docs and tests, force-pushed and rebased! @K900 and @philiptaron would you mind taking another look? |
LGTM, should we get this a Hydra jobset, or do we just send it to staging? CC @vcunat. |
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.
Requesting change for the tests of relative symlinks, especially the error case due to interpolation.
The rest of the suggestions and thoughts are not blocking.
With regard to merge target, I favor staging rather than the work of setting up a special Hydra jobset, just on the grounds that we think these are generally bugs. If we get a swath of brokenness, we can revert this and we'll be fine, as I see it.
…against absolute symlinks
Quick tip for testing:
|
All feedback addressed! @philiptaron if you're happy, please feel free to merge :) |
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.
Looks good, let's see how it tastes in staging. (All tests.stdenv
pass.)
Adds a setup hook which checks for broken symlinks; a symlink is considered broken if it's dangling (target doesn't exist) or reflexive (it refers to itself).
In my experience, outputs with broken symlinks are generally errors, and so we should provide a hook which can catch and report them.
By setting
allowDanglingSymlinks
orallowReflexiveSymlinks
the hook can be configured to allow symlinks with non-existent targets or symlinks which are reflexive, respectively.The hook can be disabled entirely by setting
dontCheckForBrokenSymlinks
.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.