test-pull-untrusted.sh: always corrupt a regular file, not a symlink

test-pull-untrusted.sh would pass when run as root, but fail when run
as testuser. It turned out that the way the files were stored in the
repo when running as a testuser were different, which meant that a
different .file object was chosen for corruption. Except that file
turned out to be a symlink, so the echo "broke" actually just wrote
to the no_such_file symlink target, thus keeping the actual symlink
file's checksum the same and causing the pull-local to pass when it
should have failed.

[smcv: split this out of a larger commit, part of PR #231]
Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #232
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2016-03-31 14:07:01 +01:00 committed by Colin Walters (automation)
parent e1ce859368
commit 7835fcdc68
1 changed files with 6 additions and 0 deletions

View File

@ -39,6 +39,12 @@ echo "ok pull-local --untrusted didn't hardlink"
# Corrupt repo
for i in ${test_tmpdir}/repo/objects/*/*.file; do
# make sure it's not a symlink
if [ -L $i ]; then
continue
fi
echo "corrupting $i"
echo "broke" >> $i
break;