Wrapping a value with builtins.break breaks most builtins #1165
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
awaiting
author
awaiting
contributors
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
Importance
High
Importance
Low
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
Release Blocking
Non-urgent
Release Blocking
Urgent
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
Urgency
High
Urgency
Low
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#1165
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
Wrapping a value with
builtins.break, which should be a transparent operation (likebuiltins.traceis), results in it being treated as a thunk by most builtins, instead of being seen as the underlying value.Steps To Reproduce
Multiple examples:
Expected behavior
A call to
builtins.breakis completely transparent to its consumer, such that ∀f,e,f (break e) == f e. This is the way that, for example,builtins.traceandbuiltins.warnwork (e.g.isAttrs (trace "foo" {}) == true).nix --versionoutputAdditional context
From what i can tell, this is caused by
prim_breaknot callingforceValueon its argument. Adding that call currently changes the output of testsrepl_characterization/stack_varsandrepl_characterization/regression_9917; this seems to be because it gives a different call stack:(on the left, the final call stack with current nix; on the right, the final call stack with
forceValue(args[0])added inprim_break)yup, that's a bug.
breakreturns its input unchanged instead of forcing it first, as would be required by our invariants. it's been like this foreverYeah, i thought this was known for a while but when i mentioned it to piegames on matrix they asked me to fill it here
fyi so there's no duplicate work: i'm making a cl for this (again it's basically just one line), including a test to make sure we don't regress on this (though i'll probably only finish it tomorrow, it's kinda late here)
This issue was mentioned on Gerrit on the following CLs: