Subject: bug#49009: 27.1.90; files loaded with -l flag does not use file-truename as required by eval-after-load

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 14 Jun 2021 15:38:12 +0200

[email-masked] 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