public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Uday Shankar <ushankar@purestorage.com>
Cc: Shuah Khan <shuah@kernel.org>,
	linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils
Date: Thu, 24 Apr 2025 08:08:56 +0800	[thread overview]
Message-ID: <aAmBGKfC72Q_JBG0@fedora> (raw)
In-Reply-To: <20250423-ublk_selftests-v1-2-7d060e260e76@purestorage.com>

On Wed, Apr 23, 2025 at 03:29:03PM -0600, Uday Shankar wrote:
> Some distributions, such as centos stream 9, still have a version of
> coreutils which does not yet support the %Hr and %Lr formats for stat(1)
> [1, 2]. Running ublk selftests on these distributions results in the
> following error in tests that use the _get_disk_dev_t helper:
> 
> line 23: ?r: syntax error: operand expected (error token is "?r")
> 
> To better accommodate older distributions, rewrite _get_disk_dev_t to
> use the much older %t and %T formats for stat instead.
> 
> [1] https://github.com/coreutils/coreutils/blob/v9.0/NEWS#L114
> [2] https://pkgs.org/download/coreutils
> 
> Signed-off-by: Uday Shankar <ushankar@purestorage.com>
> ---
>  tools/testing/selftests/ublk/test_common.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/selftests/ublk/test_common.sh
> index 9fc111f64576f91adb731d436c2d535f7dfe5c2e..a81210ca3e99d264f84260aab35827e0c00add01 100755
> --- a/tools/testing/selftests/ublk/test_common.sh
> +++ b/tools/testing/selftests/ublk/test_common.sh
> @@ -17,8 +17,8 @@ _get_disk_dev_t() {
>  	local minor
>  
>  	dev=/dev/ublkb"${dev_id}"
> -	major=$(stat -c '%Hr' "$dev")
> -	minor=$(stat -c '%Lr' "$dev")
> +	major="0x"$(stat -c '%t' "$dev")
> +	minor="0x"$(stat -c '%T' "$dev")

Reviewed-by: Ming Lei <ming.lei@redhat.com>


Thanks,
Ming


  reply	other threads:[~2025-04-24  0:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 21:29 [PATCH 0/2] selftests: ublk: misc fixes Uday Shankar
2025-04-23 21:29 ` [PATCH 1/2] selftests: ublk: kublk: build with -Werror Uday Shankar
2025-04-24  0:08   ` Ming Lei
2025-04-24  0:18   ` Jens Axboe
2025-04-23 21:29 ` [PATCH 2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils Uday Shankar
2025-04-24  0:08   ` Ming Lei [this message]
2025-04-24 12:31 ` (subset) [PATCH 0/2] selftests: ublk: misc fixes Jens Axboe

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=aAmBGKfC72Q_JBG0@fedora \
    --to=ming.lei@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=ushankar@purestorage.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