Package: texmacs
Version: 1:1.0.6-7
Severity: normal
Tags: patch

If the system's version of maxima is unsupported by TeXmacs (unstable
has 5.9.3, while 1.0.6 only supports up to 5.9.2), TeXmacs will go into an
infinite loop, and execute tm_maxima repeatedly if you do
"Insert -> Session -> Maxima", then hit return twice.

I've attached a patch that detects this and aborts the loop.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-amd64-k8
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)

Versions of packages texmacs depends on:
ii  gs-gpl                        8.50-1.1   The GPL Ghostscript PostScript int
ii  guile-1.6-libs                1.6.8-3    Main Guile libraries
ii  libc6                         2.3.6-15   GNU C Library: Shared libraries
ii  libfreetype6                  2.2.1-2    FreeType 2 font engine, shared lib
ii  libgcc1                       1:4.1.1-8  GCC support library
ii  libguile-ltdl-1               1.6.8-3    Guile's patched version of libtool
ii  libltdl3                      1.5.22-4   A system independent dlopen wrappe
ii  libstdc++6                    4.1.1-8    The GNU Standard C++ Library v3
ii  libx11-6                      2:1.0.0-7  X11 client-side library
ii  libxext6                      1:1.0.0-4  X11 miscellaneous extension librar
ii  tetex-base                    3.0-19     Basic library files of teTeX
ii  tetex-bin                     3.0-17     The teTeX binary files
ii  tetex-extra                   3.0-19     Additional library files of teTeX
ii  texmacs-common                1:1.0.6-7  WYSIWYG mathematical text editor u
ii  xbase-clients                 1:7.1.ds-2 miscellaneous X clients
ii  zlib1g                        1:1.2.3-13 compression library - runtime

Versions of packages texmacs recommends:
ii  ispell                  3.1.20.0-4.3     International Ispell (an interacti
ii  libjpeg-progs           6b-13            Programs for manipulating JPEG fil
ii  libtiff-tools           3.8.2-5          TIFF manipulation and conversion t
ii  netpbm                  2:10.0-10.1      Graphics conversion tools
pn  texmacs-extra-fonts     <none>           (no description available)
ii  xfig                    1:3.2.5-alpha5-4 Facility for Interactive Generatio

-- no debconf information
diff -r fe12759868aa TeXmacs/progs/utils/plugins/plugin-cmd.scm
--- a/TeXmacs/progs/utils/plugins/plugin-cmd.scm        Mon Jul 10 20:14:14 
2006 -0400
+++ b/TeXmacs/progs/utils/plugins/plugin-cmd.scm        Mon Jul 10 21:34:03 
2006 -0400
@@ -55,17 +55,22 @@
 
 (tm-define (plugin-async-feed name session t)
   "Evaluate tree @t for plug-in @name and return unique handle or error"
-  (with status (connection-status name session)
-    (cond ((in? status '(3 1)) (string-append "error: " name "#is busy"))
-         ((== status 0)
-          (with message (connection-start name session #t)
-            (if (== message "ok")
-                (plugin-async-feed name session t)
-                (string-append "error: " message))))
-         ((== status 2)
-          (with handle (plugin-async-new name session "output")
-            (connection-write name session t)
-            handle)))))
+  (plugin-async-feed-helper name session t 0))
+
+(define (plugin-async-feed-helper name session t ndead)
+  (if (> ndead 2)
+      (string-append "error: " name "#dies repeatedly")
+      (with status (connection-status name session)
+        (cond ((in? status '(3 1)) (string-append "error: " name "#is busy"))
+         ((== status 0)  ; CONNECTION_DEAD
+          (with message (connection-start name session #t)
+            (if (== message "ok")
+                (plugin-async-feed-helper name session t (1+ ndead))
+                (string-append "error: " message))))
+         ((== status 2)
+          (with handle (plugin-async-new name session "output")
+            (connection-write name session t)
+            handle))))))
 
 (define (plugin-async-active? handle)
   "Is the evaluation still going on?"
diff -r fe12759868aa plugins/maxima/bin/tm_maxima
--- a/plugins/maxima/bin/tm_maxima      Mon Jul 10 20:14:14 2006 -0400
+++ b/plugins/maxima/bin/tm_maxima      Mon Jul 10 21:34:03 2006 -0400
@@ -9,11 +9,11 @@ case $1 in
           | maxima_filter;;
       clisp) exec maxima -i "$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.6.lisp" \
           | maxima_filter;;
-      *) echo -e "\2latex:\\red Unsupported lisp for old maxima: $2\5"
+      *) echo -e "\2latex:\\\\red Unsupported lisp for old maxima: $2\5"
     esac;;
   5.9.0) exec maxima -u $1 -l $2 -p 
"$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.9.0.lisp" \
       | maxima_filter;;
   5.9.1) exec maxima -u $1 -l $2 -p 
"$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.9.1.lisp";;
   5.9.1.1* | 5.9.2*) exec maxima -u $1 -l $2 -p 
"$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.9.2.lisp";;
-  *) echo -e "\2latex:\\red Unsupported version of maxima: $1\5"
+  *) echo -e "\2latex:\\\\red Unsupported version of maxima: $1\5"
 esac
diff -r fe12759868aa src/Resource/Connections/connection.cpp
--- a/src/Resource/Connections/connection.cpp   Mon Jul 10 20:14:14 2006 -0400
+++ b/src/Resource/Connections/connection.cpp   Mon Jul 10 21:34:03 2006 -0400
@@ -297,6 +297,7 @@ connection_retrieve (string name, string
     else if (is_document (next)) doc << A (next);
     else doc << next;
     if (con->status == WAITING_FOR_INPUT) break;
+    if (con->status == CONNECTION_DEAD) return "";
   }
   if (N(doc) == 0) return "";
   // cout << "Retrieved " << doc << "\n";

Reply via email to