Commit 5a13c01
committed
Magic test for archives with zero-length entry
Noticed when attempting to unpack a python `.whl` wheel file;
They're just renamed .zip's, and usually work OK, but there are casess
where the first file in the `.whl` archive is zero bytes, and that
causes `file -z` to error:
```bash
❯ file -zL tests/test-1.23.zip
tests/test-1.23.zip: ERROR:[gzip: ] (data)
❯ file tests/test-1.23.zip
tests/test-1.23.zip: Zip archive data, made by v2.3 UNIX, extract using at least v1.0, last modified Oct 28 2006 14:38:44, uncompressed size 0, method=store
❯ unzip -l tests/test-1.23.zip
Archive: tests/test-1.23.zip
Length Date Time Name
--------- ---------- ----- ----
0 2006-10-28 14:38 1/2/3
0 2006-10-28 14:38 a/b
0 2006-10-28 14:38 foobar
--------- -------
0 3 files
```
This means we were not using `file` magic for any archive that started
with a zero-length file (or directory) entry.
Add a fallback when the magic test fails in this case, and add a test to
cover it.1 parent 34eecd1 commit 5a13c01
3 files changed
+20
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1357 | 1357 | | |
1358 | 1358 | | |
1359 | 1359 | | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
1360 | 1373 | | |
1361 | 1374 | | |
1362 | 1375 | | |
1363 | | - | |
1364 | | - | |
1365 | 1376 | | |
1366 | 1377 | | |
1367 | 1378 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
987 | 987 | | |
988 | 988 | | |
989 | 989 | | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
0 commit comments