unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49009: 27.1.90; files loaded with -l flag does not use file-truename as required by eval-after-load
@ 2021-06-13 21:56 ctarbide--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-06-14 13:38 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: ctarbide--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-06-13 21:56 UTC (permalink / raw)
  To: 49009

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

Consider:

emacs -nw -Q -batch -L "`pwd`" -l test.el

if the test.el file above is in a non-true path, e.g. a parent dir is a
symlink, and test.el has an eval-after-load for itself, the eval-after-load
form will not be evaluated, the reason is that startup.el does not usefile-truename while loading file, the change below solved the issue:

-  (file-ex (expand-file-name file)))
+  (file-ex (file-truename (expand-file-name file))))

http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el#n2503


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

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

* bug#49009: 27.1.90; files loaded with -l flag does not use file-truename as required by eval-after-load
  2021-06-13 21:56 bug#49009: 27.1.90; files loaded with -l flag does not use file-truename as required by eval-after-load ctarbide--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-06-14 13:38 ` Lars Ingebrigtsen
  2021-06-19 13:59   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-14 13:38 UTC (permalink / raw)
  To: ctarbide; +Cc: 49009

ctarbide@tuta.io writes:

> if the test.el file above is in a non-true path, e.g. a parent dir is a
> symlink, and test.el has an eval-after-load for itself, the eval-after-load
> form will not be evaluated, the reason is that startup.el does not use
> file-truename while loading file, the change below solved the issue:
>
> -  (file-ex (expand-file-name file)))
> +  (file-ex (file-truename (expand-file-name file))))

There's two of these, so here's the proposed patch, I think.

This seems reasonable to me -- anybody else have any comments?  I was
wondering whether there may be edge cases where this may lead to
unintended consequences...

diff --git a/lisp/startup.el b/lisp/startup.el
index ac319612e8..456c01efd1 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2500,7 +2500,7 @@ command-line-1
                                    (or argval (pop command-line-args-left))))
                             ;; Take file from default dir if it exists there;
                             ;; otherwise let `load' search for it.
-                            (file-ex (expand-file-name file)))
+                            (file-ex (file-truename (expand-file-name file))))
                        (when (file-regular-p file-ex)
                          (setq file file-ex))
                        (load file nil t)))
@@ -2511,7 +2511,7 @@ command-line-1
                      (let* ((file (command-line-normalize-file-name
                                    (or argval (pop command-line-args-left))))
                             ;; Take file from default dir.
-                            (file-ex (expand-file-name file)))
+                            (file-ex (file-truename (expand-file-name file))))
                        (load file-ex nil t t)))
 
                     ((equal argi "-insert")


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#49009: 27.1.90; files loaded with -l flag does not use file-truename as required by eval-after-load
  2021-06-14 13:38 ` Lars Ingebrigtsen
@ 2021-06-19 13:59   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-19 13:59 UTC (permalink / raw)
  To: ctarbide; +Cc: 49009

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This seems reasonable to me -- anybody else have any comments?  I was
> wondering whether there may be edge cases where this may lead to
> unintended consequences...

There were no comments in five days, so I've pushed the patch to Emacs
28.  I couldn't see any adverse effects, but if this breaks something
for somebody, it should be reverted.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-06-19 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13 21:56 bug#49009: 27.1.90; files loaded with -l flag does not use file-truename as required by eval-after-load ctarbide--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-14 13:38 ` Lars Ingebrigtsen
2021-06-19 13:59   ` Lars Ingebrigtsen

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