From: Stefan Kamphausen
Subject: CL-FAD:list-directory and dead links
Date: 
Message-ID: <85irlslk90.fsf@usenet.my.skamphausen.de>
Hi,

I just used cl-fad:list-directory to go through some files and extract
some information there.  During that CMUCL signaled an error for a
non exisiting file:


File-error in function TRUENAME:
   The file "/path/to/dir/.#findcmd.lisp" does not exist.
   [Condition of type KERNEL:SIMPLE-FILE-ERROR]

Restarts:
  0: [ABORT-REQUEST] Abort handling SLIME request.
  1: [ABORT] Return to Top-Level.

Backtrace:
  0: (TRUENAME "/path/to/dir/.#findcmd.lisp")
  1: (DIRECTORY #P"./*.*" :ALL T :CHECK-FOR-SUBDIRS ...)
  2: (FIND-TEX-COMMANDS-IN-DIR ".")


(findcmd.lisp contained my simple one-shot CL code.)


Is there any way to avoid this error?  I do not think that TRUENAME
should be called at all when I read a directory.  When the file is
really a link I might be interested in that fact.


Consider this:

shell> mkdir /tmp/links
shell> cd /tmp/links
shell> xemacs link.lisp

xemacs:
(in-package :cl-user)

(defun test-link-list (dir)
    (loop for file in (cl-fad:list-directory dir)
          do
          (format t "~a ~%" (file-namestring file))))
C-x C-s
M-x slime
;; compile ...

shell> ln -s link.lisp another-name.lisp
shell> ls -l
total 4.0K
lrwxrwxrwx 1 me users   9 Jul 20 10:58 another-name.lisp -> link.lisp
-rw-r--r-- 1 me users 327 Jul 20 10:57 link.lisp

cl-user> (test-link-list "/tmp/links")
link.lisp 
link.lisp 
NIL
CL-USER> 


IMHO this looks like a bug, I don't expect links to be resolved.  Or
am I missing something obvious?


Kind Regards,
Stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.
From: Marcus Breiing
Subject: Re: CL-FAD:list-directory and dead links
Date: 
Message-ID: <e9nngs$72v$1@chessie.cirr.com>
Stefan Kamphausen <······@gmx.de> writes:

> File-error in function TRUENAME:
>    The file "/path/to/dir/.#findcmd.lisp" does not exist.

These tend to be symlinks to nowhere created by Emacs, AFAIR.

> Is there any way to avoid this error? I do not think that TRUENAME
> should be called at all when I read a directory.

From the CLHS entry for DIRECTORY:

 ...returns a fresh list of pathnames corresponding to the truenames
 of those files

However, in CMUCL you can specify :TRUENAMEP NIL 

-- 
Marcus Breiing