+2007-05-09 Guillem Jover <guillem@debian.org>
+
+ * scripts/update-alternatives.pl (config_message): Handle the case
+ when @versions is empty. Return a negative value if there's nothing to
+ do, 0 on success.
+ (config_alternatives): Check for config_message exit value to decide
+ to return instead of @versions being empty.
+
2007-05-09 Guillem Jover <guillem@debian.org>
* scripts/dpkg-buildpackage.sh: Remove check for variable being empty,
dpkg (1.14.2) UNRELEASED; urgency=low
* Remove bashisms in dpkg-buildpackage. Closes: #422239
+ * Handle case in update-alternatives when there's no existing alternative
+ to configure. Closes: #260987, #353252, #367717, #392431
-- Guillem Jover <guillem@debian.org> Tue, 08 May 2007 18:48:22 +0300
}
sub config_message {
+ if ($#versions < 0) {
+ print "\n";
+ printf _g("There is no program which provides %s.\n".
+ "Nothing to configure.\n"), $name;
+ return -1;
+ }
if ($#versions == 0) {
print "\n";
printf _g("There is only 1 program which provides %s\n".
"(%s). Nothing to configure.\n"), $name, $versions[0];
- return;
+ return -1;
}
print STDOUT "\n";
printf(STDOUT _g("There are %s alternatives which provide \`%s'.\n\n".
$i+1, $versions[$i]);
}
printf(STDOUT "\n"._g("Press enter to keep the default[*], or type selection number: "));
+ return 0;
}
sub config_alternatives {
my $preferred;
do {
- &config_message;
- if ($#versions == 0) { return; }
+ return if config_message() < 0;
$preferred=<STDIN>;
chop($preferred);
} until $preferred eq '' || $preferred>=1 && $preferred<=$#versions+1 &&