]> err.no Git - dpkg/commitdiff
Fix update-alternatives messing with spurious slave link spuriously.
authorIan Jackson <iwj@ubuntu.com>
Wed, 8 Aug 2007 03:05:17 +0000 (06:05 +0300)
committerGuillem Jover <guillem@debian.org>
Wed, 8 Aug 2007 03:05:17 +0000 (06:05 +0300)
When a slave alternative is inapplicable do not attempt to create the
slave link before removing it again.

ChangeLog
debian/changelog
scripts/update-alternatives.pl

index 88aaa1a5a4f17b183f2c85cc90795e4d72615bee..53fccaeb7cb664a9a05a4c7ccd0160b300f1c604 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-08-08  Ian Jackson  <iwj@ubuntu.com>
+
+       * scripts/update-alternatives.pl: In the case where the slave is
+       inapplicable do not attempt to create the slave link before
+       removing it again.
+
 2007-08-08  Guillem Jover  <guillem@debian.org>
 
        * src/configure.c (deferred_configure): Do not print a new line
index fa186997ed64641f275bb6bfeba88bcb14f68cbd..0febdea75032b9c081ccca6b4f63c323821892b4 100644 (file)
@@ -28,6 +28,9 @@ dpkg (1.14.6) UNRELEASED; urgency=low
   * Tightening dpkg-dev versioned Depends to dpkg 1.14.6, and dpkg Conflicts
     against << dpkg-dev 1.14.6, where the perl modularization started.
   * Do not print empty lines after 'Setting up ...' output. Closes: #392317
+  * When a slave alternative is inapplicable do not attempt to create the
+    slave link before removing it again. Closes: #411699
+    Thanks to Ian Jackson.
 
   [ Updated scripts translations ]
   * French (Frédéric Bothamy, Christian Perrier).
index f851ccc5b17b710aa13b889b6dfab3ee9aa3574b..f0e71458491b386f55e6cf6e39a3071c018b3fe2 100755 (executable)
@@ -584,21 +584,6 @@ if ($mode eq 'auto') {
     for (my $j = 0; $j <= $#slavenames; $j++) {
         $sname= $slavenames[$j];
         $slink= $slavelinks[$j];
-
-       $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")) {
-            unlink("$slink.dpkg-tmp") || $! == &ENOENT ||
-                &quit(sprintf(_g("unable to ensure %s nonexistent: %s"), "$slink.dpkg-tmp", $!));
-            symlink("$altdir/$sname","$slink.dpkg-tmp") ||
-                &quit(sprintf(_g("unable to make %s a symlink to %s: %s"), "$slink.dpkg-tmp", "$altdir/$sname", $!));
-            rename_mv("$slink.dpkg-tmp",$slink) ||
-                &quit(sprintf(_g("unable to install %s as %s: %s"), "$slink.dpkg-tmp", $slink, $!));
-        }
         $spath= $slavepath{$bestnum,$j};
         unlink("$altdir/$sname.dpkg-tmp") || $! == &ENOENT ||
             &quit(sprintf(_g("unable to ensure %s nonexistent: %s"), "$altdir/$sname.dpkg-tmp", $!));
@@ -610,6 +595,22 @@ if ($mode eq 'auto') {
            unlink("$slink") || $! == &ENOENT ||
                &quit(sprintf(_g("unable to remove %s: %s"), $slink, $!));
         } else {
+           if (!defined($linkname= readlink($slink)) && $! != 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 ($linkname ne "$altdir/$sname") {
+               unlink("$slink.dpkg-tmp") || $! == ENOENT ||
+                   quit(sprintf(_g("unable to ensure %s nonexistent: %s"),
+                                "$slink.dpkg-tmp", $!));
+               symlink("$altdir/$sname","$slink.dpkg-tmp") ||
+                   quit(sprintf(_g("unable to make %s a symlink to %s: %s"),
+                                "$slink.dpkg-tmp", "$altdir/$sname", $!));
+               rename_mv("$slink.dpkg-tmp",$slink) ||
+                   quit(sprintf(_g("unable to install %s as %s: %s"),
+                                "$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;