#578 LOAD does not close input file on abort

lisp error
closed-fixed
clisp (525)
5
2014-08-28
2010-11-29
Anonymous
No

If a LOAD is aborted for some reason, the input file is not close. That can cause later errors when trying to open the file with different options. Here is a simplified version of the example that caused me some trouble:
$ echo 1 > foo.lisp
$ echo -e '\0' > foo.fas
$ clisp -norc
i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8

Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010

Type :h and hit Enter for context help.

[1]> (load "foo.fas")

*** - READ from #<INPUT BUFFERED FILE-STREAM CHARACTER #P"foo.fas" @1>:
illegal character #\Null
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [2]> :r1
[3]> (compile-file "foo.lisp")

** - Continuable Error
OPEN: #<INPUT BUFFERED FILE-STREAM CHARACTER #P"foo.fas" @1> already points to
file "/tmp/foo.fas", opening the file again for :OUTPUT may produce
unexpected results
If you continue (by typing 'continue'): Open the file anyway
The following restarts are also available:
ABORT :R1 Abort main loop
Break 1 [4]> :r1
[5]>

It was a surprise to me that the earlier failed LOAD interfered with the later attempt to use COMPILE-FILE. I expected the two operations to be fully independent. If LOAD closed its input file on abort, I think this problem would have been avoided.

I'm using CLISP 2.49 built from source on 64-bit Linux.

Discussion

  • Sam Steingold

    Sam Steingold - 2010-11-29

    thank you for your bug report.
    the bug has been fixed in the CVS tree.
    you can either wait for the next release (recommended)
    or check out the current CVS tree (see http://clisp.cons.org\)
    and build CLISP from the sources (be advised that between
    releases the CVS tree is very unstable and may not even build
    on your platform).

     
  • Sam Steingold

    Sam Steingold - 2010-11-29
    • assigned_to: haible --> sds
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks