[ostree: 27/70] test-pull-untrusted.sh: always corrupt a regular file, not a symlink



commit 7835fcdc682ef02654ae6aee98b45283478ec275
Author: Jonathan Lebon <jlebon redhat com>
Date:   Thu Mar 31 14:07:01 2016 +0100

    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

 tests/test-pull-untrusted.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-pull-untrusted.sh b/tests/test-pull-untrusted.sh
index 95f7ab9..5363622 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]