The branch, master has been updated
via 84e1f3e96f1c3dd8d99afc6fcb020c7d77b7ca2f (commit)
via ec613d37849f1d35bc2f076ca54805d92039ab78 (commit)
from 8baa694e542bc579f205de54b9c5c73768737095 (commit)
- Shortlog ------------------------------------------------------------
84e1f3e dpkg-divert: Fail when diverting to a non existent directory
ec613d3 update-alternatives: Properly handle alternatives with inexistent slave
links
Summary of changes:
ChangeLog | 12 +++++++
debian/changelog | 6 +++
scripts/dpkg-divert.pl | 23 ++++++++-----
scripts/update-alternatives.pl | 67 ++++++++++++++++++----------------------
4 files changed, 62 insertions(+), 46 deletions(-)
-----------------------------------------------------------------------
Details of changes:
commit 84e1f3e96f1c3dd8d99afc6fcb020c7d77b7ca2f
Author: Flavio Stanchina <[EMAIL PROTECTED]>
Date: Thu Dec 27 08:26:44 2007 +0200
dpkg-divert: Fail when diverting to a non existent directory
Closes: #245562
diff --git a/ChangeLog b/ChangeLog
index 0bc9e51..25c7f68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-27 Flavio Stanchina <[EMAIL PROTECTED]>
+
+ * scripts/dpkg-divert.pl (checkrename): Do not ignore ENOENT for
+ destination.
+
2007-12-27 Daniel Leidert <[EMAIL PROTECTED]>
Guillem Jover <[EMAIL PROTECTED]>
diff --git a/debian/changelog b/debian/changelog
index f84c8ca..5a20f20 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 <[EMAIL PROTECTED]>.
+ * Fail when diverting to a non existent directory. Closes: #245562
+ Thanks to Flavio Stanchina <[EMAIL PROTECTED]>.
[ Updated dpkg translations ]
* Swedish (Peter Karlsson)
diff --git a/scripts/dpkg-divert.pl b/scripts/dpkg-divert.pl
index 88c3f7d..6eeb818 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])) {
commit ec613d37849f1d35bc2f076ca54805d92039ab78
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Thu Dec 27 07:43:18 2007 +0200
update-alternatives: Properly handle alternatives with inexistent slave
links
Based on a patch by Daniel Leidert <[EMAIL PROTECTED]>.
Closes: #76295, #246906, #433567, #451872, #220044, #392440, #441021
Closes: #443241
diff --git a/ChangeLog b/ChangeLog
index 8158fc5..0bc9e51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-27 Daniel Leidert <[EMAIL PROTECTED]>
+ Guillem Jover <[EMAIL PROTECTED]>
+
+ * scripts/update-alternatives.pl: Refactor duplicate code into ...
+ (checked_alternative): ... here. New function.
+ (set_links): Call it.
+
2007-12-27 Guillem Jover <[EMAIL PROTECTED]>
* scripts/update-alternatives.pl (gl): Use defined instead of length.
diff --git a/debian/changelog b/debian/changelog
index b2d8186..f84c8ca 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,10 @@ dpkg (1.14.13) UNRELEASED; urgency=low
* Ignore the man pages when building without NLS support. Closes: #457673
* Fix perl warnings:
- Check for undefined values when reading from the alternative db.
+ * Properly handle symlinks for alternatives with inexistent slave links.
+ Closes: #76295, #246906, #433567, #451872, #220044, #392440, #441021
+ Closes: #443241
+ Based on a patch by Daniel Leidert <[EMAIL PROTECTED]>.
[ Updated dpkg translations ]
* Swedish (Peter Karlsson)
diff --git a/scripts/update-alternatives.pl b/scripts/update-alternatives.pl
index 9c1089d..a7c85b4 100755
--- a/scripts/update-alternatives.pl
+++ b/scripts/update-alternatives.pl
@@ -223,6 +223,32 @@ sub list_link_group
}
}
+sub checked_alternative($$$)
+{
+ my ($name, $link, $path) = @_;
+
+ $linkname = readlink($link);
+ if (!defined($linkname) && $! != ENOENT) {
+ pr(sprintf(_g("warning: %s is supposed to be a symlink to %s, \n".
+ "or nonexistent; however, readlink failed: %s"),
+ $link, "$altdir/$name", $!))
+ if $verbosemode > 0;
+ } elsif (!defined($linkname) ||
+ (defined($linkname) && $linkname ne "$altdir/$name")) {
+ checked_rm("$link.dpkg-tmp");
+ checked_symlink("$altdir/$name", "$link.dpkg-tmp");
+ checked_mv("$link.dpkg-tmp", $link);
+ }
+ $linkname = readlink("$altdir/$name");
+ if (defined($linkname) && $linkname eq $path) {
+ pr(sprintf(_g("Leaving %s (%s) pointing to %s."), $name, $link, $path))
+ if $verbosemode > 0;
+ } else {
+ pr(sprintf(_g("Updating %s (%s) to point to %s."), $name, $link, $path))
+ if $verbosemode > 0;
+ }
+}
+
sub set_links($$)
{
my ($spath, $preferred) = (@_);
@@ -235,6 +261,8 @@ sub set_links($$)
for (my $slnum = 0; $slnum < @slavenames; $slnum++) {
my $slave = $slavenames[$slnum];
if ($slavepath{$preferred, $slnum} ne '') {
+ checked_alternative($slave, $slavelinks[$slnum],
+ $slavepath{$preferred, $slnum});
checked_symlink($slavepath{$preferred, $slnum},
"$altdir/$slave.dpkg-tmp");
checked_mv("$altdir/$slave.dpkg-tmp", "$altdir/$slave");
@@ -569,24 +597,7 @@ if ($mode eq 'auto') {
checked_rm("$admindir/$name");
exit(0);
} else {
- $linkname = readlink($link);
- if (!defined($linkname) && $! != ENOENT) {
- &pr(sprintf(_g("warning: %s is supposed to be a symlink to %s\n".
- " (or nonexistent); however, readlink failed: %s"), $link,
"$altdir/$name", $!))
- if $verbosemode > 0;
- } elsif (!defined($linkname) ||
- (defined($linkname) && $linkname ne "$altdir/$name")) {
- checked_rm("$link.dpkg-tmp");
- checked_symlink("$altdir/$name", "$link.dpkg-tmp");
- checked_mv("$link.dpkg-tmp", $link);
- }
- if (defined($linkname= readlink("$altdir/$name")) && $linkname eq
$best) {
- &pr(sprintf(_g("Leaving %s (%s) pointing to %s."), $name, $link,
$best))
- if $verbosemode > 0;
- } else {
- &pr(sprintf(_g("Updating %s (%s) to point to %s."), $name, $link,
$best))
- if $verbosemode > 0;
- }
+ checked_alternative($name, $link, $best);
checked_rm("$altdir/$name.dpkg-tmp");
symlink($best,"$altdir/$name.dpkg-tmp");
}
@@ -607,25 +618,7 @@ if ($mode eq 'auto') {
checked_rm("$altdir/$sname");
checked_rm("$slink");
} else {
- $linkname = readlink($slink);
- if (!defined($linkname) && $! != ENOENT) {
- pr(sprintf(_g("warning: %s is supposed to be a slave symlink
to\n".
- " %s, or nonexistent; however, readlink failed:
%s"),
- $slink, "$altdir/$sname", $!))
- if $verbosemode > 0;
- } elsif (!defined($linkname) ||
- (defined($linkname) && $linkname ne "$altdir/$sname")) {
- checked_rm("$slink.dpkg-tmp");
- checked_symlink("$altdir/$sname", "$slink.dpkg-tmp");
- checked_mv("$slink.dpkg-tmp", $slink);
- }
- if (defined($linkname= readlink("$altdir/$sname")) && $linkname eq
$spath) {
- &pr(sprintf(_g("Leaving %s (%s) pointing to %s."), $sname,
$slink, $spath))
- if $verbosemode > 0;
- } else {
- &pr(sprintf(_g("Updating %s (%s) to point to %s."), $sname,
$slink, $spath))
- if $verbosemode > 0;
- }
+ checked_alternative($sname, $slink, $spath);
checked_symlink("$spath", "$altdir/$sname.dpkg-tmp");
checked_mv("$altdir/$sname.dpkg-tmp", "$altdir/$sname");
}
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]