GNU bug report logs - #15814
24.3.50; Signal error on malformed bindings in `cl-symbol-macrolet' (patch)

Previous Next

Package: emacs;

Reported by: Nathan Trapuzzano <nbtrap <at> nbtrap.com>

Date: Tue, 5 Nov 2013 20:42:01 UTC

Severity: minor

Tags: patch

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Nathan Trapuzzano <nbtrap <at> nbtrap.com>
Subject: bug#15814: closed (Re: bug#15814: 24.3.50; Signal error on
 malformed bindings in `cl-symbol-macrolet' (patch))
Date: Thu, 07 Nov 2013 04:39:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#15814: 24.3.50; Signal error on malformed bindings in `cl-symbol-macrolet' (patch)

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 15814 <at> debbugs.gnu.org.

-- 
15814: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15814
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Nathan Trapuzzano <nbtrap <at> nbtrap.com>
Cc: 15814-done <at> debbugs.gnu.org
Subject: Re: bug#15814: 24.3.50;
 Signal error on malformed bindings in `cl-symbol-macrolet' (patch)
Date: Wed, 06 Nov 2013 23:38:33 -0500
> I think I understand what you want.  This patch uses
> macroexp--warn-and-return.

Perfect.  Installed.

> I'll try to move the checks in bytecomp.el/cconv.el later.

Thanks, no hurry.


        Stefan

[Message part 3 (message/rfc822, inline)]
From: Nathan Trapuzzano <nbtrap <at> nbtrap.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
 Signal error on malformed bindings in `cl-symbol-macrolet' (patch)
Date: Tue, 05 Nov 2013 15:40:22 -0500
[Message part 4 (text/plain, inline)]
`cl-symbol-macrolet' silently accepts both of the following forms:

(cl-symbol-macrolet ((foo bar baz) ...) ...)
(cl-symbol-macrolet ((foo) ...) ...)

In the former case, baz is ignored; in the latter case, foo is bound to
nil.

According to the CL docs, neither of these is valid.  (Not to mention,
they are both errors in Common Lisp.)  The attached patch asserts
properly formed bindings.

I checked the Emacs source to make sure there's no code in there relying
on this behavior.

[cl-macs.el.patch (text/x-diff, inline)]
From d6feb1195b8dc8f204d49761bfa828facbb4ba57 Mon Sep 17 00:00:00 2001
From: Nathan Trapuzzano <nbtrap <at> nbtrap.com>
Date: Tue, 5 Nov 2013 14:36:32 -0500
Subject: [PATCH] Signal error with malformed bindings in cl-symbol-macrolet.

---
 lisp/ChangeLog             | 5 +++++
 lisp/emacs-lisp/cl-macs.el | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 828fcda..a4ae0ca 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-05  Nathan Trapuzzano  <nbtrap <at> nbtrap.com>
+
+	* emacs-lisp/cl-macs.el (cl-symbol-macrolet): Signal error with
+	malformed bindings form.
+
 2013-11-05  Eli Zaretskii  <eliz <at> gnu.org>
 
 	* international/quail.el (quail-help): Be more explicit about the
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 60fdc09..1e277f7 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1988,6 +1988,8 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
        (cl-symbol-macrolet ,(cdr bindings) ,@body)))
    ((null bindings) (macroexp-progn body))
    (t
+    (cl-assert (and (cdar bindings) (null (cl-cddar bindings))) nil
+	       "Malformed `cl-symbol-macrolet' binding: %S" (car bindings))
     (let ((previous-macroexpand (symbol-function 'macroexpand)))
       (unwind-protect
           (progn
-- 
1.8.4.2


This bug report was last modified 11 years and 273 days ago.

Previous Next


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