]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/rc: create a wrapper for the su command
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:27 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
Create a _su wrapper around the su command so that the next patch can
fix all the pkill isolation code so that this test can only kill
processes started for this test.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
38 files changed:
common/rc
tests/generic/093
tests/generic/125
tests/generic/128
tests/generic/193
tests/generic/230
tests/generic/231
tests/generic/233
tests/generic/270
tests/generic/314
tests/generic/327
tests/generic/328
tests/generic/355
tests/generic/453
tests/generic/514
tests/generic/573
tests/generic/600
tests/generic/601
tests/generic/603
tests/generic/673
tests/generic/674
tests/generic/675
tests/generic/680
tests/generic/681
tests/generic/682
tests/generic/683
tests/generic/684
tests/generic/685
tests/generic/686
tests/generic/687
tests/generic/688
tests/generic/691
tests/generic/721
tests/generic/726
tests/generic/727
tests/xfs/720
tests/xfs/795
tests/xfs/803

index c4c934ed8bb02fd12b08372b843abd8aef0cdb9b..1f1d75e94fbd69d918d66068d9adf55821aa0bf5 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2726,6 +2726,11 @@ _require_user_exists()
        [ "$?" == "0" ] || _notrun "$user user not defined."
 }
 
+_su()
+{
+       su "$@"
+}
+
 # check if a user exists and is able to execute commands.
 # Uses 'fsgqa' user as default.
 #
@@ -2736,7 +2741,7 @@ _require_user()
                qa_user=$1
        fi
        _require_user_exists $qa_user
-       echo /bin/true | su $qa_user
+       echo /bin/true | _su $qa_user
        [ "$?" == "0" ] || _notrun "$qa_user cannot execute commands."
 }
 
@@ -2798,7 +2803,7 @@ s,^\s*$,,;
 
 _user_do()
 {
-       echo $1 | su -s /bin/bash $qa_user 2>&1 | _filter_user_do
+       echo $1 | _su -s /bin/bash $qa_user 2>&1 | _filter_user_do
 }
 
 _require_xfs_io_command()
index c4e866da1c18ebf66095035c048b81a345203d21..047cc821e0e6086cb3629bc4e678fbdff96e65f6 100755 (executable)
@@ -62,7 +62,7 @@ chmod ugo+w $TEST_DIR
 # don't use $here/src/writemod, as we're running it as a regular user, and
 # $here may contain path component that a regular user doesn't have search
 # permission
-su $qa_user -c "src/writemod $file" | filefilter
+_su $qa_user -c "src/writemod $file" | filefilter
 cat $file
 
 # success, all done
index e2bc5fa125da6e21ab88295eb0cb623c345fd460..011a51e8fa21c23c79739e1a45f1b505ecbb876e 100755 (executable)
@@ -32,7 +32,7 @@ chmod a+rw $TESTFILE
 
 # don't use $here/src/ftrunc, as we're running it as a regular user, and $here
 # may contain path component that a regular user doesn't have search permission
-su $qa_user -c "./src/ftrunc -f $TESTFILE"
+_su $qa_user -c "./src/ftrunc -f $TESTFILE"
 
 if [ "$?" != "0" ];  then
     echo src/ftrunc returned non 0 status!
index f931ca0639687ba0e21cdc6fd49e4769394a909b..5a497cdea7382b8aa25984fcb0c7ac71cae5655e 100755 (executable)
@@ -26,7 +26,7 @@ cp "$(type -P ls)" $SCRATCH_MNT
 chmod 700 $SCRATCH_MNT/nosuid
 chmod 4755 $SCRATCH_MNT/ls
 
-su -s/bin/bash - $qa_user -c "$SCRATCH_MNT/ls $SCRATCH_MNT/nosuid >/dev/null 2>&1"
+_su -s/bin/bash - $qa_user -c "$SCRATCH_MNT/ls $SCRATCH_MNT/nosuid >/dev/null 2>&1"
 if [ $? -eq 0 ] ; then
        echo "Error: we shouldn't be able to ls the directory"
 fi
index d251d3a5c4f8eecb06425f0190ee9221dd93d8a0..ba557428f77b9cddcb03047abddd788cb2de362e 100755 (executable)
@@ -69,17 +69,17 @@ echo
 _create_files
 
 echo "user: chown root owned file to qa_user (should fail)"
-su ${qa_user} -c "chown ${qa_user} $test_root" 2>&1 | _filter_files
+_su ${qa_user} -c "chown ${qa_user} $test_root" 2>&1 | _filter_files
 
 echo "user: chown root owned file to root (should fail)"
-su ${qa_user} -c "chown root $test_root" 2>&1 | _filter_files
+_su ${qa_user} -c "chown root $test_root" 2>&1 | _filter_files
 
 echo "user: chown qa_user owned file to qa_user (should succeed)"
-su ${qa_user} -c "chown ${qa_user} $test_user"
+_su ${qa_user} -c "chown ${qa_user} $test_user"
 
 # this would work without _POSIX_CHOWN_RESTRICTED
 echo "user: chown qa_user owned file to root (should fail)"
-su ${qa_user} -c "chown root $test_user" 2>&1 | _filter_files
+_su ${qa_user} -c "chown root $test_user" 2>&1 | _filter_files
 
 _cleanup_files
 
@@ -93,19 +93,19 @@ echo
 _create_files
 
 echo "user: chgrp root owned file to root (should fail)"
-su ${qa_user} -c "chgrp root $test_root" 2>&1 | _filter_files
+_su ${qa_user} -c "chgrp root $test_root" 2>&1 | _filter_files
 
 echo "user: chgrp qa_user owned file to root (should fail)"
-su ${qa_user} -c "chgrp root $test_user" 2>&1 | _filter_files
+_su ${qa_user} -c "chgrp root $test_user" 2>&1 | _filter_files
 
 echo "user: chgrp root owned file to qa_user (should fail)"
-su ${qa_user} -c "chgrp ${qa_user} $test_root" 2>&1 | _filter_files
+_su ${qa_user} -c "chgrp ${qa_user} $test_root" 2>&1 | _filter_files
 
 echo "user: chgrp qa_user owned file to qa_user (should succeed)"
-su ${qa_user} -c "chgrp ${qa_user} $test_user"
+_su ${qa_user} -c "chgrp ${qa_user} $test_user"
 
 #echo "user: chgrp qa_user owned file to secondary group (should succeed)"
-#su ${qa_user} -c "chgrp ${group2} $test_user"
+#_su ${qa_user} -c "chgrp ${group2} $test_user"
 
 _cleanup_files
 
@@ -119,10 +119,10 @@ echo
 _create_files
 
 echo "user: chmod a+r on qa_user owned file (should succeed)"
-su ${qa_user} -c "chmod a+r $test_user"
+_su ${qa_user} -c "chmod a+r $test_user"
 
 echo "user: chmod a+r on root owned file (should fail)"
-su ${qa_user} -c "chmod a+r $test_root" 2>&1 | _filter_files
+_su ${qa_user} -c "chmod a+r $test_root" 2>&1 | _filter_files
 
 #
 # Setup a file owned by the qa_user, but with a group ID that
@@ -143,7 +143,7 @@ chown ${qa_user}:root $test_user
 chmod g+s $test_user
 
 # and let the qa_user change permission bits
-su ${qa_user} -c "chmod a+w $test_user"
+_su ${qa_user} -c "chmod a+w $test_user"
 stat -c '%A' $test_user
 
 #
@@ -220,7 +220,7 @@ echo "with no exec perm"
 echo frobnozzle >> $test_user
 chmod ug+s $test_user
 echo -n "before: "; stat -c '%A' $test_user
-su ${qa_user} -c "echo > $test_user"
+_su ${qa_user} -c "echo > $test_user"
 echo -n "after:  "; stat -c '%A' $test_user
 
 echo "with user exec perm"
@@ -228,7 +228,7 @@ echo frobnozzle >> $test_user
 chmod ug+s $test_user
 chmod u+x $test_user
 echo -n "before: "; stat -c '%A' $test_user
-su ${qa_user} -c "echo > $test_user"
+_su ${qa_user} -c "echo > $test_user"
 echo -n "after:  "; stat -c '%A' $test_user
 
 echo "with group exec perm"
@@ -237,7 +237,7 @@ chmod ug+s $test_user
 chmod g+x $test_user
 chmod u-x $test_user
 echo -n "before: "; stat -c '%A' $test_user
-su ${qa_user} -c "echo > $test_user"
+_su ${qa_user} -c "echo > $test_user"
 echo -n "after:  "; stat -c '%A' $test_user
 
 echo "with user+group exec perm"
@@ -245,7 +245,7 @@ echo frobnozzle >> $test_user
 chmod ug+s $test_user
 chmod ug+x $test_user
 echo -n "before: "; stat -c '%A' $test_user
-su ${qa_user} -c "echo > $test_user"
+_su ${qa_user} -c "echo > $test_user"
 echo -n "after:  "; stat -c '%A' $test_user
 
 #
@@ -258,10 +258,10 @@ echo
 _create_files
 
 echo "user: touch qa_user file (should succeed)"
-su ${qa_user} -c "touch $test_user"
+_su ${qa_user} -c "touch $test_user"
 
 echo "user: touch root file (should fail)"
-su ${qa_user} -c "touch $test_root" 2>&1 | _filter_files
+_su ${qa_user} -c "touch $test_root" 2>&1 | _filter_files
 
 _cleanup_files
 
index ba95fbe725ad28aa6de8dc7cf5d06ae54b22ced0..18e20f4b2e94392a6092ac78ac56e40e1e222ff8 100755 (executable)
@@ -33,13 +33,13 @@ test_enforcement()
        echo "--- initiating IO..." >>$seqres.full
        # Firstly fit below block soft limit
        echo "Write 225 blocks..."
-       su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((225 * $BLOCK_SIZE))' -c fsync \
+       _su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((225 * $BLOCK_SIZE))' -c fsync \
                $SCRATCH_MNT/file1" 2>&1 >>$seqres.full | \
                _filter_xfs_io_error | tee -a $seqres.full
        repquota -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
        # Secondly overcome block soft limit
        echo "Rewrite 250 blocks plus 1 byte..."
-       su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((250 * $BLOCK_SIZE + 1))' -c fsync \
+       _su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((250 * $BLOCK_SIZE + 1))' -c fsync \
                $SCRATCH_MNT/file1" 2>&1 >>$seqres.full | \
                _filter_xfs_io_error | tee -a $seqres.full
        repquota -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
@@ -49,14 +49,14 @@ test_enforcement()
        # scratch device that may leed to grace time exceed.
        setquota -$type $qa_user -T $grace $grace $SCRATCH_MNT 2>/dev/null
        echo "Write 250 blocks..."
-       su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((250 * $BLOCK_SIZE))' -c fsync \
+       _su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((250 * $BLOCK_SIZE))' -c fsync \
                $SCRATCH_MNT/file2" 2>&1 >>$seqres.full | \
                _filter_xfs_io_error | tee -a $seqres.full
        repquota -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
        # Now sleep for grace time and check that softlimit got enforced
        sleep $((grace+1))
        echo "Write 1 block..."
-       su $qa_user -c "$XFS_IO_PROG -c 'truncate 0' -c 'pwrite 0 $BLOCK_SIZE' \
+       _su $qa_user -c "$XFS_IO_PROG -c 'truncate 0' -c 'pwrite 0 $BLOCK_SIZE' \
                $SCRATCH_MNT/file2" 2>&1 >>$seqres.full | \
                _filter_xfs_io_error | tee -a $seqres.full
        repquota -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
@@ -65,7 +65,7 @@ test_enforcement()
        # space reservations on XFS
        setquota -$type $qa_user 0 0 3 5 $SCRATCH_MNT
        echo "Touch 3+4"
-       su $qa_user -c "touch $SCRATCH_MNT/file3 $SCRATCH_MNT/file4" \
+       _su $qa_user -c "touch $SCRATCH_MNT/file3 $SCRATCH_MNT/file4" \
                2>&1 >>$seqres.full | _filter_scratch | tee -a $seqres.full
        repquota -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
        # Try to exceed inode hardlimit
@@ -74,14 +74,14 @@ test_enforcement()
        # scratch device that may leed to grace time exceed.
        setquota -$type $qa_user -T $grace $grace $SCRATCH_MNT 2>/dev/null
        echo "Touch 5+6"
-       su $qa_user -c "touch $SCRATCH_MNT/file5 $SCRATCH_MNT/file6" \
+       _su $qa_user -c "touch $SCRATCH_MNT/file5 $SCRATCH_MNT/file6" \
                2>&1 >>$seqres.full | _filter_scratch | tee -a $seqres.full
        repquota -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
        # Wait and check grace time enforcement
        rm -f $SCRATCH_MNT/file5 >>$seqres.full 2>&1
        sleep $((grace+1))
        echo "Touch 5"
-       su $qa_user -c "touch $SCRATCH_MNT/file5" 2>&1 >>$seqres.full |
+       _su $qa_user -c "touch $SCRATCH_MNT/file5" 2>&1 >>$seqres.full |
                _filter_scratch | tee -a $seqres.full
        repquota -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
        echo "--- completed IO ($type)" >>$seqres.full
index ef3ea45d45d736d3b207d61a1b32deac024c7034..8dda926d875e8840ce06197553dc5a78ee207953 100755 (executable)
@@ -24,7 +24,7 @@ _fsx()
        for (( i = 1; i <= $tasks; i++ )); do
                SEED=$RANDOM
                echo "ltp/fsx $FSX_ARGS -S $SEED $SCRATCH_MNT/fsx_file$i" >>$seqres.full
-               su $qa_user -c "ltp/fsx $FSX_ARGS -S $SEED \
+               _su $qa_user -c "ltp/fsx $FSX_ARGS -S $SEED \
                        $FSX_AVOID $SCRATCH_MNT/fsx_file$i" >$tmp.output$i 2>&1 &
        done
 
index b4c804ff217fbba64c5eaf444322acad9c4aac02..df67b39092b7cb9858ba8b4215da41eb2b613447 100755 (executable)
@@ -43,7 +43,7 @@ _fsstress()
        # temporarily.
        ulimit -l unlimited
        echo "fsstress $args" >> $seqres.full
-       if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $seqres.full | _filter_num
+       if ! _su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $seqres.full | _filter_num
        then
                echo "    fsstress $args returned $?"
                cat $tmp.out | tee -a $seqres.full
index 342ac8b5d3d9638009436133d79f02becfb15265..d74971bb5352392eaf1c7d29db82ab3c0c3621e1 100755 (executable)
@@ -37,14 +37,14 @@ _workout()
        # io_uring_queue_init fail on ENOMEM, set max locked memory to unlimited
        # temporarily.
        ulimit -l unlimited
-       su $qa_user -c "$_FSSTRESS_PROG $args" > /dev/null 2>&1 &
+       _su $qa_user -c "$_FSSTRESS_PROG $args" > /dev/null 2>&1 &
        _FSSTRESS_PID=$!
 
        echo "Run dd writers in parallel"
        for ((i=0; i < num_iterations; i++))
        do
                # File will be opened with O_TRUNC each time
-               su $qa_user -c "dd if=/dev/zero \
+               _su $qa_user -c "dd if=/dev/zero \
                        of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M " \
                        >> $seqres.full 2>&1
                sleep $enospc_time
index 5fbc6424de3ab41b0bf6766e6cb3ff468574063e..65f7f9d9619f2e755ebb1404c702d6e1f0657d9c 100755 (executable)
@@ -27,7 +27,7 @@ chown $qa_user:12345 $TEST_DIR/$seq-dir
 chmod 2775 $TEST_DIR/$seq-dir
 
 # Make subdir
-su $qa_user -c "umask 022; mkdir $TEST_DIR/$seq-dir/subdir"
+_su $qa_user -c "umask 022; mkdir $TEST_DIR/$seq-dir/subdir"
 
 # Subdir should have inherited sgid
 _ls_l $TEST_DIR/$seq-dir/ | grep -v total | _filter_test_dir | awk '{print $1,$NF}'
index 2323e1e6a12ec83591f490deef72d2d55c8f318d..18cfcd1f655bd7a4c8747b60e0fc9aba3011f90d 100755 (executable)
@@ -47,7 +47,7 @@ _report_quota_blocks $SCRATCH_MNT
 echo "Try to reflink again"
 touch $testdir/file3
 chown $qa_user $testdir/file3
-su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch
+_su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch
 _report_quota_blocks $SCRATCH_MNT
 
 # success, all done
index 7071ded259ddb372cef196d59ac7877cefd3d85e..fa33bdb78dba120c5b1a7c767b22dba611bc5ad1 100755 (executable)
@@ -47,12 +47,12 @@ setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
 _report_quota_blocks $SCRATCH_MNT
 
 echo "Try to dio write the whole file"
-su $qa_user -c '$XFS_IO_PROG -d -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
+_su $qa_user -c '$XFS_IO_PROG -d -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
        _filter_xfs_io_error
 _report_quota_blocks $SCRATCH_MNT
 
 echo "Try to write the whole file"
-su $qa_user -c '$XFS_IO_PROG -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
+_su $qa_user -c '$XFS_IO_PROG -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
        _filter_xfs_io_error
 _report_quota_blocks $SCRATCH_MNT
 
index b0f8fc45d2b5f40af4aef8355a4b20f7a553ce40..6b4f7ebae86405c4f4882c0e6c93d621a4ecfd84 100755 (executable)
@@ -22,7 +22,7 @@ rm -f $testfile
 
 do_io()
 {
-       su $qa_user -c "$XFS_IO_PROG -d -c 'pwrite 0 4k' $testfile" \
+       _su $qa_user -c "$XFS_IO_PROG -d -c 'pwrite 0 4k' $testfile" \
                >>$seqres.full
 }
 
index b7e686f37100da35715cad08f4ecc1aa4f1ce8db..04945ad1085b2d2ce2f86b5fe4dff5d173dbeaa0 100755 (executable)
@@ -196,7 +196,7 @@ setf "job offer\xef\xb9\x92pdf" "small full stop"
 setf "job offer\xef\xbc\x8epdf" "fullwidth full stop"
 setf "job offer\xdc\x81pdf" "syriac supralinear full stop"
 setf "job offer\xdc\x82pdf" "syriac sublinear full stop"
-setf "job offer\xea\x93\xb8pdf" "lisu letter tone mya ti"
+setf "job offer\xea\x93\xb8pdf" "li_su letter tone mya ti"
 setf "job offer.pdf" "actual period"
 
 # encoding hidden tag characters in filenames to create confusing names
@@ -270,7 +270,7 @@ testf "job offer\xef\xb9\x92pdf" "small full stop"
 testf "job offer\xef\xbc\x8epdf" "fullwidth full stop"
 testf "job offer\xdc\x81pdf" "syriac supralinear full stop"
 testf "job offer\xdc\x82pdf" "syriac sublinear full stop"
-testf "job offer\xea\x93\xb8pdf" "lisu letter tone mya ti"
+testf "job offer\xea\x93\xb8pdf" "li_su letter tone mya ti"
 testf "job offer.pdf" "actual period"
 
 testf "llamapirate\xf3\xa0\x80\x81\xf3\xa0\x81\x94\xf3\xa0\x81\xa8\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb3\xf3\xa0\x81\xa1\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x81\xb3\xf3\xa0\x80\xa0\xf3\xa0\x81\xa6\xf3\xa0\x81\xaf\xf3\xa0\x81\xb2\xf3\xa0\x80\xa0\xf3\xa0\x81\x93\xf3\xa0\x81\xa5\xf3\xa0\x81\xa1\xf3\xa0\x81\xb4\xf3\xa0\x81\xb4\xf3\xa0\x81\xac\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\xb7\xf3\xa0\x81\xa5\xf3\xa0\x81\xb2\xf3\xa0\x81\xa5\xf3\xa0\x80\xa0\xf3\xa0\x81\x95\xf3\xa0\x81\x93\xf3\xa0\x81\x84\xf3\xa0\x80\xa0\xf3\xa0\x80\xb1\xf3\xa0\x80\xb2\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x80\xb0\xf3\xa0\x81\xbf"
@@ -307,7 +307,7 @@ if _check_xfs_scrub_does_unicode "$SCRATCH_MNT" "$SCRATCH_DEV"; then
                grep -q "job offer.xef.xbc.x8epdf" $tmp.scrub || echo "No complaints about fullwidth full stop?"
                grep -q "job offer.xdc.x81pdf" $tmp.scrub || echo "No complaints about syriac supralinear full stop?"
                grep -q "job offer.xdc.x82pdf" $tmp.scrub || echo "No complaints about syriac sublinear full stop?"
-               grep -q "job offer.xea.x93.xb8pdf" $tmp.scrub || echo "No complaints about lisu letter tone mya ti?"
+               grep -q "job offer.xea.x93.xb8pdf" $tmp.scrub || echo "No complaints about li_su letter tone mya ti?"
                grep -q "job offer.*could be confused with" $tmp.scrub || echo "No complaints about confusing job offers?"
                grep -q "job offer.xe2.x80.xa4.xe2.x80.x8dpdf" $tmp.scrub || echo "No complaints about one dot leader with invisible space?"
                grep -q "llamapirate" $tmp.scrub || echo "No complaints about hidden llm instructions in filenames?"
index 7f3d9c16cb70a454a2bdc10875587fd72728fadd..a2086a255c77c6ddf5bbbfcacf21739fab136f0b 100755 (executable)
@@ -21,7 +21,7 @@ _scratch_mount
 
 chmod a+rwx $SCRATCH_MNT
 $XFS_IO_PROG -f -c "pwrite -S 0x18 0 1m" $SCRATCH_MNT/foo >>$seqres.full
-su -s/bin/bash - $qa_user -c "ulimit -f 64 ; $XFS_IO_PROG -f -c \"reflink $SCRATCH_MNT/foo\" $SCRATCH_MNT/bar" >> $seqres.full 2>&1
+_su -s/bin/bash - $qa_user -c "ulimit -f 64 ; $XFS_IO_PROG -f -c \"reflink $SCRATCH_MNT/foo\" $SCRATCH_MNT/bar" >> $seqres.full 2>&1
 
 sz="$(_get_filesize $SCRATCH_MNT/bar)"
 if [ "$sz" -ne 0 ] && [ "$sz" -ne 65536 ]; then
index b310fccbddda56e7cb376c168ccc77b37c5a841c..d3f3296cb6bafa21be70cc4d55e7de56a95d4ac8 100755 (executable)
@@ -56,7 +56,7 @@ $CHATTR_PROG -i $fsv_file
 _fsv_scratch_begin_subtest "FS_IOC_MEASURE_VERITY doesn't require root"
 _fsv_create_enable_file $fsv_file >> $seqres.full
 chmod 444 $fsv_file
-su $qa_user -c "$FSVERITY_PROG measure $fsv_file" >> $seqres.full
+_su $qa_user -c "$FSVERITY_PROG measure $fsv_file" >> $seqres.full
 
 # success, all done
 status=0
index 43f75376a10efc532278291d6c32511510fca027..31c832251ebb6ff06bb6a6b1c5fbc10dc360eba2 100755 (executable)
@@ -33,7 +33,7 @@ setquota -t -u 0 1 $SCRATCH_MNT
 # Soft inode limit 1, hard limit 5
 setquota -u $qa_user 0 0 1 5 $SCRATCH_MNT
 # Run qa user over soft limit and go over grace period
-su $qa_user -c "touch $SCRATCH_MNT/file1 $SCRATCH_MNT/file2"
+_su $qa_user -c "touch $SCRATCH_MNT/file1 $SCRATCH_MNT/file2"
 sleep 3
 # Extend grace to now + 100s
 now=`date +%s`
index 78b6a4aaa13748b0d8b73c45f446f8883553c81a..320ac0c758b766e0077b4214da88e2c56ef37089 100755 (executable)
@@ -42,7 +42,7 @@ $XFS_QUOTA_PROG -x -c "timer -u -i -d 1" $SCRATCH_MNT
 # Soft inode limit 1, hard limit 5
 $XFS_QUOTA_PROG -x -c "limit -u isoft=1 ihard=5 $qa_user" $SCRATCH_MNT
 # Run qa user over soft limit and go over grace period
-su $qa_user -c "touch $SCRATCH_MNT/file1 $SCRATCH_MNT/file2"
+_su $qa_user -c "touch $SCRATCH_MNT/file1 $SCRATCH_MNT/file2"
 sleep 3
 # Extend grace to now + 100s
 now=`date +%s`
index 2a75cf9e022750fa76d665dce80f27b8a69ea230..b199f801a8f03f90619db11006a67436389e5adf 100755 (executable)
@@ -66,13 +66,13 @@ test_grace()
        echo "--- Test block quota ---"
        # Firstly fit below block soft limit
        echo "Write 225 blocks..."
-       su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((225 * $BLOCK_SIZE))' \
+       _su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((225 * $BLOCK_SIZE))' \
                -c fsync $dir/file1" 2>&1 >>$seqres.full | \
                _filter_xfs_io_error | tee -a $seqres.full
        repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1
        # Secondly overcome block soft limit
        echo "Rewrite 250 blocks plus 1 byte, over the block softlimit..."
-       su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((250 * $BLOCK_SIZE + 1))' \
+       _su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((250 * $BLOCK_SIZE + 1))' \
                -c fsync $dir/file1" 2>&1 >>$seqres.full | \
                _filter_xfs_io_error | tee -a $seqres.full
        repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1
@@ -81,7 +81,7 @@ test_grace()
        # Now sleep enough grace time and check that softlimit got enforced
        sleep $((bgrace + 1))
        echo "Try to write 1 one more block after grace..."
-       su $qa_user -c "$XFS_IO_PROG -c 'truncate 0' -c 'pwrite 0 $BLOCK_SIZE' \
+       _su $qa_user -c "$XFS_IO_PROG -c 'truncate 0' -c 'pwrite 0 $BLOCK_SIZE' \
                $dir/file2" 2>&1 >>$seqres.full | _filter_xfs_io_error | \
                filter_enospc_edquot $type | tee -a $seqres.full
        repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1
@@ -91,7 +91,7 @@ test_grace()
        # space reservations on XFS
        setquota -$type $qa_user 0 0 3 100 $SCRATCH_MNT 
        echo "Create 2 more files, over the inode softlimit..."
-       su $qa_user -c "touch $dir/file3 $dir/file4" 2>&1 >>$seqres.full | \
+       _su $qa_user -c "touch $dir/file3 $dir/file4" 2>&1 >>$seqres.full | \
                _filter_scratch | tee -a $seqres.full
        repquota -v -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
        # Reset grace time here, make below grace time test more accurate
@@ -99,7 +99,7 @@ test_grace()
        # Wait and check grace time enforcement
        sleep $((igrace+1))
        echo "Try to create one more inode after grace..."
-       su $qa_user -c "touch $dir/file5" 2>&1 >>$seqres.full | \
+       _su $qa_user -c "touch $dir/file5" 2>&1 >>$seqres.full | \
                filter_enospc_edquot $type | _filter_scratch | \
                tee -a $seqres.full
        repquota -v -$type $SCRATCH_MNT  | grep -v "^root" >>$seqres.full 2>&1
index 8f6def9c78881aafc9f8e03274a7a429a2bd9910..6c54ade81f0cec707b7d2840713b3d27800a593c 100755 (executable)
@@ -39,7 +39,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c 'reflink $SCRATCH_MNT/b 0 0 1m' $SCRATCH_MNT/a"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index 1b711f27f39ed1b8abcc8cc36405fd20a77ecb17..41fbdeb7d9eb177e3da663aa56c68dbc94b83df2 100755 (executable)
@@ -42,7 +42,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c 'dedupe $SCRATCH_MNT/b 0 0 1m' $SCRATCH_MNT/a"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index e66de84b546a25565af37be52f9da4de1eed538e..87dfbdfe278dd24559bb49ec31c9db93a7a2abc8 100755 (executable)
@@ -44,7 +44,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c 'reflink $SCRATCH_MNT/b 0 0 1m' $SCRATCH_MNT/a"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index 07048db5cc39a9236c761d4007b21005454438c6..1a418fa3b61b0b5299780769ebb7503730104292 100755 (executable)
@@ -38,7 +38,7 @@ chmod 0644 $localfile
 cp $here/src/splice2pipe $tmp.splice2pipe
 # Test unprivileged user's privilege escalation
 echo "Test unprivileged user:"
-su ${qa_user} -c "$tmp.splice2pipe $localfile 1 AAAAAAAABBBBBBBB"
+_su ${qa_user} -c "$tmp.splice2pipe $localfile 1 AAAAAAAABBBBBBBB"
 _hexdump $localfile
 
 # success, all done
index aef54205d26f3af202ac59363694c37ddc8c0ab8..dc4252013fc058398e837e42080d111c56cfebb2 100755 (executable)
@@ -55,7 +55,7 @@ ls -sld $scratchdir  >> $seqres.full
 echo "fail quota" >> $seqres.full
 for ((i = 0; i < dirents; i++)); do
        name=$(printf "y%0254d" $i)
-       su - "$qa_user" -c "ln $scratchfile $scratchdir/$name" 2>&1 | \
+       _su - "$qa_user" -c "ln $scratchfile $scratchdir/$name" 2>&1 | \
                _filter_scratch | sed -e 's/y[0-9]*/yXXX/g'
        test "${PIPESTATUS[0]}" -ne 0 && break
 done
index 3572af173cbe63551f6a6138c089d73c26589907..6914a549dc097547f7d87d06233a89fe95679050 100755 (executable)
@@ -65,7 +65,7 @@ echo "fail quota" >> $seqres.full
 for ((i = 0; i < dirents; i++)); do
        name=$(printf "y%0254d" $i)
        ln $scratchfile $stagedir/$name
-       su - "$qa_user" -c "mv $stagedir/$name $scratchdir/$name" 2>&1 | \
+       _su - "$qa_user" -c "mv $stagedir/$name $scratchdir/$name" 2>&1 | \
                _filter_scratch | _filter_mv_output
        test "${PIPESTATUS[0]}" -ne 0 && break
 done
index cc9a9786bde4bf85f5ebdd4768d332aa52dab164..883905da5f9082b72e34b0f6286d46df2d40265c 100755 (executable)
@@ -49,7 +49,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c '$command $start $end' $junk_file"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index 2ca036fe518050952bd3825c39caa96b103cf321..9cdfe4ab4f4463097c37df3cd86ac67d9e0bd1aa 100755 (executable)
@@ -49,7 +49,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c '$command $start $end' $junk_file"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index de07a798a68594a43a3fb9ec6c9b8ff4cc87c3cb..5567255032e1c7478336492c65ba1572f027e5a9 100755 (executable)
@@ -49,7 +49,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c '$command $start $end' $junk_file"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index fc6761fe61a91e26679e14f43f4ee08c6cd98f3c..a3fa8e060aeab6f177b79ce98682555058ae3bc7 100755 (executable)
@@ -49,7 +49,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c '$command $start $end' $junk_file"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index 82dce88b85ef6d1005c66cef9d134a6f2b555243..0c4b09d29fe5e6bec7196f75d9b4c2512fff50cc 100755 (executable)
@@ -49,7 +49,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c '$command $start $end' $junk_file"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index e491d5cf30af235e977e85b1fd1f12a2d18045d3..77db29461415b39766113590e734d537d85317b3 100755 (executable)
@@ -51,7 +51,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c 'falloc 0 64k' $junk_file"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index f33d6edf18a1d166f4bc1951786e4e43858abfe1..30ae4a1e384a056c22791e09264a917ef7664e19 100755 (executable)
@@ -75,11 +75,11 @@ exercise()
        setquota -${type} -t 86400 86400 $SCRATCH_MNT
        repquota -v -${type} $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1
        # Exceed the soft quota limit a bit at first
-       su $qa_user -c "$XFS_IO_PROG -f -t -c 'pwrite 0 2m' -c fsync ${file}.0" >>$seqres.full
+       _su $qa_user -c "$XFS_IO_PROG -f -t -c 'pwrite 0 2m' -c fsync ${file}.0" >>$seqres.full
        # Write more data more times under soft quota limit exhausted condition,
        # but not reach hard limit. To make sure each write won't trigger EDQUOT.
        for ((i=1; i<=100; i++));do
-               su "$qa_user" -c "$XFS_IO_PROG -f -c 'pwrite 0 1m' -c fsync ${file}.$i" >>$seqres.full
+               _su "$qa_user" -c "$XFS_IO_PROG -f -c 'pwrite 0 1m' -c fsync ${file}.$i" >>$seqres.full
                if [ $? -ne 0 ];then
                        echo "Unexpected error (type=$type)!"
                        break
@@ -89,9 +89,9 @@ exercise()
 
        # As we've tested soft limit, now exceed the hard limit and give it a
        # test in passing.
-       su $qa_user -c "$XFS_IO_PROG -f -t -c 'pwrite 0 100m' -c fsync ${file}.hard.0" 2>&1 >/dev/null | filter_quota $type
+       _su $qa_user -c "$XFS_IO_PROG -f -t -c 'pwrite 0 100m' -c fsync ${file}.hard.0" 2>&1 >/dev/null | filter_quota $type
        for ((i=1; i<=10; i++));do
-               su "$qa_user" -c "$XFS_IO_PROG -f -c 'pwrite 0 1m' -c fsync ${file}.hard.$i" 2>&1 | filter_quota $type
+               _su "$qa_user" -c "$XFS_IO_PROG -f -c 'pwrite 0 1m' -c fsync ${file}.hard.$i" 2>&1 | filter_quota $type
        done
 }
 
index a9565f1891783112afac34d132ed39aaf75bc485..75d5063c2d17010fd579174b5306b13f594d2aa8 100755 (executable)
@@ -52,7 +52,7 @@ cmd="$XFS_IO_PROG \
        -c 'pwrite -S 0x60 44k 55k -b 1m' \
        -c 'commitupdate -q' \
        \"$dir/a\""
-su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
+_su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
 
 filesnap "after commit" $dir/a
 echo
@@ -67,7 +67,7 @@ cmd="$XFS_IO_PROG \
        -c 'pwrite -S 0x60 0 55k' \
        -c 'commitupdate -q' \
        \"$dir/a\""
-su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
+_su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
 
 filesnap "after shorten commit" $dir/a
 echo
@@ -81,7 +81,7 @@ cmd="$XFS_IO_PROG \
        -c \"pwrite -S 0x60 0 $(( (blksz * nrblks) + 37373 ))\" \
        -c 'commitupdate -q' \
        \"$dir/a\""
-su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
+_su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
 
 filesnap "after lengthen commit" $dir/a
 echo
@@ -96,7 +96,7 @@ cmd="$XFS_IO_PROG \
        -c 'pwrite -S 0x60 44k 55k -b 1m' \
        -c 'cancelupdate' \
        \"$dir/a\""
-su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
+_su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
 
 filesnap "after cancel" $dir/a
 echo
@@ -115,7 +115,7 @@ cmd="$XFS_IO_PROG \
        -c 'pwrite -S 0x61 22k 11k -b 1m' \
        -c 'commitupdate -q' \
        \"$dir/a\""
-su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
+_su -s /bin/bash -c "$cmd" $qa_user 2>&1 | _filter_xfs_io | _filter_test_dir
 
 filesnap "after fail commit" $dir/a
 echo
index 131ac5b503e1a41601cc5c66e19408d5132a2b29..d2a2a2cebe522ed0317c48be98dfe91ec9f9f4a2 100755 (executable)
@@ -46,7 +46,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c 'startupdate' -c 'pwrite -S 0x57 0 1m' -c 'commitupdate' $SCRATCH_MNT/a"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index ee7ed9760a165ad865740318a44992d714872486..9551e47cb13b06ed2f5c0684bc0bd0ea672b8bae 100755 (executable)
@@ -54,7 +54,7 @@ commit_and_check() {
 
        local cmd="$XFS_IO_PROG -c 'startupdate' -c 'pwrite -S 0x57 0 1m' -c 'commitupdate' $SCRATCH_MNT/a"
        if [ -n "$user" ]; then
-               su - "$user" -c "$cmd" >> $seqres.full
+               _su - "$user" -c "$cmd" >> $seqres.full
        else
                $SHELL -c "$cmd" >> $seqres.full
        fi
index f928cc43d3bc54221482dc0b4acdd91bc8bb8f70..68a6c7f6e2d584d05e65e197256d60a48c7c56e1 100755 (executable)
@@ -61,7 +61,7 @@ $XFS_QUOTA_PROG -x -c 'report -u' $SCRATCH_MNT >> $seqres.full
 
 # Fail at appending the file as qa_user to ensure quota enforcement works
 echo "fail quota" >> $seqres.full
-su - "$qa_user" -c "$XFS_IO_PROG -c 'pwrite 10g 1' $scratchfile" >> $seqres.full
+_su - "$qa_user" -c "$XFS_IO_PROG -c 'pwrite 10g 1' $scratchfile" >> $seqres.full
 $XFS_QUOTA_PROG -x -c 'report -u' $SCRATCH_MNT >> $seqres.full
 
 # success, all done
index 5a67f02ec92eca02b68221e64f926652e165bb6e..217f96092a4c42d85fe0983c5796df373e340055 100755 (executable)
@@ -63,7 +63,7 @@ $XFS_QUOTA_PROG -x -c 'report -u' $SCRATCH_MNT >> $seqres.full
 echo "fail quota" >> $seqres.full
 for ((i = 0; i < dirents; i++)); do
        name=$(printf "y%0254d" $i)
-       su - "$qa_user" -c "ln $scratchfile $scratchdir/$name" 2>&1 | \
+       _su - "$qa_user" -c "ln $scratchfile $scratchdir/$name" 2>&1 | \
                _filter_scratch | sed -e 's/y[0-9]*/yXXX/g'
        test "${PIPESTATUS[0]}" -ne 0 && break
 done
index e3277181b41af052b9f8b5effb03b6b554d3905f..4e5a58c4a3328e6679ce50debbaac32cb21991d4 100755 (executable)
@@ -88,7 +88,7 @@ echo set too long value
 $XFS_IO_PROG -c "setfsprops $propname=$longpropval" $TEST_DIR
 
 echo not enough permissions
-su - "$qa_user" -c "$XFS_IO_PROG -c \"setfsprops $propname=$propval\" $TEST_DIR" 2>&1 | _filter_test_dir
+_su - "$qa_user" -c "$XFS_IO_PROG -c \"setfsprops $propname=$propval\" $TEST_DIR" 2>&1 | _filter_test_dir
 
 echo "*** DB TEST ***"