I have an valid, yet empty zip archive:
$ file 22.zip
22.zip: Zip archive data (empty)
$ xxd 22.zip
00000000: 504b 0506 0000 0000 0000 0000 0000 0000 PK..............
00000010: 0000 0000 0000
Trying to list the archive content or unzipping the file gives both a warning and returns exit code 1.
$ unzip -l 22.zip; echo $?
Archive: 22.zip
warning [22.zip]: zipfile is empty
1
$ unzip 22.zip; echo $?
Archive: 22.zip
warning [22.zip]: zipfile is empty
1
I understand the warning, but the exit code seems wrong. There is nothing wrong with an empty file; for example running cat
on an empty file yields exit code 0.
What is the reasoning behind unzip
returning an exit code 1 on a valid, yet empty file?
Asked by miku
(683 rep)
Mar 13, 2025, 10:26 AM
Last activity: Mar 13, 2025, 10:35 AM
Last activity: Mar 13, 2025, 10:35 AM