FORMAT should not silently accept "~<~@>"

Bug #1153148 reported by Jan Moringen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

What I do:
> (format nil "~<~@>")

What happens:
Returns ""

What I expected to happen:
Signals an error about the format string being invalid.

What I do:
> (compile nil (lambda () (format nil "~<~@>")))

What happens:
Compiles without warnings or errors.

What I expected to happen:
Signals a warning or an error about the format string being invalid.

Clisp and ECL accept this format string sliently.

CCL signals an error for this format string:
$ opt/ccl/lx86cl -e '(format nil "~<~@>")'
> Error:
> Atsign flag not allowed
> "~<~@>"
> ^
>
> While executing: CCL::DO-SUB-FORMAT, in process listener(1).
> Type :GO to continue, :POP to abort, :R for a list of available restarts.
> If continued: Skip evaluation of (format nil "~<~@>")
> Type :? for other options.
1 >

$ sbcl --version
SBCL 1.1.5
$ uname -a
Linux ferberit 3.5.0-25-generic #38-Ubuntu SMP Mon Feb 18 23:28:26 UTC 2013 i686 i686 i686 GNU/Linux
$ sbcl --eval '(print *features*)' --quit
(:QUICKLISP :SB-BSD-SOCKETS-ADDRINFO :ASDF2 :ASDF :ASDF-UNICODE
 :ALIEN-CALLBACKS :ANSI-CL :C-STACK-IS-CONTROL-STACK :COMMON-LISP
 :COMPARE-AND-SWAP-VOPS :CYCLE-COUNTER :ELF :GENCGC :IEEE-FLOATING-POINT
 :INLINE-CONSTANTS :LARGEFILE :LINKAGE-TABLE :LINUX :LITTLE-ENDIAN
 :MEMORY-BARRIER-VOPS :MULTIPLY-HIGH-VOPS :OS-PROVIDES-BLKSIZE-T
 :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN :OS-PROVIDES-GETPROTOBY-R
 :OS-PROVIDES-POLL :OS-PROVIDES-PUTWC :OS-PROVIDES-SUSECONDS-T
 :PACKAGE-LOCAL-NICKNAMES :RAW-INSTANCE-INIT-VOPS :SB-CORE-COMPRESSION :SB-DOC
 :SB-EVAL :SB-FUTEX :SB-LDB :SB-PACKAGE-LOCKS :SB-SAFEPOINT
 :SB-SOURCE-LOCATIONS :SB-TEST :SB-THREAD :SB-UNICODE :SBCL
 :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-GROWS-DOWNWARD-NOT-UPWARD :UNIX :UNWIND-TO-FRAME-AND-CALL-VOP :X86)

Revision history for this message
Jan Moringen (scymtym) wrote :

The attached patch causes the above FORMAT directive to signal an error when interpreted or compiled. A test case is included.

Revision history for this message
Stas Boukarev (stassats) wrote :

SBCL could use a better implementation of format, which allows for declarative definition of the number of arguments, their type, and allowed modifiers. And doesn't require to keep two definitions, one for the interpreter, one for the compiler. I'll commit the patch for now. Thanks.

Revision history for this message
Stas Boukarev (stassats) wrote :

commit 7b8eb24427562ae9e3ffe77e0a98899b9786e2b1
Author: Stas Boukarev <email address hidden>
Date: Sun Mar 10 20:15:53 2013 +0400

    format: Signal an error for ~<~@>

    CLHS doesn't allow @ to appear in the closing directive of ~<~>.

    Patch by Jan Moringen.

Changed in sbcl:
status: New → Fix Committed
Stas Boukarev (stassats)
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.