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/config
-BC=$(which bc 2> /dev/null) || BC=
+BC="$(type -P bc)" || BC=
_require_math()
{
#
chomp($cwd = `pwd`);
-chomp($_ = `which fill2 2>&1 | head -1`);
+chomp($_ = `type -P fill2 | head -1`);
if (-x $_) {
# look in the path
$fill2 = fill2;
. ./common/populate
. ./common/fuzzy
-if [ ! -x "$(which e2fuzz)" ]; then
+if [ ! -x "$(type -P e2fuzz)" ]; then
_notrun "Couldn't find e2fuzz"
fi
_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
_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
*) 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" || \
*.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" || \
*.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
*.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" || \