Bug 439076

Summary: Upgrading from F8 is not updating alternatives
Product: [Fedora] Fedora Reporter: Brad Walker <me>
Component: emacsAssignee: Chip Coldwell <coldwell>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: michal, notting, petersen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-04-28 20:25:46 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 235706    

Description Brad Walker 2008-03-26 16:19:15 EDT
Description of problem:
Upgrading emacs between different versions doesn't properly unregister the old
symlinks provided through alternatives. This results in a broken /usr/bin/emacs
symlink and .desktop files.

Version-Release number of selected component (if applicable):
22.1-8.fc8 to 22.1.50-4.fc0

How reproducible:
Everytime

Steps to Reproduce:
root@gibson ~]# yum list installed 'emacs*'
Error: No matching Packages to list
[root@gibson ~]# alternatives --display emacs
[root@gibson ~]# yum install emacs emacs-{common,nox,el} -y
%%%%%%%%%%%%%%%% yum output omitted for brevity %%%%%%%%%%%%%%%%%%%%
[root@gibson ~]# yum list installed 'emacs*'
Installed Packages
emacs.i386                               22.1-8.fc8             installed       
emacs-common.i386                        22.1-8.fc8             installed       
emacs-el.i386                            22.1-8.fc8             installed       
emacs-nox.i386                           22.1-8.fc8             installed    
[root@gibson ~]# alternatives --display emacs
emacs - status is auto.
 link currently points to /usr/bin/emacs-22.1
/usr/bin/emacs-22.1 - priority 80
/usr/bin/emacs-22.1-nox - priority 70
Current `best' version is /usr/bin/emacs-22.1.
[root@gibson ~]# yum upgrade 'emacs*' -y --enablerepo=development
%%%%%%%%%%%%%%%% yum output omitted for brevity %%%%%%%%%%%%%%%%%%%%
[root@gibson ~]# yum list installed 'emacs*'
Installed Packages
emacs.i386                               22.1.50-4.fc9          installed       
emacs-common.i386                        22.1.50-4.fc9          installed       
emacs-el.i386                            22.1.50-4.fc9          installed       
emacs-nox.i386                           22.1.50-4.fc9          installed       


Actual results:
[root@gibson ~]# alternatives --display emacs
emacs - status is auto.
 link currently points to /usr/bin/emacs-22.1
/usr/bin/emacs-22.1 - priority 80
/usr/bin/emacs-22.1-nox - priority 70
/usr/bin/emacs-22.1.50-nox - priority 70
/usr/bin/emacs-22.1.50 - priority 80
Current `best' version is /usr/bin/emacs-22.1.
[root@gibson ~]# emacs
-bash: emacs: command not found


Expected results:
[root@gibson ~]# alternatives --display emacs
emacs - status is auto.
 link currently points to /usr/bin/emacs-22.1.50
/usr/bin/emacs-22.1.50 - priority 80
/usr/bin/emacs-22.1.50-nox - priority 70
Current `best' version is /usr/bin/emacs-22.1.50.


Additional info:
FWIW, I have the same problem on a different machine running x86_64 rawhide
upgrading from 22.1.50-4.fc9 to 23.0.60 packages. The spec for 23.0.60 has
merged in all recent changes in rawhide, including the %pre/%post scriptlet
`alternatives' changes.
Comment 1 Jens Petersen 2008-04-13 20:05:52 EDT
I just saw this too after upgrading my laptop from F8 to current pre-F9.
Maybe %posttrans is not getting run?

It would be very good to fix this before the final release.

Comment 2 Jens Petersen 2008-04-13 20:13:19 EDT
Hmm actually even running the %posttrans script by hand did not fix the problem
for me.
Comment 3 Michal Jaegermann 2008-04-21 16:15:20 EDT
The same issue hit when replacing on rawhide emacs-22.1.50-4.fc9
with an updated emacs-23.0.60-2.fc9.  After the last version showed up
'alternatives --display emacs' prints:

emacs - status is manual.
 link currently points to /usr/bin/emacs-22.1.50
/usr/bin/emacs-21.3 - priority 50
/usr/bin/emacs-22.1 - priority 80
/usr/bin/emacs-23.0.60 - priority 80
Current `best' version is /usr/bin/emacs-22.1.

and running a command from package scripts with --verbose, i.e.

alternatives --verbose --install /usr/bin/emacs emacs /usr/bin/emacs-23.0.60 80

results in:

reading /var/lib/alternatives/emacs


That is what I have now in /var/lib/alternatives/emacs

manual
/usr/bin/emacs

/usr/bin/emacs-21.3
50
/usr/bin/emacs-22.1
80
/usr/bin/emacs-23.0.60
80

It appears that every alternatives operation I am trying ends up
with "link points to no alternative -- setting mode to manual" and
no action.  Should have been old link removed in %preun?  That may
be too late for yum.
Comment 4 Michal Jaegermann 2008-04-21 16:57:56 EDT
Urhg! The above "results in:" should be followed by

reading /var/lib/alternatives/emacs
link points to no alternative -- setting mode to manual
Comment 5 Brad Walker 2008-04-24 08:17:02 EDT
Michael, what if you uninstall emacs and then try upgrading from one fc9 version
to another? I've only been able to reproduce this problem when upgrading from
the fc8 packages to fc9. Upgrading from 22.1.50-fc9 to 22.2-fc9 or 23.0.60-fc9
on a fresh install doesn't cause problems for me.
Comment 6 Michal Jaegermann 2008-04-24 13:07:02 EDT
> ... try upgrading from one fc9 version to another?

As I said in a comment #3 what got me was an update from
emacs-22.1.50-4.fc9 to emacs-23.0.60-2.fc9; all withing rawhide.
I did not have any fc8 emacs packages on that particular installation
for a long time.  /var/lib/alternatives/emacs may had some very
old lefovers in it but so what?

I am aware that eventually I am able to work around that trouble
one way or another.
Comment 7 Jens Petersen 2008-04-28 02:59:37 EDT
I think the issue is simply related to the change of version.

Going from f8 (22.1) to f9 (22.2) leaves two alternatives for emacs
at priority 80: /usr/bin/emacs-22.1 and /usr/bin/emacs-22.2,
and /usr/bin/emacs-22.1 gets chosen since it is first, leaving
a dangling symlink.

But if emacs-22.1 has to remove itself properly there may not be
a clean way to fix this without a hack?
Comment 8 Brad Walker 2008-04-28 03:17:13 EDT
This is probably a duplicate of bug #394131
Comment 9 Michal Jaegermann 2008-04-28 11:18:58 EDT
> I think the issue is simply related to the change of version.

Reverting emacs-23 packages to emacs-22.2-1.fc9 (see "20080424 changes")
updated alternatives correctly.  Possibly because I did that
with 'rpm -U --oldpackage ...' and not with yum going through
two stages.
Comment 10 Jens Petersen 2008-04-28 20:25:46 EDT

*** This bug has been marked as a duplicate of 394131 ***