• mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f's avatar
    Fix signalling simple error with #\~ in format string · 6a866834
    (Alan Ruttenberg)
    Signaling an simple error would signal another error if the message
    happened to have a ~ in it, since in simple cases there are no format
    args, but format is called with the message string.
    We fix this by changing all cases in the source where there were calls
    to setFormatControl(x) are followed by setFormatArguments(NIL). In
    such cases we changed setFormatControl(x) ->
    setFormatControl(x.replaceAll("~","~~")), which is the CL:FORMAT
    recipe for escaping a #\~ character.
    To replicate this error, place the following in a file
        (defun foo (x) (funcall x))
        CL-USER> (compile-file "~/work/abcl/double-error")
        ; Compiling /Users/evenson/work/abcl/double-error.lisp ...
        ; (DEFUN FOO ...)
        ; Wrote /Users/evenson/work/abcl/double-error.abcl (0.015 seconds)
        CL-USER> (foo '~)
        Error (FORMAT-ERROR) during printing: #<PROGRAM-ERROR {264F63C5}>
           [Condition of type PROGRAM-ERROR]
    Merges <https://github.com/armedbear/abcl/pull/41>.