This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "ls" finds file1 but "ls file1" does not


> "ls" finds file1 but "ls file1" does not.  How can this happen?
> 
[...]
> 
> The only difference here from a correctly working directory is that the
> correctly working
> directory does not have execute permissions

You are correct that it has something with permissions.  Observe:

$ umask
0077
$ mkdir bar    # By default, searchable and readable by me
$ cd foo
$ stat -c %A .
drwx------
$ touch foo
$ ls
foo
$ ls foo
foo
$ chmod a-r .   # Make it searchable, but not readable
$ stat -c %A .
d-wx------
$ ls
ls: .: Permission denied
$ ls foo
foo
$ chmod u+r,a-x . # Make it readable, but not searchable
$ stat -c %A .
drw-------
$ ls
foo
$ ls -F
ls: foo: Permission denied
$ ls foo
ls: foo: Permission denied

The x permission on a directory stands for search permission, which is the right to ask "what are the properties of a named file in this directory".  The r permission on a directory stands for read permission, which is the right to ask "what files exist in this directory".  `ls' with no arguments defaults to `ls .', which requires only read permission on `.'.  But `ls foo' with an argument requires search permission on `.'.  Furthermore, `ls -F foo' with an argument requires both search and read permission on `.', because the -F tells ls to find out more about the file than just its name.

>[...]
> -rwx------+   1 cdr      None         3440 Nov 20  1995  finder.dat*

See the + at the end of your permissions?  It means that there are ACL's further modifying who can do things with this file.  What does getfacl print for you?  Maybe the ACLs will give you a clue why Windows lets you see the file, but your particular cygwin username cannot.  My error, without ACLs on the file foo, was EACCESS, "Permission denied".  But your error was ENOENT, "No such file or directory", so I'm not sure what is going on differently.

--
Eric Blake



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]