Bug 2277689 - emacs alternatives reset to default (/usr/bin/emacs-29.3) after update
Summary: emacs alternatives reset to default (/usr/bin/emacs-29.3) after update
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: emacs
Version: 40
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Daiki Ueno
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-04-29 07:55 UTC by Sjoerd Mullender
Modified: 2024-07-11 16:36 UTC (History)
11 users (show)

Fixed In Version: emacs-29.4-5.fc40
Clone Of:
Environment:
Last Closed: 2024-07-11 01:15:33 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Sjoerd Mullender 2024-04-29 07:55:22 UTC
On one system I have emacs, through the alternatives system, pointing at /usr/bin/emacs-29.3-gtk+x11, on another to /usr/bin/emacs-29.3-nw.  In both cases, after updating to emacs-29.3-6.fc40.x86_64, the alternatives were pointing to /usr/bin/emacs-29.3.

Both systems had been upgraded from Fedora 39, and in both cases alternatives was used to change the configuration of which emacs to use.  In both cases, the old emacs that was installed (after the upgrade to F40) was emacs-29.3-5.fc40.x86_64, and both were updated to emacs-29.3-6.fc40.x86_64 using dnf upgrade.

Reproducible: Always

Steps to Reproduce:
1.Install Fedoro 40, with emacs-1:29.3-5.fc40.x86_64
2.sudo alternatives --config emacs # select emacs-29.3-gtk+x11
3.update to emacs-1:29.3-6.fc40.x86_64

Similarly for emacs-nw, although you need to install it first.
Actual Results:  
$ ls -l /etc/alternatives/emacs
lrwxrwxrwx. 1 root root 19 Apr 29 09:51 /etc/alternatives/emacs -> /usr/bin/emacs-29.3


Expected Results:  
$ ls -l /etc/alternatives/emacs
lrwxrwxrwx. 1 root root 27 Apr 26 10:48 /etc/alternatives/emacs -> /usr/bin/emacs-29.3-gtk+x11

Comment 1 Jeffrey Walton 2024-06-30 15:55:53 UTC
Add a mee too. When I try to run emacs over ssh, it just crashes.

   $ emacs .gitconfig 
   (emacs:50018): Gtk-WARNING **: 11:53:44.641: cannot open display:

(It is not clear to me how I installed emacs-nox several years ago, and now a Gtk version is installed.)

Comment 2 Jerry James 2024-06-30 16:11:21 UTC
See https://src.fedoraproject.org/rpms/emacs/pull-request/41 for a fix for this issue.

Comment 3 Peter Oliver 2024-07-02 23:14:27 UTC
It turns out that this bug was a known side-effect of the fix for bug #684447.  From the changelog:

* Tue Mar 15 2011 Karel Klic <kklic> - 1:23.3-2
- Another attempt to fix the handling of alternatives (rhbz#684447)
  The current process loses alternatives preference on every upgrade,
  but there seems to be no elegant way how to prevent this while
  having versioned binaries (/bin/emacs-%%{version}) at the same time.

Comment 4 Jerry James 2024-07-02 23:26:23 UTC
Ah, okay, now I understand.  I'll bet the versioned binary thing can be dealt with, though.  Let me take another crack at this, and do some testing with versioned upgrades to see if it can be made to work.

Comment 5 Peter Oliver 2024-07-04 11:24:49 UTC
I think https://src.fedoraproject.org/rpms/emacs/pull-request/42 should fix this?

Comment 6 Fedora Update System 2024-07-08 23:13:14 UTC
FEDORA-2024-cf40c8f40b (emacs-29.4-5.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-cf40c8f40b

Comment 7 Fedora Update System 2024-07-09 03:27:06 UTC
FEDORA-2024-cf40c8f40b has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-cf40c8f40b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-cf40c8f40b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2024-07-11 01:15:33 UTC
FEDORA-2024-cf40c8f40b (emacs-29.4-5.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Sjoerd Mullender 2024-07-11 16:36:41 UTC
After the update, the alternatives link isn't working at all for the gtk+x11 version.  It seems that there should be a symlink emacs-gtk+x11 pointing to the versioned binary, but ther isn't.

$ rpm -q emacs emacs-gtk+x11
emacs-29.4-5.fc40.x86_64
emacs-gtk+x11-29.4-5.fc40.x86_64
$ ls -l /etc/alternatives/emacs /usr/bin/emacs*
lrwxrwxrwx. 1 root root   22 Jul 11 18:21 /etc/alternatives/emacs -> /usr/bin/emacs-gtk+x11
lrwxrwxrwx. 1 root root   23 Jul 11 18:14 /usr/bin/emacs -> /etc/alternatives/emacs
-rwxr-xr-x. 1 root root  33K Jul  8 02:00 /usr/bin/emacsclient
-rwxr-xr-x. 1 root root 8.5M Jul  8 02:00 /usr/bin/emacs-29.4-gtk+x11
-rwxr-xr-x. 1 root root 8.2M Jul  8 02:00 /usr/bin/emacs-29.4-pgtk
-rwxr-xr-x. 1 root root  445 Jul  8 02:00 /usr/bin/emacs-desktop
lrwxrwxrwx. 1 root root   15 Jul  8 02:00 /usr/bin/emacs-pgtk -> emacs-29.4-pgtk
$ sudo alternatives --config emacs

There are 2 programs which provide 'emacs'.

  Selection    Command
-----------------------------------------------
 + 1           /usr/bin/emacs-gtk+x11
*  2           /usr/bin/emacs-pgtk

Enter to keep the current selection[+], or type selection number:


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