Change in behavior of builtins.path
between 2.91.1 and 2.92.0 #776
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
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#776
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
I am trying to perform a pure evaluation of an arbitrary expression which imports a store path. This store path has a known path and hash (it is already in the store) and this functionality worked on Lix 2.91.1. However, after updating to 2.92.0 attempting to do so yields an error like the following:
Steps To Reproduce
store_path=$(nix-store --add-fixed --recursive sha256 $(pwd))
store_path_hash=$(nix-store --query $store_path --hash)
builtins.path
:nix eval --expr "builtins.path { path = \"$store_path\"; sha256 = \"$store_path_hash\"; }"
Expected behavior
I can see either this expression working or failing as acceptable, so long as it is consistent in Lix over the future. My initial thought is that this is likely an unintended change in functionality.
nix --version
outputAdditional context
It seems like this issue may be in some way related to Issue 402. I have also found just today that the following modification to the steps mentioned above does work on Lix 2.92.0:
It wasn't intuitive for me to need to pass
name
to this call, but it was mentioned on Matrix that this may be required.This is the flake purity fix in 2.92.0 probably?
Anyway I think the expression you give here would produce /nix/store/hash-hash-name ? Not confident of that fact, but pretty sure. And that's likely the root cause here: the expression you give is not a no-op.
We might want to take from this that we should improve the diagnostic in builtins.path for this case to say that it was trying to do a copy because it was missing the name parameter. And maybe also document the pure eval semantics of it.
Yes, this is a consequence the purity fix (I bisected to commit
8db8ac9a67
to be precise). However I think the observed behaviour is a bug since thebuiltins.path
call is pure due to having a hash specified. (In fact it doesn't fail if the target path is already in the store.)Yeah, hmmm. But the usage here is probably incorrect, since you really do want to give a name so nix doesn't cause pointless copies that have two hashes in them. Maybe that should generate a diagnostic.
@jade you are indeed correct that it ended up with a weird double-hash name! I had never seen that before and it makes sense given your description. I would like to be able to access fixed paths without having to deal with extra steps, but with the addition of
name
I do have things working properly again.