Guillem,
Thanks for looking at this!

Couldn't this also be added to update-alternatives --display ...so that the 
--display option provides all the information available about the alternative?
For example:    jack@berkeley:debian => update-alternatives --display rename
    rename - auto mode    /usr/bin/rename -> /etc/alternatives/rename <<<<<< 
new to add to --display <<<<<<
      link currently points to /usr/bin/prename
    /usr/bin/prename - priority 60
      slave rename.1.gz: /usr/share/man/man1/prename.1.gz
    Current 'best' version is '/usr/bin/prename'.
I thought since --display is also an existing option, it should contain all the 
info about the alternativeso that the difference between --display and --query 
continues to be that the latter is easier to parse, as mentioned in the man 
entry but the contents are the same.
thanks,--jack
--- On Tue, 6/26/12, Guillem Jover <[email protected]> wrote:

From: Guillem Jover <[email protected]>
Subject: Re: Bug#679010: dpkg: update-alternatives has no option to get name of 
master link
To: "js" <[email protected]>, [email protected]
Date: Tuesday, June 26, 2012, 5:23 AM

Hi!

On Mon, 2012-06-25 at 13:44:33 -0400, js wrote:
> Package: dpkg
> Version: 1.16.3
> Severity: normal

> To use update-alternatives --install <master link> <name> <path> <pri> ...,
> one needs an option in update-alternatives to find the master link if
> <name> has just one alternative installed. This is the symbolic link
> that points to the /etc/alternatives/<name>

> If update-alternatives is the interface to the alternatives system, it
> should provide the all information needed to install a new alternative
> in all cases.

Indeed, the correct option here would be --query but even that one
does not provide that information, and what's worse it prints the
alternative name as Link instead of Name... I'm thinking about adding
a --query-format or something similar and correcting the above for my
next push.

> There is no option in update-alternatives to find the master link that points 
> to /etc/alternatives/rename:
> 
>     jack@berkeley:tmp => update-alternatives --config rename
>     There is only one alternative in link group rename: /usr/bin/prename
>     Nothing to configure.

> This fails if there is exactly one alternative installed but works if 
> multiple alternatives are installed:
>     jack@berkeley:tmp => update-alternatives --config java
>     There are 5 choices for the alternative java (providing 
>/usr/bin/java).   <<<<<<<< this is needed for new install <<<<<<
> 
>       Selection    Path                                           
>Priority   Status
>     ------------------------------------------------------------
>       0            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      
>auto mode
>       1            /usr/bin/gij-4.6                                1046      
>manual mode
>       2            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      
>manual mode
>       3            /usr/lib/jvm/java-6-sun/jre/bin/java            63        
>manual mode
>       4            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051      
>manual mode
>     * 5            /usr/local/sun-java/jre1.7.0_05/bin/java        64        
>manual mode

Right, and at least this is easily fixable, I'll be adding the link
name to the case where there's only one alternative.

thanks,
guillem

Reply via email to