perl -r says readable dir is unreadable

2009-04-25 Thread Mikel Ward
Hi

I'm having problems with a Perl script that works fine on Linux.

The key is that the -r (file is readable) operator returns false for
directories that I CAN read.  "test" and "ls" prove that I can read
them.

Something that might be related is that C:, C:\Windows, and others are
owned by the "TrustedInstaller" user, which mkpasswd can't handle.
http://www.nabble.com/group-%3D-(2**32-1)-%3D-4294967295-td20319853.html

I use / as my Cygwin prefix rather than /cygdrive, but I've tried
/cygdrive and it gives the same results.

I'm running as myself, but running as Administrator also gives the same results.

I'm running Vista.

$ test -r /c/WINDOWS && echo "/c/WINDOWS is readable"
/c/WINDOWS is readable

$ cat ~/bin/readable
#!/usr/bin/perl

if (-r $ARGV[0]) {
print $ARGV[0] . " is readable\n";
exit 0;
}
else {
print $ARGV[0] . " IS NOT readable\n";
exit 1;
}

$ ~/bin/readable /c/WINDOWS
/c/WINDOWS IS NOT readable

$ cat ~/bin/pstat
#!/usr/bin/perl

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
= stat($ARGV[0]);
print "mode = " . $mode . "\n";

$ ~/bin/pstat /c/WINDOWS
mode = 16888

$ ls -l /c/WINDOWS | head
ls: /c/WINDOWS/bthservsdp.dat: Permission denied
ls: /c/WINDOWS/DUMP4352.tmp: Permission denied
ls: /c/WINDOWS/LiveKernelReports: Permission denied
ls: /c/WINDOWS/MEMORY.DMP: Permission denied
ls: /c/WINDOWS/ModemLogs: Permission denied
ls: /c/WINDOWS/Prefetch: Permission denied
ls: /c/WINDOWS/Temp: Permission denied
total 505455
-rwx--+1 Administrators None 0 Jan  2 10:58 AS_Debug.txt*
drwxrwx---+4      4096 Apr 15 07:30 AppPatch/
drwxrwx---+6     0 Nov 23 13:52 Boot/
drwxrwx---+4     0 Nov  2  2006 Branding/
drwx--+2 Administrators  49152 Nov  2  2006 Cursors/
-rwx--+1 Administrators None  1171 Jan  6 22:34 DIFx.log*
-rwx--+1 Administrators None319456 Jan  2 10:59 DIFxAPI.dll*
-rwx--+1 SYSTEM SYSTEM   17932 Jan  6 23:13 DPINST.LOG*
-- 1     212167315 Nov 20 22:51 DUMP4352.tmp

$ perl -version

This is perl, v5.10.0 built for cygwin-thread-multi-64int
(with 6 registered patches, see perl -V for more detail)

Copyright 1987-2007, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


cygcheck.out
Description: Binary data
--
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/

Re: perl -r says readable dir is unreadable

2009-04-25 Thread Mikel Ward
Sorry.

Found this
http://sourceware.org/ml/cygwin/2005-03/msg00488.html

Apparently it's been an issue since at least Perl 5.8.6 in 2005, but
probably longer.

On Sun, Apr 26, 2009 at 2:37 PM, Mikel Ward  wrote:
> Hi
>
> I'm having problems with a Perl script that works fine on Linux.
>
> The key is that the -r (file is readable) operator returns false for
> directories that I CAN read.  "test" and "ls" prove that I can read
> them.
>
> Something that might be related is that C:, C:\Windows, and others are
> owned by the "TrustedInstaller" user, which mkpasswd can't handle.
> http://www.nabble.com/group-%3D-(2**32-1)-%3D-4294967295-td20319853.html
>
> I use / as my Cygwin prefix rather than /cygdrive, but I've tried
> /cygdrive and it gives the same results.
>
> I'm running as myself, but running as Administrator also gives the same 
> results.
>
> I'm running Vista.
>
> $ test -r /c/WINDOWS && echo "/c/WINDOWS is readable"
> /c/WINDOWS is readable
>
> $ cat ~/bin/readable
> #!/usr/bin/perl
>
> if (-r $ARGV[0]) {
>        print $ARGV[0] . " is readable\n";
>        exit 0;
> }
> else {
>        print $ARGV[0] . " IS NOT readable\n";
>        exit 1;
> }
>
> $ ~/bin/readable /c/WINDOWS
> /c/WINDOWS IS NOT readable
>
> $ cat ~/bin/pstat
> #!/usr/bin/perl
>
> ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
> = stat($ARGV[0]);
> print "mode = " . $mode . "\n";
>
> $ ~/bin/pstat /c/WINDOWS
> mode = 16888
>
> $ ls -l /c/WINDOWS | head
> ls: /c/WINDOWS/bthservsdp.dat: Permission denied
> ls: /c/WINDOWS/DUMP4352.tmp: Permission denied
> ls: /c/WINDOWS/LiveKernelReports: Permission denied
> ls: /c/WINDOWS/MEMORY.DMP: Permission denied
> ls: /c/WINDOWS/ModemLogs: Permission denied
> ls: /c/WINDOWS/Prefetch: Permission denied
> ls: /c/WINDOWS/Temp: Permission denied
> total 505455
> -rwx--+    1 Administrators None             0 Jan  2 10:58 AS_Debug.txt*
> drwxrwx---+    4              4096 Apr 15 07:30 AppPatch/
> drwxrwx---+    6                 0 Nov 23 13:52 Boot/
> drwxrwx---+    4                 0 Nov  2  2006 Branding/
> drwx--+    2 Administrators      49152 Nov  2  2006 Cursors/
> -rwx--+    1 Administrators None          1171 Jan  6 22:34 DIFx.log*
> -rwx--+    1 Administrators None        319456 Jan  2 10:59 DIFxAPI.dll*
> -rwx--+    1 SYSTEM         SYSTEM       17932 Jan  6 23:13 DPINST.LOG*
> --     1         212167315 Nov 20 22:51 DUMP4352.tmp
>
> $ perl -version
>
> This is perl, v5.10.0 built for cygwin-thread-multi-64int
> (with 6 registered patches, see perl -V for more detail)
>
> Copyright 1987-2007, Larry Wall
>
> Perl may be copied only under the terms of either the Artistic License or the
> GNU General Public License, which may be found in the Perl 5 source kit.
>
> Complete documentation for Perl, including FAQ lists, should be found on
> this system using "man perl" or "perldoc perl".  If you have access to the
> Internet, point your browser at http://www.perl.org/, the Perl Home Page.
>

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



ls / does not show /c with cygdrive prefix=/

2009-09-27 Thread Mikel Ward
Hi All

If I use a standard install with the cygdrive prefix as /cygdrive, the
drive letters appear in a directory listing:

$ ls /cygdrive
c d w

But if I change cygdrive to /, they don't:

$ mount -c /
$ ls /
Cygwin.bat   bindev   home   optsbin   usr
Cygwin.ico   cygdrive   etc   libproc   tmpvar
[ends]

But of course, they are there:

$ ls /c
$Recycle.Bin  PerfLogs
[...]

That's as Administrator.  Adding the -s flag to mount doesn't help,
neither does a reboot.

Is there any way to make /c, etc. appear in the listing?

I'm running on Windows Server 2008 64-bit with Cygwin DLL 1.5.25-19.

cygcheck on request.

Thanks

Mike



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



Re: ls / does not show /c with cygdrive prefix=/

2009-09-28 Thread Mikel Ward
Corinna Vinschen wrote:
> Mikel Ward wrote:
> > If I use a standard install with the cygdrive prefix as /cygdrive, the
> > drive letters appear in a directory listing:
> > 
> > $ ls /cygdrive
> > c d w
> > 
> > But if I change cygdrive to /, they don't:
> > 
> > Is there any way to make /c, etc. appear in the listing?
> 
> Manually, yes, automatically, no.  You can change your cygdrive
> folder to any other folder and the drives will show up there.
> This has only been disabled for the root folder for performance
> reasons.

Thanks Corinna.

Roughly what was the performance impact?

Is there any way to disable this special case to get the behavior I want
with prefix=/?



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



Re: ls / does not show /c with cygdrive prefix=/

2009-09-29 Thread Mikel Ward
Corinna Vinschen wrote:
> > Is there any way to disable this special case to get the behavior I want
> > with prefix=/?
> 
> No, sorry.

OK.

I don't understand why, but if you don't have time to explain, that's
fine.

But are there any other possible problems with having prefix=/ that I
should be aware of?

Mike



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



Re: ls / does not show /c with cygdrive prefix=/

2009-09-29 Thread Mikel Ward
Corinna Vinschen wrote:
> 
> I don't know what you would like to read.  It's part of the way the
> Cygwin DLL handles that stuff.  To enumerate the available
> directories,
> the directory opened with opendir() must have been recognized as the
> cygdrive directory.  If that happens, *only* drives are enumerated
> since the cygdrive directory is a virtual directory anyway.
> This method can't work on / since then you would have a broken
> filesystem tree.  That's why we frown on / as cygdrive directory (at
> least I do, but apparently nobody cares).

OK.  So cygdrive prefix is like a mount point.

No problem. :-)

Thanks

Mike




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



default ACLs

2009-10-22 Thread Mikel Ward
Hi All

Default ACLs don't seem to work as they would on Linux, or for that
matter as they do for files created via Windows Explorer.

Is this expected?

administra...@hostname:/
$ mkdir newdir

administra...@hostname:/
$ getfacl newdir
# file: newdir
# owner: Administrator
# group: None
user::rwx
group::r-x
mask:rwx
other:r-x
default:user::rwx
default:group::r-x
default:other:r-x

administra...@hostname:/
$ setfacl -m 'd:g:dbas:rwx,d:g:SYSTEM:rwx' newdir

administra...@hostname:/
$ getfacl newdir
# file: newdir
# owner: Administrator
# group: None
user::rwx
group::r-x
mask:rwx
other:r-x
default:user::rwx
default:group::r-x
default:group:SYSTEM:rwx
default:group:dbas:rwx
default:mask:rwx
default:other:r-x

administra...@hostname:/
$ touch newdir/newfile

administra...@hostname:/
$ getfacl newdir/newfile
# file: newdir/newfile
# owner: Administrator
# group: None
user::rw-
group::r--
mask:rwx
other:r--

Irrespective of CYGWIN=(null), CYGWIN=ntsec, or CYGWIN=nontsec.

If I create a file in Windows Explorer, its ACLs are:
$ getfacl newdir/newfile2
# file: newdir/newfile2
# owner: Administrators
# group: None
user::rwx
group::r-x
group:SYSTEM:rwx
group:Users:r-x
group:dbas:rwx
mask:rwx
other:r-x

Basically I'm looking for a way to ensure the right users and groups can read 
files that I create.

Thanks

Mikel



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



Re: default ACLs

2009-10-23 Thread Mikel Ward
Corinna wrote:
> Neither the NtCreateFile function, nor the
> CreateFile function handle ACE inheritance either. 

Looks like that's only if lpSecurityAttributes is non-NULL, but I guess
Cygwin uses that field?

"Windows Server 2003 and Windows XP/2000:  For backward compatibility
purposes, CreateFile does not apply inheritance rules when you specify a
security descriptor in lpSecurityAttributes. To support inheritance,
functions that later query the security descriptor of this file may
heuristically determine and report that inheritance is in effect. For
more information, see Automatic Propagation of Inheritable ACEs."

Out of interest I'm going to have a look at SECURITY_DESCRIPTORs, but
it'll take some time. :-)

> Thanks for the report
Thanks for taking a look!





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



Re: default ACLs

2009-10-24 Thread Mikel Ward
Corinna wrote:
> I applied a patch to Cygwin CVS which seems to work fine.  That will
> be in the next 1.7.0 test release.

Thank you so much!



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