From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16236"; mail-complaints-to="usenet@ciao.gmane.io" To: 57562@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 03 17:04:36 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oUUhH-00040s-Ng for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Sep 2022 17:04:36 +0200 Original-Received: from localhost ([::1]:52084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUUhG-000351-Fz for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Sep 2022 11:04:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUUdq-0007cv-FU for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2022 11:01:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUUdq-0003wt-43 for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2022 11:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUUdp-0007o8-MX for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2022 11:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Sep 2022 15:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57562 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166221723027670 (code B ref -1); Sat, 03 Sep 2022 15:01:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Sep 2022 15:00:30 +0000 Original-Received: from localhost ([127.0.0.1]:42606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUUdJ-0007Al-LW for submit@debbugs.gnu.org; Sat, 03 Sep 2022 11:00:30 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUUdI-00075t-7z for submit@debbugs.gnu.org; Sat, 03 Sep 2022 11:00:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUUdH-0007RM-Aw for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2022 11:00:27 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUUdE-0003o6-MH for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2022 11:00:26 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 87586100D03 for ; Sat, 3 Sep 2022 11:00:22 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E1C2C1001F3 for ; Sat, 3 Sep 2022 11:00:20 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1662217220; bh=P9NPUXe7V812Kqqu18XC1CbucaE4wIJIEX+0osZ+eMI=; h=From:To:Subject:Date:From; b=VcUyfjkRyo9N4DFkWtn+APT62P4VI0hHQUHHCKxyjcI638SWq3mRD2WWB7/bDVIee EfqzBLJu8pOgUR5PW/bQbc83qBR3th7mmHgmM2lMZNVG1N32JgqhERWBakCKN/Pz1E kbuWWoyYkOfh9hFH1J91cx1x01hLbIM9Oht1z/de8nPLQzmw9h9iVzHeBADBNzlkaq we8jlQyy+3JMPaXO8z2VkA+hOMAEPhqCeTGmX7wmQMCZ5Avuc8TjjGVHmRBnMdBt8m JSpf2KGdOemANRJyksnU0drQWgNxx55/hSnJ/MOFlWHsQkxMrhOBeu9A8yUxV8a2Sb oznvRNeRePq4g== Original-Received: from pastel (unknown [157.52.9.190]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C0DB1120609 for ; Sat, 3 Sep 2022 11:00:20 -0400 (EDT) Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241413 Archived-At: --=-=-= Content-Type: text/plain 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' --=-=-= Content-Type: text/patch Content-Disposition: inline; filename=0001-lisp-emacs-lisp-comp.el-comp-run-async-workers-Fail-.patch >From d0a989debc23ddeb692c120fb4aa5b8568e3c754 Mon Sep 17 00:00:00 2001 From: Stefan Monnier 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 --=-=-=--