The file command (Debian Jessie) in does not recognize some Perl modules. For example: /usr/share/perl5/XML/SAX.pm (from libxml-sax-perl) gives:

$ file /usr/share/perl5/XML/SAX.pm
/usr/share/perl5/XML/SAX.pm: C++ source, ASCII text

The module starts with:

# $Id$

package XML::SAX;

use strict;
use vars qw($VERSION @ISA @EXPORT_OK);

When I remove the first two line, file sees it as a Perl module:

$ file tt
tt: Perl5 module source, ASCII text

Still, other modules starting with comment, such as /usr/lib/i386-linux-gnu/perl/5.20.2/Encode.pm are correctly identified.

Is this a bug? And where do I find the uncompiled mime data for /usr/share/file/magic.mgc?

1 Answer 1


The uncompiled data (it's not MIME data) for /usr/share/file/magic.mgc is in Magdir in the file(1) source code. The Perl magic in particular is defined in Magdir/perl. The issue you're seeing has been fixed; the fix is available in file versions 5.23 and later.

  • I have version 5.22 indeed; thanks! May 18, 2016 at 11:27
  • @WyboDekker If this answer solved your issue, please take a moment and accept it by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites.
    – terdon
    May 18, 2016 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.