Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > File::MMagic doesn't recognize rar file

Reply
Thread Tools

File::MMagic doesn't recognize rar file

 
 
Vilmos Soti
Guest
Posts: n/a
 
      05-16-2006
Hello,

File::MMagic doesn't seem to recognize rar files. (tar is ok).
The machine is running Debian Etch. Here is the perl version:

$ perl -v

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi

Copyright 1987-2006, Larry Wall
....

Here is the version of File::MMagic:

$ head -3 /usr/share/perl5/File/MMagic.pm
# File::MMagic
#
# $Id: MMagic.pm 198 2006-01-30 05:24:17Z knok $
$

Here is my script:

############################## Script starts ##############################
#!/usr/bin/perl -w
use strict;
use File::MMagic;

my $magic = new File::MMagic;
my $type;

foreach my $file (<c.*>) {
$type = $magic->checktype_filename ("$file");
print "$file, $type\n";
system ("file $file");
print "\n";
}
############################## Script ends ##############################

And here is the output of the script:

$ ./a
c.rar, application/octet-stream
c.rar: RAR archive data, v1d, os: Win32

c.tar, application/x-gtar
c.tar: POSIX tar archive

$

Here are the last two lines from /usr/share/perl5/File/MMagic.pm:

# RAR archiver (Greg Roelofs, http://www.velocityreviews.com/forums/(E-Mail Removed))
0 string Rar! application/x-rar

And here are the first few characters from c.rar:

$ xxd c.rar | head -1
0000000: 5261 7221 1a07 00cf 9073 0000 0d00 0000 Rar!.....s......
$

Do I do anything wrong or is it something else?

Thanks for your time, Vilmos
 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-16-2006
Vilmos Soti <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> File::MMagic doesn't seem to recognize rar files. (tar is ok).
> The machine is running Debian Etch.


rar is the last entry in the file and there is no newline after that entry
which causes that line of data to be missed.

Edit your copy of MMagic: Go to the end of the line, press enter, and
save. That should result in rar files correctly being identified as
application/x-rar.

Please report this to the module author.

Sinan

--
A. Sinan Unur <(E-Mail Removed)>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc...uidelines.html

 
Reply With Quote
 
 
 
 
Vilmos Soti
Guest
Posts: n/a
 
      05-16-2006
"A. Sinan Unur" <(E-Mail Removed)> writes:

> Vilmos Soti <(E-Mail Removed)> wrote in
> news:(E-Mail Removed):
>
>> File::MMagic doesn't seem to recognize rar files. (tar is ok).
>> The machine is running Debian Etch.

>
> rar is the last entry in the file and there is no newline after that entry
> which causes that line of data to be missed.


!@#$%

My copy does have a newline, but it doesn't have an empty line.
Maybe this was the problem. Now it works.

> Edit your copy of MMagic: Go to the end of the line, press enter, and
> save. That should result in rar files correctly being identified as
> application/x-rar.


Done, and it works now.

> Please report this to the module author.


I did.

Sinan, thank you for your help.

Vilmos
 
Reply With Quote
 
DJ Stunks
Guest
Posts: n/a
 
      05-16-2006

Vilmos Soti wrote:
> "A. Sinan Unur" <(E-Mail Removed)> writes:
>
> > Vilmos Soti <(E-Mail Removed)> wrote in
> > news:(E-Mail Removed):
> >
> >> File::MMagic doesn't seem to recognize rar files. (tar is ok).
> >> The machine is running Debian Etch.

> >
> > rar is the last entry in the file and there is no newline after that entry
> > which causes that line of data to be missed.

>
> > Edit your copy of MMagic: Go to the end of the line, press enter, and
> > save. That should result in rar files correctly being identified as
> > application/x-rar.

>
> Done, and it works now.
>
> Sinan, thank you for your help.


Another example of how a good posting technique is directly
proportional to the quality of the responses.

Excellent post, and great job picking that up, Sinan.

gooooo team!

-jp

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-17-2006
"DJ Stunks" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) oups.com:

>
> Vilmos Soti wrote:
>> "A. Sinan Unur" <(E-Mail Removed)> writes:
>>

.....
>> > and save. That should result in rar files correctly being
>> > identified as application/x-rar.

>>
>> Done, and it works now.
>>
>> Sinan, thank you for your help.


You are welcome.

> Another example of how a good posting technique is directly
> proportional to the quality of the responses.
>
> Excellent post, and great job picking that up, Sinan.
>
> gooooo team!




Sinan

--
A. Sinan Unur <(E-Mail Removed)>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc...uidelines.html

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-17-2006
"A. Sinan Unur" <(E-Mail Removed)> wrote in
news:Xns97C5AED08DBFAasu1cornelledu@127.0.0.1:

> Please report this to the module author.


Fixed.

http://rt.cpan.org/Public/Bug/Display.html?id=19294

Sinan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Posting RAR inside ZIP inside RAR Mike Easter Computer Support 0 02-28-2010 05:31 PM
How to recognize the binary file is in Release mode or in Debug modefrom the core file. prajakta143@gmail.com C Programming 3 01-03-2008 06:26 PM
*.rar.txt and *rar files jdruk Computer Support 0 10-11-2004 01:21 AM
Deploy resource adapter (.RAR-file) in Tomcat? Oliver Hoehle Java 0 02-26-2004 01:07 PM
how do you turn a rar/par file into something useable? ddrr Computer Support 4 09-03-2003 03:18 PM



Advertisments