Skip to content

Import symlink resolution regression #12449

@edolstra

Description

@edolstra

Describe the bug

Nix 2.19.8:

$ nix eval https://flakehub.com/f/DeterminateSystems/nix/2.26.1 --raw --system x86_64-linux --apply '(x: x.drvPath)'
/nix/store/v7v8pli2n4biwwgbh9csc5jlk6f3b4kx-nix-2.26.1.drv

Nix 2.27:

$ nix eval https://flakehub.com/f/DeterminateSystems/nix/2.26.1 --raw --system x86_64-linux --apply '(x: x.drvPath)'
/nix/store/rv615sv2w4wad00cms2x7562krinz1ah-nix-2.26.1.drv

However 2.19.8 produces the same result as 2.27 when using --impure:

$ nix eval https://flakehub.com/f/DeterminateSystems/nix/2.26.1 --raw --system x86_64-linux --apply '(x: x.drvPath)' --impure
/nix/store/rv615sv2w4wad00cms2x7562krinz1ah-nix-2.26.1.drv

This issue is triggered by this line:

  nix-functional-tests = callPackage ../src/nix-functional-tests/package.nix {

where ../src/nix-functional-tests is a symlink to tests/functional. The latter has

    workDir = ./.;

which via

      sourceRoot = "${src.name}/" + workDirSubpath;

ends up in the derivation as source/./tests/functional (2.19) or source/./src/nix-functional-tests (2.27).

The root cause is that in Nix <= 2.19, we had a function checkSourcePath() that resolved symlinks depending on whether pure mode was enabled. This was removed in ea95327.

Steps To Reproduce

Expected behavior

Metadata

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugregressionSomething doesn't work anymore

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions