Package: devscripts
Version: 2.9.20
Tags: patch
Hello.
When I run `bts --mbox` and save an attachment without a full path, I
expect it to be saved in the directory I invoked `bts` from. However, it
is saved in ~/.devscripts_cache/bts.
This is because there's a chdir($cachedir) in download() that does not
get reverted, and I think this is a bug (though I don't know the code
well enough to notice if code called after download() expects CWD to be
~/devscripts_cache/bts).
Attached is a patch that fixes the issue. Since I guess no extra
dependencies are wanted, I use plain chdir() in all points of return of
the function. It'd be a nice use case for File::chdir, though.
Thanks.
--
Adeodato Simó dato at net.com.org.es
Debian Developer adeodato at debian.org
Listening to: Joaquín Sabina - Juana la Loca
--- /usr/bin/bts~
+++ /usr/bin/bts
@@ -1792,6 +1792,8 @@
my $versionstamp = '';
my $url;
+ chomp(my $oldcwd = `pwd`);
+
# What URL are we to download?
if ($thgopts ne '') {
# have to be intelligent here :/
@@ -1850,6 +1852,7 @@
print "$bug_current/$bug_total" if $bug_total;
print "\n";
}
+ chdir($oldcwd) || die "bts: chdir $oldcwd: $!\n";
return "";
}
elsif ($ret == MIRROR_DOWNLOADED) {
@@ -1890,6 +1893,7 @@
# do nothing
}
+ chdir($oldcwd) || die "bts: chdir $oldcwd: $!\n";
return $livepage;
} else {
die "bts: couldn't download $url:\n$msg\n";