Subject: bug#43875: closed (Re: bug#43875: feature/native-comp; Fix another failure when eln-cache is removed)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 10 Oct 2020 08:46:02 +0000

Your bug report

#43875: feature/native-comp; Fix another failure when eln-cache is removed

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
43875: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=43875
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#43875: feature/native-comp; Fix another failure when eln-cache is removed
From: Andrea Corallo <[email-masked]>
To: Andrew Whatson <[email-masked]>
Cc: [email-masked]
Date: Sat, 10 Oct 2020 08:45:09 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Andrew Whatson <[email-masked]> writes:

> Yep it's all sorted!

Wonderful!

I've applied the patch as for the part related to the typo fix and
making the error homogeneous (85450f03be).

I've made a slightly different one (138990bbda) to address the problem
of the missing directory as it looks more correct to me (unwind-protect
would have not prevented the error to be catch-ed).

I've test it, as it works for me I'm closing.

Thanks for looking into this and submitting the patch!

  Andrea

Subject: feature/native-comp; Fix another failure when eln-cache is removed
From: Andrew Whatson <[email-masked]>
To: [email-masked]
Cc: Andrew Whatson <[email-masked]>
Date: Fri, 9 Oct 2020 11:38:09 +1000
List-Id: <debbugs-submit.debbugs.gnu.org>

	* lisp/emacs-lisp/comp.el (comp-trampoline-compile): Fix typo in
	  name.  Attempt to create eln-cache directory before failing
	  with writability error.  Change error to be consistent.
---
 lisp/emacs-lisp/comp.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 763d44a23e..78f2ca696c 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2580,7 +2580,7 @@ comp-search-trampoline
    when (file-exists-p filename)
      do (cl-return filename)))
 
-(defun comp-tampoline-compile (subr-name)
+(defun comp-trampoline-compile (subr-name)
   "Synthesize and compile a trampoline for SUBR-NAME and return its filename."
   (let ((trampoline-sym (comp-trampoline-sym subr-name))
         (lambda-list (comp-make-lambda-list-from-subr
@@ -2608,9 +2608,13 @@ comp-tampoline-compile
                (comp-trampoline-filename subr-name)
                (concat dir
                        comp-native-version-dir))
-      when (file-writable-p f)
+      when (or (file-writable-p f)
+               (unwind-protect
+                   (progn
+                     (make-directory (file-name-directory f) t)
+                     t)))
         do (cl-return f)
-      finally (error "Can't find a writable directory in \
+      finally (error "Cannot find suitable directory for output in \
 `comp-eln-load-path'")))))
 
 ;;;###autoload
@@ -2621,7 +2625,7 @@ comp-subr-trampoline-install
     (let ((trampoline-sym (comp-trampoline-sym subr-name)))
       (cl-assert (subr-primitive-p (symbol-function subr-name)))
       (load (or (comp-search-trampoline subr-name)
-                (comp-tampoline-compile subr-name))
+                (comp-trampoline-compile subr-name))
             nil t)
       (cl-assert
        (subr-native-elisp-p (symbol-function trampoline-sym)))
-- 
2.28.0