delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/09/15:49:19

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: ericblake AT comcast DOT net (Eric Blake)
To: worwor AT bellsouth DOT net, cygwin <cygwin AT cygwin DOT com>
Subject: Re: "ls" finds file1 but "ls file1" does not
Date: Mon, 09 May 2005 19:48:54 +0000
Message-Id: <050920051948.29983.427FBEA60005B0510000751F22007358340A050E040D0C079D0A@comcast.net>
X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0

> "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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019