OK,
Here is a simplified session with just a 'write' to a file
(%i6) build_info();
Maxima version: 5.12.0
Maxima build date: 23:16 5/28/2007
host type: i686-pc-linux-gnu
lisp-implementation-type: CMU Common Lisp
lisp-implementation-version: 19c Fedora Extras release 7.fc6 (19C)
(%o6)
(%i7) system("ls file");
ls: file: No such file or directory
(%o7) #<process 17288 :EXITED>
(%i8) s: openw("file");
(%o8) #<Stream for file "file">
(%i9) system("ls file");
file
(%o9) #<process 17290 :EXITED>
(%i10) printf(s,"Hello");
; ;
; Warning: This function is undefined:
; MLISTP
(%o10) false
(%i11) close(s);
(%o11) true
(%i12) system("ls -l file");
-rw-r--r-- 1 sen users 5 Jul 10 2007 file
(%o12) #<process 17291 :EXITED>
(%i13) s: openw("file");
File-error in function LISP::FD-OPEN: Error opening #P"file", File
exists.
[Condition of type KERNEL:SIMPLE-FILE-ERROR]
Restarts:
0: [CONTINUE ] Return NIL.
1: [MACSYMA-QUIT] Maxima top-level
2: [ABORT ] Skip remaining initializations.
Debug (type H for help)
(LISP::FD-OPEN #P"file" :OUTPUT :ERROR NIL ...)
Source: Error finding source:
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no
longer exists:
target:code/fd-stream.lisp.
0] back
: (LISP::FD-OPEN #P"file" :OUTPUT :ERROR NIL ...)
1: (LISP::OPEN-FD-STREAM #P"file" :DIRECTION :OUTPUT :ELEMENT-TYPE
...)
2: (MEVAL1 (($OPENW) &FILE))
3: (MEVAL (($OPENW) &FILE))
4: ("DEFMSPEC MSETQ" ((MSETQ) $S (# &FILE)))
5: (MEVAL1 ((MSETQ) $S (# &FILE)))
6: (MEVAL ((MSETQ) $S (# &FILE)))
7: (MEVAL* ((MSETQ) $S (# &FILE)))
8: (CONTINUE
#<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*>,
Output = #<Synonym Stream to SYSTEM:*STDOUT*>>
NIL)
9: (MACSYMA-TOP-LEVEL
#<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*>,
Output = #<Synonym Stream to SYSTEM:*STDOUT*>>
NIL)
10: (RUN)
11: (RUN)
12: (RUN)
13: (EXTENSIONS::EVAL-SWITCH-DEMON
#<Command Line Switch "eval" -- ("(cl-user::run)")>)
14: (EXTENSIONS::INVOKE-SWITCH-DEMONS
(#<Command Line Switch "quiet">
#<Command Line Switch "core" --
("/usr/local/lib/maxima/5.12.0/binary-cmucl/maxima.core")>
#<Command Line Switch "eval" -- ("(cl-user::run)")>
#<Command Line Switch "-"> #<Command Line Switch
"-disable-readline">
...)
(("load" . #) ("eval" . #)))
15: ((LABELS LISP::%RESTART-LISP
EXTENSIONS:SAVE-LISP))
16: ((LABELS LISP::RESTART-LISP
EXTENSIONS:SAVE-LISP))
0]
-sen
On Tue, 10 Jul 2007, Raymond Toy wrote:
> Robert Dodier wrote:
>> On 7/8/07, sen1 at math.msu.edu <sen1 at math.msu.edu> wrote:
>>
>>>> (defun $openw (file)
>>>> (open
>>>> (l-string file)
>>>> :direction :output
>>>> :if-exists :supersede
>>>> :if-does-not-exist :create))
>>
>>> %i3) build_info();
>>>
>>> Maxima version: 5.12.0
>>> Maxima build date: 23:16 5/28/2007
>>> host type: i686-pc-linux-gnu
>>> lisp-implementation-type: CMU Common Lisp
>>> lisp-implementation-version: 19c Fedora Extras release 7.fc6 (19C)
>>
>> Hmm. I can't tell what's going on here. You might have to
>> take it up with the CMUCL developers. It seems strange that
>> (open foo :direction :output :if-exists :supersede :if-does-not-exist :create)
>> should cause CMUCL to complain. Maybe you can try it with
>> another Lisp implementation.
>
> I checked version 19c (on Solaris), and (open "foo" ...) works just fine
> even when "foo" already exists.
>
> Something else is going on. Can you run "maxima -g" and when the error
> is encountered, you should be in the debugger. Then type "back" to get
> a backtrace so I can see what's happening.
>
> Also note that cmucl supports a type of versioning for files, using
> Emacs-style file versions like foo~1~, foo~2~ and so on. I've forgotten
> how to enable that, though. You might have to modify openw to to make
> this work. Perhaps (open "foo" :if-exists :new-version)?
>
> Ray
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
--
---------------------------------------------------------------------------
| Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu |
| Mathematics Department | |
| Michigan State University | telephone: 517-355-9684 |
| E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 |
---------------------------------------------------------------------------