all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59115: 29.0.50; byte-recompile-directory incorrectly ignoring files
@ 2022-11-08  0:49 No Wayman
  2022-11-08 14:35 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: No Wayman @ 2022-11-08  0:49 UTC (permalink / raw)
  To: 59115

[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]


Commit 8638aace3fbe01529f33870f469fa60bf5e43ee7
introduced a bug which will cause byte-recompile-directory to 
invert the semantics of the byte-compile-ingore-files option.

To reproduce:

1. mkdir /tmp/bug/ && cd /tmp/bug/
2. Copy an elisp file which would normally be byte-compiled into 
that directory
3. emacs -Q --batch --eval "(byte-recompile-directory 
default-directory 0 'force)"

You should see output similar to:

Checking /tmp/bug...
Done (Total of 0 files compiled)


In general the entire logic of byte-recompile-directory is messy.
Two ifs without elses, lots of negated predicates, etc. I can see 
why the mistake was easy to overlook. This could be further 
refactored to make it easier to read by leveraging when/unless 
appropriately. Perhaps there's an argument for some abnormal hooks 
in place of those long chains of ad-hoc predicates, but I'm more 
interested in fixing the problem now.

The attached patch fixes it for me.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.34, cairo version 1.17.6) of 2022-11-07 built on nbook
Repository revision: 35221a7bd55e18244604376497097f4259c7351b
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 
11.0.12101004
System Description: Arch Linux


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-byte-recompile-directory --]
[-- Type: text/x-patch, Size: 1351 bytes --]

From f2f8a3f09dc020550ef9cbd064db86082cf19a29 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Mon, 7 Nov 2022 19:57:34 -0500
Subject: [PATCH] bytecomp.el (byte-recompile-directory): Fix negated ignore
 logic

Previous logic would only compile files which matched the
byte-compile-ignore-files regular expression.
---
 lisp/emacs-lisp/bytecomp.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 4d258dab96..c685e5087f 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1955,9 +1955,9 @@ byte-recompile-directory
                         (not (auto-save-file-name-p source))
                         (not (member source (dir-locals--all-files directory)))
                         ;; File is requested to be ignored
-                        (string-match-p
-                         (regexp-opt byte-compile-ignore-files)
-                         source))
+                        (not (string-match-p
+                              (regexp-opt byte-compile-ignore-files)
+                              source)))
                    (progn (cl-incf
                            (pcase (byte-recompile-file source force arg)
                              ('no-byte-compile skip-count)
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#59115: 29.0.50; byte-recompile-directory incorrectly ignoring files
  2022-11-08  0:49 bug#59115: 29.0.50; byte-recompile-directory incorrectly ignoring files No Wayman
@ 2022-11-08 14:35 ` Eli Zaretskii
  2022-11-09  8:39   ` Philip Kaludercic
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2022-11-08 14:35 UTC (permalink / raw)
  To: No Wayman, Philip Kaludercic; +Cc: 59115

> From: No Wayman <iarchivedmywholelife@gmail.com>
> Date: Mon, 07 Nov 2022 19:49:58 -0500
> 
> Commit 8638aace3fbe01529f33870f469fa60bf5e43ee7
> introduced a bug which will cause byte-recompile-directory to 
> invert the semantics of the byte-compile-ingore-files option.
> 
> To reproduce:
> 
> 1. mkdir /tmp/bug/ && cd /tmp/bug/
> 2. Copy an elisp file which would normally be byte-compiled into 
> that directory
> 3. emacs -Q --batch --eval "(byte-recompile-directory 
> default-directory 0 'force)"
> 
> You should see output similar to:
> 
> Checking /tmp/bug...
> Done (Total of 0 files compiled)
> 
> 
> In general the entire logic of byte-recompile-directory is messy.
> Two ifs without elses, lots of negated predicates, etc. I can see 
> why the mistake was easy to overlook. This could be further 
> refactored to make it easier to read by leveraging when/unless 
> appropriately. Perhaps there's an argument for some abnormal hooks 
> in place of those long chains of ad-hoc predicates, but I'm more 
> interested in fixing the problem now.
> 
> The attached patch fixes it for me.

Philip, can you look into tis, please?





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#59115: 29.0.50; byte-recompile-directory incorrectly ignoring files
  2022-11-08 14:35 ` Eli Zaretskii
@ 2022-11-09  8:39   ` Philip Kaludercic
  0 siblings, 0 replies; 3+ messages in thread
From: Philip Kaludercic @ 2022-11-09  8:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 59115-done, No Wayman

Eli Zaretskii <eliz@gnu.org> writes:

>> From: No Wayman <iarchivedmywholelife@gmail.com>
>> Date: Mon, 07 Nov 2022 19:49:58 -0500
>> 
>> Commit 8638aace3fbe01529f33870f469fa60bf5e43ee7
>> introduced a bug which will cause byte-recompile-directory to 
>> invert the semantics of the byte-compile-ingore-files option.
>> 
>> To reproduce:
>> 
>> 1. mkdir /tmp/bug/ && cd /tmp/bug/
>> 2. Copy an elisp file which would normally be byte-compiled into 
>> that directory
>> 3. emacs -Q --batch --eval "(byte-recompile-directory 
>> default-directory 0 'force)"
>> 
>> You should see output similar to:
>> 
>> Checking /tmp/bug...
>> Done (Total of 0 files compiled)
>> 
>> 
>> In general the entire logic of byte-recompile-directory is messy.
>> Two ifs without elses, lots of negated predicates, etc. I can see 
>> why the mistake was easy to overlook. This could be further 
>> refactored to make it easier to read by leveraging when/unless 
>> appropriately. Perhaps there's an argument for some abnormal hooks 
>> in place of those long chains of ad-hoc predicates, but I'm more 
>> interested in fixing the problem now.
>> 
>> The attached patch fixes it for me.
>
> Philip, can you look into tis, please?

Yes, the patch makes sense.  I'm going to apply the patch.

Thanks.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-09  8:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  0:49 bug#59115: 29.0.50; byte-recompile-directory incorrectly ignoring files No Wayman
2022-11-08 14:35 ` Eli Zaretskii
2022-11-09  8:39   ` Philip Kaludercic

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.