From: Flavio Stanchina Date: Thu, 27 Dec 2007 06:26:44 +0000 (+0200) Subject: dpkg-divert: Fail when diverting to a non existent directory X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84e1f3e96f1c3dd8d99afc6fcb020c7d77b7ca2f;p=dpkg dpkg-divert: Fail when diverting to a non existent directory Closes: #245562 --- diff --git a/ChangeLog b/ChangeLog index 0bc9e517..25c7f686 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-12-27 Flavio Stanchina + + * scripts/dpkg-divert.pl (checkrename): Do not ignore ENOENT for + destination. + 2007-12-27 Daniel Leidert Guillem Jover diff --git a/debian/changelog b/debian/changelog index f84c8ca9..5a20f20f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -45,6 +45,8 @@ dpkg (1.14.13) UNRELEASED; urgency=low Closes: #76295, #246906, #433567, #451872, #220044, #392440, #441021 Closes: #443241 Based on a patch by Daniel Leidert . + * Fail when diverting to a non existent directory. Closes: #245562 + Thanks to Flavio Stanchina . [ Updated dpkg translations ] * Swedish (Peter Karlsson) diff --git a/scripts/dpkg-divert.pl b/scripts/dpkg-divert.pl index 88c3f7d5..6eeb8188 100755 --- a/scripts/dpkg-divert.pl +++ b/scripts/dpkg-divert.pl @@ -237,15 +237,20 @@ sub checkrename { # same name as the diversions but with an extension that # (hopefully) wont overwrite anything. If it succeeds, we # assume a writable filesystem. - foreach my $file ($rsrc, $rdest) { - if (open (TMP, ">> ${file}.dpkg-devert.tmp")) { - close TMP; - unlink ("${file}.dpkg-devert.tmp"); - } elsif ($! == ENOENT) { - $dorename = !$dorename; - } else { - &quit(sprintf(_g("error checking \`%s': %s"), $file, $!)); - } + if (open (TMP, ">>", "${rsrc}.dpkg-devert.tmp")) { + close TMP; + unlink ("${rsrc}.dpkg-devert.tmp"); + } elsif ($! == ENOENT) { + $dorename = !$dorename; + } else { + quit(sprintf(_g("error checking \`%s': %s"), $rsrc, $!)); + } + + if (open (TMP, ">>", "${rdest}.dpkg-devert.tmp")) { + close TMP; + unlink ("${rdest}.dpkg-devert.tmp"); + } else { + quit(sprintf(_g("error checking \`%s': %s"), $rdest, $!)); } if (@ssrc && @sdest && !($ssrc[0] == $sdest[0] && $ssrc[1] == $sdest[1])) {