unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52292: 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
@ 2021-12-05  2:37 Faerryn
  2022-04-10  2:02 ` Jorge Israel Peña
  2022-05-11  4:23 ` bug#52292: [PATCH] #52292 No Wayman
  0 siblings, 2 replies; 5+ messages in thread
From: Faerryn @ 2021-12-05  2:37 UTC (permalink / raw)
  To: 52292

[-- Attachment #1: Type: text/plain, Size: 7299 bytes --]

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))

[-- Attachment #2: Type: text/html, Size: 7977 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52292: 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
  2021-12-05  2:37 bug#52292: 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 Faerryn
@ 2022-04-10  2:02 ` Jorge Israel Peña
  2022-05-11  4:23 ` bug#52292: [PATCH] #52292 No Wayman
  1 sibling, 0 replies; 5+ messages in thread
From: Jorge Israel Peña @ 2022-04-10  2:02 UTC (permalink / raw)
  To: alexandre.liao, 52292

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

I am also observing this on Windows with Emacs 28. Reverting to Emacs 27.2
resolved the issue.

I was also able to work around this issue on Emacs 28 by using an
around-advice similar to the one provided by Faerryn but tailored for
straight.el, wrapping function straight--build-autoloads.

You can find other users running into this problem in this straight.el
issue: https://github.com/raxod502/straight.el/issues/701

[-- Attachment #2: Type: text/html, Size: 559 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52292: [PATCH] #52292
  2021-12-05  2:37 bug#52292: 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 Faerryn
  2022-04-10  2:02 ` Jorge Israel Peña
@ 2022-05-11  4:23 ` No Wayman
  2022-05-11 11:17   ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: No Wayman @ 2022-05-11  4:23 UTC (permalink / raw)
  To: 52292; +Cc: Lars Ingebrigtsen, alexandre.liao

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]


The solution for this seems simple enough, but I'm not sure 
exactly where it should be placed.
In any case, here's a patch which may solve the problem.
Offering it in hopes that someone more knowledgeable in this area 
can step in and apply the actual fix.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-autoload.el-Don-t-use-file-truename-for-symlinked-au.patch --]
[-- Type: text/x-patch, Size: 1080 bytes --]

From 1c78d0dd6b197986c660d0f82a7ccd93b2bbb712 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Wed, 11 May 2022 00:16:45 -0400
Subject: [PATCH] autoload.el: Don't use file truename for symlinked autoloads

* lisp/emacs-lisp/autoload.el (autoload-find-generated-file): Bind
find-file-true-visit-truename to nil.  Otherwise the output file may
resolve to a relative path when the file it is based off of is
symlinked (bug #52292).
---
 lisp/emacs-lisp/autoload.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 1e4b2c14a0..23e34ddad0 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -282,6 +282,7 @@ autoload-find-generated-file
   (let ((enable-local-variables :safe)
         (enable-local-eval nil)
         (find-file-hook nil)
+        (find-file-visit-truename nil)
         (delay-mode-hooks t))
     ;; We used to use `raw-text' to read this file, but this causes
     ;; problems when the file contains non-ASCII characters.
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#52292: [PATCH] #52292
  2022-05-11  4:23 ` bug#52292: [PATCH] #52292 No Wayman
@ 2022-05-11 11:17   ` Eli Zaretskii
  2022-05-11 17:50     ` No Wayman
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2022-05-11 11:17 UTC (permalink / raw)
  To: No Wayman; +Cc: larsi, alexandre.liao, 52292

> Cc: Lars Ingebrigtsen <larsi@gnus.org>, alexandre.liao@gmail.com
> From: No Wayman <iarchivedmywholelife@gmail.com>
> Date: Wed, 11 May 2022 00:23:42 -0400
> 
> diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
> index 1e4b2c14a0..23e34ddad0 100644
> --- a/lisp/emacs-lisp/autoload.el
> +++ b/lisp/emacs-lisp/autoload.el
> @@ -282,6 +282,7 @@ autoload-find-generated-file
>    (let ((enable-local-variables :safe)
>          (enable-local-eval nil)
>          (find-file-hook nil)
> +        (find-file-visit-truename nil)
>          (delay-mode-hooks t))
>      ;; We used to use `raw-text' to read this file, but this causes
>      ;; problems when the file contains non-ASCII characters.

I think I'd prefer to run the file name through expand-file-name
instead, as not resolving symlinks and other similar "equivalences"
could have adverse effect elsewhere, if someone compares the file name
to some other file name.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52292: [PATCH] #52292
  2022-05-11 11:17   ` Eli Zaretskii
@ 2022-05-11 17:50     ` No Wayman
  0 siblings, 0 replies; 5+ messages in thread
From: No Wayman @ 2022-05-11 17:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, alexandre.liao, 52292


Eli Zaretskii <eliz@gnu.org> writes:

> I think I'd prefer to run the file name through expand-file-name
> instead, as not resolving symlinks and other similar 
> "equivalences"
> could have adverse effect elsewhere, if someone compares the 
> file name
> to some other file name.

Sounds good.
Too busy to tackle this myself now, but hopefully someone can take 
initiative given that we have a reproducible test case and a 
suggested solution now.






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-11 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-05  2:37 bug#52292: 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 Faerryn
2022-04-10  2:02 ` Jorge Israel Peña
2022-05-11  4:23 ` bug#52292: [PATCH] #52292 No Wayman
2022-05-11 11:17   ` Eli Zaretskii
2022-05-11 17:50     ` No Wayman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).