FS#76362 - [file] invalid system call on zip file and -z

Attached to Project: Arch Linux
Opened by Patrick Northon (patlefort) - Tuesday, 01 November 2022, 04:39 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 01 November 2022, 21:36 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Sébastien Luttringer (seblu)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Running file with -z on a zip file result in `invalid system call`. I couldn't reproduce it on other systems (Fedora, Ubuntu).

Additional info:
Version: 5.43

Last lines of strace:
```
futex(0x7f60a461b98c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
newfstatat(1, 0x7f60a45d9dd5, 0x7ffddba9a9a0, AT_EMPTY_PATH) = 0
mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f60a42d6000
newfstatat(AT_FDCWD, 0x7ffddba9c0ee, 0x7ffddba9b020, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, 0x7ffddba9c0ee, O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 3
newfstatat(3, 0x7f60a45d9dd5, 0x7ffddba9b020, AT_EMPTY_PATH) = 0
read(3, 0x7f60a42d6010, 1048576) = 162
rt_sigaction(SIGPIPE, 0x7ffddba9a810, 0x7ffddba9a8b0, 8) = 0
write(1, 0x563766473f00, 28/home/elrick/Temp/test.zip: ) = 28
pipe2(0x7ffddba9a8a8, O_CLOEXEC) = 293
+++ killed by SIGSYS +++
```

Steps to reproduce:
- Example: `file -z test.zip` result in that error.
This task depends upon

Closed by  Toolybird (Toolybird)
Tuesday, 01 November 2022, 21:36 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#65250 
Comment by Toolybird (Toolybird) - Tuesday, 01 November 2022, 08:26 GMT
It's not just zip files:

$ file -z /var/cache/pacman/pkg/filesystem-2022.10.18-1-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/filesystem-2022.10.18-1-x86_64.pkg.tar.zst: Bad system call
Comment by Levente Polyak (anthraxx) - Tuesday, 01 November 2022, 15:48 GMT
This is somewhat expected whenever file does not provide an internal decompression routine:

-S, --no-sandbox
On systems where libseccomp (https://github.com/seccomp/libseccomp) is available, the -S option disables sandboxing which is
enabled by default. This option is needed for file to execute external decompressing programs, i.e. when the -z option is
specified and the built-in decompressors are not available. On systems where sandboxing is not available, this option has no
effect.
Comment by Patrick Northon (patlefort) - Tuesday, 01 November 2022, 16:12 GMT
I hit the problem while using aunpack from atool on a .cbz file. Aunpack is trying to use file with the -z switch to figure out its type. Should this program be changed to use the -S switch? It would be nice if it could be controlled by the user with maybe an environment variable, but there is no way that I can tell.
Comment by Toolybird (Toolybird) - Tuesday, 01 November 2022, 21:35 GMT
Thanks @anthraxx. I completely missed  FS#65250  (my bad!). Too much bug wrangling fries the brain :(

Loading...