Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Correct behavior for file-write-date?

8 views
Skip to first unread message

Bill Clementson

unread,
Aug 23, 2002, 10:30:56 AM8/23/02
to
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

Dave Bakhash

unread,
Aug 23, 2002, 10:45:43 AM8/23/02
to
Bill Clementson <bc1...@attbi.com> writes:

> 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

Barry Margolin

unread,
Aug 23, 2002, 11:08:58 AM8/23/02
to
In article <c29d6s9...@no-knife.mit.edu>,

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.

--
Barry Margolin, bar...@genuity.net
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.

Erik Naggum

unread,
Aug 23, 2002, 11:15:22 AM8/23/02
to
* 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.

0 new messages