Files
lix/tests/functional/nar-access.nix
T
Raito BezariusandMaximilian Bosch 3c614a136b libstore/binary-cache: fix catching JSON exceptions
We were catching ForeignExceptions believing it came from the TRY_AWAIT
handler, but this was misguided.

`j.dump()` is evaluated in synchronous context, outside of the `try {
... } catch (...)` block from `TRY_AWAIT`.

Therefore, we need to use `JSON::Exception` directly.

The previous test case did not catch it because:

(1) https://git.lix.systems/lix-project/lix/issues/865 hid the fact that
`--arg` was wrong.
(2) we did not grep for the warning because… we were not even copying
the strange store path to the binary cache.
(3) checking for the NAR happened after the NAR directory was emptied
for test reasons and this was not even caught neither.

Anyway, the test case was completely busted and has now been tested
without this commit and after this commit and we can confirm that prior
to this commit, the test will fail with an exception trace.

Co-authored-by: Maximilian Bosch <maximilian@mbosch.me>
Change-Id: I8df5befd06c4a449072b987f82a67bc4437e7e49
Signed-off-by: Raito Bezarius <raito@lix.systems>
2025-07-25 21:04:16 +02:00

27 lines
530 B
Nix

{ nonUtf8Inodes ? false }:
with import ./config.nix;
rec {
a = mkDerivation {
name = "nar-index-a";
builder = builtins.toFile "builder.sh"
''
mkdir $out
mkdir $out/foo
touch $out/foo-x
touch $out/foo/bar
touch $out/foo/baz
touch $out/qux
mkdir $out/zyx
${if nonUtf8Inodes then ''touch `echo -e $out/$'\322'.txt`'' else ""}
cat >$out/foo/data <<EOF
lasjdöaxnasd
asdom 12398
ä"§Æẞ¢«»”alsd
EOF
'';
};
}