From 7835fcdc682ef02654ae6aee98b45283478ec275 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 31 Mar 2016 14:07:01 +0100 Subject: [PATCH] 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 Closes: #232 Approved by: cgwalters --- tests/test-pull-untrusted.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test-pull-untrusted.sh b/tests/test-pull-untrusted.sh index 95f7ab93..53636224 100755 --- a/tests/test-pull-untrusted.sh +++ b/tests/test-pull-untrusted.sh @@ -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;