View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000612 | file | General | public | 2025-01-08 11:19 | 2025-01-25 16:17 |
Reporter | EQz | Assigned To | christos | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 5.46 | ||||
Fixed in Version | HEAD | ||||
Summary | 0000612: wrong mime type for zip files larger than ~20mb | ||||
Description | worked in version 5.45-r1 (1/2) Installing libmagic (5.45-r1) (2/2) Installing file (5.45-r1) Executing busybox-1.37.0-r9.trigger OK: 15 MiB in 17 packages /test # file --mime-type ./Weyland ./Weyland: application/zip (1/2) Installing libmagic (5.46-r2) (2/2) Installing file (5.46-r2) Executing busybox-1.37.0-r9.trigger OK: 17 MiB in 17 packages /test # file --mime-type ./Weyland ./Weyland: application/octet-stream | ||||
Tags | No tags attached. | ||||
|
I've ended up in a similar problem but with `libmagic`'s magic_buffer() function. Even small zip files (e.g. create a zip file that contains an empty/small file) are reported as 'application/octet-stream' by the `magic_buffer()` function while with `magic_descriptor()` they are correctly detected as `application/zip`. After digging a bit, it seems the culprit is around `buffer_fill()` from the src/buffer.c file - https://github.com/file/file/blob/FILE5_46/src/buffer.c#L71 , https://github.com/file/file/blob/FILE5_46/src/buffer.c#L93 `b->elen` is not handled for `magic_buffer()` when the offset is negative (i.e. looking for some bytes at the end of the file) and that seems to affect even the rest of the matches. The interesting thing is the `buffer_fill()` function doesn't look to be changed in the last version, which probably means the order of the magic database lookup made this issue surface |
|
Fixed... |
Date Modified | Username | Field | Change |
---|---|---|---|
2025-01-08 11:19 | EQz | New Issue | |
2025-01-24 16:10 | ifoancea | Note Added: 0004154 | |
2025-01-25 16:17 | christos | Assigned To | => christos |
2025-01-25 16:17 | christos | Status | new => assigned |
2025-01-25 16:17 | christos | Status | assigned => resolved |
2025-01-25 16:17 | christos | Resolution | open => fixed |
2025-01-25 16:17 | christos | Fixed in Version | => HEAD |
2025-01-25 16:17 | christos | Note Added: 0004156 |