Re: perl -r says readable dir is unreadable
2009/4/26 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. Oops. I'll to fix that and get it into perl core. Right now I'm on a business trip in Berlin, so it will need some days. But it will be in the next perl for cygwin-1.7 (if I can reproduce it). 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) -- Reini Urban http://phpwiki.org/ http://murbreak.at/ -- 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
On Sat, April 25, 2009 9:37 pm, Mikel Ward wrote: 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. -r does not test to see if you can read a file, it tests whether the mode gives you read access to the file. $ ~/bin/pstat /c/WINDOWS mode = 16888 (= 040770) And it does not. This may help: use filetest access; (see http://search.cpan.org/perldoc/filetest) but the only guaranteed cross-platform way to see if you can read a file is to try to read it. -- 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
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 mi...@mikelward.com 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/