fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>,
	fstests@vger.kernel.org, roman.penyaev@profitbricks.com
Subject: Re: [PATCH 1/2] xfstests: replace hexdump with od command
Date: Tue, 22 Mar 2022 08:54:05 -0700	[thread overview]
Message-ID: <20220322155405.GL8200@magnolia> (raw)
In-Reply-To: <20220322122015.7zd3qgdvvhmefa2y@zlang-mailbox>

On Tue, Mar 22, 2022 at 08:20:15PM +0800, Zorro Lang wrote:
> On Tue, Mar 22, 2022 at 04:22:59PM +1100, Dave Chinner wrote:
> > On Mon, Mar 21, 2022 at 07:03:40PM +0800, Zorro Lang wrote:
> > > The "od" is one of the most fundamental commands in GNU/Linux and
> > > most Unix-like systems. So we nearly always can count on it, don't
> > > need to check if it's installed.
> > > 
> > > The "hexdump" isn't such fundamental as "od", some systems don't
> > > install it by default. And as "od" nearly can replace all functions
> > > of "hexdump", so let's use an unified command "od" to do the hexdump
> > > job in fstests cases.
> > > 
> > > Signed-off-by: Zorro Lang <zlang@redhat.com>
> > 
> > Looks good.
> > 
> > Reviewed-by: Dave Chinner <dchinner@redhat.com>
> > 
> > > ---
> > > 
> > > Hi,
> > > 
> > > As Dave and Darrick suggested, I did this change, I've tested most of cases,
> > > except f2fs/001 and ceph/002, but I think they're good. And I used "od"
> > > command directly in generic/404 and generic/042 for their special reason.
> > 
> > That generic/404 usage is ... strange. Why record md5sums of the
> > encoded hexdump output of the file when you can just run md5sum on
> > the file directly and get the same information?  i.e.
> > 
> > > diff --git a/tests/generic/404 b/tests/generic/404
> > > index f1e8b0a8..939692eb 100755
> > > --- a/tests/generic/404
> > > +++ b/tests/generic/404
> > > @@ -110,7 +110,7 @@ for (( block=3; block<=500; block++ )); do
> > >  	# or blocks are in correct order, this commit:
> > >  	#   2b3864b32403 ("ext4: do not polute the extents cache while shifting extents")
> > >  	#
> > > -	md5=`hexdump -e '16/1 "%_p" "\n"' $testfile | md5sum`
> > > +	md5=`od -An -c $testfile | md5sum`
> > >  	printf "#%d %s\n" "$block" "$md5"
> > 
> > Why isn't this just:
> > 
> > -	md5=`hexdump -e '16/1 "%_p" "\n"' $testfile | md5sum`
> > -	printf "#%d %s\n" "$block" "$md5"
> > +	echo -n "#$block "
> > +	md5sum $testfile | _filter_test_dir
> 
> Yes, I thought about that too, but I can't be sure about it, so tried to keep
> the logic of original code. If the original author doesn't have some special
> reason, I'd like to change it as this way (cc roman.penyaev@profitbricks.com).
> 
> And for the generic/042:
> -       if hexdump -v -e '/1 "%02X "' $file | grep -q "CD"; then
> +       if od -An -tx1 -v $file | grep -q "CD"; then
> 
> I don't know what that "-v" option is needed (cc Darrick). I thought it might just
> waste the time of grep running ?

Probably.  I probably put that in there for debugging purposes and then
frogot to take it out.

--D

> > 
> > Seperate patch, perhaps?
> 
> Sure, if no one object that, I'll change them in separated patch.
> 
> Thanks,
> Zorro
> 
> > 
> > Cheers,
> > 
> > Dave.
> > -- 
> > Dave Chinner
> > david@fromorbit.com
> > 
> 

  reply	other threads:[~2022-03-22 15:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 11:03 [PATCH 0/2] xfstests: hexdump and CVE-2022-0847 Zorro Lang
2022-03-21 11:03 ` [PATCH 1/2] xfstests: replace hexdump with od command Zorro Lang
2022-03-22  5:22   ` Dave Chinner
2022-03-22 12:20     ` Zorro Lang
2022-03-22 15:54       ` Darrick J. Wong [this message]
2022-03-22 17:10         ` Zorro Lang
2022-03-21 11:03 ` [PATCH 2/2] fstests: test dirty pipe vulnerability issue of CVE-2022-0847 Zorro Lang
2022-03-22  5:35   ` Dave Chinner
2022-03-22 12:30     ` Zorro Lang
2022-03-22 15:52       ` Darrick J. Wong
2022-03-22 17:13         ` Zorro Lang

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=20220322155405.GL8200@magnolia \
    --to=djwong@kernel.org \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=roman.penyaev@profitbricks.com \
    /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).