Bug#679010: dpkg: update-alternatives has no option to get name of master link

June 25th, 2012 - 01:50 pm ET by js | Report spam
Package: dpkg
Version: 1.16.3
Severity: normal

Dear Maintainer,

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>

For example, suppose one wants to install a new alternative to 'rename':
jack@berkeley:tmp => ls -lt /etc/alternatives/rename
0 lrwxrwxrwx 1 root root 16 Jan 15 17:04 /etc/alternatives/rename -> /usr/bin/prename

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.

jack@berkeley:tmp => update-alternatives --display rename
rename - auto mode
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'.

The only workaround is to look at the /var/lib/dpkg/alternatives file:
jack@berkeley:tmp => cat /var/lib/dpkg/alternatives/rename
auto
/usr/bin/rename <<<<<<<< this is needed for new install <<<<<<
rename.1.gz
/usr/share/man/man1/rename.1.gz

/usr/bin/prename
60
/usr/share/man/man1/prename.1.gz

jack@berkeley:tmp => ls -lt /usr/bin/rename
0 lrwxrwxrwx 1 root root 24 Jan 15 17:04 /usr/bin/rename -> /etc/alternatives/rename*

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.

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






Debian Release: wheezy/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.1.0-1-686-pae (SMP w/6 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg depends on:
ii libbz2-1.0 1.0.6-1
ii libc6 2.13-24
ii libselinux1 2.1.0-4
ii tar 1.26-4
ii xz-utils 5.1.1alpha+20110809-3
ii zlib1g 1:1.2.3.4.dfsg-3

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii apt 0.9.6

/etc/dpkg/dpkg.cfg changed:
refuse-downgrade
no-debsig
log /var/log/dpkg.log





To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
email Follow the discussionReplies 1 replyReplies Make a reply

Similar topics

Replies

#1 Guillem Jover
June 26th, 2012 - 05:30 am ET | Report spam
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:

: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:
: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



To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact
email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search