Skip Menu |

This queue is for tickets about the File-LibMagic CPAN distribution.

Report information
The Basics
Id: 29014
Status: rejected
Priority: 0/
Queue: File-LibMagic

People
Owner: Nobody in particular
Requestors: parkerm [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.84
Fixed in: (no value)



Subject: First character of MIME encoding result (if it exists) is cutoff
Here is a small script that illustrates the error for me: use File::LibMagic; my $lm = File::LibMagic->new(); my $filedata = <<EOS; From: foo\@example.com blah EOS print "==> " . $lm->checktype_contents($filedata) . "\n"; The output is: ==> message/rfc822\011bit The relevant line in the magic.mime file is here: 0 string From: message/rfc822 7bit I can recreate this for any other types as well.
This seems to be a problem with libmagic that is just passed unchanged through File::LibMagic. use the attached c programm. (use gcc test-libmagic.c -o test-libmagic -lmagic to compile the example). regards, Andreas On Mon Aug 27 10:21:00 2007, PARKER wrote: Show quoted text
> Here is a small script that illustrates the error for me: > use File::LibMagic; > my $lm = File::LibMagic->new(); > my $filedata = <<EOS; > From: foo\@example.com > > blah > EOS > > print "==> " . $lm->checktype_contents($filedata) . "\n"; > > The output is: > ==> message/rfc822\011bit > > The relevant line in the magic.mime file is here: > 0 string From: message/rfc822 7bit > > > I can recreate this for any other types as well.
#include <magic.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int Exit(char * c, int i, magic_t m); int main(void) { char * TestPattern="From: foo@example.com\n\nblah\n"; magic_t m; int ret_i; char * c; m =magic_open(MAGIC_MIME); if (m==NULL) { Exit("Err",1,m); } ret_i=magic_load(m,NULL); if (ret_i==-1) { Exit("Error Load",1,m); } c = (char *) magic_buffer(m, TestPattern, strlen(TestPattern)); if (c==NULL) { Exit("E",2,m); } else { printf("%s\n",c); } magic_close(m); exit(0); } int Exit(char * c, int i, magic_t m) { printf("%s\n",c); if (i==1) { printf("%s\n", magic_error(m)); } exit(i); }
problem with file (see example written in C).