unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 57562@debbugs.gnu.org
Subject: bug#57562: [PATCH] * lisp/emacs-lisp/comp.el (comp-run-async-workers): Fail more gracefully
Date: Sat, 03 Sep 2022 11:00:09 -0400	[thread overview]
Message-ID: <jwvzgfg7bba.fsf@iro.umontreal.ca> (raw)

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

Tags: patch

Any objection to installing this patch into `emacs-28`?


        Stefan


 In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2022-08-29 built on pastel
Repository revision: b4cabfe2b1be20c2d896da81a8e408b57612905b
Repository branch: work
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type --with-modules --with-cairo --with-tiff=ifavailable
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-emacs-lisp-comp.el-comp-run-async-workers-Fail-.patch --]
[-- Type: text/patch, Size: 3524 bytes --]

From d0a989debc23ddeb692c120fb4aa5b8568e3c754 Mon Sep 17 00:00:00 2001
From: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Sat, 3 Sep 2022 10:51:17 -0400
Subject: [PATCH] * lisp/emacs-lisp/comp.el (comp-run-async-workers): Fail more
 gracefully

Otherwise Emacs may fail to start if it can't find a writable
`~/.emacs.d/eln-cache` directory.
See Debian's bug #1017739.
---
 lisp/emacs-lisp/comp.el | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 306ec918b1a..6e2564236db 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1370,19 +1370,22 @@ comp-spill-lap-function
   (unless byte-to-native-top-level-forms
     (signal 'native-compiler-error-empty-byte filename))
   (unless (comp-ctxt-output comp-ctxt)
-    (setf (comp-ctxt-output comp-ctxt) (comp-el-to-eln-filename
-                                        filename
-                                        (or native-compile-target-directory
-                                            (when byte+native-compile
-                                              (car (last native-comp-eln-load-path)))))))
+    (setf (comp-ctxt-output comp-ctxt)
+          (comp-el-to-eln-filename
+           filename
+           (or native-compile-target-directory
+               (when byte+native-compile
+                 (car (last native-comp-eln-load-path)))))))
   (setf (comp-ctxt-speed comp-ctxt) (alist-get 'native-comp-speed
                                                byte-native-qualities)
         (comp-ctxt-debug comp-ctxt) (alist-get 'native-comp-debug
                                                byte-native-qualities)
-        (comp-ctxt-compiler-options comp-ctxt) (alist-get 'native-comp-compiler-options
-                                                        byte-native-qualities)
-        (comp-ctxt-driver-options comp-ctxt) (alist-get 'native-comp-driver-options
-                                                        byte-native-qualities)
+        (comp-ctxt-compiler-options comp-ctxt)
+        (alist-get 'native-comp-compiler-options
+                   byte-native-qualities)
+        (comp-ctxt-driver-options comp-ctxt)
+        (alist-get 'native-comp-driver-options
+                   byte-native-qualities)
         (comp-ctxt-top-level-forms comp-ctxt)
         (cl-loop
          for form in (reverse byte-to-native-top-level-forms)
@@ -3933,10 +3936,13 @@ comp-run-async-workers
                        "`comp-files-queue' should be \".el\" files: %s"
                        source-file)
          when (or native-comp-always-compile
-                  load ; Always compile when the compilation is
-                       ; commanded for late load.
-                  (file-newer-than-file-p
-                   source-file (comp-el-to-eln-filename source-file)))
+                  load        ; Always compile when the compilation is
+                              ; commanded for late load.
+                  ;; Skip compilation if `comp-el-to-eln-filename' fails
+                  ;; to find a writable directory.
+                  (with-demoted-errors "Async compilation :%S"
+                    (file-newer-than-file-p
+                     source-file (comp-el-to-eln-filename source-file))))
          do (let* ((expr `((require 'comp)
                            (setq comp-async-compilation t)
                            (setq warning-fill-column most-positive-fixnum)
-- 
2.30.2


             reply	other threads:[~2022-09-03 15:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-03 15:00 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-09-03 15:14 ` bug#57562: [PATCH] * lisp/emacs-lisp/comp.el (comp-run-async-workers): Fail more gracefully Eli Zaretskii
2022-09-03 15:24   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03 15:28     ` Eli Zaretskii
2022-09-03 15:41       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03 15:59         ` Eli Zaretskii
2022-09-03 19:16           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03 19:28             ` Eli Zaretskii
2022-09-04  2:02               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-04  5:10                 ` Eli Zaretskii
2022-09-04  5:38                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03 19:17     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03 15:27   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03 15:33     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvzgfg7bba.fsf@iro.umontreal.ca \
    --to=bug-gnu-emacs@gnu.org \
    --cc=57562@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).