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).