GNU bug report logs - #49739
28.0.50; byte-compiled pcase pattern match failure

Previous Next

Package: emacs;

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

Date: Mon, 26 Jul 2021 03:35:02 UTC

Severity: normal

Found in version 28.0.50

Done: Mattias Engdegård <mattiase <at> acm.org>

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 49739 in the body.
You can then email your comments to 49739 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#49739; Package emacs. (Mon, 26 Jul 2021 03:35: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. (Mon, 26 Jul 2021 03:35: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: 28.0.50; byte-compiled pcase pattern match failure
Date: Sun, 25 Jul 2021 23:33:39 -0400
Recently a user reported a bug on Org-mode's mailing list in which 
an org-capture template was failing to fill properly:

https://orgmode.org/list/87fsw3zyjl.fsf <at> ucl.ac.uk/T/#t

I was able to reproduce the issue with emacs -Q and the following 
recipe:

Evaluate the following in *scratch*:

(progn
 (require 'org-capture)
 (org-capture-fill-template "%^t"))

This should prompt the user for a time, instead we hit the `_` 
case in one of the pcase calls in `org-capture-fill-template' 
despite the valid template string. This results in the error:

"unrecognized template placeholder: %^t"

I've observed that this only occurs when 
`org-capture-fill-template' has been byte-compiled.
Re-evaluating the defun results in the expected behavior. And 
byte-compiling the function puts us back in the erroneous state:

(progn
 (byte-compile #'org-capture-fill-template)
 (org-capture-fill-template "%^t")) ; unrecognized template 
 placeholder...

I didn't do a proper git-bisect, but the everything works as 
expected when building from the parent 
(3af2cee64b86e4ce59adb8e8720d92db35039cbc) of the following 
commit:

commit 937b6c18bd6c4806eb1e4c8764db56b314c09056
Author: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date:   Fri Mar 19 17:42:22 2021 -0400

   * lisp/emacs-lisp/pcase.el (pcase-compile-patterns): New 
   function (bug#47261)
   
   Extracted from `pcase--expand`.
   (pcase--expand): Use it.

I tried to do some more debugging, but I'm not familiar with how 
to debug a problem which only crops up in byte-compiled elisp. 
Happy to provide any other information if necessary.

~ Nick




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49739; Package emacs. (Mon, 26 Jul 2021 22:27:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: No Wayman <iarchivedmywholelife <at> gmail.com>
Cc: 49739 <at> debbugs.gnu.org
Subject: Re: bug#49739: 28.0.50; byte-compiled pcase pattern match failure
Date: Tue, 27 Jul 2021 00:26:30 +0200
No Wayman <iarchivedmywholelife <at> gmail.com> writes:

> (progn
>  (require 'org-capture)
>  (org-capture-fill-template "%^t"))
>
> This should prompt the user for a time, instead we hit the `_` case in
> one of the pcase calls in `org-capture-fill-template' despite the
> valid template string. This results in the error:
>
> "unrecognized template placeholder: %^t"

That works for me.  Are there any other requirements, a natively
compiled Emacs or so?

Or maybe "make bootstrap" (i.e. building Emacs from scratch) helps?

If not, are you able to provide a test case?  AFAIU the `pcase' call
causing the trouble fails to compare strings correctly.

If you compile and load a function like

(defun test (string)
  (pcase string
    ("a" 1)
    (_ nil)))

does that work as expected?


TIA,

Michael.




Reply sent to Mattias Engdegård <mattiase <at> acm.org>:
You have taken responsibility. (Tue, 27 Jul 2021 17:11:02 GMT) Full text and rfc822 format available.

Notification sent to No Wayman <iarchivedmywholelife <at> gmail.com>:
bug acknowledged by developer. (Tue, 27 Jul 2021 17:11:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattiase <at> acm.org>
To: 49739-done <at> debbugs.gnu.org
Subject: Re: bug#49739: 28.0.50; byte-compiled pcase pattern match failure
Date: Tue, 27 Jul 2021 19:10:46 +0200
Fixed on master.





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

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

Previous Next


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