Jerry D. Hedden schrieb:
After this change, I get the fillowing test failure:

3 perl-current>  ./perl.exe -Ilib t/op/filetest.t
1..406
ok 1
ok 2
ok 3
ok 4
ok 5
# oldeuid = 78809, euid = 78809
not ok 6
# Failed at t/op/filetest.t line 41
ok 7
ok 8
ok 9

Is this because I'm still using Cygwin 1.5, or does the test need to
be changed or skipped?

I thought the code should work on 1.5 also, but I haven't tested it there, just 1.7. On thinking about this I see that the cygwin-1.5 platform is the problem, 1.7 is just stricter on file perms.

The doio.c code is okay. ingroup(544) is the same as
PL_euid == 0 for cygwin file access tests.

We need to skip the test on 1.5.
Patch later.


On Thu, Jan 14, 2010 at 06:56, H. Merijn Brand<h.m.br...@xs4all.nl>  wrote:
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/b595cd4b73a6e1bd45865d6446c34d4019c740d1?hp=91152fc19d1c59a1213e39f74ac8a80f4a015f5e>

- Log -----------------------------------------------------------------
commit b595cd4b73a6e1bd45865d6446c34d4019c740d1
Author: Reini Urban<rur...@x-ray.at>
Date:   Mon Jan 11 20:24:32 2010 +0000

    CYG23-544-stat

    Stable cygwin patch for root filetests (gid 0 root<= gid 544 
Administrators).

    On cygwin check for the Administrators group (544) which has root
    rights regarding -r filetests.

    Signed-off-by: H.Merijn Brand<h.m.br...@xs4all.nl>
-----------------------------------------------------------------------

Summary of changes:
  doio.c      |    4 ++++
  t/op/stat.t |   11 ++++++++---
  2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/doio.c b/doio.c
index 168c10e..87f2da0 100644
--- a/doio.c
+++ b/doio.c
@@ -1918,7 +1918,11 @@ Perl_cando(pTHX_ Mode_t mode, bool effective, register 
const Stat_t *statbufp)
      return (mode&  statbufp->st_mode) ? TRUE : FALSE;

  #else /* ! DOSISH */
+# ifdef __CYGWIN__
+    if (ingroup(544,effective)) {     /* member of Administrators */
+# else
     if ((effective ? PL_euid : PL_uid) == 0) { /* root is special */
+# endif
        if (mode == S_IXUSR) {
            if (statbufp->st_mode&  0111 || S_ISDIR(statbufp->st_mode))
                return TRUE;
diff --git a/t/op/stat.t b/t/op/stat.t
index 5167655..bc05112 100644
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -27,10 +27,15 @@ $Is_DGUX    = $^O eq 'dgux';
  $Is_MPRAS   = $^O =~ /svr4/&&  -f '/etc/.relid';
  $Is_Rhapsody= $^O eq 'rhapsody';

-$Is_Dosish  = $Is_Dos || $Is_OS2 || $Is_MSWin32 || $Is_NetWare || $Is_Cygwin;
+$Is_Dosish  = $Is_Dos || $Is_OS2 || $Is_MSWin32 || $Is_NetWare;

  $Is_UFS     = $Is_Darwin&&  (() = `df -t ufs . 2>/dev/null`) == 2;

+if ($Is_Cygwin) {
+  require Win32;
+  Win32->import;
+}
+
  my($DEV, $INO, $MODE, $NLINK, $UID, $GID, $RDEV, $SIZE,
    $ATIME, $MTIME, $CTIME, $BLKSIZE, $BLOCKS) = (0..12);

@@ -163,10 +168,10 @@ SKIP: {
         my $olduid = $>;
         eval { $>  = 1; };
         skip "Can't test -r or -w meaningfully if you're superuser", 2
-          if $>  == 0;
+          if ($Is_Cygwin ? Win32::IsAdminUser : $>  == 0);

         SKIP: {
-            skip "Can't test -r meaningfully?", 1 if $Is_Dos || $Is_Cygwin;
+            skip "Can't test -r meaningfully?", 1 if $Is_Dos;
             ok(!-r $tmpfile,    "   -r");
         }


--
Perl5 Master Repository

--
Reini Urban
http://phpwiki.org/  http://murbreak.at/

Reply via email to