Subject: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring

From: Brandon Irizarry <[email-masked]>
Date: Wed, 16 Aug 2023 14:21:53 -0400

To reproduce: in emacs invoked with '-Q', in the Scratch buffer, insert the
following
code:

(require 'cl-macs)

(cl-flet ((fn ((min max))
     (message "%d %d" min max)))
  (fn '(2 3)))

The cl-flet form evaluates fine (e.g. with C-x C-e or C-M-x), which
leads me to conclude that this construct is legal. However, attempting
to instrument the form with Edebug (C-u C-M-x) results in an enormous
backtrace starting with

Debugger entered--Lisp error: (invalid-read-syntax "Expected" "lambda")

If I get rid of the argument destructuring, Edebug works as
expected. For example, I'm able to step through the following code with
Edebug just fine:

(cl-flet ((fn (min max)
     (message "%d %d" min max)))
  (fn 2 3))

=> "2 3"

I should be able to, for example, instrument the destructuring (buggy)
cl-flet form,
run through it with 'g', and see the same output.

In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37,
cairo version 1.16.0)
 of 2023-05-13, modified by Debian built on x86-ubc-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-mPr7Vr/emacs-28.2+1=.
-fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  paredit-mode: t
  ws-butler-mode: t
  global-corfu-mode: t
  corfu-mode: t
  fido-vertical-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  fido-mode: t
  electric-pair-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Load-path shadows:
/home/demo/.emacs.d/elpa/transient-20230810.1716/transient hides
/usr/share/emacs/28.2/lisp/transient
/home/demo/.emacs.d/elpa/xref-1.6.3/xref hides
/usr/share/emacs/28.2/lisp/progmodes/xref
/home/demo/.emacs.d/elpa/project-0.9.8/project hides
/usr/share/emacs/28.2/lisp/progmodes/project
/home/demo/.emacs.d/elpa/eldoc-1.14.0/eldoc hides
/usr/share/emacs/28.2/lisp/emacs-lisp/eldoc

Features:
(shadow sort mail-extr emacsbug sendmail edebug cl-print help-fns
radix-tree org-element avl-tree generator ol-eww eww xdg url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search
eieio-opt speedbar ezimage dframe gnus-art mm-uu mml2015 mm-view
mml-smime smime dig gnus-sum shr kinsoku svg dom gnus-group gnus-undo
gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7
netrc nnoo parse-time gnus-spec gnus-int gnus-range gnus-win gnus
nnheader ol-docview doc-view image-mode exif ol-bibtex ol-bbdb ol-w3m
ol-doi org-link-doi org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete org-list
org-faces org-entities noutline outline org-version ob-emacs-lisp
ob-core ob-eval org-table oc-basic bibtex iso8601 ol org-keys oc
org-compat org-macs org-loaddefs cal-menu calendar cal-loaddefs ert ewoc
debug backtrace find-func movie-data-table rater-table hash-helper
csv-helper parse-csv cl-indent misearch multi-isearch magit-ediff
git-rebase goto-addr vc-mtn vc-hg vc-git vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs vc vc-dispatcher bug-reference magit-extras face-remap
magit-submodule magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff git-commit log-edit message rmc puny rfc822 mml mml-sec
epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
mail-utils gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor shell pcomplete comint server ansi-color
magit-mode transient magit-git magit-base magit-section format-spec
cursor-sensor crm dash mule-util jka-compr ediff-ptch comp comp-cstr
warnings rx cl-extra help-mode diff-mode easy-mmode ediff ediff-merg
ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util
dired-aux dired dired-loaddefs paredit ws-butler cus-edit cus-start
wid-edit macrostep ring pp ffap thingatpt edmacro kmacro web-mode advice
disp-table finder-inf wombat-theme corfu compat compat-29 icomplete
elec-pair cus-load pcase info package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 727871 424820)
 (symbols 48 38766 141)
 (strings 32 238349 577478)
 (string-bytes 1 6177910)
 (vectors 16 81263)
 (vector-slots 8 1667405 1015905)
 (floats 8 484 3251)
 (intervals 56 28782 5018)
 (buffers 992 35))