Bug#953728: gambc: FTBFS on s390x

Nick Gasson <[email protected]>
Newsgroups gmane.linux.debian.devel.bugs.general,gmane.linux.debian.ports.s390
Message-ID <[email protected]>
On 05/23/20 13:13 PM, Adrian Bunk wrote:
> On Thu, Mar 12, 2020 at 04:36:17PM +0000, Ivo De Decker wrote:
>> package: src:gambc
>> version: 4.9.3-1
>> severity: serious
>> tags: ftbfs
>> 
>> Hi,
>> 
>> The latest upload of gambc to unstable fails on s390x:
>> 
>> https://buildd.debian.org/status/package.php?p=gambc
>
> Can an s390x porter please have a look?
>

I had a look at this because it's blocking another package, slib. I can
reproduce the hanging test case in qemu-user. It's testing timeouts with
UDP sockets but there seems to be a bug in the set_socket_blocking_mode
function where it passes an unsigned long argument to the FIONBIO ioctl
which actually takes an int parameter.

  unsigned long param = !blocking;

  return SOCKET_CALL_ERROR(IOCTL_SOCKET(s, FIONBIO, &param));

The parameter value is only ever 0 or 1 so it's benign on little-endian
LP64 systems but on a big-endian system the parameter is always 0 when
read as an int so the socket is never put in non-blocking mode and reads
from it hang.

The patch below fixes the problem from me on S390 qemu-user. I'm
wondering if someone with access to real hardware can verify?

diff --git a/lib/os_io.c b/lib/os_io.c
index 046be4a6bd30..b8b5f96c191e 100644
--- a/lib/os_io.c
+++ b/lib/os_io.c
@@ -5458,7 +5458,7 @@ ___BOOL blocking;)
 
 #ifdef FIONBIO
 
-  unsigned long param = !blocking;
+  int param = !blocking;
 
   return SOCKET_CALL_ERROR(IOCTL_SOCKET(s, FIONBIO, &param));


--
Thanks,
Nick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.