qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: Alice Frosi <alice@linux.vnet.ibm.com>,
	qemu-s390x <qemu-s390x@nongnu.org>,
	Cornelia Huck <cohuck@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine and other busybox environments
Date: Tue, 30 Jan 2018 09:41:36 -0600	[thread overview]
Message-ID: <fb70731d-b857-8adb-0dc7-cd072a2c50b1@redhat.com> (raw)
In-Reply-To: <20180130133828.77336-2-borntraeger@de.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]

On 01/30/2018 07:38 AM, Christian Borntraeger wrote:
> From: Alice Frosi <alice@linux.vnet.ibm.com>
> 
> In alpine docker image the qemu-system-s390x build is broken and
> it throws this error:
> qemu-system-s390x: Initialization of device s390-ipl failed: could not
> load bootloader 's390-ccw.img'
> 
> The grep command of busybox uses regex. This fails on binary data
> (e.g. stops on every \0), so it does not identify the string
> BiGeNdIaN in the test case big/little. Therefore, it assumes
> that the architecture is little endian.
> 
> This fix solves the grep problem by printing the content of
> TMPO with strings
> 
> Signed-off-by: Alice Frosi <alice@linux.vnet.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> [some changes to patch description, add -a option to strings]
> ---
> v1->v2:
> - Fix email address of Alice
> - Fix patch prefix

Oh, that reminds me I still have an old patch to qobject_from_jsonf that
probed $TMPO using strings [1].  It does look like 'strings -a' is
portable, so I'll have to update my patch when I dig it back out of storage.

[1] https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg07963.html

> +++ b/configure
> @@ -1906,9 +1906,9 @@ int main(int argc, char *argv[]) {
>  EOF
>  
>  if compile_object ; then
> -    if grep -q BiGeNdIaN $TMPO ; then
> +    if strings -a $TMPO | grep -q BiGeNdIaN ; then
>          bigendian="yes"
> -    elif grep -q LiTtLeEnDiAn $TMPO ; then
> +    elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then

Yes, this is indeed a more portable way to grep binary files (it's also
possible to do:

tr -d '\0' < $TMPO | grep -q ...

if we're worried about the availability of strings, but I don't see that
being a problem if no one reports it actually failing).

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

  reply	other threads:[~2018-01-30 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 13:38 [Qemu-devel] [PATCH v2 0/1] Fix binary build of qemu-system-s390x on alpine Christian Borntraeger
2018-01-30 13:38 ` [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine and other busybox environments Christian Borntraeger
2018-01-30 15:41   ` Eric Blake [this message]
2018-01-31 12:14     ` Christian Borntraeger
2018-01-31 12:51       ` Peter Maydell
2018-01-31 13:40         ` Christian Borntraeger
2018-01-31 13:47           ` Cornelia Huck

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=fb70731d-b857-8adb-0dc7-cd072a2c50b1@redhat.com \
    --to=eblake@redhat.com \
    --cc=alice@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    /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).