GNU bug report logs - #59115
29.0.50; byte-recompile-directory incorrectly ignoring files

Previous Next

Package: emacs;

Reported by: No Wayman <iarchivedmywholelife <at> gmail.com>

Date: Tue, 8 Nov 2022 01:26:02 UTC

Severity: normal

Merged with 59076

Found in version 29.0.50

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59115 in the body.
You can then email your comments to 59115 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59115; Package emacs. (Tue, 08 Nov 2022 01:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to No Wayman <iarchivedmywholelife <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 08 Nov 2022 01:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: No Wayman <iarchivedmywholelife <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; byte-recompile-directory incorrectly ignoring files
Date: Mon, 07 Nov 2022 19:49:58 -0500
[Message part 1 (text/plain, inline)]
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

[0001-bytecomp.el-byte-recompile-directory-Fix-negated-ign.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59115; Package emacs. (Tue, 08 Nov 2022 14:36:01 GMT) Full text and rfc822 format available.

Message #8 received at 59115 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: No Wayman <iarchivedmywholelife <at> gmail.com>,
 Philip Kaludercic <philipk <at> posteo.net>
Cc: 59115 <at> debbugs.gnu.org
Subject: Re: bug#59115: 29.0.50;
 byte-recompile-directory incorrectly ignoring files
Date: Tue, 08 Nov 2022 16:35:34 +0200
> From: No Wayman <iarchivedmywholelife <at> 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?




Reply sent to Philip Kaludercic <philipk <at> posteo.net>:
You have taken responsibility. (Wed, 09 Nov 2022 08:41:01 GMT) Full text and rfc822 format available.

Notification sent to No Wayman <iarchivedmywholelife <at> gmail.com>:
bug acknowledged by developer. (Wed, 09 Nov 2022 08:41:01 GMT) Full text and rfc822 format available.

Message #13 received at 59115-done <at> debbugs.gnu.org (full text, mbox):

From: Philip Kaludercic <philipk <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59115-done <at> debbugs.gnu.org, No Wayman <iarchivedmywholelife <at> gmail.com>
Subject: Re: bug#59115: 29.0.50; byte-recompile-directory incorrectly
 ignoring files
Date: Wed, 09 Nov 2022 08:39:54 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: No Wayman <iarchivedmywholelife <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59115; Package emacs. (Sat, 12 Nov 2022 16:02:01 GMT) Full text and rfc822 format available.

Message #16 received at 59115 <at> debbugs.gnu.org (full text, mbox):

From: David Ponce <da_vid <at> orange.fr>
To: 59139 <at> debbugs.gnu.org, 59115 <at> debbugs.gnu.org
Subject: 29.0.50; batch-byte-recompile-directory doesn't recompile file as
 expected
Date: Sat, 12 Nov 2022 17:01:52 +0100
Hello,

If I correctly understood the code, a fix similar to the one applied for Bug#59115
is also needed for directories.  Please find below another patch.
Please also feel free to close this Bug#59139.

diff --git a/bytecomp.el b/bytecomp.el
index c685e50..c81c42e 100644
--- a/bytecomp.el
+++ b/bytecomp.el
@@ -1941,11 +1941,10 @@ also be compiled."
 		      ;; This file is a subdirectory.  Handle them differently.
 		      (or (null arg) (eq 0 arg)
 			  (y-or-n-p (concat "Check " source "? ")))
-		      (setq directories (nconc directories (list source)))
                       ;; Directory 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))
                       (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)


Thanks!




Forcibly Merged 59076 59115. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 12 Nov 2022 20:35:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 11 Dec 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.