Subject: bug#64985: closed (Re: bug#64985: 29.1; [PATCH] Byte-compilation of packages via package-vc doesn't correctly handle .elpaignore wildcards)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 02 Aug 2023 18:09:02 +0000

Your bug report

#64985: 29.1; [PATCH] Byte-compilation of packages via package-vc doesn't correctly handle .elpaignore wildcards

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
64985: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64985
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#64985: 29.1; [PATCH] Byte-compilation of packages via package-vc doesn't correctly handle .elpaignore wildcards
From: Jim Porter <[email-masked]>
To: Philip Kaludercic <[email-masked]>
Cc: Mattias Engdegård <[email-masked]>, [email-masked]
Date: Wed, 2 Aug 2023 11:08:17 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 8/1/2023 12:21 PM, Philip Kaludercic wrote:
> Jim Porter <[email-masked]> writes:
> 
>> How about this? For extra micro-optimization, I put the 'mapconcat'
>> call outside of the loop. Now we won't concat the same list of strings
>> for every file/dir that we look at.
> 
> I like this a lot more, thanks.

Thanks. Now merged to the release branch as da5e05a50e8. Marking this 
bug closed.

Subject: 29.1; [PATCH] Byte-compilation of packages via package-vc doesn't correctly handle .elpaignore wildcards
From: Jim Porter <[email-masked]>
To: [email-masked]
Date: Mon, 31 Jul 2023 23:20:21 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

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 <[email-masked]>
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))
                       (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)
-- 
2.25.1