Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#65100 - [file] 5.38-1 crashes with "Bad system call" in makepkg strip.sh

Attached to Project: Arch Linux
Opened by xnor (xnor) - Friday, 10 January 2020, 01:24 GMT
Last edited by Levente Polyak (anthraxx) - Friday, 10 January 2020, 03:12 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To S├ębastien Luttringer (seblu)
Levente Polyak (anthraxx)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Upgrading file from 5.37-5 to 5.38-1 broke makepkg stripping binaries and shared libraries because /usr/share/makepkg/tidy/strip.sh calls $(file -bi "$binary") which crashes with "Bad system call".

Tail of strace output:
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=3035216, ...}) = 0
mmap(NULL, 3035216, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7efe9cbbe000
close(3) = 0
prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) = 0
prctl(PR_SET_DUMPABLE, SUID_DUMP_DISABLE) = 0
prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) = 0
seccomp(SECCOMP_SET_MODE_STRICT, 1, NULL) = -1 EINVAL (Invalid argument)
seccomp(SECCOMP_SET_MODE_FILTER, 0, 0x55ee622dcb60) = 0
futex(0x7efe9cf01048, FUTEX_WAKE_PRIVATE, 2147483647) = 0
stat(0x55ee622dcf30, 0x7fffb989ed80) = -1 ENOENT (No such file or directory)
stat(0x55ee622df3f0, 0x7fffb989ed80) = -1 ENOENT (No such file or directory)
access(0x55ee622e1460, R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, 0x55ee622e1460, O_RDONLY) = 3
fstat(3, 0x7fffb989ee60) = 0
msgget(0x35db8cad, IPC_CREAT|0600) = ?
+++ killed by SIGSYS +++


Recompiling file with --disable-libseccomp fixes the crash and results in makepkg stripping binaries again.
This task depends upon

Closed by  Levente Polyak (anthraxx)
Friday, 10 January 2020, 03:12 GMT
Reason for closing:  Fixed
Additional comments about closing:  pacman 5.2.1-4
Comment by xnor (xnor) - Friday, 10 January 2020, 01:36 GMT
Not totally unrelated:  FS#58626 
Comment by Eli Schwartz (eschwartz) - Friday, 10 January 2020, 01:37 GMT
file without the -S argument is also broken whenever it is used via fakeroot. pacman master doesn't use this invocation of file inside fakeroot, so it does not have this issue.

The makepkg change in question is not what I'd call a stable backport-worthy commit...
Comment by Eli Schwartz (eschwartz) - Friday, 10 January 2020, 01:50 GMT
This patch is what I'd push upstream, if it were applicable to master.

EDIT: I'll see about getting it into release/5.2.x though. https://lists.archlinux.org/pipermail/pacman-dev/2020-January/023962.html
Comment by Levente Polyak (anthraxx) - Friday, 10 January 2020, 02:23 GMT
Quite interesting it does so totally in silent >.>
Comment by Eli Schwartz (eschwartz) - Friday, 10 January 2020, 02:34 GMT
It's immensely frustrating. I hacked up /usr/share/makepkg/tidy/strip.sh and inserted this:

echo "running file..."
file -bi "$binary"
echo "running file in command substitution..."
echo "$(file -bi "$binary")"

The output looks like this:

------
running file...
/usr/share/makepkg/tidy/strip.sh: line 97: 1001875 Bad system call file -bi "$binary"
running file in command substitution...

------

Loading...