Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in symlink handling in 2.16 #9298

Closed
jtojnar opened this issue Nov 5, 2023 · 1 comment · Fixed by #9363
Closed

Regression in symlink handling in 2.16 #9298

jtojnar opened this issue Nov 5, 2023 · 1 comment · Fixed by #9363

Comments

@jtojnar
Copy link
Contributor

jtojnar commented Nov 5, 2023

Describe the bug

I have been creating a clean directory tree derivation by only symlinking interpolated paths of the relevant subdirectories.
Nix files in one of the subdirectories import files from different subdirectory.
But since the subdirectory paths are interpolated, each subdirectory will end up as a separate store path.

Since 2.16, the imported path appears to be resolved relative to realpath in some cases, breaking the previously working code.

I think this new behaviour is better in terms of #2109 but it is still a regression and I was asked to report it.

I bisected the regression to 94812cc

Steps To Reproduce

  1. Run the following commands:
mkdir -p 144-store/overlays
echo 'import ../lib' > 144-store/overlays/overlay.nix
mkdir -p 144-store/foo/lib
echo '"test"' > 144-store/foo/lib/default.nix
ln -s $PWD/144-store/overlays 144-store/foo/overlays
nix-instantiate --eval --strict "144-store/foo/overlays/overlay.nix"
  1. You will get
error:
       … while calling the 'import' builtin

         at /home/jtojnar/Projects/nixpkgs-hammering/144-store/overlays/overlay.nix:1:1:

            1| import ../lib
             | ^
            2|

       error: getting status of '/home/jtojnar/Projects/nixpkgs-hammering/144-store/lib': No such file or directory

Expected behavior

No error should be produced.

Unless this regression is acceptable, since this error is sensible wrt #2109.

nix-env --version output

2.18.1

Additional context

Discovered in jtojnar/nixpkgs-hammering#144

Priorities

Add 👍 to issues you find important.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-11-06-nix-team-meeting-minutes-101/35247/1

edolstra added a commit to edolstra/nix that referenced this issue Nov 16, 2023
This restores the symlink handling behaviour prior to
94812cc.

Fixes NixOS#9298.
@infinisil infinisil mentioned this issue Dec 11, 2023
9 tasks
github-actions bot pushed a commit that referenced this issue Jan 21, 2024
This restores the symlink handling behaviour prior to
94812cc.

Fixes #9298.

(cherry picked from commit 31ebc60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants