From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03F4B380 for ; Thu, 24 Apr 2025 00:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745453354; cv=none; b=hazf9TlXLtIKGe58spQmklz0pgJViRtkH0R/mpNbDoomeiyg2Q7xqgVtivEAcudu/IKB9/TQpNkmq4ztQbqJ118shT63RiMC8YsFAwS/GmNloTZpStog5GAgjxblr5xZ2RvC073WVTp2EntJKINWwr6SYySO982JO/4C5jfE550= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745453354; c=relaxed/simple; bh=rpML8Vw4CRUhPj0L+195Bj7yvekpPYn5VCnsEkrlF7c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QEOtr7hb/jxoYvNLub7w0xJLpI/ieusw0ZipSm6L9mzWDAYMB2Hgz06S+RVt9sv+O/Udp43hZVldJPpReXHHep777s6+ykYkbxKQijuk/playIVyc/95A/DCYQyrxiJMR2jvTqwC6KFMVhWQeJw7JvTj2SPGXPT/1NDpMC+sa8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=EO7DSxbV; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EO7DSxbV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745453351; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=remwpkwHo2Gyd19QnDcRBS0h2F0Mkh/a20m7ArEbiYc=; b=EO7DSxbV4KSKFV2SUackroSJgBGV7QkSosxk73XZmjmhKoI06RBH+//CsgsTLAdSEN6Z/C IZLLPICSdfN2X992rivSmVwG4LhB6fvIUh2t7CPQbvUwrxRuRj7ssMQxvlzKyGCAzPexNr OO0d6+8Eh4zZJbZkOLtO4oKdzMvuh1Y= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-391-9HT4SPqZOtSa0NxKAdv81A-1; Wed, 23 Apr 2025 20:09:06 -0400 X-MC-Unique: 9HT4SPqZOtSa0NxKAdv81A-1 X-Mimecast-MFC-AGG-ID: 9HT4SPqZOtSa0NxKAdv81A_1745453345 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7A5261800878; Thu, 24 Apr 2025 00:09:05 +0000 (UTC) Received: from fedora (unknown [10.72.116.12]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B9DCD180047F; Thu, 24 Apr 2025 00:09:01 +0000 (UTC) Date: Thu, 24 Apr 2025 08:08:56 +0800 From: Ming Lei To: Uday Shankar Cc: Shuah Khan , 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 Message-ID: References: <20250423-ublk_selftests-v1-0-7d060e260e76@purestorage.com> <20250423-ublk_selftests-v1-2-7d060e260e76@purestorage.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250423-ublk_selftests-v1-2-7d060e260e76@purestorage.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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 > --- > 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 Thanks, Ming