Bug 394131 - /etc/alternatives/emacs link is wrong after upgrading emacs
Summary: /etc/alternatives/emacs link is wrong after upgrading emacs
Keywords:
Status: CLOSED DUPLICATE of bug 474578
Alias: None
Product: Fedora
Classification: Fedora
Component: emacs
Version: 9
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: Daniel Novotny
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 437599 439076 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-11-21 13:27 UTC by Jonathan Kamens
Modified: 2009-02-16 14:36 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-02-16 14:36:03 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jonathan Kamens 2007-11-21 13:27:47 UTC
Afer upgrading to emacs-22.1.50-1.fc9, /etc/alternatives/emacs points at
/usr/bin/emacs-22.1, which doesn't exist.  It should point at
/usr/bin/emacs-22.1.50, I think.

Comment 1 Michel Lind 2008-01-27 01:01:52 UTC
This is bizarre, as both the F-8 and devel versions of the Emacs spec files
properly call alternatives in %preun and %posttrans. Might it be a path problem?
It's calling alternatives without /usr/sbin, and I'm not sure it's in the path
(on the other hand, I did not notice any error when upgrading)

Comment 2 Chip Coldwell 2008-01-28 17:52:04 UTC
Usually the problem is that the /usr/bin/emacs file/link already exists, because
it isn't properly removed by the scriptlet in the *old* package during the
upgrade process.  /sbin/alternatives won't overwrite it.

The scriptlet ordering is a bit non-intuitive (to my mind).  See

http://fedoraproject.org/wiki/Packaging/ScriptletSnippets#head-e54edd34de98841f72f542ebb78ae8e73860acca

for details, but basically, because the %postun of the old package runs *after*
the %post of the new package during an upgrade, if the %postun of the old
package removes the old link, it will happen *after* the %post of the new
package has tried to install it.  That's why I moved it all to %posttrans.

What should work is removing the old package and then installing the new one
(i.e. do the upgrade in two steps).

Chip


Comment 3 Michael Schwendt 2008-01-29 15:28:22 UTC
$ sudo yum -y remove emacs
[...]
$ sudo yum -y install emacs
[...]
$ which emacs
/usr/bin/which: no emacs in
(/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/bin:/usr/bin:/home/misc/bin)

$ cd /usr/bin
$ ll emacs
lrwxrwxrwx 1 root root 23 2007-06-28 10:26 emacs -> /etc/alternatives/emacs

$ rpm -q emacs
emacs-22.1.50-3.fc9


Comment 4 Chip Coldwell 2008-01-29 17:23:41 UTC
What does the /etc/alternatives/emacs symlink point to?

Chip


Comment 5 Michael Schwendt 2008-01-29 18:22:15 UTC
/etc/alternatives/emacs -> /usr/bin/emacs-22.1

which doesn't exist. Only /usr/bin/emacs-22.1.50 exists.


Comment 6 Chip Coldwell 2008-01-29 18:50:42 UTC
So the problem is that the old package didn't properly remove the symlink; thus
when the new package was installed, alternatives didn't overwrite it.  Try this:

remove emacs.
Manually remove the two (broken) symlinks /usr/bin/emacs and
/etc/alternatives/emacs.
install emacs.

And let me know if the symlink is there and working.

Chip


Comment 7 Michael Schwendt 2008-01-29 19:47:21 UTC
Negative.

# rm -f /etc/alternatives/emacs   /usr/bin/emacs
# yum -y remove emacs
[...]
# yum -y install emacs
[...]
Transaction Test Succeeded
Running Transaction
  Installing: emacs                        ######################### [1/1] 
failed to read link /usr/bin/emacs: No such file or directory
[...]
# which emacs
/usr/bin/which: no emacs in
(/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
# ll /usr/bin/emacs*
lrwxrwxrwx 1 root root      23 2008-01-29 20:45 /usr/bin/emacs ->
/etc/alternatives/emacs
-rwxr-xr-t 1 root root 5563696 2007-12-13 19:58 /usr/bin/emacs-22.1.50
-rwxr-xr-x 1 root root   18660 2007-12-13 19:59 /usr/bin/emacsclient
# ll /etc/alternatives/emacs
lrwxrwxrwx 1 root root 19 2008-01-29 20:45 /etc/alternatives/emacs ->
/usr/bin/emacs-22.1


Comment 8 Ulrich Drepper 2008-03-08 07:20:05 UTC
In rawhide, the emacs link is now completely gone.

emacs-22.1.50-4.fc9.x86_64

Comment 9 Chip Coldwell 2008-03-18 13:35:15 UTC
*** Bug 437599 has been marked as a duplicate of this bug. ***

Comment 10 Matt Domsch 2008-04-21 01:57:09 UTC
This still is a problem.  I upgraded what was a previously up-to-date rawhide
system with emacs-22.1.50-4.fc9, to the new rawhide emacs-23.0.60-2.fc9.  The
/usr/bin/emacs symlink points to /etc/alternatives/emacs. 
/etc/alternatives/emacs still pointed pointed to the now removed older package.

# 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-23.0.60 - priority 80
Current `best' version is /usr/bin/emacs-22.1.

Of course, this breaks any system where emacs was working properly before. 
Users must manually run:

# alternatives --set emacs /usr/bin/emacs-23.0.60

to restore emacs to working.  This isn't good behavior.


Comment 11 Jens Petersen 2008-04-29 00:25:47 UTC
*** Bug 439076 has been marked as a duplicate of this bug. ***

Comment 12 Jens Petersen 2008-04-29 00:27:34 UTC
Moving this to F9Blocker since bug 439076 was on the blocker list.

Is it actually possible to fix this for people upgrading from F8?

Comment 13 Braden McDaniel 2008-04-30 16:03:02 UTC
Still a problem with 22.2-1.fc9.

I removed emacs, removed /etc/alternatives/emacs. After then installing
emacs-22.2-1.fc9, I now have a fresh dead /etc/alternatives/emacs symlink:

# ll /etc/alternatives/emacs
lrwxrwxrwx 1 root root 19 2008-04-30 11:50 /etc/alternatives/emacs ->
/usr/bin/emacs-22.1


Comment 14 Bill Nottingham 2008-05-02 14:48:23 UTC
Can someone reproduce this with 22.2-4.fc9?

Comment 15 Brad Walker 2008-05-02 15:09:07 UTC
On my F9-preview box I yum erased emacs, installed emacs-22.1-8.fc8 and then
upgraded to emacs-22.2-4.fc9 using rpm -Uvh. It's still affected:

[root@brad ~]# 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.2 - priority 80
Current `best' version is /usr/bin/emacs-22.1.


Comment 16 Braden McDaniel 2008-05-03 04:38:52 UTC
And in the situation I described in comment #13, 22.2-4.fc9 behaves exactly the
same.


Comment 17 Bill Nottingham 2008-05-05 19:34:25 UTC
This is a problem with the F-8 (or similar) packages that have:

%preun
if [ $1 -eq 0 ] ; then
  alternatives --remove emacs %{_bindir}/emacs-%{version}
fi

The current latest update for F-8 (22.1-8.fc8) has this problem.

This can't be fixed in F-9 - we need to push a newer build for F-8 that removes
the conditional from the %preun. These fixes appear to already be in CVS, so we
just need to build and push an update.


Comment 18 Bill Nottingham 2008-05-05 19:38:39 UTC
As it's not a F-9 fix, removing from the F9 Blocker.

Comment 19 Braden McDaniel 2008-05-05 20:08:35 UTC
Per the scenario I described, there would appear to be something still
malfunctioning irrespective of F-8.

Comment 20 Brad Walker 2008-05-07 15:25:30 UTC
I did a clean install of 22.1-8.fc8 on F9-preview with rpm, upgraded to
22.1-11.fc8 with rpm, and then yum upgraded to 22.2-4.fc9. The 22.2 package
updated the alternatives as it should.

Comment 21 Bug Zapper 2008-05-14 03:58:15 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 22 Braden McDaniel 2008-05-14 18:06:59 UTC
If this bug is just about upgrading (as the summary suggests), then perhaps it's
fixed. I've created bug 446467 to cover the problem I'm observing.


Comment 24 Daniel Novotny 2009-02-16 14:36:03 UTC

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


Note You need to log in before you can comment on or make changes to this bug.