nix-super/src
Robert Hensing 9b88bf8adf Fix underflow in Printer::printAttrs
The code that counts the number of elided attrs incorrectly used the
per-printer "global" attribute counter instead of a counter that
was relevant only to the current attribute set.

This bug flew under the radar because often the attribute sets aren't
nested, not big enough, or we wouldn't pay attention to the numbers.
I've noticed the issue because the difference underflowed.

Although this behavior is tested by the functional test
lang/eval-fail-bad-string-interpolation-4.nix, the underflow slipped
through review. A simpler reproducer would be as follows, but I
haven't added it to the test suite to keep it simple and marginally
faster.

```
$ nix run nix/2.23.1 -- eval --expr '"" + (let v = { a = { a = 1; b = 2; c = 1; d = 1; e = 1; f = 1; g = 1; h = 1; }; b = { a = 1; b = 1; c = 1; }; }; in builtins.deepSeq v v)'
error:
       … while evaluating a path segment
         at «string»:1:6:
            1| "" + (let v = { a = { a = 1; b = 2; c = 1; d = 1; e = 1; f = 1; g = 1; h = 1; }; b = { a = 1; b = 1; c = 1; }; }; in builtins.deepSeq v v)
             |      ^

       error: cannot coerce a set to a string: { a = { a = 1; b = 2; c = 1; d = 1; e = 1; f = 1; g = 1; h = 1; }; b = { a = 1; «4294967289 attributes elided» }; }
```
2024-06-29 13:53:05 +02:00
..
build-remote Use the new StoreReference in Machine 2024-05-22 09:20:15 -04:00
external-api-docs Use lib instead of explicit fileset passing 2024-06-26 04:11:20 +02:00
internal-api-docs Use lib instead of explicit fileset passing 2024-06-26 04:11:20 +02:00
libcmd Split out a new libnixflake 2024-06-26 19:56:21 -04:00
libexpr Fix underflow in Printer::printAttrs 2024-06-29 13:53:05 +02:00
libexpr-c No global eval settings in libnixexpr 2024-06-24 12:15:16 -04:00
libfetchers Split out a new libnixflake 2024-06-26 19:56:21 -04:00
libflake Restore commit-lock-file-summary rename for consistency 2024-06-28 14:53:40 -07:00
libmain Split out GlobalConfig into its own header 2024-06-24 11:36:21 -04:00
libstore Merge branch 'master' into fix-sandbox-escape 2024-06-26 18:11:39 -04:00
libstore-c add empty line to documentation comments after @brief field (#10800) 2024-05-28 23:05:40 +00:00
libutil Merge branch 'master' into fix-sandbox-escape 2024-06-26 18:11:39 -04:00
libutil-c Use lib instead of explicit fileset passing 2024-06-26 04:11:20 +02:00
nix Split out a new libnixflake 2024-06-26 19:56:21 -04:00
nix-build No global eval settings in libnixexpr 2024-06-24 12:15:16 -04:00
nix-channel downloadFile(): Remove the "locked" (aka "immutable") flag 2024-04-08 15:56:16 +02:00
nix-collect-garbage inline the usage of nix::readDirectory 2024-05-12 17:42:18 +05:30
nix-copy-closure Restrict some code to StoreDirConfig 2023-11-04 19:05:36 -04:00
nix-env Merge pull request #10913 from NixOS/no-global-eval-settings-in-libexpr 2024-06-24 18:52:19 +02:00
nix-instantiate No global eval settings in libnixexpr 2024-06-24 12:15:16 -04:00
nix-store Cleanup ContentAddressMethod to match docs 2024-06-24 10:24:06 -04:00
perl Use lib instead of explicit fileset passing 2024-06-26 04:11:20 +02:00
libutil-test Build nix-util-c with meson and unit test 2024-06-25 21:35:23 +02:00
libutil-test-support Build nix-util-c with meson and unit test 2024-06-25 21:35:23 +02:00