develooper Front page | perl.perl5.porters | Postings from April 2016

[perl #127953] stat.t build tests failing on some Cygwin

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
April 25, 2016 00:52
Subject:
[perl #127953] stat.t build tests failing on some Cygwin
Message ID:
rt-4.0.18-11084-1461545519-606.127953-15-0@perl.org
On Thu Apr 21 20:25:29 2016, jmaslak@antelope.net wrote:
> On at least Perl 5.22.1 and Perl 5.24.0-RC0, Cygwin builds under
> perlbrew as a standard Windows 10 user fails.  User is a member
> of the Administrators group on the local machine, but Cygwin
> and Perl.exe are not running with any special privileges.
> 
> t/op/stat.t fails on this environment:
> 
> ok 88 - unlink tmp file
> ok 89 - can create temp file
> ok 90 - -T _ doesn't break the statbuffer
> not ok 91 - -T _ doesn't break lstat for unreadable file
> # Failed test 91 - -T _ doesn't break lstat for unreadable file at
> # t/op/stat.t line 552

Works fine here:

tony@mimas ~/dev/perl/git/perl
$ cd t

tony@mimas ~/dev/perl/git/perl/t
$ ./perl harness op/stat.t
op/stat.t .. ok
All tests successful.
Files=1, Tests=118,  6 wallclock secs ( 0.01 usr  0.00 sys +  0.09 cusr  0.34 csys =  0.45 CPU)
Result: PASS

tony@mimas ~/dev/perl/git/perl/t
$ uname -a
CYGWIN_NT-10.0-WOW mimas 2.5.0(0.297/5/3) 2016-03-29 15:44 i686 Cygwin

tony@mimas ~/dev/perl/git/perl/t
$ id
uid=1001(tony) gid=513(None) groups=513(None),545(Users),14(REMOTE INTERACTIVE LOGON),4(INTERACTIVE),11(Authenticated Users),15(This Organization),113(Local account),66048(LOCAL),262154(NTLM Authentication),401408(Medium Mandatory Level)

tony@mimas ~/dev/perl/git/perl/t
$ ./perl -v

This is perl 5, version 24, subversion 0 (v5.24.0-RC2) built for cygwin-thread-multi-64int
(with 1 registered patch, see perl -V for more detail)

The user is an admin but not in an admin shell.

> # I'm an admin, but Win32::IsAdminUser() doesn't detect that because
> I'm
> # not running in an elevated privilege context.  So I don't have admin
> # rights in this session
> 
> $ id
> uid=181623(jmasl) gid=181623(jmasl) groups=197609(jmasl),401408(Medium
> Mandatory Level),545(Users),4(INTERACTIVE),66049(CONSOLE
> LOGON),11(Authenticated Users),15(This
> Organization),68413(MicrosoftAccount+jmaslak@antelope.net),113(Local
> account),66048(LOCAL),262180(Cloud Account Authentication)

I wonder if it's the cloud authentication.

> $ PERL5LIB=lib ./perl.exe -MWin32 -e 'print Win32::IsAdminUser(),
> "\n"'
> 0
> 
> # When I create a file and set it's mode to 077, the mode instead ends
> # up being 777, which I can read:
> 
> $ echo test >test.txt
> $ ls -l test.txt
> -rw-r--r-- 1 jmasl jmasl 5 Apr 21 21:04 test.txt
> $ chmod 077 test.txt
> $ ls -l test.txt
> -rwxrwxrwx 1 jmasl jmasl 5 Apr 21 21:04 test.txt
> $ cat test.txt
> test

tony@mimas ~/dev/perl/git/perl
$ echo test >test.txt

tony@mimas ~/dev/perl/git/perl
$ ls -l test.txt
-rw-r--r-- 1 tony None 5 Apr 25 10:46 test.txt

tony@mimas ~/dev/perl/git/perl
$ chmod 077 test.txt

tony@mimas ~/dev/perl/git/perl
$ ls -l test.txt
----rwxrwx 1 tony None 5 Apr 25 10:46 test.txt

tony@mimas ~/dev/perl/git/perl
$ chmod 000 test.txt

tony@mimas ~/dev/perl/git/perl
$ ls -l test.txt
---------- 1 tony None 5 Apr 25 10:46 test.txt

> 
> # If I set the mode to 000, I can't.
> 
> $ chmod 000 test.txt
> joel-win10:perl-5.22.1$ ls -l test.txt
> ---------- 1 jmasl jmasl 5 Apr 21 21:04 test.txt
> joel-win10:perl-5.22.1$ cat test.txt
> cat: test.txt: Permission denied
> 
> As you can see, chmod 077, at least on my Win 10 machine does let you
> read the file still, thus the -T can successfully read the file.  That
> means the lstat _ in the eval at 552 succeeds.  If the file was not
> readable, it would error with "The stat preceding lstat() wasn't an
> lstat"
> and thus the test passes.
> 
> I think the best way to fix this in the test is probably to skip this
> test period if the user is running in Cygwin. Alternatively, use a
> mode of 0000 instead of 0077 in the chmod() statement.  The build
> fails
> as a normal user today, but passes as an admin because we skip the
> test
> if an admin (with elevated privileges) does the build.

I test cygwin regularly as a non-admin user (a user who is not a member of administrators.)

> The Perl I used for perlbug is not the Perl that is causing issues -
> the issue is on Cygwin on newer Windows with Perls up to 5.24.0-RC1.

perl -V from your cygwin build would have been usefui to see what release of Cygwin you're running.

Tony

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=127953

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About