Hello community,

here is the log from the commit of package perl-File-MMagic for 
openSUSE:Factory checked in at 2013-06-09 16:57:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-File-MMagic (Old)
 and      /work/SRC/openSUSE:Factory/.perl-File-MMagic.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-File-MMagic"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-File-MMagic/perl-File-MMagic.changes        
2011-11-21 12:39:56.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.perl-File-MMagic.new/perl-File-MMagic.changes   
2013-06-09 16:57:34.000000000 +0200
@@ -1,0 +2,33 @@
+Thu Jun  6 12:44:47 UTC 2013 - [email protected]
+
+- license update: Apache-1.0
+  correct license is  Apache-1.0
+
+-------------------------------------------------------------------
+Tue Jun  4 08:53:23 UTC 2013 - [email protected]
+
+- updated to 1.29
+        * MMagic.pm (checktype_contents): Fix infinity loop bug.
+        Reported by [email protected] (#77836)
+ 
+        * MMagic.pm: Add missing =back.
+ 
+        * MMagic.pm (readMagicEntry): Removed deprecated code
+          (defined(@array)) reported by [email protected] (#74252).
+ 
+        * MMagic.pm (checktype_byfilename): Fixed memory leak.
+ 
+        * MMagic.pm: Added 'regex' and 'search' support for magic entry,
+          and fixed fatal error when unknown type in magic entry.
+          (The patch made by Man Min Yan, thank you).
+ 
+        * MMagic.pm (readMagicLine): Added Hex representation support.
+          (The patch made by Man Min Yan, thank you)
+ 
+        * MMagic.pm (checktype_container): Added container check.
+          (Powerd by CodeFest 2006 Akihabara
+           https://members.fsij.org/trac/codefestakihabara2006c)
+ 
+        * Applied subclass patch, made by Michael Hendricks.
+
+-------------------------------------------------------------------

Old:
----
  File-MMagic-1.27.tar.gz

New:
----
  File-MMagic-1.29.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-File-MMagic.spec ++++++
--- /var/tmp/diff_new_pack.GxV2b2/_old  2013-06-09 16:57:35.000000000 +0200
+++ /var/tmp/diff_new_pack.GxV2b2/_new  2013-06-09 16:57:35.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-File-MMagic
 #
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -15,51 +15,45 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
-
 
 Name:           perl-File-MMagic
-License:        Artistic-1.0
+Version:        1.29
+Release:        0
+%define cpan_name File-MMagic
+Summary:        Guess file type
+License:        Apache-1.0
 Group:          Development/Libraries/Perl
-#Obsoletes:
-#Provides:
-AutoReqProv:    on
-Summary:        Perl modules to guess file types
-Version:        1.27
-Release:        113
-Source:         
http://search.cpan.org/CPAN/authors/id/K/KN/KNOK/File-MMagic-%{version}.tar.gz
+Url:            http://search.cpan.org/dist/File-MMagic/
+Source:         
http://www.cpan.org/authors/id/K/KN/KNOK/%{cpan_name}-%{version}.tar.gz
+BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%{perl_requires}
 BuildRequires:  perl
 BuildRequires:  perl-macros
+#BuildRequires: perl(File::MMagic)
+#BuildRequires: perl(Module::Build)
+%{perl_requires}
 
 %description
-Perl modules to guess file types
-
-
-
-Authors:
---------
-    Nokubi Takatsugu <[email protected]>
+checktype_filename(), checktype_filehandle() and checktype_contents returns
+string contains file type with MIME mediatype format.
 
 %prep
-%setup -n File-MMagic-%{version}
+%setup -q -n %{cpan_name}-%{version}
 
 %build
-perl Makefile.PL
-make %{?_smp_mflags}
-make test
+%{__perl} Makefile.PL INSTALLDIRS=vendor
+%{__make} %{?_smp_mflags}
+
+%check
+%{__make} test
 
 %install
-rm -rf $RPM_BUILD_ROOT
-make DESTDIR=$RPM_BUILD_ROOT install_vendor
+%perl_make_install
 %perl_process_packlist
+%perl_gen_filelist
 
-%files
-%defattr(-,root,root)
-%{perl_vendorlib}/File
-%{perl_vendorarch}/auto/File
-%{_mandir}/man?/*
-%doc ChangeLog README.en README.ja
+%files -f %{name}.files
+%defattr(-,root,root,755)
+%doc ChangeLog COPYING README.en README.ja
 
 %changelog

++++++ File-MMagic-1.27.tar.gz -> File-MMagic-1.29.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/ChangeLog 
new/File-MMagic-1.29/ChangeLog
--- old/File-MMagic-1.27/ChangeLog      2006-05-23 07:55:27.000000000 +0200
+++ new/File-MMagic-1.29/ChangeLog      2012-07-12 02:39:35.000000000 +0200
@@ -1,3 +1,47 @@
+2012-07-12  NOKUBI Takatsugu  <[email protected]>
+
+       * MMagic.pm (checktype_contents): Fix infinity loop bug.
+       Reported by [email protected] (#77836)
+       * Version 1.29.
+
+2012-06-29  NOKUBI Takatsugu  <[email protected]>
+
+       * MMagic.pm: Add missing =back.
+
+2012-05-31  NOKUBI Takatsugu  <[email protected]>
+
+       * MMagic.pm: Version 1.28.
+
+2012-03-15  NOKUBI Takatsugu  <[email protected]>
+
+       * MMagic.pm (readMagicEntry): Removed deprecated code
+         (defined(@array)) reported by [email protected] (#74252).
+
+2011-07-21  Yukio USUDA  <[email protected]>
+
+       * MMagic.pm (checktype_byfilename): Fixed memory leak.
+
+2007-10-02  NOKUBI Takatsugu  <[email protected]>
+
+       * MMagic.pm: Added 'regex' and 'search' support for magic entry,
+         and fixed fatal error when unknown type in magic entry.
+         (The patch made by Man Min Yan, thank you).
+
+2006-09-19  NOKUBI Takatsugu  <[email protected]>
+
+       * MMagic.pm (readMagicLine): Added Hex representation support.
+         (The patch made by Man Min Yan, thank you)
+
+2006-07-01  NOKUBI Takatsugu  <[email protected]>
+
+       * MMagic.pm (checktype_container): Added container check.
+         (Powerd by CodeFest 2006 Akihabara
+          https://members.fsij.org/trac/codefestakihabara2006c)
+
+2006-06-26  NOKUBI Takatsugu  <[email protected]>
+
+       * Applied subclass patch, made by Michael Hendricks.
+
 2006-05-23  NOKUBI Takatsugu  <[email protected]>
 
        * MMagic.pm: Version 1.27.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/MANIFEST 
new/File-MMagic-1.29/MANIFEST
--- old/File-MMagic-1.27/MANIFEST       2006-05-23 07:56:03.000000000 +0200
+++ new/File-MMagic-1.29/MANIFEST       2012-07-12 02:42:33.000000000 +0200
@@ -11,5 +11,8 @@
 t/test.html
 t/04-string-mod.t
 t/test-magic
+t/05-subclass.t
+t/06-conthook.t
+t/07-contents.t
 contrib/Build.PL
 META.yml                                 Module meta-data (added by MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/META.yml 
new/File-MMagic-1.29/META.yml
--- old/File-MMagic-1.27/META.yml       2006-05-23 07:56:03.000000000 +0200
+++ new/File-MMagic-1.29/META.yml       2012-07-12 02:42:33.000000000 +0200
@@ -1,10 +1,21 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         File-MMagic
-version:      1.27
-version_from: MMagic.pm
-installdirs:  site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+--- #YAML:1.0
+name:               File-MMagic
+version:            1.29
+abstract:           Guess file type from contents
+author:
+    - NOKUBI Takatsugu <[email protected]>
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:  {}
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.55_02
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/MMagic.pm 
new/File-MMagic-1.29/MMagic.pm
--- old/File-MMagic-1.27/MMagic.pm      2006-05-23 07:55:27.000000000 +0200
+++ new/File-MMagic-1.29/MMagic.pm      2012-07-12 02:42:19.000000000 +0200
@@ -1,6 +1,6 @@
 # File::MMagic
 #
-# $Id: MMagic.pm 259 2006-05-23 05:55:32Z knok $
+# $Id: MMagic.pm 288 2012-07-12 00:42:19Z knok $
 #
 # This program is originated from file.kulp that is a production of The
 # Unix Reconstruction Projct.
@@ -197,6 +197,8 @@
 
 =item $mm->checktype_contents
 
+=back
+
 =head1 COPYRIGHT
 
 This program is originated from file.kulp that is a production of The
@@ -302,6 +304,7 @@
 
 use FileHandle;
 use strict;
+use Scalar::Util;
 
 use vars qw(
 %TEMPLATES %ESC $VERSION
@@ -339,7 +342,7 @@
            t => "\t",
            f => "\f");
 
-$VERSION = "1.27";
+$VERSION = "1.29";
 $allowEightbit = 1;
 }
 
@@ -422,8 +425,9 @@
             '\.html$' => 'text/html',
             '\.htm$' => 'text/html',
     };
-    bless($self);
-    return $self;
+    # content hook
+    $self->{chook} = {};
+    return bless $self, $class;
 }
 
 sub addSpecials {
@@ -492,6 +496,13 @@
     readMagicEntry($self->{magic}, $self->{MF});
 }
 
+sub addContainerHook {
+    my $self = shift;
+    my $mtype = shift;
+    my $funcref = shift;
+    $self->{chook}->{$mtype} = $funcref;
+}
+
 # Not implimented.
 #
 #sub readMagicFile {
@@ -619,6 +630,9 @@
 
     return 'application/octet-stream' if (length($data) <= 0);
 
+    $mtype = checktype_container($self, $data);
+    return $mtype unless $mtype eq "";
+
     $mtype = checktype_magic($self, $data);
 
     # 4) check if it's text or binary.
@@ -632,6 +646,17 @@
     return $mtype;
 }
 
+sub checktype_container {
+    my $self = shift;
+    my $data = shift;
+    my $href = $self->{chook};
+    foreach my $mtype (keys %$href) {
+       my $ret = &{$href->{$mtype}}($self, $data);
+       return $ret if $ret ne "";
+    }
+    return "";
+}
+
 sub checktype_magic {
     my $self = shift;
     my $data = shift;
@@ -715,6 +740,7 @@
 
     $fname =~ s/^.*\///;
     for my $regex (keys %{$self->{FILEEXTS}}) {
+       Scalar::Util::weaken($self->{FILEEXTS});
        if ($fname =~ /$regex/i) {
            if ((defined $type && $type !~ /;/) || (! defined $type)) {
                $type = $self->{FILEEXTS}->{$regex}; # has no x-type param
@@ -764,6 +790,7 @@
     # this saves time otherwise wasted parsing unused subtests.
     if (@$item == 3){
         my $tmp = readMagicLine(@$item);
+       return unless defined($tmp);
         @$item = @$tmp;
     }
 
@@ -802,7 +829,7 @@
        $fh->seek($offset,0) or return;
     }
 
-    if ($type =~ /^string/) {
+    if ($type =~ /^string/ || $type =~ /^regex/) {
        # read the length of the match string unless the
        # comparison is '>' ($numbytes == 0), in which case 
        # read to the next null or "\n". (that's what BSD's file does)
@@ -827,6 +854,10 @@
        elsif ($op eq '>') {
            $match = ($data gt $testval);
        }
+       elsif ($op eq 'match') {
+           $data = ($data || '') ? $data : '';
+           $match = $data =~ /$testval/;
+       }
        # else bogus op, but don't die, just skip
 
        if ($checkMagic) {
@@ -834,6 +865,9 @@
        }
 
     }
+    elsif ($type =~ /^search\//)
+    {
+    }
     else {
        #numeric
 
@@ -962,7 +996,7 @@
        $str = substr($str, $offset);
     }
 
-    if ($type =~ /^string/) {
+    if ($type =~ /^string/ || $type =~ /^regex/) {
        # read the length of the match string unless the
        # comparison is '>' ($numbytes == 0), in which case 
        # read to the next null or "\n". (that's what BSD's file does)
@@ -984,6 +1018,10 @@
        elsif ($op eq '>') {
            $match = ($data gt $testval);
        }
+       elsif ($op eq 'match') {
+           $match = eval {($data || '') =~ /$testval/};
+       }
+
        # else bogus op, but don't die, just skip
 
        if ($checkMagic) {
@@ -991,6 +1029,9 @@
        }
 
     }
+    elsif ($type =~ /^search\//)
+    {
+    }
     else {
        #numeric
 
@@ -1119,7 +1160,7 @@
            $$MF[1] = $line;
            return length($thisDepth);
        }
-       elsif (defined(@$entry)) {
+       elsif ('ARRAY' eq ref $entry && @$entry) {
            # already have an entry.  this is not a continuation.
            # save this line for the next call and exit.
            $$MF[1] = $line;
@@ -1225,7 +1266,7 @@
     }
     
     # check if type is valid
-    if (!exists($TEMPLATES{$type}) && $type !~ /^string/) {
+    if (!exists($TEMPLATES{$type}) && $type !~ /^string/ && $type !~ /^regex/ 
&& $type !~ /^search\//) {
        warn "Invalid type '$type' at line $line_num\n";
        return;
     }
@@ -1243,20 +1284,29 @@
     $line =~ s/\n$//o;
 
     # get the operator.  if 'x', must be alone.  default is '='.
-    if ($line =~ s/^([><&^=!])//o) {
-       $operator = $1;
-    }
-    elsif ($line eq 'x') {
-       $operator = 'x';
+    if ($type !~ /regex/)
+    {
+       if ($line =~ s/^([><&^=!])//o) {
+           $operator = $1;
+       }
+       elsif ($line eq 'x') {
+           $operator = 'x';
+       }
+       else { $operator = '='; }
+    } else {
+       $operator = 'match';
     }
-    else { $operator = '='; }
     
 
-    if ($type =~ /string/) {
+    if ($type =~ /^string/ || $type =~ /^regex/)
+    {
        $testval = $line;
 
        # do octal/hex conversion
-       $testval =~ s/\\([x0-7][0-7]?[0-7]?)/chr(oct($1))/eg;
+       # manmin
+       $testval =~ s/\\x([0-9a-fA-F][0-9a-fA-F])/pack("H2", $1)/eg;
+       $testval =~ s/\\([0-7][0-7]?[0-7]?)/chr(oct($1))/eg;
+       # end manmin
 
        # do single char escapes
        $testval =~ s/\\(.)/$ESC{$1}||$1/eg;
@@ -1276,6 +1326,11 @@
            $numbytes = length($testval);
            $operator = '=';
        }
+       elsif ($operator eq 'match') {
+           eval {"" =~ /$testval/};    # Check the regex
+           warn "Invalid regex at line $line_num - $@\n" if ($@);
+           $numbytes = 0;
+       }
        else {
            # there's a bug in my magic file where there's
            # a line that says "0       string  ^!<arc..." and the BSD
@@ -1286,6 +1341,9 @@
            return;
        }
     }
+    elsif ($type =~ /^search\//)
+    {
+    }
     else {
        # numeric
        if ($operator ne 'x') {
@@ -1324,6 +1382,7 @@
        # delayed evaluation.
         if (@$entry == 3){
             my $tmp = readMagicLine(@$entry);
+           next if (! $tmp);
             @$entry = @$tmp;
         }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/Makefile.PL 
new/File-MMagic-1.29/Makefile.PL
--- old/File-MMagic-1.27/Makefile.PL    2006-05-23 07:55:27.000000000 +0200
+++ new/File-MMagic-1.29/Makefile.PL    2012-03-15 09:49:36.000000000 +0100
@@ -1,6 +1,6 @@
 # File::MMagic Makefile.PL 
 #
-# $Id: Makefile.PL 192 2006-01-04 07:57:15Z knok $
+# $Id: Makefile.PL 112 1999-10-27 09:44:08Z knok $
 
 use ExtUtils::MakeMaker;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/t/01-selfcheck.t 
new/File-MMagic-1.29/t/01-selfcheck.t
--- old/File-MMagic-1.27/t/01-selfcheck.t       2006-05-23 07:55:28.000000000 
+0200
+++ new/File-MMagic-1.29/t/01-selfcheck.t       2012-03-15 09:49:36.000000000 
+0100
@@ -1,5 +1,5 @@
 # perl-test
-# $Id: 01-selfcheck.t 192 2006-01-04 07:57:15Z knok $
+# $Id: 01-selfcheck.t 182 2003-11-21 02:25:52Z knok $
 
 use strict;
 use Test;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/t/02-extmagic.t 
new/File-MMagic-1.29/t/02-extmagic.t
--- old/File-MMagic-1.27/t/02-extmagic.t        2006-05-23 07:55:28.000000000 
+0200
+++ new/File-MMagic-1.29/t/02-extmagic.t        2012-03-15 09:49:36.000000000 
+0100
@@ -1,5 +1,5 @@
 # perl-test
-# $Id: 02-extmagic.t 192 2006-01-04 07:57:15Z knok $
+# $Id: 02-extmagic.t 182 2003-11-21 02:25:52Z knok $
 
 use strict;
 use Test;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/t/03-typecheck.t 
new/File-MMagic-1.29/t/03-typecheck.t
--- old/File-MMagic-1.27/t/03-typecheck.t       2006-05-23 07:55:28.000000000 
+0200
+++ new/File-MMagic-1.29/t/03-typecheck.t       2012-03-15 09:49:36.000000000 
+0100
@@ -1,5 +1,5 @@
 # perl-test
-# $Id: 03-typecheck.t 192 2006-01-04 07:57:15Z knok $
+# $Id: 03-typecheck.t 182 2003-11-21 02:25:52Z knok $
 
 use strict;
 use Test;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/t/04-string-mod.t 
new/File-MMagic-1.29/t/04-string-mod.t
--- old/File-MMagic-1.27/t/04-string-mod.t      2006-05-23 07:55:28.000000000 
+0200
+++ new/File-MMagic-1.29/t/04-string-mod.t      2012-03-15 09:49:36.000000000 
+0100
@@ -1,5 +1,5 @@
 # perl-test
-# $Id: 04-string-mod.t 192 2006-01-04 07:57:15Z knok $
+# $Id: 04-string-mod.t 187 2005-07-29 05:55:40Z knok $
 
 use strict;
 use Test;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/t/05-subclass.t 
new/File-MMagic-1.29/t/05-subclass.t
--- old/File-MMagic-1.27/t/05-subclass.t        1970-01-01 01:00:00.000000000 
+0100
+++ new/File-MMagic-1.29/t/05-subclass.t        2012-03-15 09:49:36.000000000 
+0100
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+my $mm = Example::Module->new();
+isa_ok( $mm, 'Example::Module', 'subclassed object' );
+isa_ok( $mm, 'File::MMagic', 'subclassed object' );
+is( $mm->checktype_filename(), 'foo/bar', 'override method' );
+
+package Example::Module;
+use base qw( File::MMagic );
+
+sub checktype_filename { 'foo/bar' }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/t/06-conthook.t 
new/File-MMagic-1.29/t/06-conthook.t
--- old/File-MMagic-1.27/t/06-conthook.t        1970-01-01 01:00:00.000000000 
+0100
+++ new/File-MMagic-1.29/t/06-conthook.t        2012-03-15 09:49:36.000000000 
+0100
@@ -0,0 +1,19 @@
+# perl-test
+# $Id$
+
+use strict;
+use Test;
+
+BEGIN { plan tests => 1 };
+
+use File::MMagic;
+
+my $ans = "text/plain; conthook";
+my $magic = File::MMagic->new();
+$magic->addContainerHook($ans, sub {
+       my $self = shift;
+       my $data = shift;
+       return "text/plain; conthook" if $data =~ /conthook/;
+       return ""; });
+my $ret = $magic->checktype_container('text conthook');
+ok($ret eq $ans);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-MMagic-1.27/t/07-contents.t 
new/File-MMagic-1.29/t/07-contents.t
--- old/File-MMagic-1.27/t/07-contents.t        1970-01-01 01:00:00.000000000 
+0100
+++ new/File-MMagic-1.29/t/07-contents.t        2012-07-12 02:34:26.000000000 
+0200
@@ -0,0 +1,14 @@
+# perl-test
+# $Id$
+
+use strict;
+use Test;
+
+BEGIN { plan tests => 1 };
+
+use File::MMagic;
+
+my $ans = "text/plain";
+my $magic = File::MMagic->new();
+my $ret = $magic->checktype_contents('text conthook');
+ok($ret eq $ans);

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to