Skip to content

pnpm.fetchDeps: non-deterministic hash #422889

@jfraudeau

Description

@jfraudeau

pnpm.fetchDeps produces different hashes depending on whether the build directory and $out are on the same partition. This is a problem for setups where /nix is on its own partition

What we currently put in $out is a pnpm content-addressable store which is hardlinked with files with identical content in node_modules. During the install process for each package in node_modules pnpm will flip the permission executable bit of files that are declared in the bin field in package.json

When the workdir and $out are on the same partition files are properly hardlinked so the bit is flipped in node_modules and in the content-addressable store. When they are in different partitions there is no hardlink so original permissions are preserved in the content-addressable store.

This results in different hashes depending on the situation since permissions are taken into account when calculating the hash.

Here are the solutions that I could imagine:

  • Normalize permissions in fixupPhase -> No way to easily know what the permissions should be, may break other things
  • Put the store inside the workdir so we know it is on the same partition then copy it to $out

Any idea @Scrumplex @gepbird

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions