Your message dated Wed, 26 Oct 2011 08:30:25 +0200
with message-id <[email protected]>
and subject line Re: file and magic_load mime regressions
has caused the Debian Bug report #500734,
regarding file and magic_load mime regressions
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
500734: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500734
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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");
    }
}

--- End Message ---
--- Begin Message ---
Version: 5.09-1

File since several versions does not ship any 'plain' magic and
magic.mime files anymore, one has to do any access through the library,
thus closing this bug.

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          [email protected]
Internet:       http://people.progress-technologies.net/~daniel.baumann/


--- End Message ---

Reply via email to