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#64985: 29.1; [PATCH] Byte-compilation of packages via package-vc doesn't correctly handle .elpaignore wildcards Date: Tue, 01 Aug 2023 12:20:36 +0000 Message-ID: <87edknj6nf.fsf@posteo.net> References: <8e555eb8-529d-d11c-66c7-bd16f5d45be7@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29283"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64985@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 01 14:21:21 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 1qQoNM-0007MO-Qt for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Aug 2023 14:21:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQoN6-0005pI-4S; Tue, 01 Aug 2023 08:21:04 -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 1qQoN4-0005p2-AI for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2023 08:21:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQoN4-0006zQ-1u for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2023 08:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qQoN3-0000Fk-Jq for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2023 08:21:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Aug 2023 12:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64985 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 64985-submit@debbugs.gnu.org id=B64985.1690892446945 (code B ref 64985); Tue, 01 Aug 2023 12:21:01 +0000 Original-Received: (at 64985) by debbugs.gnu.org; 1 Aug 2023 12:20:46 +0000 Original-Received: from localhost ([127.0.0.1]:47371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQoMo-0000FA-3z for submit@debbugs.gnu.org; Tue, 01 Aug 2023 08:20:46 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:54895) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQoMl-0000Ew-OL for 64985@debbugs.gnu.org; Tue, 01 Aug 2023 08:20:44 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id C6BE8240103 for <64985@debbugs.gnu.org>; Tue, 1 Aug 2023 14:20:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690892437; bh=i4DYQFQEIxU3X/5fMVYewUgl+6jxlRfkddOltBQzPBc=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=XoAT5h1UiGfJZWJAj8MeCaf1qtXydUO8CERwn8Xt3Cmd1s31GJNMHBSV9ffXx750I 0AtURJRb6ln0PoKppxPQXsx233pDCMgjBEWe8Az0fxgew666rU5i839B9mR28zTX2q 3HeFB1VIgDA2mdf1R06EQW+/VujOP/fRnmHPlvKS4d5lewaoiPcZ+xuO5HOIJ5bdhl KHeWUQomdXSBMHB6cs1DD3pyzniJDizdk9uoELJiXkBisyWu0jhx5Qj3wAWbRWTvGc LIYNzThEQ2FPHDX0BttD3KVrhzcYuaAFDltm8mQcsLd9wK6k8RGKT5Mj38Z9ffERB6 LgHt48id1GitA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RFZ2F2VNJz9sS4; Tue, 1 Aug 2023 14:20:37 +0200 (CEST) In-Reply-To: <8e555eb8-529d-d11c-66c7-bd16f5d45be7@gmail.com> (Jim Porter's message of "Mon, 31 Jul 2023 23:20:21 -0700") 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:266446 Archived-At: Jim Porter writes: > When using the various package-vc installation functions, Emacs > byte-compiles the source (good). However, it doesn't ignore sources > that match wildcards in ".elpaignore" (bad). That's because, even > though 'byte-compile-ignore-files' is documented to be a list of > regexps, 'byte-recompile-directory' treats it as a list of strings. I am a bit confused about this point. Why do you think that `byte-recompile-directory' treads `byte-compile-ignore-files' as a list of non-regexp strings? > To reproduce this, install a package via VC, for example via M-x > package-vc-install RET https://github.com/jimporter/urgrep.git > RET. Then notice how "urgrep-tests.el" got compiled, even though it > matches a wildcard in ".elpaignore". > > Patch attached to fix this. Eli, would this be safe enough for 29.2? > 'byte-compile-ignore-files' is a new feature in 29.1, so hopefully no > one else is relying on its current semantics just yet. > > From ec4e198fb9c87653d1e65288969bed1ff548683c Mon Sep 17 00:00:00 2001 > From: Jim Porter > Date: Mon, 31 Jul 2023 23:10:03 -0700 > Subject: [PATCH] Fix handling of ".elpaignore" file when compiling packages > > * lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Treat > 'byte-compile-ignore-files' as a list of regexps per its docstring. > --- > lisp/emacs-lisp/bytecomp.el | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el > index 5b1d958e6c2..d123e68a088 100644 > --- a/lisp/emacs-lisp/bytecomp.el > +++ b/lisp/emacs-lisp/bytecomp.el > @@ -1995,9 +1995,8 @@ byte-recompile-directory > (or (null arg) (eq 0 arg) > (y-or-n-p (concat "Check " source "? "))) > ;; Directory is requested to be ignored > - (not (string-match-p > - (regexp-opt byte-compile-ignore-files) > - source)) > + (not (seq-some (lambda (ex) (string-match-p ex source)) > + byte-compile-ignore-files)) Here also, instead of merging a list of regular expressions into a disjunctive one, you match each individually. Am I missing something, or what does this change? (string-match-p (regexp-opt '("foo" "bar" "baz")) "foo") ;=> 0 (seq-some (lambda (ex) (string-match-p ex "foo")) '("foo" "bar" "baz")) ;=> 0 (string-match-p (regexp-opt '("foo" "bar" "baz")) "quux") ;=> nil (seq-some (lambda (ex) (string-match-p ex "quux")) '("foo" "bar" "baz")) ;=> nil > (setq directories (nconc directories (list source)))) > ;; It is an ordinary file. Decide whether to compile it. > (if (and (string-match emacs-lisp-file-regexp source) > @@ -2007,9 +2006,8 @@ byte-recompile-directory > (not (auto-save-file-name-p source)) > (not (member source (dir-locals--all-files directory))) > ;; File is requested to be ignored > - (not (string-match-p > - (regexp-opt byte-compile-ignore-files) > - source))) > + (not (seq-some (lambda (ex) (string-match-p ex source)) > + byte-compile-ignore-files))) > (progn (cl-incf > (pcase (byte-recompile-file source force arg) > ('no-byte-compile skip-count)