qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine an


From: Eric Blake
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 01/30/2018 07:38 AM, Christian Borntraeger wrote:
> From: Alice Frosi <address@hidden>
> 
> 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 <address@hidden>
> Signed-off-by: Christian Borntraeger <address@hidden>
> [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 <address@hidden>

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]