Subject: 29.0.50; when ~/.emacs.d is a relative symlink to ~/foo/bar, (setq find-file-visit-truename t) causes package-install to generate incorrect autoloads

From: Faerryn <[email-masked]>
Date: Sat, 4 Dec 2021 20:37:33 -0600

In an empty HOME directory, run the following shell commands:

mkdir -p ~/foo/bar
ln -srf ~/foo/bar ~/.emacs.d
emacs -Q

In emacs, type the following elisp in the scratch buffer:

(progn
  (setq find-file-visit-truename t)
  (package-install 'vertico))

Then type 'C-x C-e' to evaluate.  Once Emacs is done evaluating, type
'C-x C-c' to quit from emacs.

In the shell, run 'emacs -Q' again.  Then type the following elisp in
the scratch buffer:

(package-initialize)

And type 'C-x C-e' to evaluate.  Then type 'M-x' and 'vertico-mode' in
the prompt.  Emacs will complain that it could not open the load file
for vertico.

Currently I use this snippet to patch the issue up:

(defun faerryn-patch-package-find-file-visit-truename (oldfun &rest r)
  (let ((find-file-visit-truename nil))
    (apply oldfun r)))
(advice-add #'package-install :around
            #'faerryn-patch-package-find-file-visit-truename)

In GNU Emacs 29.0.50 (build 9, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.17.4, Xaw3d scroll bars)
 of 2021-12-04 built on FaerrynLaptop
Repository revision: f14a4c377dfa6602e9e159c806656137854a667b
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101001
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-sound=alsa --with-modules --without-gconf --without-gsettings
 --with-native-compilation --with-x-toolkit=lucid --with-xft
 --with-xaw3d --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=native -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2
LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11
XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: EXWM

Minor modes in effect:
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  display-time-mode: t
  display-battery-mode: t
  global-auto-revert-mode: t
  electric-pair-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  gcmh-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/faerryn/.emacs.d/elpa/transient-0.3.7/transient hides
/usr/share/emacs/29.0.50/lisp/transient

Features:
(shadow sort mail-extr emacsbug sendmail git-rebase ediff ediff-merg
ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util
let-alist magit-bookmark bookmark magit-submodule magit-obsolete
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log magit-diff smerge-mode diff git-commit
magit-core magit-autorevert magit-margin magit-transient magit-process
magit-mode magit-git magit-section magit-utils which-func imenu ido crm
with-editor transient log-edit pcvs-util add-log benchmark dash edmacro
checkdoc term ehelp eshell esh-cmd esh-ext esh-opt esh-proc esh-io
esh-arg esh-module esh-groups esh-util pcase compile autoload lisp-mnt
tar-mode arc-mode archive-mode mm-archive cus-edit cus-start cus-load
shortdoc pp cl-print help-fns radix-tree vc-git diff-mode vc-dispatcher
org-indent org-element avl-tree generator ol-eww eww xdg url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search
eieio-opt speedbar ezimage dframe gnus-art mm-uu mml2015 mm-view
mml-smime smime dig gnus-sum shr pixel-fill kinsoku svg dom gnus-group
gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source utf7
netrc nnoo parse-time gnus-spec gnus-int gnus-range message yank-media
rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode
mm-bodies mm-encode mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util rmail rmail-loaddefs text-property-search wid-edit
ol-docview doc-view jka-compr image-mode exif ol-bibtex ol-bbdb ol-w3m
ol-doi org-link-doi org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete org-list
org-faces org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex iso8601 ol
org-keys oc org-compat advice org-macs org-loaddefs find-func cal-menu
calendar cal-loaddefs time-date shell pcomplete comint ansi-color ring
dired-aux dired-x dired dired-loaddefs thingatpt mail-utils comp
comp-cstr warnings rx cl-extra help-mode exwm exwm-input xcb-keysyms
xcb-xkb exwm-manage exwm-floating xcb-cursor xcb-render exwm-layout
exwm-workspace exwm-core xcb-ewmh xcb-icccm xcb xcb-xproto xcb-types
xcb-debug kmacro server time format-spec battery dbus xml gnutls
network-stream url-http mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr url-gw nsm rmc puny url-cache url-auth disp-table
whitespace autorevert filenotify elec-pair modus-vivendi-theme
modus-themes info display-line-numbers gcmh finder-inf package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars seq gv subr-x byte-opt bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting cairo x-toolkit x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 735182 520539)
 (symbols 48 43675 1482)
 (strings 32 139031 55401)
 (string-bytes 1 4616283)
 (vectors 16 76452)
 (vector-slots 8 1331544 461443)
 (floats 8 548 2348)
 (intervals 56 4297 2144)
 (buffers 992 28))