This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Allow for parent dir's gid in gfortran.dg/stat_[12].f90 (PR fortran/42900)


As described in the PR, the gfortran.dg/stat_[12].f90 tests can FAIL if
run on either a filesystem mounted with the grpid mount option or in a
directory with the sgid bit set and a group different from the primary
group of the person running the testsuite.

Both tests fail when checking if the group of the newly created file are
identical to the invokers real gid, because in this case, the file is
created with the group of the directory the testcase is run in.  There
is nothing the testsuite can do to guarantee otherwise, so either that
check should be removed wholesale (testing a condition outside of the
control of the testsuite doesn't seem very useful to me) or, as this
patch proposes, widended to allow the file to have either the user's
primary group or the parent directory's group.

With this patch, I could manually run the testcases both with the sgid
set on the test directory and sgid cleared and it succeeded in both
cases.

Ok for mainline?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2010-02-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR fortran/42900
	* gfortran.dg/stat_1.f90: Accept 'testfile' gid == parent dir gid.
	* gfortran.dg/stat_2.f90: Likewise.

diff -r 3e8092899c3e -r 07a4c477186c gcc/testsuite/gfortran.dg/stat_1.f90
--- a/gcc/testsuite/gfortran.dg/stat_1.f90	Wed Feb 17 09:08:18 2010 +0100
+++ b/gcc/testsuite/gfortran.dg/stat_1.f90	Wed Feb 17 09:08:19 2010 +0100
@@ -2,7 +2,7 @@
 ! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } }
 ! { dg-options "-std=gnu" }
   character(len=*), parameter :: f = "testfile"
-  integer :: s1(13), r1, s2(13), r2, s3(13), r3
+  integer :: s1(13), r1, s2(13), r2, s3(13), r3, d(13), rd
   
   open (10,file=f)
   write (10,"(A)") "foo"
@@ -12,11 +12,12 @@
   call lstat (f, s1, r1)
   call stat (f, s2, r2)
   call fstat (10, s3, r3)
+  call stat (".", d, rd)
 
-  if (r1 /= 0 .or. r2 /= 0 .or. r3 /= 0) call abort
+  if (r1 /= 0 .or. r2 /= 0 .or. r3 /= 0 .or. rd /= 0) call abort
   if (any (s1 /= s2) .or. any (s1 /= s3)) call abort
   if (s1(5) /= getuid()) call abort
-  if (s1(6) /= getgid() .and. getgid() /= 0) call abort
+  if (s1(6) /= getgid() .and. s1(6) /= d(6) .and. getgid() /= 0) call abort
   if (s1(8) < 3 .or. s1(8) > 5) call abort
 
   close (10,status="delete")
diff -r 3e8092899c3e -r 07a4c477186c gcc/testsuite/gfortran.dg/stat_2.f90
--- a/gcc/testsuite/gfortran.dg/stat_2.f90	Wed Feb 17 09:08:18 2010 +0100
+++ b/gcc/testsuite/gfortran.dg/stat_2.f90	Wed Feb 17 09:08:19 2010 +0100
@@ -2,7 +2,7 @@
 ! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } }
 ! { dg-options "-std=gnu" }
   character(len=*), parameter :: f = "testfile"
-  integer :: s1(13), r1, s2(13), r2, s3(13), r3
+  integer :: s1(13), r1, s2(13), r2, s3(13), r3, d(13), rd
   
   open (10,file=f)
   write (10,"(A)") "foo"
@@ -12,11 +12,12 @@
   r1 = lstat (f, s1)
   r2 = stat (f, s2)
   r3 = fstat (10, s3)
+  rd = stat (".", d)
 
-  if (r1 /= 0 .or. r2 /= 0 .or. r3 /= 0) call abort
+  if (r1 /= 0 .or. r2 /= 0 .or. r3 /= 0 .or. rd /= 0) call abort
   if (any (s1 /= s2) .or. any (s1 /= s3)) call abort
   if (s1(5) /= getuid()) call abort
-  if (s1(6) /= getgid() .and. getgid() /= 0) call abort
+  if (s1(6) /= getgid() .and. s1(6) /= d(6) .and. getgid() /= 0) call abort
   if (s1(8) < 3 .or. s1(8) > 5) call abort
 
   close (10,status="delete")


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]