On 01/30/2018 04:41 PM, Eric Blake wrote:
> On 01/30/2018 07:38 AM, Christian Borntraeger wrote:
>> From: Alice Frosi <al...@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 <al...@linux.vnet.ibm.com>
>> Signed-off-by: Christian Borntraeger <borntrae...@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 <ebl...@redhat.com>

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


Reply via email to