bugGNU Common Lisp - Bugs: bug #23977, ansi tests should close open files

 
 

bug #23977: ansi tests should close open files

Submitted by:  Sam Steingold <sds>
Submitted on:  Fri 01 Aug 2008 06:35:06 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 01 Aug 2008 06:37:15 PM UTC, comment #1:

more information:

some ansi tests fail in clisp because a file which is already open for
input and not closed is re-opened for output:

Test READ-BYTE.ERROR.3 failed
Form:
(PROGN
(LET ((S (OPEN "foo.txt" :DIRECTION :OUTPUT :IF-EXISTS :SUPERSEDE)))
(CLOSE S))
(SIGNALS-ERROR
(LET ((S (OPEN "foo.txt" :DIRECTION :INPUT)))
(UNWIND-PROTECT (READ-BYTE S) (CLOSE S)))
ERROR))
Expected value: T
Actual value: OPEN: #<INPUT BUFFERED FILE-STREAM (UNSIGNED-BYTE 8) #P"foo.txt"> already points to file "/homedata/sds/src/clisp/current/build-O/ansi-tests/foo.txt", opening the file again for :OUTPUT may produce unexpected results.
Test READ-BYTE.ERROR.4 failed

it would be nice if you made sure that you close all streams that you
open to avoid these kinds of errors.
this is simply a good programming practice.
also, strictly speaking,
http://www.lispworks.com/documentation/HyperSpec/Body/f_open.htm says:

"If it is utterly impossible for an implementation to handle some
option in a manner similar to what is specified here, it may simply
signal an error"

- and indeed win32 does not allow two processes (let alone the same
process!) to open a file at the same time.

Sam Steingold <sds>
Fri 01 Aug 2008 06:35:06 PM UTC, original submission:

there are quite a few tests that open files but never explicitly close them (e.g., READ-SEQUENCE.BV.*).
it would be nice if you used with-open-file instead - both out of "hygienic" consideration and because CLISP detects open file overwrites (see http://www.podval.org/~sds/clisp/impnotes/stream-dict.html#open).

Another issue is that some OSes may limit the total number of open file handles a process may have, so you are thus testing OS and not Lisp.

Sam Steingold <sds>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by sds (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup