Package: maxima
Version: 5.41.0-3
Severity: normal

While writing a script for Maxima, I wanted to print output to stdout while
simultaneously printing debug output to stderr. I am reporting this as a debian
bug first because console I/O likely ties in to the underlying libraries and
build configuration.



In the documentation for the Maxima "printf" function it states:

> If dest is a stream or true, then printf returns false. Otherwise, printf
> returns a string containing the output. By default the streams stdin, stdout
> and stderr are defined.

However, the output I expected to go to stderr actually went to stdout instead.



Here is a one-liner to show the behaviour:

> maxima --very-quiet -r >maxima-stdout 2>maxima-stderr \
>    'printf(stdout,"stdout~%")$ printf(stderr,"stderr~%")$'

I expect two files: maxima-stdout should contain "stdout" and maxima-stderr
should contan "stderr". Instead, maxima-stdout contains both lines and
maxima-stderr is empty.



Starting up a Maxima session, stdout and stderr does not seem to mean anything
until using them with printf(). After doing that, I can print what stdout and
stderr are connected to:

> Maxima 5.41.0 http://maxima.sourceforge.net
> using Lisp GNU Common Lisp (GCL) GCL 2.6.12
> Distributed under the GNU Public License. See the file COPYING.
> Dedicated to the memory of William Schelter.
> The function bug_report() provides bug reporting information.
> (%i1) stdout;
> (%o1)                               stdout
> (%i2) stderr;
> (%o2)                               stderr
> (%i3) printf(stdout,"Hello")$
> Hello
> (%i4) printf(stderr,"World")$
> World
> (%i5) stdout;
> (%o5)                 #<synonym stream to *TERMINAL-IO*>
> (%i6) stderr;
> (%o6)                 #<synonym stream to *TERMINAL-IO*>



My Maxima bug_report() says this:

-------------------------------------------------------------
Maxima version: "5.41.0"
Maxima build date: "2018-03-29 16:06:55"
Host type: "x86_64-pc-linux-gnu"
Lisp implementation type: "GNU Common Lisp (GCL)"
Lisp implementation version: "GCL 2.6.12"
-------------------------------------------------------------



-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.17.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), 
LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages maxima depends on:
ii  libc6         2.27-5
ii  libgmp10      2:6.1.2+dfsg-3
ii  libreadline7  7.0-5
ii  libx11-6      2:1.6.5-1

Versions of packages maxima recommends:
ii  gnuplot-x11   5.2.2+dfsg1-2
ii  maxima-share  5.41.0-3

Versions of packages maxima suggests:
ii  maxima-doc    5.41.0-3
pn  maxima-emacs  <none>
pn  texmacs       <none>
ii  tk [wish]     8.6.0+9
pn  xmaxima       <none>

-- no debconf information

Reply via email to