Bug 695379 - The load() function doesn't work for maxima compiled with SBCL
Summary: The load() function doesn't work for maxima compiled with SBCL
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: maxima
Version: el6
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Rex Dieter
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-11 14:31 UTC by J. J. Ramsey
Modified: 2011-04-12 20:41 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-04-12 20:37:49 UTC
Type: ---


Attachments (Terms of Use)
Simple test file for Maxima, takes the derivative of x^2. (32 bytes, application/octet-stream)
2011-04-11 14:31 UTC, J. J. Ramsey
no flags Details

Description J. J. Ramsey 2011-04-11 14:31:13 UTC
Created attachment 491249 [details]
Simple test file for Maxima, takes the derivative of x^2.

Description of problem: The load() function returns an error, at least when its argument is a Maxima file.

Version-Release number of selected component (if applicable): 5.23.2-1

How reproducible: Always

Steps to Reproduce:
1. Start maxima.

2. Type 

  load("test.max")$

at the Maxima prompt, where "test.max" is the attached file.
  
Actual results: I get the following error messages:

Maxima encountered a Lisp error:

 READ failure in COMPILE-FILE:
   SB-INT:SIMPLE-READER-ERROR at 4 (line 1, column 4) on #<SB-SYS:FD-STREAM
                                                           for "file /home/jjramsey/Desktop/test.max"
                                                           {1005C29D71}>:
     illegal terminating character after a colon: #\ 

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
; 
; compilation unit aborted
;   caught 1 fatal ERROR condition

Expected results: Maxima displays "foo = 2 x".

Additional info: Typing

  batch("test.max")$

works as expected.

Comment 1 J. J. Ramsey 2011-04-12 20:37:49 UTC
The problem goes away if I rename "test.max" to "test.mac". Turns out that the function that load() uses to identify the file type has changed in newer versions. In Maxima 5.23.2, the function looks like this:

(defun $file_type (fil)
  (let ((typ ($pathname_type fil)))
    (cond
      ((member typ '("l" "lsp" "lisp") :test #'string=)
       '$lisp)
      ((member typ '("mac" "mc" "demo" "dem" "dm1" "dm2" "dm3" "dmt")
               :test #'string=)
       '$maxima)
      (t
       '$object))))

Near as I can tell, if the file name ends in ".mac", ".mc", ".demo", etc., it's counted as a file with Maxima code.

The code from Maxima 5.20.1 reads as follows:

(defun $file_type (fil &aux typ)
  (setq fil (pathname fil))
  (setq typ (format nil "~(~A~)" (pathname-type fil)))
  (or 
   (and (> (length typ) 0)
        (let ((ch (aref typ 0)))
          (cdr (assoc ch '((#\m . $maxima)
                           (#\d . $maxima)
                           (#\l . $lisp)
                           (#\o . $object)
                           (#\f . $object))))))
   '$object))

Near as I can tell, if the file name extension begins with an "m" or "d", it's counted as a file with Maxima code.

I used to be able to load files ending in ".max" in older versions of Maxima, but Maxima's behavior has simply changed in newer versions. That's all.

Comment 2 Rex Dieter 2011-04-12 20:41:50 UTC
Whew, excellent detective-work.


Note You need to log in before you can comment on or make changes to this bug.