update-alternatives inconsistent after package upgrade
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-defaults (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
$ gcc -v
...
gcc version 8.1.0 (Ubuntu 8.1.0-1ubuntu1)
$ sudo apt update && sudo apt upgrade
...
The following packages will be upgraded:
binutils binutils-common binutils-
g++-8 gcc gcc-7 gcc-7-base gcc-8 gcc-8-base gdm3 gir1.2-gdm-1.0 lib32gcc1
lib32stdc++6 libasan4 libasan5 libatomic1 libbinutils libcc1-0 libcilkrts5
libgcc-7-dev libgcc-8-dev libgcc1 libgdm1 libgomp1 libitm1 liblsan0 libmpx2
libnautilus-
libstdc++-8-dev libstdc++6 libtsan0 libubsan0 libubsan1 nautilus
nautilus-data python3-distupgrade tzdata ubuntu-
ubuntu-
...
Setting up gcc-7 (7.3.0-
Setting up g++-7 (7.3.0-
Setting up gcc (4:7.3.
Setting up gcc-8 (8.2.0-
Setting up g++-8 (8.2.0-
Setting up g++ (4:7.3.
Processing triggers for libc-bin (2.27-3ubuntu1) ...
$ gcc -v
...
gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1
$ update-alternatives --display gcc
gcc - auto mode
link best version is /usr/bin/gcc-8
link currently points to /usr/bin/gcc-8
link gcc is /usr/bin/gcc
slave g++ is /usr/bin/g++
/usr/bin/gcc-7 - priority 700
slave g++: /usr/bin/g++-7
/usr/bin/gcc-8 - priority 800
slave g++: /usr/bin/g++-8
$ $ ll /usr/bin/gcc
lrwxrwxrwx 1 root root 5 Sep 17 09:07 /usr/bin/gcc -> gcc-7*
So after the upgrades update-alternatives shows that /usr/bin/gcc points to /usr/bin/gcc-8 as it was before the upgrades, when in fact it points to gcc-7.
Changed in gcc-defaults (Ubuntu): | |
status: | New → Invalid |
Reassigning to gcc. gcc does not appear to be managed by update- alternatives. AFAIUI, update-alternatives updates symlinks in /etc/alternatives. So /usr/bin/gcc would have to point to /etc/alternativ es/gcc which then points to gcc-8.
But /usr/bin/gcc is provided by the gcc package as a fixed symlink to a specific versioned one, not an alternative.
So this seems like an upgrade bug or something: You have a gcc alternative where you should not have one.