Bug 695379

Summary: The load() function doesn't work for maxima compiled with SBCL
Product: [Fedora] Fedora EPEL Reporter: J. J. Ramsey <jjramsey>
Component: maximaAssignee: Rex Dieter <rdieter>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: jamatos, rdieter
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-12 20:37:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Simple test file for Maxima, takes the derivative of x^2. none

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.