Skip to content

builtins.pathExists returns false for symlink to directory suffixed with "/." #9585

@singron

Description

@singron

Describe the bug
If you create a symlink to a directory and then add "/." to the symlink path, that is a path to that directory. The OS recognizes that as a path to the directory. However, builtins.pathExists returns false.

Steps To Reproduce

mkdir regular-dir
ln -s regular-dir symlink-dir
nix eval --impure --expr 'builtins.pathExists (toString ./symlink-dir + "/.")'

Expected behavior

It should return true.

nix-env --version output
nix-env (Nix) 2.18.1

Additional context
Related: #8838 (Regression in builtins.pathExists)

This similarly breaks overlays if your <nixpkgs-overlays> is a symlink to a directory (e.g. a symlink in /etc pointing into /nix).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions