Subject: [clisp-list] probe-file bug

From: Peter Wood <[email-masked]>
Date: Fri Feb 15 10:28:12 2002

Hi

The following works on gcl-2.5.0, Lispworks-4.1 (personal), and
Allegro 6.1 (trial), but fails in clisp.

#<output buffered file-stream character #P"probe-file.txt" @1>
[2]> (probe-file #"/home/prw/.inputrc")

*** - no file name given: #P"/home/prw/.inputrc"
1. Break [3]> :a

[4]> (probe-file "/home/prw/.inputrc")

*** - no file name given: #P"/home/prw/.inputrc"
1. Break [5]> :a

[6]> (probe-file "/home/prw/.pinputrc")

*** - no file name given: #P"/home/prw/.pinputrc"
1. Break [7]> :a

[8]> (dribble)
-rw-r--r--   1 prw      nofiles      2462 Jul 30  2001 /home/prw/.inputrc
GNU CLISP 2.27 (released 2001-07-17) (built 3205317348) (memory 3205318651)
Linux localhost.localdomain 2.4.5 #1 Fri Jun 22 23:12:44 CEST 2001 i586 unknown

[6] should return nil, and [2] and [4] should return the name of the
file.

Regards,
Peter

---

From: Sam Steingold <[email-masked]>
Date: Sun Feb 17 22:04:02 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] probe-file bug"
> * Sent on Fri, 15 Feb 2002 19:12:11 +0100
> * Honorable Peter Wood <[email-masked]> writes:
>

this is a feature, not a bug.
<http://clisp.cons.org/impnotes.html#d39e11164>

#".foo"
==>
#S(PATHNAME :HOST NIL :DEVICE NIL :DIRECTORY (:RELATIVE) :NAME NIL :TYPE "foo"
   :VERSION NIL)

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
Sex is like air.  It's only a big deal if you can't get any.

---

From: Peter Wood <[email-masked]>
Date: Sat Feb 23 09:05:01 2002

> #S(PATHNAME :HOST NIL :DEVICE NIL :DIRECTORY (:RELATIVE) :NAME NIL :TYPE "foo"

Hi,

After due reflection and experimentation, I have to say I disagree.  I
was going to ask about this on CLL but after a pause from it, reading
the last 100 or so messages made me feel distinctly sick.  Even sicker
than reading up on the pathnames section of the hyperspec.

On unix, a filename does _not_ have the sort of type which Clisp is
insisting on.  Also, a directory is not radically different to a file,
so why can't #'probe-file take a directory?  It can on all the other
lisp implementations to which I have access (Gcl, CMUCL, Lispworks
Personal and Allegro trial).

On all the mentioned implementations (probe-file X) where X can be a
string naming a directory or file, with or without a trailing slash in
the case of a directory, works just fine as a test for the existence
of X, and where the return value can be used sensibly.

I have to jump through rings to get something like it to work on
Clisp, and chuck portability out the window.  Please don't quote the
spec at me, because Clisp needs ext:probe-directory to help in cases
like this, and don't refer me to CLL - I've had my year's fill of old
farts rambling about VAX and multics and LispM's filesystems.

Maybe its not a bug.  It's certainly NOT a feature.

Regards,
Peter

---

From: Dave Pearson <[email-masked]>
Date: Tue Mar 5 09:31:03 2002

On Sat, Feb 23, 2002 at 05:50:01PM +0100, Peter Wood wrote:

> I have to jump through rings to get something like it to work on Clisp,
> and chuck portability out the window. [SNIP]

How is

,----
| (probe-file
|  (merge-pathnames
|   (user-homedir-pathname)
|   (make-pathname :name ".inputrc")))
`----

not portable?

-- 
Dave Pearson
http://www.davep.org/

---

From: Peter Wood <[email-masked]>
Date: Tue Mar 5 11:31:12 2002

> |   (make-pathname :name ".inputrc")))

Hi, Dave

Here's the bit you censored out:

"On all the mentioned implementations (probe-file X) where X can be a
string naming a directory or file, with or without a trailing slash in
the case of a directory, works just fine as a test for the existence
of X, and where the return value can be used sensibly.

I have to jump through rings to get something like it to work on
Clisp, and chuck portability out the window."

If you reread that, I think you'll agree that your code doesn't apply
to what I'm talking about.

Here is the challenge:

Write a few lines of portable Common Lisp code which will accept a
string and test wether it names an existing file or directory, and
return a useable pathname if it does.

On all the other implementations (probe-file X) does it.

Regards,
Peter

---

From: Dave Pearson <[email-masked]>
Date: Wed Mar 6 02:28:01 2002

> Here's the bit you censored out:

Don't you think "censored" is a strong word for a common SNIP to keep email
length down?

> [SNIP]
> 
> If you reread that, I think you'll agree that your code doesn't apply to
> what I'm talking about.

Sure, but I was wondering more about the name/type problem you were
referring to at the start of your email (I'd, possibly incorrectly, assumed
that this was a portability issue for you too).

-- 
Dave Pearson
http://www.davep.org/

---

From: Sam Steingold <[email-masked]>
Date: Sun Mar 17 22:01:04 2002

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] probe-file bug"
> * Sent on Sat, 23 Feb 2002 17:50:01 +0100
> After due reflection and experimentation, I have to say I disagree.  

I just committed a patch which will make CLISP parse namestrings as you
expect.
To get the old behavior back, set *parse-namestring-dot-file* to :TYPE.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
Good judgment comes from experience and experience comes from bad judgment.