update-alternatives gives "argument isn't numeric"

Bug #248284 reported by Paul Smith
4
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
Invalid
Low
Unassigned

Bug Description

Binary package hint: dpkg

On Hardy with dpkg 1.14.16.6ubuntu4, I ran "update-alternatives --config java" and I saw the "+" next to one of my options. I had no idea what that meant, so I entered "?" as the response to the prompt to choose which alternative, to get some help. The first problem is that no help was forthcoming: there should be a sentence or two on what to do and what any special characters actually mean.

The second problem was that I got a Perl warning as a result:

Press enter to keep the default[*], or type selection number: ?
Argument "?" isn't numeric in numeric ge (>=) at /usr/sbin/update-alternatives line 652, <STDIN> line 1.

I got the same result when I tried to use "q" to quit without changing anything.

Looking at the code it's obvious someone WANTED to test for this, but just did it wrong. I've attached a trivial diff that solves the warning, but doesn't try to do anything fancier like support "q", "h/?" etc. options or even give a reasonable error message if the user enters an invalid value. But since the old code didn't do any of this either I guess it's just about right :-).

Revision history for this message
Paul Smith (psmith-gnu) wrote :
Revision history for this message
Brian Murray (brian-murray) wrote :

I tested this bug report using dpkg version 1.15.3.1ubuntu1 on Karmic Koala and was unable to recreate the original bug and the lines of code mentioned in your patch are no longer in update-alternatives.

Changed in dpkg (Ubuntu):
status: New → Invalid
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.