mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Make the NAR parser much stricter wrt field order
We really want to enforce a canonical representation since NAR hashing/signing/deduplication depends on that.
This commit is contained in:
parent
27ec0def74
commit
7aa3e7e3a5
4 changed files with 85 additions and 100 deletions
BIN
tests/functional/executable-after-contents.nar
Normal file
BIN
tests/functional/executable-after-contents.nar
Normal file
Binary file not shown.
BIN
tests/functional/name-after-node.nar
Normal file
BIN
tests/functional/name-after-node.nar
Normal file
Binary file not shown.
|
@ -112,3 +112,11 @@ expectStderr 1 nix-store --restore "$TEST_ROOT/out" < slash.nar | grepQuiet "NAR
|
|||
# Likewise for an empty filename.
|
||||
rm -rf "$TEST_ROOT/out"
|
||||
expectStderr 1 nix-store --restore "$TEST_ROOT/out" < empty.nar | grepQuiet "NAR contains invalid file name ''"
|
||||
|
||||
# Test that the 'executable' field cannot come before the 'contents' field.
|
||||
rm -rf "$TEST_ROOT/out"
|
||||
expectStderr 1 nix-store --restore "$TEST_ROOT/out" < executable-after-contents.nar | grepQuiet "expected tag ')', got 'executable'"
|
||||
|
||||
# Test that the 'name' field cannot come before the 'node' field in a directory entry.
|
||||
rm -rf "$TEST_ROOT/out"
|
||||
expectStderr 1 nix-store --restore "$TEST_ROOT/out" < name-after-node.nar | grepQuiet "expected tag 'name'"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue