View Issue Details

IDProjectCategoryView StatusLast Update
0000011file[All Projects] Generalpublic2018-08-01 09:03
ReportercbiedlAssigned Tochristos 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000011: Differing results from magic_file() and magic_buffer()
DescriptionThe recent changes in file added inspection on the stat() system call result. This is of course not possible when magic_buffer() was call which does not know about the underlying file, if any.

As one of several results, the test suite of Adam Hupp's python-magic breaks as it silently compares the result of both functions and fails on any difference: https://github.com/ahupp/python-magic/issues/173

Can you please add a warning to the documentation of magic_buffer() this might have a different result/less detailed result? One example is some ELF files where the executable bit is taken into consideration.

And about that one, the gzip magic checks for the file size only AFAICT. Given the buffer size provided by any magic_buffer() caller, it should be possible to create a synthetic stat record containing at least that information.

Cheers,
    Christoph
TagsNo tags attached.
Attach Tags

Activities

christos

2018-07-25 06:24

manager   ~0000014

Thanks. The ELF change that depended on stat(2) has been undone, but the magic_buffer and magic_file can still return different results, so I've documented it.

christos

2018-08-01 09:03

manager   ~0000023

feedback timeout

Issue History

Date Modified Username Field Change
2018-07-22 08:07 cbiedl New Issue
2018-07-25 06:19 christos Assigned To => christos
2018-07-25 06:19 christos Status new => assigned
2018-07-25 06:24 christos Status assigned => feedback
2018-07-25 06:24 christos Note Added: 0000014
2018-08-01 09:03 christos Status feedback => resolved
2018-08-01 09:03 christos Resolution open => fixed
2018-08-01 09:03 christos Note Added: 0000023