Whamcloud - gitweb
LU-17009 tests: fix runtests to read file name with backslash 47/51847/1
authorJian Yu <yujian@whamcloud.com>
Wed, 2 Aug 2023 07:16:04 +0000 (00:16 -0700)
committerJian Yu <yujian@whamcloud.com>
Wed, 2 Aug 2023 07:16:04 +0000 (00:16 -0700)
If a file in /etc dir has a name with backslash, then runtests
will fail because the read command considers the backslash as
an escape character. This patch fixes the issue by adding "-r"
option to read.

Change-Id: Iab912ba9708f5b64e6bb8d8adc266ff23ed32de5
Test-Parameters: trivial testlist=runtests
Signed-off-by: Jian Yu <yujian@whamcloud.com>
lustre/tests/runtests

index 3809d26..a0d5647 100755 (executable)
@@ -84,7 +84,7 @@ test_1() {
 
        log "comparing $COUNT newly copied files at $(date)"
 
-       cat $findfiles | tr "\0" "\n" | ( rc=0; while read f; do
+       cat $findfiles | tr "\0" "\n" | ( rc=0; while read -r f; do
                diff -q "$f" "$dst/$f" || rc=18
        done
        [ "$rc" = 0 ] || error_exit "old and new files are different: rc=$rc" )
@@ -98,7 +98,7 @@ test_1() {
        setupall || error "setupall failed"
 
        log "comparing $COUNT previously copied files"
-       cat $findfiles | tr "\0" "\n" | ( rc=0; while read f; do
+       cat $findfiles | tr "\0" "\n" | ( rc=0; while read -r f; do
                diff -q "$f" "$dst/$f" || rc=22
        done
        [ "$rc" = 0 ] || error_exit "old and new files are different: rc=$rc" )