Test that deserializing NARs with names with equal Unicode normal forms fails on macOS

The test is based on the one by @puckipedia but with the file names
swapped to make them sorted.
This commit is contained in:
Eelco Dolstra 2024-09-05 20:37:26 +02:00
parent 3557587381
commit 7a765a6aaf
2 changed files with 11 additions and 0 deletions

View File

@ -43,3 +43,14 @@ touch "$TEST_ROOT/case/xt_CONNMARK.h~nix~case~hack~3"
# 'Test~nix~case~hack~1' and 'test'). # 'Test~nix~case~hack~1' and 'test').
rm -rf "$TEST_ROOT/case" rm -rf "$TEST_ROOT/case"
expectStderr 1 nix-store "${opts[@]}" --restore "$TEST_ROOT/case" < case-collision.nar | grepQuiet "NAR contains file name 'test' that collides with case-hacked file name 'Test~nix~case~hack~1'" expectStderr 1 nix-store "${opts[@]}" --restore "$TEST_ROOT/case" < case-collision.nar | grepQuiet "NAR contains file name 'test' that collides with case-hacked file name 'Test~nix~case~hack~1'"
# Deserializing a NAR that contains file names that Unicode-normalize
# to the same name should fail on macOS but succeed on Linux.
rm -rf "$TEST_ROOT/out"
if [[ $(uname) = Darwin ]]; then
expectStderr 1 nix-store --restore "$TEST_ROOT/out" < unnormalized.nar | grepQuiet "cannot create directory.*File exists"
else
nix-store --restore "$TEST_ROOT/out" < unnormalized.nar
[[ -e $TEST_ROOT/out/â ]]
[[ -e $TEST_ROOT/out/â ]]
fi

Binary file not shown.