Skip Menu |

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

Report information
The Basics
Id: 128394
Status: resolved
Priority: 0/
Queue: File-LibMagic

People
Owner: DROLSKY [...] cpan.org
Requestors: DAINA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.12
Fixed in: (no value)



Subject: CSV file identified as C source code
This is probably a problem with the underlying libmagic.so library, so it may not be best to solve it in File::LibMagic, but it might. I have a case where an obviously comma separated values (.CSV) file that should have a mime-type of 'text/plain' or 'text/csv' is identified as a mime-type of 'text/x-c' (C source code).  I believe this happened because one of the lines in the file started with an email address that just happened to start with the C keyword 'char'.  So with an email address 'charlie@example.com' as the first thing on any line triggered the identification as a C source code file.  However, ' charlie@example.com' (first character is a space) or 'Charlie@example.com' (first character is upper-case C) did not.  I didn't try all C keywords, but I did try 'int' and it didn't trigger the identification as a C source code file. This is File::LibMagic version 1.12 running under Perl v5.20.3 on Ubuntu 14.04.5. I thought this was kind of funny.  We created a workaround so it's not a huge deal for us, but it really is a goofy bug. Daina
On 2019-01-29 16:43:51, DAINA wrote: Show quoted text
> This is probably a problem with the underlying libmagic.so library, so > it may not be best to solve it in File::LibMagic, but it might. > > I have a case where an obviously comma separated values (.CSV) file > that should have a mime-type of 'text/plain' or 'text/csv' is > identified as a mime-type of 'text/x-c' (C source code). > > I believe this happened because one of the lines in the file started > with an email address that just happened to start with the C keyword > 'char'.  So with an email address 'charlie@example.com' as the first > thing on any line triggered the identification as a C source code > file.  However, ' charlie@example.com' (first character is a space) or > 'Charlie@example.com' (first character is upper-case C) did not.  I > didn't try all C keywords, but I did try 'int' and it didn't trigger > the identification as a C source code file. > > This is File::LibMagic version 1.12 running under Perl v5.20.3 > on Ubuntu 14.04.5. > > I thought this was kind of funny.  We created a workaround so it's not > a huge deal for us, but it really is a goofy bug. > > Daina
Thanks for the report. I marked this as "stalled" since there's really nothing that I can do about it. It would need to be fixed in libmagic, as you noted. It'd be great if you could report it to that project, except both their mailing list and bug tracker links are broken (https://www.darwinsys.com/file/)