1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 12:06:01 +01:00
nix/src
Sergei Zimmerman 34f06900aa
libexpr: Fix invalid handling of errors for imported functions
c39cc00404 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 6e78cc90d3)
2025-07-11 22:47:36 +03:00
..
build-remote Add -Wundef to make #if FOO an error if not defined 2025-04-05 13:44:58 +02:00
external-api-docs Format .nix files 2025-01-24 17:04:02 +01:00
internal-api-docs Format .nix files 2025-01-24 17:04:02 +01:00
libcmd nix repl: remember :load-flake calls for :reload 2025-05-14 18:36:56 +00:00
libexpr libexpr: Fix invalid handling of errors for imported functions 2025-07-11 22:47:36 +03:00
libexpr-c Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
libexpr-test-support Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
libexpr-tests Fix more -Wundef, in darwin context 2025-04-05 13:46:04 +02:00
libfetchers lockFlake(): Allow registry lookups for the top-level flake 2025-04-25 13:31:24 +02:00
libfetchers-tests Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
libflake Use correct parent outPath for relative path inputs 2025-06-27 11:59:11 +00:00
libflake-c Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
libflake-tests Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
libmain replace all instances of std::filesystem::directory_iterator with DirectoryIterator 2025-05-03 09:07:00 +02:00
libmain-c Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
libstore Fixes for GHSA-g948-229j-48j3 2025-06-19 16:40:11 +02:00
libstore-c Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
libstore-test-support Revert "Merge pull request #12862 from NixOS/mergify/bp/2.28-maintenance/pr-12853" 2025-04-03 10:05:58 +02:00
libstore-tests Derivation "advanced attrs" test: Ensure fields are set to distinct values 2025-04-15 14:25:13 -04:00
libutil libutil: Use caching directory_entry API in PosixSourceAccessor::readDirectory 2025-07-01 15:00:31 +00:00
libutil-c Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
libutil-test-support Remove unused tracing-file-system-object-sink.{hh,cc} 2025-04-07 20:42:08 +00:00
libutil-tests add DirectoryIterator to re-throw std::filesystem::filesystem_error 2025-05-03 09:06:56 +02:00
nix docs: Fix miscellaneous typos and formatting issues 2025-05-14 19:10:59 +00:00
nix-build Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
nix-channel Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
nix-collect-garbage replace all instances of std::filesystem::directory_iterator with DirectoryIterator 2025-05-03 09:07:00 +02:00
nix-copy-closure Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
nix-env Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
nix-instantiate Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
nix-store Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
perl Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
nix-functional-tests Build Functional tests with Meson 2024-08-14 15:35:40 -04:00
nix-manual Build the manual with Meson 2024-10-09 11:58:17 -04:00