From: Raphael Hertzog Date: Thu, 28 Feb 2008 22:07:46 +0000 (+0100) Subject: * scripts/dpkg-source.pl: remove trailing slash on user-supplied directories X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f312bdeee57e746ab7dd46ddfbd71d3347914f7;p=dpkg * scripts/dpkg-source.pl: remove trailing slash on user-supplied directories --- diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index 7e8cee37..397ca855 100755 --- a/scripts/dpkg-source.pl +++ b/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); }