On Thursday, March 15, 2012 5:25:13 PM UTC+1, Nils Bruin wrote:
>
> On Mar 15, 12:21 am, "syd.lavas...@gmail.com" <syd.lavas...@gmail.com> 
> wrote: 
> > The problem is that my home directory is: 
> > 
> > /files3/home/sahosse/ 
> > 
> > but I only have execution permission to the directory "home": 
>
> I confirm: 
>
> $ mkdir /tmp/test 
> $ chmod a-r /tmp/test 
> $ mkdir /tmp/test/a 
> $ touch /tmp/test/a/b 
> $ ls /tmp/test/a/* 
> /tmp/test/a/b 
>
> $ ecl 
> ECL (Embeddable Common-Lisp) 11.1.1 
> [...] 
> > (directory "/tmp/test/a/*") 
>
> NIL 
> > (quit) 
> $ chmod u+r /tmp/test 
> $ ecl 
> ECL (Embeddable Common-Lisp) 11.1.1 
> [...] 
> > (directory "/tmp/test/a/*") 
>
> (#P"/tmp/test/a/b") 
>
> so, changing read permissions on a directory higher up in the tree 
> makes everything below not reachable for "directory". The same problem 
> arises for multi-level wildcards in the shell, i.e., "ls /tmp/test/*/ 
> *" can't find /tmp/test/a/b either if test is not readable. I guess 
> ECL uses the same code for wildcards as it uses for specified path 
> components. 
>

This is now fixed in CVS. It is a question of semantics not of good or 
"poor" implementations, as described above. I interpreted that the _whole_ 
of the argument to DIRECTORY is to be processed as a pattern matching 
pathname. Indeed, contrary to what Unix users would expect, we cannot 
optimize a directory to "/foo/faa/fee/*" jumping directly into the last 
component because we have to find out truenames -- in other words, if "faa" 
or "foo" are actually links, we have to traverse them and substitute the 
appropriate parts of the pathname by their content 
(See http://clhs.lisp.se/Body/f_dir.htm 
and http://clhs.lisp.se/Body/26_glo_t.htm#truename).

I have modified the implementation of DIRECTORY to read as follows (sketch, 
the actual implementation is more complicated)

* Loop D over directory components
** If D is not a wildcard component
*** Enter D
*** If D is a link, replace by value
** Else
*** List directory content
*** Collect components that match D
*** Recursively process each component
** End If
*

Formerly the first "If" was not present.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to