Discussion:
Wild pathnames
Faré
2014-03-18 02:55:26 UTC
Permalink
Is there a mailing-list where to report such issues, and where to
contact vendors so they fix their bugs?

mkdir -p /tmp/x ; touch "/tmp/x/" ; for i in sbcl ccl clisp cmucl ecl
abcl scl allegro lispworks gcl xcl ; do echo $i ; cl -l $i -iw '(let
((x (directory "/tmp/x/"))) (list "'$i'" x (pathname-name (first
x))))' ; done #cl


Escape properly:
("sbcl" (#P"/tmp/x/\\") "")
("cmucl" (#P"/tmp/x/\\") "")
("ccl" (#P"/tmp/x/\\") "\\")
("lispworks" (#P"/tmp/x/\\") "\\")
("scl" (#P"file://localhost/tmp/x/") "")

Read badly:
("clisp" (#P"/tmp/x/*") :WILD)
("ecl" (#P"/tmp/x/*") :WILD)
("allegro" (#P"/tmp/x/*") :WILD)
("xcl" (#P"/tmp/x/*") :WILD)

Error out:
abcl
Fatal condition:
Bad place for a wild pathname.

gcl:
Fatal condition:
Condition in LET [or a callee]: INTERNAL-SIMPLE-FILE-ERROR: File error
on "/tmp/x/": File "/tmp/x/" is wild

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
It ain't what a man don't know that makes him a fool;
it's the things he knows that ain't so. — Josh Billings
Antoniotti Marco
2014-03-18 16:01:38 UTC
Permalink
On Mar 18, 2014, at 03:55 , Faré <***@gmail.com<mailto:***@gmail.com>> wrote:

Is there a mailing-list where to report such issues, and where to
contact vendors so they fix their bugs?

Each vendor has his/her own mailing list or other contact point where to submit bug reports and other requests. It looks like most vendors are here though.


mkdir -p /tmp/x ; touch "/tmp/x/" ; for i in sbcl ccl clisp cmucl ecl
abcl scl allegro lispworks gcl xcl ; do echo $i ; cl -l $i -iw '(let
((x (directory "/tmp/x/"))) (list "'$i'" x (pathname-name (first
x))))' ; done #cl


Escape properly:
("sbcl" (#P"/tmp/x/\\") "")
("cmucl" (#P"/tmp/x/\\") "")
("ccl" (#P"/tmp/x/\\") "\\")
("lispworks" (#P"/tmp/x/\\") "\\")
("scl" (#P"file://localhost/tmp/x/") "")

Read badly:
("clisp" (#P"/tmp/x/*") :WILD)
("ecl" (#P"/tmp/x/*") :WILD)
("allegro" (#P"/tmp/x/*") :WILD)
("xcl" (#P"/tmp/x/*") :WILD)

Error out:
abcl
Fatal condition:
Bad place for a wild pathname.

gcl:
Fatal condition:
Condition in LET [or a callee]: INTERNAL-SIMPLE-FILE-ERROR: File error
on "/tmp/x/": File "/tmp/x/" is wild

Some of the results are obviously erroneous, but I don’t quite understand some of the others
 (my POSIX-fu being very rusty).

The script you posted is (reformatted)

mkdir -p /tmp/x # Creates directory /tmp/x/
touch "/tmp/x/“ # What is the intended effect here?
for i in sbcl ccl clisp cmucl ecl abcl scl allegro lispworks gcl xcl
do
echo $i
cl -l $i -iw '(let ((x (directory "/tmp/x/"))) (list "'$i'" x (pathname-name (first x))))'
done #cl


If you execute the first two commands on a Mac the result is a just to create the /tmp/x/ directory.

The call to DIRECTORY in CCL then returns:

Welcome to Clozure Common Lisp Version 1.8-store-r15418 (DarwinX8664)!
? (directory "/tmp/x/")
(#P"/private/tmp/x/“) ; Which may be correct by interpreting the CLHS.


The call to DIRECTORY in LW returns

CL-USER 1 > (directory "/tmp/x/")
NIL ; Which may be not be appropriate...


In SBCL you get

This is SBCL 1.0.49, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

* (directory "/tmp/x/")
(#P"/private/tmp/x/“) ; Which may be correct; ditto.


In SBCL and CCL the PATHNAME-NAME returned is NIL. I would have expected no escaping and NIL as pathname names.

Cheers
--
Marco Antoniotti
Martin Simmons
2014-03-18 16:43:10 UTC
Permalink
Post by Antoniotti Marco
The script you posted is (reformatted)
mkdir -p /tmp/x # Creates directory /tmp/x/
touch "/tmp/x/" # What is the intended effect here?
for i in sbcl ccl clisp cmucl ecl abcl scl allegro lispworks gcl xcl
do
echo $i
cl -l $i -iw '(let ((x (directory "/tmp/x/"))) (list "'$i'" x (pathname-name (first x))))'
done #cl
If you execute the first two commands on a Mac the result is a just to create the /tmp/x/ directory.
I suspect that some asterisks got lost in the Faré's email and it was supposed
to create a file name with a single asterisk:

touch "/tmp/x/*"

Likewise for all the results ironically under the heading "Escape properly".
Post by Antoniotti Marco
The call to DIRECTORY in LW returns
CL-USER 1 > (directory "/tmp/x/")
NIL ; Which may be not be appropriate...
LW's DIRECTORY never returns the directory itself (i.e. "."), but maybe some
other implementations do?
--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/
Faré
2014-03-18 17:12:13 UTC
Permalink
My apologies: blindly copying and pasting from Google+ was a bad idea.

Here is the command I ran, where cl is the latest cl-launch 4:

mkdir -p /tmp/x ; touch "/tmp/x/*" ;
for i in sbcl ccl clisp cmucl ecl abcl \
scl allegro lispworks gcl xcl ; do
echo $i ; cl -l $i -iw \
'(let ((x (directory "/tmp/x/*"))) (list "'$i'" x (pathname-name
(first x))))' ;
done

And the summarized results are:

Escape properly:
("sbcl" (#P"/tmp/x/\\*") "*")
("ccl" (#P"/tmp/x/\\*") "\\*")
("cmucl" (#P"/tmp/x/\\*") "*")
("lispworks" (#P"/tmp/x/\\*") "\\*")
("scl" (#P"file://localhost/tmp/x/*") "*")

Read badly:
("clisp" (#P"/tmp/x/*") :WILD)
("ecl" (#P"/tmp/x/*") :WILD)
("allegro" (#P"/tmp/x/*") :WILD)
("xcl" (#P"/tmp/x/*") :WILD)

Error out:
abcl
Fatal condition:
Bad place for a wild pathname.

gcl:
Fatal condition:
Condition in LET [or a callee]: INTERNAL-SIMPLE-FILE-ERROR: File error
on "/tmp/x/*": File "/tmp/x/*" is wild

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
The older I grow, the more I distrust the familiar doctrine that age
brings wisdom. — H.L. Mencken

Continue reading on narkive:
Loading...