Przeglądaj źródła

* scripts/dpkg-source.pl: remove trailing slash on user-supplied directories

Raphael Hertzog 18 lat temu
rodzic
commit
5f312bdeee
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      scripts/dpkg-source.pl

+ 3 - 3
scripts/dpkg-source.pl

@@ -23,6 +23,7 @@ use Dpkg::Source::Package;
 
 use POSIX;
 use English;
+use File::Spec;
 
 textdomain("dpkg-dev");
 
@@ -179,8 +180,7 @@ if ($opmode eq 'build') {
     if (not scalar(@ARGV)) {
 	usageerr(_g("-b needs a directory"));
     }
-    my $dir = shift(@ARGV);
-    $dir =~ s{/*$}{}; # Strip trailing /
+    my $dir = File::Spec->catdir(shift(@ARGV));
     stat($dir) || syserr(_g("cannot stat directory %s"), $dir);
     if (not -d $dir) {
 	error(_g("directory argument %s is not a directory"), $dir);
@@ -338,7 +338,7 @@ if ($opmode eq 'build') {
     my $newdirectory = $srcpkg->get_basename();
     $newdirectory =~ s/_/-/g;
     if (@ARGV) {
-	$newdirectory = shift(@ARGV);
+	$newdirectory = File::Spec->catdir(shift(@ARGV));
 	if (-e $newdirectory) {
 	    error(_g("unpack target exists: %s"), $newdirectory);
 	}