$NIX_PATH
entries can shadow internal lookup paths #998
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#998
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
At times, Lix (or users) will call internal, vendored files (like
<nix/fetchurl.nix>
) for various operations. However, these can be shadowed by entries into$NIX_PATH
from the environment, which will completely break some functionality - especially if thenix
path entry actually contains files of the same name, as then Lix won't fall back to its internal filesSteps To Reproduce
mkdir -p not-internal-nix
echo 'assert false; "womp womp"' > not-internal-nix/fetchurl.nix
NIX_PATH="nix=$PWD/not-internal-nix" nix-instantiate -E "import <nix/fetchurl.nix>"
Expected behavior
Internal Lix files are always used and the names of my path entries don't (silently) cause this unattended consequence
A more specific idea I had was to maybe limit the "regular" lookup paths here (i.e., use certain characters or make a longer string that will make it basically impossible to have these kinds of conflicts, unlike the more plausible
nix
entry name). This obviously wouldn't work for internal files like <nix/fetchurl.nix> that are meant to be consumed though...so maybe we could special case those "public" ones? Or just not allow entry names namednix
to at least avoid this footgun?nix --version
outputAdditional context
Came across this originally in Nix through the very funny https://github.com/NixOS/nix/issues/14062, which was then diagnosed as this issue by @xokdvium, who also figured out the extent to which it goes
Pure evaluation is unaffected by this, since no
$NIX_PATH