Skip to content

Commit

Permalink
Test that deserializing NARs with names with equal Unicode normal for…
Browse files Browse the repository at this point in the history
…ms fails on macOS

The test is based on the one by @puckipedia but with the file names
swapped to make them sorted.
  • Loading branch information
edolstra committed Sep 5, 2024
1 parent 3557587 commit 7a765a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/functional/nars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ touch "$TEST_ROOT/case/xt_CONNMARK.h~nix~case~hack~3"
# 'Test~nix~case~hack~1' and 'test').
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'"

# 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 added tests/functional/unnormalized.nar
Binary file not shown.

0 comments on commit 7a765a6

Please sign in to comment.