gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: error-free truename on directories


From: Camm Maguire
Subject: [Gcl-devel] Re: error-free truename on directories
Date: Thu, 21 Oct 2010 16:29:24 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Greetings!

I've wrestled with this a bit in 2.7.0.  I must confess I do not
really understand the lisp spec on these issues at all.  There seems
to be considerable lattitude to implement what looks reasonable.
Truename must throw an error if links cannot be traversed or
directories cannot be "cd'ed" into, AFAICT.  #'directory globbing
rules appear to have some freedom. #'ignore-errors requires a bunch of
conditions support absent in CLTL1, though we could do something more
simple here if needed.

In any case, until clarity arrives on the standard functions (if you
can provide such clarity, I'd be *most* appreciative!), I can
easily backport this from 2.7.0 if that would kelp:

address@hidden:~/nesl$ ls -l /tmp/g*
-rw-r--r-- 1 camm camm  635 Oct 21 13:07 /tmp/gazonk0.fn
lrwxrwxrwx 1 camm camm    7 Oct 21 15:27 /tmp/gr -> /tmp/gg
lrwxrwxrwx 1 camm camm    8 Oct 21 15:27 /tmp/gr1 -> /tmp/gg1


/tmp/gg:
total 0

>(si::stat "/tmp/gg/")

(:DIRECTORY 4096 1287674312)

>(si::stat "/tmp/gr")

(:LINK 7 1287674869)

>(si::stat "/tmp/gr1")

(:LINK 8 1287674873)

>(si::stat "/tmp/gg1")

NIL

>(si::stat "/tmp/gazonk0.fn")

(:FILE 635 1287666472)



Matt Kaufmann <address@hidden> writes:

> Hi, Camm --
>
> Please let me know if I should send questions like the following to
> gcl-devel or some other list instead of directly to you.
>
> Is there a way in non-ansi GCL to determine if a directory exists
> without getting an error?  For a file (as opposed to a directory) I
> can use probe-file, but this doesn't work for directories in GCL.  I
> could use truename, but it can cause an error if there is a trailing
> slash (/) and produce nothing useful if not.
>
>   lhug-8:~> /p/bin/gcl-2.6.8pre-big
>   GCL (GNU Common Lisp)  2.6.8 CLtL1    Sep 27 2010 09:41:51
>   Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
>   Binary License:  GPL due to GPL'ed components: (XGCL READLINE UNEXEC)
>   Modifications of this banner must retain notice of a compatible license
>   Dedicated to the memory of W. Schelter
>
>   Use (help) to get some basic information on how to use GCL.
>   Temporary directory for compiler files set to /tmp/
>
>   >(probe-file "emacs")
>
>   NIL
>
>   >(probe-file "emacs/")
>
>   NIL
>
>   >(probe-file "emacs/.")
>
>   NIL
>
>   >(truename "emacs")
>
>   #p"/v/filer4b/v41q001/kaufmann/emacs"
>
>   >(truename "no-such")
>
>   #p"/v/filer4b/v41q001/kaufmann/no-such"
>
>   >(truename "no-such/")
>
>   Error: Cannot get the truename of "no-such/".
>   Fast links are on: do (si::use-fast-links nil) for debugging
>   Error signalled by EVAL.
>   Broken at TRUENAME.  Type :H for Help.
>   >>:q
>
>   Top level.
>   >(directory "no-such/")
>
>   NIL
>
>   >(directory "temp/")
>
>   Error: Cannot get the truename of "temp/bad-meta.lisp".
>   Fast links are on: do (si::use-fast-links nil) for debugging
>   Error signalled by EVAL.
>   Broken at DIRECTORY.  Type :H for Help.
>   >>(quit)
>   lhug-8:~> ls -l temp/bad-meta.lisp
>   lrwxrwxrwx 1 kaufmann acl2 45 Aug 20  2009 temp/bad-meta.lisp -> 
> /projects/acl2/devel/tests/meta/bad-meta.lisp
>   lhug-8:~> 
>
> By the way, in Ansi lisps the following seems to work:
>
>   (ignore-errors (truename x))
>
> But I don't see ignore-errors defined in non-Ansi GCL.
>
> Thanks --
> -- Matt
>
>
>
>

-- 
Camm Maguire                                        address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



reply via email to

[Prev in Thread] Current Thread [Next in Thread]