Package: libmagic1 Version: 4.26-1 Severity: serious The libmagic(3) man page says:
"magic_load() adds â.mimeâ and/or â.mgcâ to the database filename as appropriate." and it indeed worked that way in etch. However it is no longer working in sid. Attached is a sample program (written by my co-worker Neal Krawetz) to demonstrate this, build it with gcc testmagic.c -o testmagic -lmagic then copy a magic file to /tmp for it to use cp /usr/share/file/magic.mime /tmp/foo.mime and run testmagic. It is testing two things 1.) It should work when trying to magic_load "/tmp/foo" with a file named /tmp/foo.mime. If it doesn't this is a direct contradiction of the manpage and past behaviour. 2.) It should fail when trying to magic_load "/tmp/foo.mime" with a file named /tmp/foo.mime. If it doesn't this is a direct contradiction of past behaviour. Maybe it was "enhanced" to do-the-right-thing and check if the file exists before appending .mime? Even so it still breaks in the case where someone was expecting that behavior and there are both foo and foo.mime files present. This bug breaks all applications that uses libmagic and depend on this behavior, so I think it's severity serious at least (for #1, #2 is debatable). Thanks, -- Matt Taggart [EMAIL PROTECTED]
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <magic.h> int main () { magic_t MagicCookie; MagicCookie = magic_open(MAGIC_PRESERVE_ATIME|MAGIC_MIME); if (MagicCookie == NULL) { fprintf(stderr,"FATAL: Failed to initialize magic cookie\n"); exit(-1); } if (magic_load(MagicCookie,"/tmp/foo") != 0) { fprintf(stderr,"FATAL: Failed to load magic file: foo.mime\n"); } else { fprintf(stderr,"GOOD: Correctly loaded magic file: foo.mime\n"); } if (magic_load(MagicCookie,"/tmp/foo.mime") != 0) { fprintf(stderr,"GOOD: Correctly failed to load magic file: foo.mime.mime\n"); } else { fprintf(stderr,"FATAL: Managed to load foo.mime when should have attempted to load foo.mime.mime\n"); } }