Package: devscripts
Version: 2.17.11
Severity: normal
User: devscri...@packages.debian.org
Usertags: debsnap
Tags: patch

Dear Maintainers,

After setting DEBSNAP_DESTDIR in my ~/.devscripts configuration file, I
get the following unexpected error:

,----
| $ debsnap --list python-evtx
| debsnap: fatal error at line 255:
| Destination dir /home/bengen/tmp/deb already exists.
| Please (re)move it first, or use --force to overwrite.
`----

I don't see why I should need to use --force for an operation that does
not even modify the destination directory, so I have moved the check
as-is into the $mkDestDir function, see attached patch.

Cheers,
-Hilko
>From 4a5041d19e56ce2e35ffdcd7c007c1d2408b2500 Mon Sep 17 00:00:00 2001
From: Hilko Bengen <ben...@debian.org>
Date: Tue, 12 Dec 2017 12:43:23 +0100
Subject: [PATCH] debsnap: Complain about existing destdir only when it is
 created

---
 scripts/debsnap.pl | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/scripts/debsnap.pl b/scripts/debsnap.pl
index fe7c3f9f..c72061ca 100755
--- a/scripts/debsnap.pl
+++ b/scripts/debsnap.pl
@@ -252,16 +252,15 @@ if ($opt{binary}) {
     $baseurl = "$opt{baseurl}/mr/package/$package/";
 }
 
-if (-d $opt{destdir}) {
-    unless ($opt{force} || cwd() eq abs_path($opt{destdir})) {
-	fatal "Destination dir $opt{destdir} already exists.\nPlease (re)move it first, or use --force to overwrite.";
-    }
-}
-
 my $mkdir_done = 0;
 my $mkDestDir = sub {
     unless ($mkdir_done)
     {
+	if (-d $opt{destdir}) {
+	    unless ($opt{force} || cwd() eq abs_path($opt{destdir})) {
+		fatal "Destination dir $opt{destdir} already exists.\nPlease (re)move it first, or use --force to overwrite.";
+	    }
+	}
 	make_path($opt{destdir});
 	$mkdir_done = 1;
     }
-- 
2.15.1

_______________________________________________
devscripts-devel mailing list
devscripts-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel

Reply via email to