Package: devscripts
Version: 2.18.1
Severity: normal
File: /usr/bin/uscan
Tags: patch

My ~/.devscripts includes:
USCAN_DESTDIR="$HOME/tmp/build-area"

This works for most uscan modes, but not for mode=git, where uscan tries
to compose a path "$curdir/$dst" where $curdir is the current working
directory and $dst is USCAN_DESTDIR, resulting in an attempt to access
a path like /home/smcv/src/debian/ioquake3//home/smcv/tmp/build-area/...
which fails.

Please consider the attached path, which replaces "$curdir/$dst" with
abs_path($dst).

Regards,
    smcv

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'buildd-unstable'), (500, 
'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental-debug'), (1, 
'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages devscripts depends on:
ii  dpkg-dev              1.19.0.5
ii  libc6                 2.27-3
ii  libfile-homedir-perl  1.002-1
ii  perl                  5.26.1-5
ii  python3               3.6.5-2
ii  sensible-utils        0.0.12

Versions of packages devscripts recommends:
ii  apt                         1.6~beta1
ii  at                          3.1.20-3.1
ii  curl                        7.58.0-2
ii  dctrl-tools                 2.24-2+b1
ii  debian-keyring              2018.03.24
ii  dput                        1.0.2
ii  equivs                      2.1.0
ii  fakeroot                    1.22-2
ii  file                        1:5.32-2
ii  gnupg                       2.2.5-1
ii  libdistro-info-perl         0.18
ii  libdpkg-perl                1.19.0.5
ii  libencode-locale-perl       1.05-1
ii  libgit-wrapper-perl         0.048-1
ii  liblist-compare-perl        0.53-1
ii  liblwp-protocol-https-perl  6.07-2
ii  libsoap-lite-perl           1.26-1
ii  liburi-perl                 1.73-1
ii  libwww-perl                 6.33-1
ii  licensecheck                3.0.31-2
ii  lintian                     2.5.81
ii  man-db                      2.8.3-2
ii  patch                       2.7.6-2
ii  patchutils                  0.3.4-2
ii  pseudo [fakeroot]           1.8.1+git20161012-2
ii  python3-apt                 1.6.0~rc2
ii  python3-debian              0.1.32
ii  python3-magic               2:0.4.15-1
ii  python3-requests            2.18.4-2
ii  python3-unidiff             0.5.4-1
ii  python3-xdg                 0.25-4
ii  strace                      4.21-1
ii  unzip                       6.0-21
ii  wdiff                       1.2.2-2
ii  wget                        1.19.4-1
ii  xz-utils                    5.2.2-1.3

Versions of packages devscripts suggests:
ii  adequate                     0.15.1
ii  autopkgtest                  5.2
pn  bls-standalone               <none>
ii  bsd-mailx [mailx]            8.1.2-0.20160123cvs-4
ii  build-essential              12.4
ii  check-all-the-things         2017.05.20
pn  cvs-buildpackage             <none>
pn  devscripts-el                <none>
ii  diffoscope                   93
pn  disorderfs                   <none>
pn  dose-extra                   <none>
pn  duck                         <none>
ii  faketime                     0.9.7-2
ii  gnuplot                      5.2.2+dfsg1-2
ii  gnuplot-x11 [gnuplot]        5.2.2+dfsg1-2
ii  gpgv                         2.2.5-1
ii  how-can-i-help               16
ii  libauthen-sasl-perl          2.1600-1
ii  libfile-desktopentry-perl    0.22-1
pn  libnet-smtps-perl            <none>
pn  libterm-size-perl            <none>
ii  libtimedate-perl             2.3000-2
ii  libyaml-syck-perl            1.29-1+b3
pn  mozilla-devscripts           <none>
ii  mutt                         1.9.4-3
ii  openssh-client [ssh-client]  1:7.7p1-2
ii  piuparts                     0.84
pn  postgresql-client            <none>
ii  quilt                        0.63-8.2
pn  ratt                         <none>
ii  reprotest                    0.7.7
ii  svn-buildpackage             0.8.6
ii  w3m                          0.5.3-36

-- no debconf information
>From f3a6681d075ef7fdb4f1cf75c1cf406e9929740f Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Mon, 9 Apr 2018 10:07:54 +0100
Subject: [PATCH] uscan: Handle absolute USCAN_DESTDIR in git mode

An absolute path for USCAN_DESTDIR was handled everywhere else, but in
git mode uscan blindly appended it to $curdir, resulting in paths
like "/home/smcv/src/debian/ioquake3//home/smcv/tmp/build-area..."
when used.

Signed-off-by: Simon McVittie <s...@debian.org>
---
 scripts/uscan.pl | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 06428164..bd7d693b 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -4435,6 +4435,7 @@ sub downloader ($$$$$)
 	my $curdir = cwd();
 	$fname =~ m%(.*)/([^/]*)-([^_/-]*)\.tar\.(gz|xz|bz2|lzma)%;
 	my $dst = $1;
+	my $abs_dst = abs_path($dst);
 	my $pkg = $2;
 	my $ver = $3;
 	my $suffix = $4;
@@ -4451,14 +4452,14 @@ sub downloader ($$$$$)
 		$gitrepo_state=2;
 	    }
 	}
-	uscan_verbose "Execute: git --git-dir=$destdir/$gitrepo_dir archive --format=tar --prefix=$pkg-$ver/ --output=$curdir/$dst/$pkg-$ver.tar $gitref\n";
-	system('git', "--git-dir=$destdir/$gitrepo_dir", 'archive', '--format=tar', "--prefix=$pkg-$ver/", "--output=$curdir/$dst/$pkg-$ver.tar", $gitref) == 0 or uscan_die("git archive failed\n");
+	uscan_verbose "Execute: git --git-dir=$destdir/$gitrepo_dir archive --format=tar --prefix=$pkg-$ver/ --output=$abs_dst/$pkg-$ver.tar $gitref\n";
+	system('git', "--git-dir=$destdir/$gitrepo_dir", 'archive', '--format=tar', "--prefix=$pkg-$ver/", "--output=$abs_dst/$pkg-$ver.tar", $gitref) == 0 or uscan_die("git archive failed\n");
 	# If git cloned repo exists and not --debug ($verbose=1) -> remove it
 	if ($gitrepo_state > 0 and $verbose < 1) {
-	    system('rm', '-rf', "$curdir/$dst/$gitrepo_dir");
+	    system('rm', '-rf', "$abs_dst/$gitrepo_dir");
 	    $gitrepo_state=0;
 	}
-	chdir "$curdir/$dst" or uscan_die("Unable to chdir($curdir/$dst): $!\n");
+	chdir "$abs_dst" or uscan_die("Unable to chdir($abs_dst): $!\n");
 	if ($suffix eq 'gz') {
 	    uscan_verbose "Execute: gzip -n -9 $pkg-$ver.tar\n";
 	    system("gzip", "-n", "-9", "$pkg-$ver.tar") == 0 or uscan_die("gzip failed\n");
-- 
2.17.0

Reply via email to