From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs Subject: bug#59707: 29.0.50; Seeking a more robust `package-quickstart' Date: Wed, 30 Nov 2022 11:13:52 -0800 Message-ID: <87fse08dcf.fsf@rfc20.org> References: <87edtlpact.fsf@rfc20.org> <87cz95rnhf.fsf@rfc20.org> 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="8123"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59707@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 30 20:37: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 1p0Stk-0001wP-DK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 30 Nov 2022 20:37:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0StB-0004f8-TK; Wed, 30 Nov 2022 14:37:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0St6-0004cK-4b for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 14:36:57 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0St5-0000cB-RN for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 14:36:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0SXu-0002MS-2J for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 14:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Nov 2022 19:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59707 X-GNU-PR-Package: emacs Original-Received: via spool by 59707-submit@debbugs.gnu.org id=B59707.16698356489037 (code B ref 59707); Wed, 30 Nov 2022 19:15:02 +0000 Original-Received: (at 59707) by debbugs.gnu.org; 30 Nov 2022 19:14:08 +0000 Original-Received: from localhost ([127.0.0.1]:34577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0SX2-0002Lg-4V for submit@debbugs.gnu.org; Wed, 30 Nov 2022 14:14:08 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:55861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0SWw-0002LC-OQ for 59707@debbugs.gnu.org; Wed, 30 Nov 2022 14:14:06 -0500 Original-Received: (Authenticated sender: matt@rfc20.org) by mail.gandi.net (Postfix) with ESMTPSA id 8965C60004; Wed, 30 Nov 2022 19:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1; t=1669835636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1xro2EEK0rxahz7s8Zaqfp3ES3qvKU9AP9T7HLmGb1g=; b=ccMxcdakcuTzBjEJJFtMLXl/OKxJda1yokIXbF6P0F7vl7BVPo/bVDTUU5OrbMWbwGfttQ SfZlic0efeA+RWdNlYyqeWkBmxsnOPxhZ4v98wbUAsbqYoYZ7ar1F+zWe16MiOpu/AFIE4 kpXkbC2JlQtGOEBgJZfvTQxloHHy81616POCfodZD8N4ykXGN6MTV6Hhb9OXhwqYzoem4D TfG2MScoNS5I7jNUaHqep/EzeTRk17E+9iTdITOVSCZvoQJrVwNdfJmvigkcE2oJ/sflGm 2MLSC8S9jMBoMKDbFqGgopkUY2k3Mw8Idp1S7OpDCIsi9jWmFVAs8jU5tuhXIA== Original-Received: by mac-mini.lan (Postfix) with ESMTPS id 621D53CF64; Wed, 30 Nov 2022 11:13:52 -0800 (PST) Original-Received: by naz.lan (Postfix, from userid 1000) id 3A78543DAD59; Wed, 30 Nov 2022 11:13:52 -0800 (PST) In-Reply-To: <87cz95rnhf.fsf@rfc20.org> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249558 Archived-At: --=-=-= Content-Type: text/plain Matt Armstrong writes: >>> 1) Harden Emacs such that signaled errors from >>> "package-quickstart.elc" don't prevent startup (but are somehow >>> saved and logged, maybe as warnings?). >> >> Agreed. I suspect it should also do things like delete the `.elc` >> file (and/or the `.el` file), or at least suggest doing it, so as to >> help diagnose/circumvent the problem. > > Ok, let's keep it on the list of possibilities. This (attached) approach seems to work in my manual testing. If you like the general idea I can polish it off (try to make a test, etc.). One thing that bothers me: because I fall back to `package--activate-all' even package that successfully activate in the quickstart file can have their activation code run twice, and they aren't necessarily idempotent operations. Do you think this is a significant problem? One possibility is to update `package-activated-list' and `Info-directory-list' incrementally in the quickstart file, so any signaled errors leave `package-activated-list' mostly-correct. This way, `package--activate-all' will attempt to activate only one package twice -- the one that signaled from the quickstart file. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Make-package-activate-all-resilient-to-quickload-err.patch >From 0ec2a7408eb248eef21c0a431eaf9c23cd5e99d3 Mon Sep 17 00:00:00 2001 From: Matt Armstrong Date: Wed, 30 Nov 2022 10:56:59 -0800 Subject: [PATCH] Make `package-activate-all' resilient to quickload errors. If `package-activate-all' fails Emacs fails to start, so if quickloading fails fall back to per-package activation. Note that per-package activation already has logic to report package level actiation errors with `message' and continue. --- lisp/emacs-lisp/package.el | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 8d44fae30a..95921256d6 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1714,16 +1714,23 @@ package-activate-all package-quickstart-file)))) ;; The quickstart file presumes that it has a blank slate, ;; so don't use it if we already activated some packages. - (if (and qs (not (bound-and-true-p package-activated-list))) - ;; Skip load-source-file-function which would slow us down by a factor - ;; 2 when loading the .el file (this assumes we were careful to - ;; save this file so it doesn't need any decoding). - (let ((load-source-file-function nil)) - (unless (boundp 'package-activated-list) - (setq package-activated-list nil)) - (load qs nil 'nomessage)) - (require 'package) - (package--activate-all))))) + (or (and qs (not (bound-and-true-p package-activated-list)) + ;; Skip load-source-file-function which would slow us + ;; down by a factor 2 when loading the .el file (this + ;; assumes we were careful to save this file so it + ;; doesn't need any decoding). + (let ((load-source-file-function nil)) + (unless (boundp 'package-activated-list) + (setq package-activated-list nil)) + (condition-case err + (load qs nil 'nomessage) + ;; If quickstart activation fails fall through to + ;; `package--activate-all' activation. + (error (message "Error loading %s: %s" + qs (error-message-string err)))))) + (progn + (require 'package) + (package--activate-all)))))) ;;;###autoload (defun package--activate-all () -- 2.35.1 --=-=-=--