pnpm.fetchDeps: ensure consistent hashes by setting file permissions after fetching #350063
+12
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For reasons not yet completely understood,
pnpm
might create dependency files with inconsistent file permissions. Since file permissions influence the resulting hash, this PR attempts a workaround by ensuring consistency after the fact.NOTE: I am unsure that this should be merged prior to understanding what causes
pnpm
to generate inconsistent file permissions in the first place.Maybe this PR already helps others facing the same issue.
More details:
We tried to build a small pnpm-based application locally versus within Github actions.
Here we observed build failures due to differing hashes for
pnpmDeps
. After investigation of the actual derivation contents we discovered that on a local, Ubuntu 24.04.1 LTS-based laptops with multi-user nix installs, all files in the derivation either had444
or555
, the same derivation within theubuntu-24.04
-based runner (with single user install via nix-quick-install) had644
/755
as permissions and in different quantities.To make things even more confusing: The
ubuntu-22.04
agent runner showed the same behavior as our local environment.Detailed statistics.
ubuntu-22.04
Github actions runnerubuntu-22.04
Github actions runnerubuntu-24.04
Github actions runnerubuntu-24.04
Github actions runnerSince file permissions are stored in the NAR-archives used to derive the hash of a fixed output derivation, this leads to inconsistencies depending on where a derivation is built.
Hence, we ensure a consistent file permission schema:
-exec
suffix have 555.This schema was chosen because it as already upheld in most environments we tested (i.e. local multi user installs on Ubuntu 24.04.1 LTS and single user install via nix-quick-install in
ubuntu-22.04
-based Github action runners).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.