Correct behavior for file-write-date? 
Author Message
 Correct behavior for file-write-date?

Under CLISP, if a file doesn't exist when you try to get the time a
file was written (or created), an error is produced:

[2]> (file-write-date "dummy.txt")
*** - FILE-WRITE-DATE: file #P"C:\\usr\\home\\dummy.txt" does not exist
1. Break [11]>

This also happens with Corman Lisp. However, both ACL and LW return
NIL. CLHS says that "An error of type file-error is signaled if the file
system cannot perform the requested operation." So, is this a bug with
ACL & LW?

FYI, I am using Win2000 and the latest versions of each of the Lisp
implementations.

--
Bill Clementson



Tue, 08 Feb 2005 22:30:56 GMT  
 Correct behavior for file-write-date?

Quote:

> Under CLISP, if a file doesn't exist when you try to get the time a
> file was written (or created), an error is produced:
> This also happens with Corman Lisp. However, both ACL and LW return
> NIL. CLHS says that "An error of type file-error is signaled if the
> file system cannot perform the requested operation." So, is this a bug
> with ACL & LW?

That's not what I'm reading, exactly.  The description of
file-write-date says:

Description:

Returns a universal time representing the time at which the file
specified by pathspec was last written (or created), or returns nil if
such a time cannot be determined.

However, I also see where it describes the exceptional behavior.  I
think that the spec here is ambiguous enough for both behaviors to be
considered okay, though I would prefer an exception personally (i.e. if
the file exists, but the write-date cannot be determined, then return
NIL, but if it does not exist, then return a file-error, etc.)

--dave



Tue, 08 Feb 2005 22:45:43 GMT  
 Correct behavior for file-write-date?


Quote:

>> Under CLISP, if a file doesn't exist when you try to get the time a
>> file was written (or created), an error is produced:

>> This also happens with Corman Lisp. However, both ACL and LW return
>> NIL. CLHS says that "An error of type file-error is signaled if the
>> file system cannot perform the requested operation." So, is this a bug
>> with ACL & LW?

>That's not what I'm reading, exactly.  The description of
>file-write-date says:

>Description:

>Returns a universal time representing the time at which the file
>specified by pathspec was last written (or created), or returns nil if
>such a time cannot be determined.

>However, I also see where it describes the exceptional behavior.  I
>think that the spec here is ambiguous enough for both behaviors to be
>considered okay, though I would prefer an exception personally (i.e. if
>the file exists, but the write-date cannot be determined, then return
>NIL, but if it does not exist, then return a file-error, etc.)

I think the latter was our intent.  We wanted to allow for file systems
that don't keep track of modification times.

That still leaves an ambiguous case, though: the user might have permission
to determine that the file exists, but not access its modification time.
This can happen on Unix if you have read permission to the containing
directory, but not execute permission -- you can list the filenames the
directory contains, but not access any of them in any way.

I think this should also signal an error; the NIL case is best left for a
general inability to determine write dates, not a problem with the specific
file.

--

Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.



Tue, 08 Feb 2005 23:08:58 GMT  
 Correct behavior for file-write-date?
* Barry Margolin
| We wanted to allow for file systems that don't keep track of modification
| times.

  `file-write-date takes a pathname designator as argument.  This could be a
  stream.  If this stream is not associated with a file, like a network socket
  or pipe or whatever else the operating system offers and above which the
  Common Lisp implementation has chosen to offer a stream abstraction or
  perhaps even terminal I/O, I expect `nil.  If there is an actual file under
  that pathname designator, I expect a useful value or an error.

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.



Tue, 08 Feb 2005 23:15:22 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Behavior of newline character in ANS Forth, using WRITE-FILE

2. ********** HELP NEEDED IN WRITING BEHAVIOR FILE ******

3. g77 fortran - strange behavior writing binary file

4. Strange file writing behavior

5. Writing the date/time to output files.

6. Set File last written date

7. Setting FILE-WRITE-DATE

8. correct behavior

9. Is this behavior correct?

10. the correct behavior

11. correct Numeric behavior?

12. Correct behavior for failure during __init__()

 

 
Powered by phpBB® Forum Software