After wondering why Emacs was hanging on startup after a reinstallation of machines with Debian 11 at my lab, I looked at the strace output (strace -o str.out -f /usr/bin/emacs-gtk -Q) and could see: [...] 380295 openat(AT_FDCWD, "/usr/share/X11/POSIX/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/share/X11/POSIX/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/share/X11/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/share/X11/POSIX/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/share/X11/POSIX/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/share/X11/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/lib/X11/POSIX/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/lib/X11/POSIX/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/lib/X11/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/lib/X11/POSIX/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/lib/X11/POSIX/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/usr/lib/X11/app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/home/vlefevre/.app-defaults/POSIX/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/home/vlefevre/.app-defaults/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/home/vlefevrePOSIX/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 380295 openat(AT_FDCWD, "/home/vlefevreEmacs", O_RDONLY) = -1 ENOENT (No such file or directory) [...] So, Emacs tries to open /home/vlefevrePOSIX/Emacs and /home/vlefevreEmacs, which potentially belong to other users! Moreover, here, this makes Emacs hang for several dozens of seconds possibly due to a timeout in the automounter or something like that.
Due to this issue, I reported the bug from but another machine (I should have unset DISPLAY, instead). So here are some corrections. Actually 1:27.1+1-3.1 Debian Release: 11.3 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 5.10.0-13-amd64 (SMP w/16 CPU threads) Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages emacs-gtk depends on: ii emacs-bin-common 1:27.1+1-3.1 ii emacs-common 1:27.1+1-3.1 ii libacl1 2.2.53-10 ii libasound2 1.2.4-1.1 ii libc6 2.31-13+deb11u3 ii libcairo2 1.16.0-5 ii libdbus-1-3 1.12.20-2 ii libfontconfig1 2.13.1-4.2 ii libfreetype6 2.10.4+dfsg-1 ii libgdk-pixbuf-2.0-0 2.42.2+dfsg-1 ii libgif7 5.1.9-2 ii libglib2.0-0 2.66.8-1 ii libgmp10 2:6.2.1+dfsg-1+deb11u1 ii libgnutls30 3.7.1-5 ii libgpm2 1.20.7-8 ii libgtk-3-0 3.24.24-4+deb11u2 ii libharfbuzz0b 2.7.4-1 ii libice6 2:1.0.10-1 ii libjansson4 2.13.1-1.1 ii libjpeg62-turbo 1:2.0.6-4 ii liblcms2-2 2.12~rc1-2 ii libm17n-0 1.8.0-2 ii libotf0 0.9.13-7 ii libpango-1.0-0 1.46.2-3 ii libpng16-16 1.6.37-3 ii librsvg2-2 2.50.3+dfsg-1 ii libselinux1 3.1-3 ii libsm6 2:1.2.3-1 ii libsystemd0 247.3-7 ii libtiff5 4.2.0-1+deb11u1 ii libtinfo6 6.2+20201114-2 ii libx11-6 2:1.7.2-1 ii libxext6 2:1.3.3-1.1 ii libxfixes3 1:5.0.3-2 ii libxml2 2.9.10+dfsg-6.7+deb11u1 ii libxrender1 1:0.9.10-1 ii zlib1g 1:1.2.11.dfsg-2+deb11u1 emacs-gtk recommends no packages. Versions of packages emacs-gtk suggests: pn emacs-common-non-dfsg <none>
I can reproduce the issue with upstream's 27.1 version: 11 openat(AT_FDCWD, "/home/vlefevrePOSIX/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 11 openat(AT_FDCWD, "/home/vlefevreEmacs", O_RDONLY) = -1 ENOENT (No such file or directory) but not with master: 481514 openat(AT_FDCWD, "/home/vlefevre/POSIX/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) 481514 openat(AT_FDCWD, "/home/vlefevre/Emacs", O_RDONLY) = -1 ENOENT (No such file or directory) (this was actually a missing slash after the home dir).
This is also fixed in upstream's 27.2.
Control: forwarded -1 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42827
2020-08-17 Robert Pluim <rpluim@gmail.com>
Fix bug with ~/Emacs file not being read at init
* src/xrdb.c (get_user_app): Put "/" between homedir
and %L or %N (Bug#42827).
I've attached the patch. (Unfortunately, I get an unrelated failure in the tests; bug 1010170.) [...] [...] To clarify, I reported the bug from a Debian/unstable machine, but the bug *also* occurs in Debian 11 (bullseye).
On Mon, 25 Apr 2022 15:40:26 +0200 Vincent Lefevre <vincent@vinc17.net> wrote: So, let's mark this bug as fixed. I'm not closing the bug, I leave that to the maintainer and/or bug submitter. Paul
Will this be fixed in Debian/stable? With NFS automount for home directories, this bug makes Emacs hang for several minutes on startup (unless I unset DISPLAY).
The bug log again states that this issue has been fixed in 2022, but the bug was kept open perhaps to track that the fix reaches stable. That has also happened, so close it.