Skip to content

builtins.pathExists returns false on symlinks that point to non-existent paths #9901

@infinisil

Description

@infinisil

Describe the bug

On master, builtins.pathExists returns false for an existing symlink that points to a non-existent path.

This is a regression, as Nix 2.18.1 returns true.

Steps To Reproduce

$ ln -s does-not-exist symlink
$ nix-instantiate --eval -E 'builtins.pathExists ./symlink'
false

Expected behavior

The same as Nix 2.18.1, which is true

nix-env --version output

nix-env (Nix) 2.21.0pre20240201_ef6d055

Additional context

This was found from the lib.fileset test suite in Nixpkgs failing in a PR (NixOS/nixpkgs#285264), after which @roberth opened #9900.

This may relate to previous regressions:

This issue is sponsored by Antithesis

Priorities

Add 👍 to issues you find important.

Metadata

Metadata

Assignees

Labels

bugregressionSomething doesn't work anymore

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions