libexpr: Fix invalid handling of errors for imported functions (backport #13450)#13451
Conversation
|
Cherry-pick of 6e78cc9 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
c39cc00 has added assertions for all Value accesses and the following case has started failing with an `unreachable`: (/tmp/fun.nix): ```nix {a}: a ``` ``` $ nix eval --impure --expr 'import /tmp/fun.nix {a="a";b="b";}' ``` This would crash: ``` terminating due to unexpected unrecoverable internal error: Unexpected condition in getStorage at ../include/nix/expr/value.hh:844 ``` This is not a regression, but rather surfaces an existing problem, which previously was left undiagnosed. In the case of an import `fun` is the `import` primOp, so that read is invalid and previously this resulted in an access into an inactive union member, which is UB. The correct thing to use is `vCur`. Identical problem also affected the case of a missing argument. Add previously failing test cases to the functional/lang test suite. Fixes #13448. (cherry picked from commit 6e78cc9)
3dc3515 to
34f0690
Compare
|
This pull request has been removed from the queue for the following reason: Pull request #13451 has been dequeued. The pull request could not be merged. This could be related to an activated branch protection or ruleset rule that prevents us from merging. (details: Required status check "installer test on macos" is in progress.). You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. |
Motivation
c39cc00 has added assertions for all Value accesses and the following case has started failing with an
unreachable:(/tmp/fun.nix):
This would crash:
This is not a regression, but rather surfaces an existing problem, which previously was left undiagnosed. In the case of an import
funis theimportprimOp, so that read is invalid and previously this resulted in an access into an inactive union member, which is UB. The correct thing to use isvCur. Identical problem also affected the case of a missing argument.Add previously failing test cases to the functional/lang test suite.
Context
Fixes #13448.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.
This is an automatic backport of pull request #13450 done by [Mergify](https://mergify.com).