Damn... I just found a bug in libmagic.
if(b->fd != -1)
ms->offset = ms->eoffset + offset;
and so all my webm files, libmagic is saying are application/octet-stream if I use magic_buffer, and video/webm if I use magic_file. Why is it even checking the file descriptor there??
I wonder if I could open /dev/null and trick libmagic into thinking that's the file descriptor. Or maybe some bullsit with pipes. Otherwise, I have to convince maintainers of a core package that millions of people use all the time, to accept my patch...
#programming #bug