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

Bug#916779: libc6-armhf-cross: strerror(-3) sets errno to ENOMEM



Package: libc6-armhf-cross
Version: 2.28-2cross2
Severity: normal

Dear Maintainer,

currently strerror(-3) sets errno unexpectedly to ENOMEM (12).

The expected errno value would be either EINVAL or not touching errno
at all.

This behavior is relatively new and causes some CI cross builds to fail.
The failing test is a gnulib test (test-strerror.c).

The behavior is not seen on an i368 cross build, while on all our other cross builds,
which are arm-linux-gnueabihf, mips-linux-gnu, aarch64-linux-gnu.

Here is a small reproducer:
include <stdio.h>
#include <string.h>
#include <errno.h>

int main(void)
{
        errno=0;
        char *msg=strerror(-3);
        printf("errno=%d, msg=%s\n",errno,msg);

        return 0;
}

Test it with:
$ arm-linux-gnueabihf-gcc -Wextra x.c -o x
$ ./x
errno=12, msg=Unknown error -3

You need the binfmt/qemu stuff set up to execute the cross-compiled binary.

Regards, Tim

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-3-amd64 (SMP w/12 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled


Reply to: