All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/1] Fix binary build of qemu-system-s390x on alpine
@ 2018-01-30 13:38 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
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Borntraeger @ 2018-01-30 13:38 UTC (permalink / raw)
  To: Paolo Bonzini, Peter Maydell
  Cc: qemu-devel, qemu-s390x, Cornelia Huck, Alice Frosi,
	Christian Borntraeger

Peter, Paolo,

sending this to you as you have the most commits on configure.
If you are ok with it, we can also carry that via the s390 tree.

Alice Frosi (1):
  Fix configure for s390 qemu on alpine and other busybox environments

 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.13.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine and other busybox environments
  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 ` Christian Borntraeger
  2018-01-30 15:41   ` Eric Blake
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Borntraeger @ 2018-01-30 13:38 UTC (permalink / raw)
  To: Paolo Bonzini, Peter Maydell
  Cc: qemu-devel, qemu-s390x, Cornelia Huck, Alice Frosi,
	Christian Borntraeger

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

 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 6d8c996c62..383b14e991 100755
--- a/configure
+++ 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
         bigendian="no"
     else
         echo big/little test failed
-- 
2.13.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine and other busybox environments
  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
  2018-01-31 12:14     ` Christian Borntraeger
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2018-01-30 15:41 UTC (permalink / raw)
  To: Christian Borntraeger, Paolo Bonzini, Peter Maydell
  Cc: Alice Frosi, qemu-s390x, Cornelia Huck, qemu-devel

[-- 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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine and other busybox environments
  2018-01-30 15:41   ` Eric Blake
@ 2018-01-31 12:14     ` Christian Borntraeger
  2018-01-31 12:51       ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Borntraeger @ 2018-01-31 12:14 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Eric Blake, Paolo Bonzini, Alice Frosi, qemu-s390x,
	Cornelia Huck, qemu-devel



On 01/30/2018 04:41 PM, Eric Blake wrote:
> 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>

Peter, does that patch work on MacOS and Windows? If yes we could
get this patch in via the s390 tree.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine and other busybox environments
  2018-01-31 12:14     ` Christian Borntraeger
@ 2018-01-31 12:51       ` Peter Maydell
  2018-01-31 13:40         ` Christian Borntraeger
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2018-01-31 12:51 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Eric Blake, Paolo Bonzini, Alice Frosi, qemu-s390x,
	Cornelia Huck, qemu-devel

On 31 January 2018 at 12:14, Christian Borntraeger
<borntraeger@de.ibm.com> wrote:
> On 01/30/2018 04:41 PM, Eric Blake wrote:
>> On 01/30/2018 07:38 AM, Christian Borntraeger wrote:
>>> +++ 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>
>
> Peter, does that patch work on MacOS and Windows? If yes we could
> get this patch in via the s390 tree.

I haven't tested but I think it should be fine. OSX provides
a strings binary that supports -a, and Windows cross-builds
so it will use the Linux strings.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine and other busybox environments
  2018-01-31 12:51       ` Peter Maydell
@ 2018-01-31 13:40         ` Christian Borntraeger
  2018-01-31 13:47           ` Cornelia Huck
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Borntraeger @ 2018-01-31 13:40 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: Peter Maydell, Eric Blake, Paolo Bonzini, Alice Frosi,
	qemu-s390x, qemu-devel

On 01/31/2018 01:51 PM, Peter Maydell wrote:
> On 31 January 2018 at 12:14, Christian Borntraeger
> <borntraeger@de.ibm.com> wrote:
>> On 01/30/2018 04:41 PM, Eric Blake wrote:
>>> On 01/30/2018 07:38 AM, Christian Borntraeger wrote:
>>>> +++ 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>
>>
>> Peter, does that patch work on MacOS and Windows? If yes we could
>> get this patch in via the s390 tree.
> 
> I haven't tested but I think it should be fine. OSX provides
> a strings binary that supports -a, and Windows cross-builds
> so it will use the Linux strings.
> 
> thanks
> -- PMM
> 

Conny, can you take this patch via s390-next?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/1] Fix configure for s390 qemu on alpine and other busybox environments
  2018-01-31 13:40         ` Christian Borntraeger
@ 2018-01-31 13:47           ` Cornelia Huck
  0 siblings, 0 replies; 7+ messages in thread
From: Cornelia Huck @ 2018-01-31 13:47 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Peter Maydell, Eric Blake, Paolo Bonzini, Alice Frosi,
	qemu-s390x, qemu-devel

On Wed, 31 Jan 2018 14:40:00 +0100
Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> On 01/31/2018 01:51 PM, Peter Maydell wrote:
> > On 31 January 2018 at 12:14, Christian Borntraeger
> > <borntraeger@de.ibm.com> wrote:  
> >> On 01/30/2018 04:41 PM, Eric Blake wrote:  
> >>> On 01/30/2018 07:38 AM, Christian Borntraeger wrote:  
> >>>> +++ 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>  
> >>
> >> Peter, does that patch work on MacOS and Windows? If yes we could
> >> get this patch in via the s390 tree.  
> > 
> > I haven't tested but I think it should be fine. OSX provides
> > a strings binary that supports -a, and Windows cross-builds
> > so it will use the Linux strings.
> > 
> > thanks
> > -- PMM
> >   
> 
> Conny, can you take this patch via s390-next?
> 

Sure, we'll notice anyway if something goes wrong after all.

Thanks, queued to s390-next.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-01-31 13:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.