Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1j6eFR-0001qk-A5 for mharc-qemu-trivial@gnu.org; Tue, 25 Feb 2020 12:43:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41854) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6eFO-0001or-E7 for qemu-trivial@nongnu.org; Tue, 25 Feb 2020 12:43:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6eFM-0007kE-Gl for qemu-trivial@nongnu.org; Tue, 25 Feb 2020 12:43:53 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46005 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6eFM-0007ie-8s for qemu-trivial@nongnu.org; Tue, 25 Feb 2020 12:43:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582652631; 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:autocrypt:autocrypt; bh=Gd/xI8JgucqpJBV8ygCv+8M1Rjwau3tTd2+xzioA9y8=; b=NC68nidhuiADlkcampPEB6n27/C7z6Zt1VjQ5XPeH80HKUC3Q5PrTuuFM2RJrmiUNcT5gR DQn3ClUe3HVUuoGCKpgF2GMkhyP5Za/HFM8cOQQhPEZz1yBAsvtZVD6FtsmZzRFU9aWF08 Zy0vecyIv7pLjmFYV5GmVTQh7UFBahE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-440-kbqdAqn8MV669ITJeTlqkA-1; Tue, 25 Feb 2020 12:43:49 -0500 X-MC-Unique: kbqdAqn8MV669ITJeTlqkA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 745D68017DF; Tue, 25 Feb 2020 17:43:48 +0000 (UTC) Received: from dresden.str.redhat.com (ovpn-117-215.ams2.redhat.com [10.36.117.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0AE4227181; Tue, 25 Feb 2020 17:43:46 +0000 (UTC) Subject: Re: [PATCH] iotests: Fix nonportable use of od --endian To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-trivial@nongnu.org, andrey.shinkevich@virtuozzo.com, Kevin Wolf References: <20200219144103.2919292-1-eblake@redhat.com> From: Max Reitz Autocrypt: addr=mreitz@redhat.com; prefer-encrypt=mutual; keydata= mQENBFXOJlcBCADEyyhOTsoa/2ujoTRAJj4MKA21dkxxELVj3cuILpLTmtachWj7QW+TVG8U /PsMCFbpwsQR7oEy8eHHZwuGQsNpEtNC2G/L8Yka0BIBzv7dEgrPzIu+W3anZXQW4702+uES U29G8TP/NGfXRRHGlbBIH9KNUnOSUD2vRtpOLXkWsV5CN6vQFYgQfFvmp5ZpPeUe6xNplu8V mcTw8OSEDW/ZnxJc8TekCKZSpdzYoxfzjm7xGmZqB18VFwgJZlIibt1HE0EB4w5GsD7x5ekh awIe3RwoZgZDLQMdOitJ1tUc8aqaxvgA4tz6J6st8D8pS//m1gAoYJWGwwIVj1DjTYLtABEB AAG0HU1heCBSZWl0eiA8bXJlaXR6QHJlZGhhdC5jb20+iQFTBBMBCAA9AhsDBQkSzAMABQsJ CAcCBhUICQoLAgQWAgMBAh4BAheABQJVzie5FRhoa3A6Ly9rZXlzLmdudXBnLm5ldAAKCRD0 B9sAYdXPQDcIB/9uNkbYEex1rHKz3mr12uxYMwLOOFY9fstP5aoVJQ1nWQVB6m2cfKGdcRe1 2/nFaHSNAzT0NnKz2MjhZVmcrpyd2Gp2QyISCfb1FbT82GMt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ent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200219144103.2919292-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NKUr5LFGQbGwODBlqq3Cm5DfAUcOVcPlB" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Feb 2020 17:43:56 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NKUr5LFGQbGwODBlqq3Cm5DfAUcOVcPlB Content-Type: multipart/mixed; boundary="4GDF1HxE34OHdehYJWokpWYbNbIqrFumC" --4GDF1HxE34OHdehYJWokpWYbNbIqrFumC Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 19.02.20 15:41, Eric Blake wrote: > Tests 261 and 272 fail on RHEL 7 with coreutils 8.22, since od > --endian was not added until coreutils 8.23. Fix this by manually > constructing the final value one byte at a time. >=20 > Fixes: fc8ba423 > Reported-by: Andrey Shinkevich > Signed-off-by: Eric Blake > --- > tests/qemu-iotests/common.rc | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) >=20 > diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc > index 8a6366c09daf..b77ef3d22cd1 100644 > --- a/tests/qemu-iotests/common.rc > +++ b/tests/qemu-iotests/common.rc > @@ -56,6 +56,12 @@ poke_file() I don=E2=80=99t know how you did it, but something in your workflow broke t= his patch. This should be -56,18 +56,30. (Note that git accepts this patch without error, but it drops everything after the first part. I noticed because your squash-in failed to apply. I suppose I might have noticed later when reviewing, because only peek_file_le() was touched, but who knows.) > # peek_file_le 'test.img' 512 2 =3D> 65534 > peek_file_le() > { > - # Wrap in echo $() to strip spaces > - echo $(od -j"$2" -N"$3" --endian=3Dlittle -An -vtu"$3" "$1") > + local val=3D0 shift=3D0 i > + > + # coreutils' od --endian is not portable, so manually assemble bytes= . > + for i in $(od -j"$2" -N"$3" -An -v -tu1 "$1"); do =E2=80=9Ci=E2=80=9D is a weird name for something that isn=E2=80=99t an ind= ex. > + val=3D$(( val | (i << shift) )) > + shift=3D$((shift + 8)) > + done > + echo $val > } >=20 Regarding the broken patch format again: There are no spaces here... > # peek_file_be 'test.img' 512 2 =3D> 65279 > peek_file_be() > { > - # Wrap in echo $() to strip spaces > - echo $(od -j"$2" -N"$3" --endian=3Dbig -An -vtu"$3" "$1") > + local val=3D0 i > + > + # coreutils' od --endian is not portable, so manually assemble bytes= . > + for i in $(od -j"$2" -N"$3" -An -v -tu1 "$1"); do > + val=3D$(( (val << 8) | i )) > + done > + echo $val > } >=20 ...and here like there normally would be. With the patch format fixed, and your proposed to-be-squashed patch squashed in, there isn=E2=80=99t anything wrong, so: Reviewed-by: Max Reitz But if I=E2=80=99m already about to squash something in, would you allow me= to rename all instances of =E2=80=9Ci=E2=80=9D to e.g. =E2=80=9Cbyte=E2=80=9D? Max > -# peek_file_raw 'test.img' 512 2 =3D> '\xff\xfe' > +# peek_file_raw 'test.img' 512 2 =3D> '\xff\xfe'. Do not use if the raw = data > +# is likely to contain \0 or trailing \n. > peek_file_raw() > { > dd if=3D"$1" bs=3D1 skip=3D"$2" count=3D"$3" status=3Dnone >=20 --4GDF1HxE34OHdehYJWokpWYbNbIqrFumC-- --NKUr5LFGQbGwODBlqq3Cm5DfAUcOVcPlB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEkb62CjDbPohX0Rgp9AfbAGHVz0AFAl5VXNEACgkQ9AfbAGHV z0D93Af7BzoMeAZD8ZM2Hfc9bp/ObX/Ih94v8qF4e5phd8eMZ4m/zUWjAI1tZ4zx +V2LH3RTMOmxzfiIzMaLCphO2x8rXp4eGNGj0JBp3jPCVYwMnPSXCr0qejfHShAz LhkiR+QgpzzK4EXE3JdJJSNH3EgIO6yNKH9Z6wMwJ1g9ui5xHcn3VMHobZsomz1d GWnY2wOjneMy7wj+svD6/2B6sGwzb/1PZssPJ+jB1aQQJQ41BuXfYDQOXdHv/4pc VZsV5sIg0d6PwbD7ZFx32SlHnNthZuEKEktEOKIfvE92+q7ZGcEeDRhTvPBoiIq/ pUcavXhDsHs9PvH8O/taz4ohc3bITw== =8PDB -----END PGP SIGNATURE----- --NKUr5LFGQbGwODBlqq3Cm5DfAUcOVcPlB--