The following commit has been merged in the master branch:
commit 9ca16e39e7a581119cf3a5d65b23092a7fdd0365
Author: James McCoy <[email protected]>
Date:   Sat Dec 10 01:09:45 2011 -0500

    uscan: Handle filenames with special characters.
    
    Closes: #648299
    Signed-off-by: James McCoy <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index 9e412a4..9e41d27 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,8 +10,10 @@ devscripts (2.11.3) UNRELEASED; urgency=low
   [ James McCoy ]
   * Update tools to uniformly handle the supported compression types for
     source packages.  (Closes: #650118)
-  * uscan: Use "gzip -n" when repacking zip files.  Thanks to Franz Schrober
-    for the patch.  (Closes: #646691)
+  * uscan:
+    + Use "gzip -n" when repacking zip files.  Thanks to Franz Schrober for
+      the patch.  (Closes: #646691)
+    + Handle filenames with special characters.  (Closes: #648299)
 
  -- David Prévot <[email protected]>  Sat, 03 Dec 2011 11:39:52 -0400
 
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 438d4d6..3b325a5 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -25,9 +25,10 @@ use 5.008;  # uses 'our' variables and filetest
 use strict;
 use Cwd;
 use Cwd 'abs_path';
+use Dpkg::IPC;
 use File::Basename;
 use File::Copy;
-use File::Temp qw/tempdir/;
+use File::Temp qw/tempfile tempdir/;
 use filetest 'access';
 use Getopt::Long qw(:config gnu_getopt);
 use lib '/usr/share/devscripts';
@@ -1344,8 +1345,14 @@ EOF
     if ($repack and $newfile_base =~ /^(.*)\.(tar\.bz2|tbz2?)$/) {
        print "-- Repacking from bzip2 to gzip\n" if $verbose;
        my $newfile_base_gz = "$1.tar.gz";
-       system("bunzip2 -c $destdir/$newfile_base | gzip -n -9 > 
$destdir/$newfile_base_gz") == 0
-         or die "repacking from bzip2 to gzip failed\n";
+       my $fname = tempfile(UNLINK => 1);
+       spawn(exec => ['bunzip2', '-c', "$destdir/$newfile_base"],
+             to_file => $fname,
+             wait_child => 1);
+       spawn(exec => ['gzip', '-n', '-9'],
+             from_file => $fname,
+             to_file => "$destdir/$newfile_base_gz",
+             wait_child => 1);
        unlink "$destdir/$newfile_base";
        $newfile_base = $newfile_base_gz;
     }
@@ -1353,8 +1360,14 @@ EOF
     if ($repack and $newfile_base =~ /^(.*)\.(tar\.lzma|tlz(?:ma?)?)$/) {
        print "-- Repacking from lzma to gzip\n" if $verbose;
        my $newfile_base_gz = "$1.tar.gz";
-       system("xz -F lzma -cd $destdir/$newfile_base | gzip -n -9 > 
$destdir/$newfile_base_gz") == 0
-         or die "repacking from lzma to gzip failed\n";
+       my $fname = tempfile(UNLINK => 1);
+       spawn(exec => ['xz', '-F', 'lzma', '-cd', "$destdir/$newfile_base"],
+             to_file => $fname,
+             wait_child => 1);
+       spawn(exec => ['gzip', '-n', '-9'],
+             from_file => $fname,
+             to_file => "$destdir/$newfile_base_gz",
+             wait_child => 1);
        unlink "$destdir/$newfile_base";
        $newfile_base = $newfile_base_gz;
     }
@@ -1362,8 +1375,14 @@ EOF
     if ($repack and $newfile_base =~ /^(.*)\.(tar\.xz|txz)$/) {
        print "-- Repacking from xz to gzip\n" if $verbose;
        my $newfile_base_gz = "$1.tar.gz";
-       system("xz -cd $destdir/$newfile_base | gzip -n -9 > 
$destdir/$newfile_base_gz") == 0
-         or die "repacking from xz to gzip failed\n";
+       my $fname = tempfile(UNLINK => 1);
+       spawn(exec => ['xz', '-cd', "$destdir/$newfile_base"],
+             to_file => $fname,
+             wait_child => 1);
+       spawn(exec => ['gzip', '-n', '-9'],
+             from_file => $fname,
+             to_file => "$destdir/$newfile_base_gz",
+             wait_child => 1);
        unlink "$destdir/$newfile_base";
        $newfile_base = $newfile_base_gz;
     }
@@ -1379,12 +1398,12 @@ EOF
        my $globpattern = "*";
        my $hidden = ".[!.]*";
        my $absdestdir = abs_path($destdir);
-       system("unzip -q -a -d $tempdir $destdir/$newfile_base") == 0
+       system('unzip', '-q', '-a', '-d', $tempdir, "$destdir/$newfile_base") 
== 0
          or die("Repacking from zip to tar.gz failed (could not unzip)\n");
        if (defined glob("$tempdir/$hidden")) {
            $globpattern .= " $hidden";
        }
-       system("cd $tempdir; GZIP='-n -9' tar --owner=root --group=root 
--mode=a+rX -czf $absdestdir/$newfile_base_gz $globpattern") == 0
+       system("cd $tempdir; GZIP='-n -9' tar --owner=root --group=root 
--mode=a+rX -czf \"$absdestdir/$newfile_base_gz\" $globpattern") == 0
          or die("Repacking from zip to tar.gz failed (could not create 
tarball)\n");
        unlink "$destdir/$newfile_base";
        $newfile_base = $newfile_base_gz;
@@ -1394,7 +1413,7 @@ EOF
                             |tar\.bz2|tbz2?
                             |tar.lzma|tlz(?:ma?)?
                             |tar.xz|txz)$/x) {
-       my $filetype = `file -b -k $destdir/$newfile_base`;
+       my $filetype = `file -b -k \"$destdir/$newfile_base\"`;
        unless ($filetype =~ /compressed data/) {
            warn "$progname warning: $destdir/$newfile_base does not appear to 
be a compressed file;\nthe file command says: $filetype\nNot processing this 
file any further!\n";
            return 1;

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to