[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [spr6217] FORMAT bug in ACL4.0.1 (after patch installed)

[This matter has been assigned the tracking identifier "spr6217".
Please refer to it in any followup communication.  Also, be sure
to cc bugs@franz.com so that if I am unavailable someone else will
be able to respond.]

   I'm running ACL-4.0.1 (with patches through 'patch91') and am having
   trouble with format.  I'm trying to construct a string which I can later
   pass to FORMAT as a control string.  The problem is that when I include
   a sequence such as "~~{" or "~~[" inside a '~:[...~] directive, (so that
   the resulting string contains either a "~{" or "~[" based on a flag),
   FORMAT wants to process the '~{' or '~[ before the '~~'.  It doesn't seem
   to be processing things in a left-to-right order as one would assume.
   Is there some precedence-order in how FORMAT directives are processed?
   I can't seem to find one listed in Cltl-2.

You have run into a known bug in the format control string parser.  it
is a `fencepost' error that starts scanning internal nested substrings
one character too early in some cases, causing incorrect parsing when
said internal string begins with "~~".

A fix is in progress for 4.1 and a patch will possibly be available
before too long after it survives some more testing.  It would be
somewhat more difficult to retrofit a patch to 4.0, though, so I'll
need to ask if there is some particular good reason you are still
running 4.0 instead of 4.1?

Meanwhile, you can possibly workaround the problem by padding the
format string with a space to separate the ~~ from the following
character, or if the extra space is unacceptable, you could try a
substitute hacked version of format tilde using ~/.../.  It isn't
pretty, and it eats an extra format argument, but it works:

   user(13): (defun my-package::my-tilde (s x c a &optional (n 1))
	      (declare (ignore x c a))
	      (write-string "~~~~~~~~~~~~~~~~~~~~~~" s :end n))
   user(14): (format nil "~:[~;~/my-package:my-tilde/{~]" :ignored t)