bugGNU Common Lisp - Bugs: bug #65440, gcl, mformat and *error-output*

 
 

bug #65440: gcl, mformat and *error-output*

Submitter:  Leo Butler <l_butler>
Submitted:  Sat 09 Mar 2024 07:32:10 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 17 Jan 2025 05:43:08 PM UTC, comment #2: 

Thanks, Camm. But the function does not work correctly. Here is an example where I use error-output throughout. You can see that this is the same behaviour as in the original report. The function should return T.

MAXIMA> (defun my-error-fn (sstring &rest l)
           (mformat error-output "~a" sstring)
   (fresh-line error-output))

MY-ERROR-FN
MAXIMA> (my-error-fn "help")
help
NIL

Leo Butler <l_butler>
Mon 30 Dec 2024 07:32:06 PM UTC, comment #1: 

Greetings, thanks for your report, and please excuse the delayed reply!

By default GCL's error-output is directed toward a separate stream outputting to the unix stderr, which may or may not be directed outside of GCL to the same terminal.  With this binding the file column of error-output is not the same as standard-output.  Your function works as intended if error-output instead of t is passed to mformat.  BTW I get the same results with ordinary format.  Alternatively you can set error-output to standard-output or equivalent if you want the newline detections between the two streams to be synchronized.  THe  default binding is quite useful when redirecting stderr for gcl jobs from the command line.  Please feel free to ask questions if any.

Camm Maguire <camm>
Group administrator
Sat 09 Mar 2024 07:32:10 PM UTC, original submission:  

From: Leo Butler <Leo.Butler@umanitoba.ca>
Subject: [Maxima-discuss] gcl, mformat and error-output
To: maxima-discuss <maxima-discuss@lists.sourceforge.net>
Date: Thu, 7 Mar 2024 21:03:14 +0000 (1 day, 22 hours, 25 minutes ago)

I am trying to figure out what is causing a vexing bug involving GCL,
MFORMAT and ERROR-OUTPUT.

Consider a stripped-down definition of MY-ERROR-FN:

MAXIMA> (defun my-error-fn (sstring &rest l)
(let ((standard-output *error-output*))
           (mformat t "~a" sstring)
   (fresh-line standard-output)))

The return value of MY-ERROR-FN is T if FRESH-LINE prints a newline and
NIL if not.

Here it is with the default value of ERROR-OUTPUT:

MAXIMA> (my-error-fn "An error occurred.")
An error occurred.
NIL

That is a bug, FRESH-LINE should have inserted a newline. What is weird
is that if MFORMAT is replaced by FORMAT, then FRESH-LINE works as
expected. I cannot figure out what MFORMAT is doing that tickles this
bug. Note that this is specific to GCL (tested with v2.6.14).




Here are two good cases, where FRESH-LINE works correctly.

MAXIMA> (setf error-output *standard-output* )

#<synonym stream to TERMINAL-IO>

MAXIMA> (my-error-fn "An error occurred.")
An error occurred.
T


MAXIMA> (setf error-output (make-string-output-stream ))

#<string-output stream 000000000257bc18>
MAXIMA> (my-error-fn "An error occurred.")

T
MAXIMA> (get-output-stream-string error-output)

"An error occurred.
"

TIA,
Leo

Leo Butler <l_butler>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by camm (Posted a comment)
  • -email is unavailable- added by l_butler (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.14-9aa3.
    Corresponding source code