FS/XFS testing framework
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Zorro Lang <zlang@redhat.com>
Cc: fstests@vger.kernel.org, djwong@kernel.org
Subject: Re: [PATCH 1/2] xfstests: replace hexdump with od command
Date: Tue, 22 Mar 2022 16:22:59 +1100	[thread overview]
Message-ID: <20220322052259.GC1609613@dread.disaster.area> (raw)
In-Reply-To: <20220321110341.1323882-2-zlang@redhat.com>

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

Seperate patch, perhaps?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2022-03-22  5:23 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 [this message]
2022-03-22 12:20     ` Zorro Lang
2022-03-22 15:54       ` Darrick J. Wong
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=20220322052259.GC1609613@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=zlang@redhat.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