all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#49746: 28.0.50; bytecompilation introduces bug in org-capture with certain template
@ 2021-07-27 13:58 Gregor Zattler
  2021-07-27 15:25 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-27 15:45 ` Mattias Engdegård
  0 siblings, 2 replies; 4+ messages in thread
From: Gregor Zattler @ 2021-07-27 13:58 UTC (permalink / raw)
  To: 49746

Dear emacs developers, I use org-capture a lot with
org-capture-templates. It stopped working a few days ago,
throwing a error message instead:

org-capture: Capture abort: Unknown template placeholder: "%^g"

This is due to a problem with byte compilation.  It does not
happen, if I remove all .elc files before starting emacs.


You may test it with this:

(custom-set-variables
 '(org-capture-templates '(("d" "diary" entry (file "~/notes.org") "*** %? %^g"))))


in   minconfig.el   and with this invocation of emacs:

~/src/emacs$ src/emacs -Q -l /tmp/minconfig.el --eval '(org-capture 0 "d")'

If this gives you an error, quit emacs, remove all .elc
-files:

~/src/emacs$ find -type f -print0| grep -zZ "\.elc$" |xargs -0r rm

start emacs again:

~/src/emacs$ src/emacs -Q -l /tmp/minconfig.el --eval '(org-capture 0 "d")'

and there is no error.



I narrowed it down to this commit:


51a86b6a0504d580d3e10efe41abf3ae42c90711 is the first bad commit
commit 51a86b6a0504d580d3e10efe41abf3ae42c90711
Author: Mattias Engdegård <mattiase@acm.org>
Date:   Tue Jul 20 17:23:11 2021 +0200

    Count (not X) as a switch condition

    * lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix):
    Treat (not VAR) and (null VAR) as (eq VAR nil) when computing the
    extent of switch ops.

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 6970c8a5055..2968f1af5df 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -4340,6 +4340,16 @@ byte-compile--cond-switch-prefix
                          (push value keys)
                          (push (cons (list value) (or body '(t))) cases))
                        t))))
+             ;; Treat (not X) as (eq X nil).
+             (`((,(or 'not 'null) ,(and var (pred symbolp))) . ,body)
+              (and (or (eq var switch-var) (not switch-var))
+                   (progn
+                     (setq switch-var var)
+                     (setq switch-test 'eq)
+                     (unless (memq nil keys)
+                       (push nil keys)
+                       (push (cons (list nil) (or body '(t))) cases))
+                     t)))
              (`((,(and fn (or 'memq 'memql 'member)) ,var ,expr) . ,body)
               (and (symbolp var)
                    (or (eq var switch-var) (not switch-var))

:040000 040000 ae3e2ceaa690965108fb8547ce6e90ecd2fcaaf3 28eec9e6920160dc5dff29e2567ee34b50924bec M      lisp


The problem came up recently on the org-mode mailing list:
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg138065.html
Especially this message:
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg138121.html
inspired me to do a git bisect and test builds if the throw
this error and if so, if it also happens after removing all
.elc files.

For every step in git bisect I did a

rm -rf * ; git checkout -f ; make 

in order to make sure that all .elc files are build afresh.


Ciao; Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-






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

* bug#49746: 28.0.50; bytecompilation introduces bug in org-capture with certain template
  2021-07-27 13:58 bug#49746: 28.0.50; bytecompilation introduces bug in org-capture with certain template Gregor Zattler
@ 2021-07-27 15:25 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-27 15:45 ` Mattias Engdegård
  1 sibling, 0 replies; 4+ messages in thread
From: Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-27 15:25 UTC (permalink / raw)
  To: Gregor Zattler; +Cc: 49746

Gregor Zattler <telegraph@gmx.net> writes:

> Dear emacs developers, I use org-capture a lot with
> org-capture-templates. It stopped working a few days ago,
> throwing a error message instead:
>
> org-capture: Capture abort: Unknown template placeholder: "%^g"
>
> This is due to a problem with byte compilation.  It does not
> happen, if I remove all .elc files before starting emacs.

This is the same issue as that described in https://bugs.gnu.org/49739,
right?

Thanks,

-- 
Basil





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

* bug#49746: 28.0.50; bytecompilation introduces bug in org-capture with certain template
  2021-07-27 13:58 bug#49746: 28.0.50; bytecompilation introduces bug in org-capture with certain template Gregor Zattler
  2021-07-27 15:25 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-27 15:45 ` Mattias Engdegård
  1 sibling, 0 replies; 4+ messages in thread
From: Mattias Engdegård @ 2021-07-27 15:45 UTC (permalink / raw)
  To: Gregor Zattler; +Cc: 49746-done

Thanks for reporting it. Your bisection saved a lot of time!

Fixed on master. Most embarrassing! Heaven knows what else was miscompiled.






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

* bug#49746: 28.0.50; bytecompilation introduces bug in org-capture with certain template
       [not found] <13106EC8-D99A-413C-9B90-33A700CD5840@acm.org>
@ 2021-07-27 16:10 ` No Wayman
  0 siblings, 0 replies; 4+ messages in thread
From: No Wayman @ 2021-07-27 16:10 UTC (permalink / raw)
  To: Mattias Engdegård
  Cc: Basil L. Contovounesios, Michael Heerdegen, Gregor Zattler, 49746


Mattias Engdegård <mattiase@acm.org> writes:

> forcemerge 49746 49739
> done
>
>>This is the same issue as that described in 
>>https://bugs.gnu.org/49739, right?
>
> Yes, thank you, let's close that one as well.

Gregor and I were on the same path!
I git bisected to the commit mentioned in #49746 this morning and 
was in the process of diffing the disassembled byte-code with a 
known good commit.
Looks like the issue was the strings were being compared via a 
jump-table-eq instead of a jump-table-equal bytecode instruction.
Built off of 949dd41c31dab69f7a5067bba324c28bb2cfbf8e and tested. 
Working fine now.

Thanks to all.






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

end of thread, other threads:[~2021-07-27 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-27 13:58 bug#49746: 28.0.50; bytecompilation introduces bug in org-capture with certain template Gregor Zattler
2021-07-27 15:25 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-27 15:45 ` Mattias Engdegård
     [not found] <13106EC8-D99A-413C-9B90-33A700CD5840@acm.org>
2021-07-27 16:10 ` No Wayman

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.