Subject: Re: bug#42534: 28.0.50; package-test-macro-compilation test fails on macOS

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 25 Dec 2020 22:43:24 +0100

The problem on Macos seems to be that it's comparing file-truenames, but
that's not what's in the load history.  For instance,
"/var/folders/l4/brbf3lnd693fpdl8bn87q5w80000gn/T/pkg-test-user-dir-FaftUD/macro-problem-1.0/macro-problem-autoloads"
is in load-history, but it's finding conflicts by truenaming:

(file-truename "/var/folders/l4/brbf3lnd693fpdl8bn87q5w80000gn/T/pkg-test-user-dir-FaftUD/macro-problem-1.0/macro-problem-autoloads")
=> "/private/var/folders/l4/brbf3lnd693fpdl8bn87q5w80000gn/T/pkg-test-user-dir-FaftUD/macro-problem-1.0/macro-problem-autoloads"

And indeed:

larsi@open-catalina test % ls -ld /var
lrwxr-xr-x@ 1 root  admin  11 Dec 18 15:11 /var -> private/var

The following seems to fix the problem for me on Macos and doesn't lead
to any breakages on Debian, so I'm pushing it now.  Can you check
whether this fixes the problem on Windows?

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 0170e61e12..bc450b09d0 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -830,7 +830,7 @@ package--files-load-history
         (mapcar (lambda (x)
                   (let ((f (car x)))
                     (and (stringp f)
-                         (file-name-sans-extension f))))
+                         (file-name-sans-extension (file-truename f)))))
                 load-history)))
 
 (defun package--list-of-conflicts (dir history)

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