From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#63260: 29.0.90; Regression installing/activating packages without autoloads Date: Sun, 07 May 2023 19:37:26 +0000 Message-ID: <87jzxkgcg9.fsf@posteo.net> References: <87ild8tnbg.fsf@tcd.ie> <87ttwsnn59.fsf@gmail.com> <87zg6kysao.fsf@tcd.ie> <87lei3nv24.fsf@gmail.com> <87a5yhtxkw.fsf@tcd.ie> <83sfc9fva8.fsf@gnu.org> <87mt2go4ne.fsf@tcd.ie> <83pm7ce7p2.fsf@gnu.org> <87y1m0co2z.fsf@posteo.net> <83fs88e1yz.fsf@gnu.org> <87jzxkcmk0.fsf@posteo.net> <83cz3ce0qq.fsf@gnu.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="24729"; mail-complaints-to="usenet@ciao.gmane.io" Cc: contovob@tcd.ie, 63260@debbugs.gnu.org, rpluim@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 07 21:38:24 2023 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 1pvkDA-0006GV-3W for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 May 2023 21:38:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvkCr-0007o5-Js; Sun, 07 May 2023 15:38:06 -0400 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 1pvkCo-0007np-FQ for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 15:38:02 -0400 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 1pvkCo-0006MA-6l for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 15:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pvkCo-0001gQ-2R for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 15:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2023 19:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63260 X-GNU-PR-Package: emacs Original-Received: via spool by 63260-submit@debbugs.gnu.org id=B63260.16834882606437 (code B ref 63260); Sun, 07 May 2023 19:38:02 +0000 Original-Received: (at 63260) by debbugs.gnu.org; 7 May 2023 19:37:40 +0000 Original-Received: from localhost ([127.0.0.1]:38555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvkCR-0001fl-JY for submit@debbugs.gnu.org; Sun, 07 May 2023 15:37:40 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:43727) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvkCM-0001fT-22 for 63260@debbugs.gnu.org; Sun, 07 May 2023 15:37:37 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id EA995240170 for <63260@debbugs.gnu.org>; Sun, 7 May 2023 21:37:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683488248; bh=aSEdL0YBFtnSVs/9fr7gwjwlb/7yZqXw7gT+565nTJo=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=SHc4FcbFR4PsgrJqSIjT2kkRNEgJdCISW/hPWKzuYvYgevHpFlENOumLX43fzQDMG U5IXDa633JQzTpknzXXFgPBiNjCm4VfSp7r/mSuxjJwGszO5pSlRNSAAd9F/2RKexG tAVFL7QrYscIfrZJmh99/hgM6qN3n1PXwt7uorECmnNL5vtKgVptpg9gxGK27ch+rV gi/wcuvpKbD/UGKUKHOW6/dmCjZKFQ17NnQV4y55pk2WWmF+xvtN0WxodUyvN6v094 HXvU7DBQIx8cHZ9lNRKSH319fyu0iEf3pXaoSHAD2/rm2OfOijBUJ+aF1TUfTOkHe1 JCdm5nQ0H7ehw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QDvnz38s7z9rxM; Sun, 7 May 2023 21:37:27 +0200 (CEST) In-Reply-To: <83cz3ce0qq.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 May 2023 16:21:01 +0300") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM 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:261276 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: contovob@tcd.ie, 63260@debbugs.gnu.org, rpluim@gmail.com >> Date: Sun, 07 May 2023 13:12:47 +0000 >> >> One hack might just be to check if `loaddefs-generate' has generated >> anything at all or not, and if that is not the case to do so manually in >> package.el. The reason this doesn't seem nice, is that we'd have to >> make the fact that `loaddefs-generate' does not generate a OUTPUT-FILE >> if there is no file with autoloads explicit, and finding a justification >> for that is difficult. Alternatively, this could be done inside of >> `loaddefs-generate'? Something like > > Assuming it solves the issue and doesn't break anything, the latter > sounds good to me, better than the alternatives. > >> + ;; HACK: If no file with autoloads were found, but EXTRA-DATA was >> + ;; passed, we still want to generate a file. > > The comment says "EXTRA-DATA was passed", but this added snipped will > also run if EXTRA-DATA was NOT passed, but the OUTPUT-FILE doesn't > exist, right? Right, the code was not tested as I was in a hurry. I've changed it to ;; HACK: If no file with autoloads were found, but EXTRA-DATA was ;; passed, we still want to generate a file. (when (and extra-data (not (file-exists-p output-file))) and this file is generated when installing the SICP package: --8<---------------cut here---------------start------------->8--- ;;; sicp-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- ;; Generated by the `loaddefs-generate' function. ;; This file is part of GNU Emacs. ;;; Code: (add-to-list 'load-path (or (and load-file-name (file-name-directory load-file-name)) (car load-path))) ;;; End of scraped data (provide 'sicp-autoloads) ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t ;; no-native-compile: t ;; coding: utf-8-emacs-unix ;; End: ;;; sicp-autoloads.el ends here --8<---------------cut here---------------end--------------->8--- and this does not break anything when installing packages. > And I would explain in the comment the real-life situations where this > is needed, and why, rather than just explaining in English what the > code does. You are right. How does this patch look like: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Ensure-that-EXTRA-DATA-are-always-written-when-gener.patch >From 08c914abaa37bfb1f84ca7a357cc6e01ccfd254f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 7 May 2023 21:37:01 +0200 Subject: [PATCH] Ensure that EXTRA-DATA are always written when generating autoloads * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Handle edge-case where no autoloads are found. (Bug#63260) --- lisp/emacs-lisp/loaddefs-gen.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 2a46fb7a022..5db9af21508 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -656,7 +656,20 @@ loaddefs-generate (write-region (point-min) (point-max) loaddefs-file nil 'silent) (byte-compile-info (file-relative-name loaddefs-file (car (ensure-list dir))) - t "GEN"))))))) + t "GEN"))))) + + ;; If processing files without any autoloads, the above loop will + ;; not generate any files. If the function was invoked with + ;; EXTRA-DATA, we want to ensure that even if no autoloads were + ;; found, that at least a file will have been generated containing + ;; the contents of EXTRA-DATA: + (when (and extra-data (not (file-exists-p output-file))) + (with-temp-buffer + (insert (loaddefs-generate--rubric output-file nil t)) + (search-backward "\f") + (insert extra-data) + (ensure-empty-lines 1) + (write-region (point-min) (point-max) output-file nil 'silent))))) (defun loaddefs-generate--print-form (def) "Print DEF in a format that makes sense for version control." -- 2.39.2 --=-=-= Content-Type: text/plain > Thanks. --=-=-=--