Pixi run fails on broken symlink since v0.31
Checks
-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pixi, using
pixi --version.
Reproducible example
pixi init .
pixi add gcc_impl_linux-64==14.1.0
Issue description
I noticed today in https://github.com/Deltares/Ribasim/pull/1870 that the upgrade from pixi v0.30 to v0.31 broke some of our CI jobs on Ubuntu that install rust and its dependency gcc_impl_linux-64 via pixi. When doing pixi run of different tasks, I regularly but not always run into:
× /home/runner/work/Ribasim/Ribasim/.pixi/envs/dev/lib/gcc/x86_64-conda-
│ linux-gnu/14.1.0/libhwasan.so: No such file or directory (os error 2)
I don't have a clear reproducer, but by installing only gcc_impl_linux-64==14.1.0 I do see that the referenced file is a broken symlink:
ls -la .pixi/envs/default/lib/gcc/x86_64-conda-linux-gnu/14.1.0/
libhwasan.so -> ../../../libhwasan.so
ls -la .pixi/envs/default/lib/
lrwxrwxrwx 1 visr visr 18 Oct 3 21:15 libhwasan.so.0 -> libhwasan.so.0.0.0
-rwxrwxr-x 2 visr visr 3708944 Aug 28 01:39 libhwasan.so.0.0.0
This symlink is equally broken when I install this environment with pixi v0.30, but it seems like v0.31 doesn't like broken symlinks. Might be something that needs fixing in a feedstock instead.
Expected behavior
Like pixi v0.30 no file not found errors.
I just tried to debug with rattler, but could not reproduce the issue yet.
@visr can you please try if you can reproduce the issue with the cache disabled?
Disabling the cache doesn't seem to help: https://github.com/Deltares/Ribasim/pull/1871
I think this the line which reports the error: https://github.com/conda/rattler/blob/0cacc4b66903aea0ce65e1c1283314b50440f6ae/crates/rattler_package_streaming/src/write.rs#L376
@Hofer-Julian unfortunately that's the code that would write a package so I think this might be unrelated.
@Hofer-Julian unfortunately that's the code that would write a package so I think this might be unrelated.
You are right, I debugged pixi on Ribasim and this PR is to blame: https://github.com/prefix-dev/pixi/pull/2141
Since our last release, we follow symlinks when searching for files for task caching: https://github.com/prefix-dev/pixi/blob/0317e0ad465cbc7aa1fc07e872dda8c7719f96d4/src/task/file_hashes.rs#L114
But actually that is only the symptom of the problem. When running with RUST_LOG=debug I've seen that files in .pixi are probed for task caching. There is also nothing in Ribasim's pixi.toml which should cause something like that.
That's the reason why the broken symlink in .pixi/envs suddenly matters.
Here is a small reproducer: https://github.com/Hofer-Julian/broken_symlink_pixi
Here is an even smaller one that works easily on macOS:
[project]
authors = ["Julian Hofer <[email protected]>"]
channels = ["conda-forge"]
description = "Add a short description here"
name = "broken_symlink"
platforms = ["linux-64", "osx-64", "osx-arm64"]
version = "0.1.0"
[tasks]
mklink = { cmd = "mkdir -p .pixi/envs/default && ln -s /broken .pixi/envs/default/broken" }
test = { cmd = "echo Hello", inputs = [".gitignore"], depends-on = ["mklink"] }