fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: Re: [PATCH] fstests: which has been deprecated by Debian
Date: Wed, 1 Sep 2021 09:46:01 +1000	[thread overview]
Message-ID: <20210831234601.GI2566745@dread.disaster.area> (raw)
In-Reply-To: <20210830132927.7glbrcsgwep6xq4v@fedora>

On Mon, Aug 30, 2021 at 09:29:27PM +0800, Zorro Lang wrote:
> On Mon, Aug 30, 2021 at 11:14:01AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > 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>
> > ---
> 
> 
> 
> 
> >  common/rc         | 2 +-
> >  src/fill2fs       | 2 +-
> >  tests/ext4/006    | 2 +-
> >  tests/generic/128 | 2 +-
> >  tests/generic/452 | 2 +-
> >  tests/xfs/293     | 2 +-
> >  tests/xfs/505     | 2 +-
> >  tests/xfs/514     | 2 +-
> >  tests/xfs/515     | 2 +-
> >  9 files changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/common/rc b/common/rc
> > index a7f9ed86..db400c4d 100644
> > --- 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()
> >  {
> > diff --git a/src/fill2fs b/src/fill2fs
> > index 1c3383a8..d5e5436b 100755
> > --- a/src/fill2fs
> > +++ b/src/fill2fs
> > @@ -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;
> > diff --git a/tests/ext4/006 b/tests/ext4/006
> > index 17e77f86..48ed6bee 100755
> > --- a/tests/ext4/006
> > +++ b/tests/ext4/006
> > @@ -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
> >  
> > diff --git a/tests/generic/128 b/tests/generic/128
> > index dfc67fd5..dc1d43f4 100755
> > --- a/tests/generic/128
> > +++ b/tests/generic/128
> > @@ -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
> >  
> > diff --git a/tests/generic/452 b/tests/generic/452
> > index ee4dfe9e..7cbd2dfa 100755
> > --- a/tests/generic/452
> > +++ b/tests/generic/452
> > @@ -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) --skip-alias --skip-functions)"
> 
> I think the "--skip-alias" and "--skip-functions" options are belong to
> the "which" command, so this change might cause fail.

Yay for command line parsing - invalid options are silently ignored
by which on debian, so this actual command does the same thing as
'which ls'....

Really, though, I think I'm just going to allow the path to find ls
in most cases - the only reason for using `which ls` was for tests
that use it as a file copy source. If 'ls' is not in the default
execution path, lots of stuff will not work...

> >  SCRATCH_LS=$SCRATCH_MNT/ls_on_scratch
> >  cp $LS $SCRATCH_LS

Oh, look, copying the ls binary is exactly what this test is
doing, so this would result in a cp failure...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2021-08-31 23:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30  1:14 [PATCH] fstests: which has been deprecated by Debian Dave Chinner
2021-08-30 13:29 ` Zorro Lang
2021-08-31 23:46   ` Dave Chinner [this message]
2021-09-05 13:12   ` Eryu Guan
2021-08-30 17:19 ` Darrick J. Wong
2021-08-31 23:48   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831234601.GI2566745@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).