]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fstests: which has been deprecated by Debian
authorDave Chinner <dchinner@redhat.com>
Mon, 30 Aug 2021 01:14:01 +0000 (11:14 +1000)
committerEryu Guan <guaneryu@gmail.com>
Sun, 5 Sep 2021 13:08:06 +0000 (21:08 +0800)
This patch is brought to you by the Department That Hates Users.

The latest debian unstable release is now causing a bunch of new
test failures because they have deprecated the which command.

Rather than make everyone jump through hoops chasing problems with
'which' while debian decides to how to package at least three
variants of 'which' - each which will different semantics, behaviour
and support - as alternatives users then have to opt into, let's
just remove the remaining uses of the shell independent 'which'
command and replace them with bash builtin 'type -P' operations.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc
src/fill2fs
tests/ext4/006
tests/generic/128
tests/generic/452
tests/xfs/293
tests/xfs/505
tests/xfs/514
tests/xfs/515

index 46b6b22040ec2516b790cf0efe61a48a3de80c2a..f89e327652a614a1daab4c6e7cb4d9c230e102eb 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -4,7 +4,7 @@
 
 . common/config
 
-BC=$(which bc 2> /dev/null) || BC=
+BC="$(type -P bc)" || BC=
 
 _require_math()
 {
index 1c3383a89cd4e865f33a479173e11a53dc2d90c8..d5e5436ba9f35fc448671692850fa3b4a3bd6239 100755 (executable)
@@ -111,7 +111,7 @@ sub normal {
 #
 
 chomp($cwd = `pwd`);
-chomp($_ = `which fill2 2>&1 | head -1`);
+chomp($_ = `type -P fill2 | head -1`);
 if (-x $_) {
   # look in the path
   $fill2 = fill2;
index 17e77f869d5081e4693ddf06d23c097f49510d57..48ed6bee967ebe8e5548b987bdf85d4e53c3b897 100755 (executable)
@@ -24,7 +24,7 @@ _cleanup()
 . ./common/populate
 . ./common/fuzzy
 
-if [ ! -x "$(which e2fuzz)" ]; then
+if [ ! -x "$(type -P e2fuzz)" ]; then
        _notrun "Couldn't find e2fuzz"
 fi
 
index dfc67fd5cdb6b2eaa519cee89026a8fe96e35c01..dc1d43f4413472639fb0326f2a5930fc4a54b580 100755 (executable)
@@ -23,7 +23,7 @@ _scratch_mkfs >/dev/null 2>&1
 _scratch_mount "-o nosuid"
 
 mkdir $SCRATCH_MNT/nosuid
-cp `which ls` $SCRATCH_MNT
+cp "$(type -P ls)" $SCRATCH_MNT
 chmod 700 $SCRATCH_MNT/nosuid
 chmod 4755 $SCRATCH_MNT/ls
 
index ee4dfe9e4d3c02aa916acddb731246bfc6326306..6e14a1c4e7b06a84886e2f6d5ea444ffb4f50a9a 100755 (executable)
@@ -26,7 +26,7 @@ _exclude_scratch_mount_option "noexec"
 _scratch_mkfs > $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 
-LS=$(which ls --skip-alias --skip-functions)
+LS="$(type -P ls)"
 SCRATCH_LS=$SCRATCH_MNT/ls_on_scratch
 cp $LS $SCRATCH_LS
 
index fbd26b63f5dd5886e7c5a2c85f0aeb3a75520c0f..20f8c48689b6459c0b4fc1c39b1723c0dcf9f47c 100755 (executable)
@@ -30,7 +30,7 @@ case "$MANPAGE" in
 *)             CAT=cat;;
 esac
 
-_require_command `which $CAT` $CAT
+_require_command "$(type -P $CAT)" $CAT
 
 for COMMAND in `$XFS_IO_PROG -c help | awk '{print $1}' | grep -v "^Use"`; do
   $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
index 8a999ff461536c31703d8b408aeb25f2aa64984f..71fb6e9d3c45c5c5ea3a3592e1f85d87aa255797 100755 (executable)
@@ -26,7 +26,7 @@ case "$MANPAGE" in
 *.xz)          CAT=xzcat;;
 *)             CAT=cat;;
 esac
-_require_command `which $CAT` $CAT
+_require_command "$(type -P $CAT)" $CAT
 
 for COMMAND in `$XFS_SPACEMAN_PROG -c help $TEST_DIR | awk '{print $1}' | grep -v "^Use"`; do
   $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
index a9c67645017aecdcbf8abb37fdc51272f0ee3dc9..cf5588f25619ec28bc643b7fdcf2018be2fe06cb 100755 (executable)
@@ -34,7 +34,7 @@ case "$MANPAGE" in
 *.xz)          CAT=xzcat;;
 *)             CAT=cat;;
 esac
-_require_command `which $CAT` $CAT
+_require_command "$(type -P $CAT)" $CAT
 
 file=$TEST_DIR/xx.$seq
 truncate -s 128m $file
index 32216fe6130a35b0f5422743e3749e90080e233c..2d7bbb357768d21b0f7ea2a65744d9d65368e005 100755 (executable)
@@ -34,7 +34,7 @@ case "$MANPAGE" in
 *.xz)          CAT=xzcat;;
 *)             CAT=cat;;
 esac
-_require_command `which $CAT` $CAT
+_require_command "$(type -P $CAT)" $CAT
 
 for COMMAND in `$XFS_QUOTA_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`; do
   $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \