[dpkg] 98/187: u-a: Fix lookup by name on --config

Reiner Herrmann reiner at reiner-h.de
Sun Nov 6 12:46:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository dpkg.

commit cdf41bcf1d3551ffa0ce1cc85be69d4ea9251893
Author: Guillem Jover <guillem at debian.org>
Date:   Thu Aug 25 00:45:04 2016 +0200

    u-a: Fix lookup by name on --config
    
    The code was wrong and not working at least on Mac OS X.
---
 debian/changelog            | 2 ++
 utils/update-alternatives.c | 4 +---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 6d55ee6..1420bc1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,6 +43,8 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     - Port start-stop-daemon process handling to Mac OS X.
       Based on a patch by Mo McRoberts <mo at nevali.net>.
     - Port start-stop-daemon process handling to AIX.
+    - Fix lookup by name on update-alternatives --config. The code was wrong
+      and not working at least on Mac OS X, making the test suite to fail.
   * Perl modules:
     - Obsolete Source-Version substvar in Dpkg::Substvars by emitting errors.
     - Rework keyring hooks in Dpkg::Vendor. Deprecate the keyrings hook, and
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 5dc3213..02a3a83 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1581,9 +1581,7 @@ alternative_select_choice(struct alternative *a)
 			return xstrdup(current);
 		errno = 0;
 		idx = strtol(selection, &ret, 10);
-		if (idx < 0 || errno != 0)
-			continue;
-		if (*ret == '\0') {
+		if (idx >= 0 && errno == 0 && *ret == '\0') {
 			/* Look up by index */
 			if (idx == 0) {
 				alternative_set_status(a, ALT_ST_AUTO);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list