Discussion:
[Maxima-discuss] clisp broken on ubuntu?
Gunter Königsmann
2017-07-08 15:07:18 UTC
Permalink
Dear all,

On a machine with a preview version for the next Ubuntu both the git
head and the last release of maxima with clisp run into an error message
when trying to draw or to read a matrix from a file.

Running maxima with sbcl works fine, though.

The problem might be that the preview version isn't fit for productive
use. But as it might indicate a problem with clisp and ubuntu I thought
I'd better ask.

(%i1) build_info();
(%o1)
Maxima version: "branch_5_40_base_102_g10962a64f"
Maxima build date: "2017-07-06 19:50:33"
Host type: "x86_64-pc-linux-gnu"
Lisp implementation type: "CLISP"
Lisp implementation version: "2.49 (2010-07-07) (built 3663837293)
(memory 3708352236)"
(%i2) draw2d(explicit(sin(x),x,1,10));
;; Compiling file
/usr/local/share/maxima/branch_5_40_base_102_g10962a64f/share/draw/grcommon.lisp
...

---- snip ----

;; Compiling file
/usr/local/share/maxima/branch_5_40_base_102_g10962a64f/share/draw/picture.lisp
...
;; Wrote file
/home/gunter/.maxima/binary/branch_5_40_base_102_g10962a64f/clisp/2_49__2010_07_07___built_3663837293___memory_3708352236_/share/draw/picture.fas
0 errors, 0 warnings
*** - Program stack overflow. RESET

[/build/clisp-O4UKdM/clisp-2.49/src/eval.d:573] reset() found no driver
frame (sp=0x7ffc5840d750-0x7ffc58405980)

Exiting on signal 6
Aborted (core dumped)


***@Marius:~$ clisp --version
GNU CLISP 2.49 (2010-07-07) (built on lcy01-31.buildd [127.0.1.1])
Software: GNU C 5.3.1 20160205
gcc -falign-functions=4 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit
-Wreturn-type -Wmissing-declarations -O -DENABLE_UNICODE -DDYNAMIC_FFI
-DDYNAMIC_MODULES -I. -lreadline -lncurses -ldl /usr/lib/libavcall.so
/usr/lib/libcallback.so -lsigsegv libgnu_cl.a
SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED
TRIVIALMAP_MEMORY
libsigsegv 2.10
libreadline 5.2
libffcall 1.11
Features:
(READLINE REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL
COMMON-LISP
LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI
GETTEXT UNICODE BASE-CHAR=CHARACTER WORD-SIZE=64 PC386 UNIX)
C Modules: (clisp i18n syscalls regexp readline)
Installation directory: /usr/lib/clisp-2.49/
User language: ENGLISH
Machine: X86_64 (X86_64) Marius [127.0.1.1]
Robert Dodier
2017-07-08 20:08:59 UTC
Permalink
Post by Gunter Königsmann
(%i2) draw2d(explicit(sin(x),x,1,10));
;; Compiling file
/usr/local/share/maxima/branch_5_40_base_102_g10962a64f/share/draw/grcommon.lisp
...
---- snip ----
;; Compiling file
/usr/local/share/maxima/branch_5_40_base_102_g10962a64f/share/draw/picture.lisp
...
;; Wrote file
/home/gunter/.maxima/binary/branch_5_40_base_102_g10962a64f/clisp/2_49__2010_07_07___built_3663837293___memory_3708352236_/share/draw/picture.fas
0 errors, 0 warnings
*** - Program stack overflow. RESET
I'm getting the same error w/ Clisp 2.49 + Ubuntu 14.04 (32bit x86) +
current Maxima.

After some investigation, it appears the error is actually in
src/plot.lisp, not in the draw package.

plot2d(sin(x), [x, 1, 10]);

is enough to trigger it.

The problem seems to be that EXT:MAKE-PIPE-OUTPUT-STREAM fails,
returning NIL but not signalling a condition. There is code to catch an
error (recently revised in commit 2179776) but it doesn't notice the
stream is null.

I propose to put in a check to see if *GNUPLOT-STREAM* is null after
trying to open it; see patch below. The "HEY" message is only for
debugging, I don't propose to commit it.

However, that begs the question, why is *GNUPLOT-STREAM* null? It seems
to have been working in the recent past. Or has it really been a long
time since anybody tried it? Dunno. Maybe someone can do a Git bisect to
see if/when it stopped working.

best,

Robert Dodier

PS.
$ git diff src/plot.lisp
diff --git a/src/plot.lisp b/src/plot.lisp
index 4a4357e..8dc3507 100644
--- a/src/plot.lisp
+++ b/src/plot.lisp
@@ -93,6 +93,7 @@ sin(y)*(10.0+6*cos(x)),

(defun start-gnuplot-process (path)
#+clisp (let (gnuplot-stream (ext:make-pipe-output-stream path))
+ (format t "HEY START-GNUPLOT-PROCESS, (EXT:MAKE-PIPE-OUTPUT-STREAM ~S) => ~S~%" path gnuplot-stream)
(setq *gnuplot-stream* (cadr gnuplot-stream))
(make-echo-stream (caddr gnuplot-stream) *error-output*))
;; TODO: Forward gnuplot's stderr stream to maxima's stderr output
@@ -123,6 +124,9 @@ sin(y)*(10.0+6*cos(x)),
#-(or clisp cmu sbcl gcl scl lispworks ecl ccl allegro abcl)
(merror (intl:gettext "plotting: I don't know how to tell this Lisp to run Gnuplot."))

+ (if (null *gnuplot-stream*)
+ (merror (intl:gettext "plotting: I tried to execute ~s but *GNUPLOT-STREAM* is still null.~%") path))
+
;; set mouse must be the first command send to gnuplot
(send-gnuplot-command "set mouse"))
Gunter Königsmann
2017-07-09 07:40:17 UTC
Permalink
Dear Robert,

I've found it - and sorry for the noise: I wouldn't have written to the
list if my last try to bisect hadn't (erroneously) told that the problem
already existed in the last release that I had successfully used
together with clisp:

My try to allow gnuplot to forward error messages to the user worked
fine with wxMaxima - but not with plain maxima => reverted the part that
caused this problem. When I have more time I will try to find out what
went wrong.

Thanks a lot,
and

Kind regards,

Gunter.
Robert Dodier
2017-07-09 18:32:01 UTC
Permalink
Post by Gunter Königsmann
My try to allow gnuplot to forward error messages to the user worked
fine with wxMaxima - but not with plain maxima => reverted the part that
caused this problem. When I have more time I will try to find out what
went wrong.
OK. Another datum -- it appears that EXT:MAKE-PIPE-OUTPUT-STREAM
signaled a condition after load("plot.lisp"); which means that the
plotting code is interpreted, but not when the code is compiled. That
seems to be a bug in Clisp -- the code to detect the condition
apparently doesn't work in compiled code.

I say "appears", "seems", and "apparently" because I'm not sure what's
going on -- I didn't investigate carefully. But perhaps this is
something to bear in mind if you are working on this stuff.

best

Robert Dodier

Loading...