[devscripts] 01/01: licensecheck: handle postscript with embedded binary

dod at debian.org dod at debian.org
Thu Nov 12 19:38:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

dod pushed a commit to branch master
in repository devscripts.

commit f16311c4370799e4d3db660d461e61d3d920a487
Author: Dominique Dumont <dod at debian.org>
Date:   Thu Nov 12 20:38:28 2015 +0100

    licensecheck: handle postscript with embedded binary
    
    This patch is also required to fix #803724
---
 debian/changelog        |  2 +-
 scripts/licensecheck.pl | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 08d8870..2a67f50 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,7 +6,7 @@ devscripts (2.15.10) UNRELEASED; urgency=medium
 
   [ Dominique Dumont ]
   * licensecheck: parse file matching -c regex whatever its mime
-    type (Closes: #803724)
+    type. Parse postscript with embedded binary (Closes: #803724)
   * licensecheck: --text option is deprecated
 
  -- Benjamin Drung <bdrung at debian.org>  Fri, 23 Oct 2015 23:54:58 +0200
diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl
index 4f34eb2..5099f8d 100755
--- a/scripts/licensecheck.pl
+++ b/scripts/licensecheck.pl
@@ -343,14 +343,22 @@ while (@files) {
           nocheck => 1,
           wait_child => 1);
     my $charset ;
+    chomp $mime;
     if ($mime =~ m/; charset=((?!binary)(?!unknown)[\w-]+)/) {
+	# regular text file, may be postscript
 	$charset = $1;
     }
+    elsif ($mime =~ m!application/postscript;\s+charset=([\w-]+)!) {
+	# postscript files with embedded binary are detected as binary
+	$charset = $1;
+    }
+    elsif ($check_regex) {
+	# user asked for the file...
+	$charset = 'maybe-binary';
+    }
     else {
-	chomp $mime;
 	warn "$0 warning: cannot parse file '$file' with mime type '$mime'\n";
-	$charset = 'maybe-binary';
-	next unless $check_regex; # user asked for this file
+	next;
     }
 
     open (my $F, '<' ,$file) or die "Unable to access $file\n";
@@ -359,7 +367,7 @@ while (@files) {
     while ( <$F>) {
 	last if ($. > $OPT{'lines'});
 	my $data = $_;
-	$data = decode($charset, $data) if $charset ne 'maybe-binary';
+	$data = decode($charset, $data) if $charset !~ /binary$/;
 	$content .= $data;
     }
     close($F);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list