PATCH] Fix for PR fortran/38956

David Billinghurst dbcygwin@gmail.com
Fri Jan 30 22:41:00 GMT 2009


Jack Howarth wrote:
> On Fri, Jan 30, 2009 at 12:58:21PM +1100, David Billinghurst wrote:
>> PR PR38956 is the failure of testsuite/gfortran.dg/chmod_{1,2,3}.f90 on i686-pc-cygwin.
>>
>> The problem is due to a mismatch between Windows and POSIX file access models.
>> Under Windows, accounts with Administrator rights can write to any file
>> regardless of the file permission.  There is no easy way to check for this
>> from Fortran.
>>
>> This patch removes the failing parts of tests chmod_{1,2,3}.f90 and
>> adds them to a new test chmod_4.f90
>>

> I wonder if this could be fixed by resorting to something like...
> 
> ! { dg-options "-DWINDOWS" { target i686-pc-cygwin } }
> 
> ....
> 
> 
> #ifndef WINDOWS
>   call chmod (n, "a-w", i)
>   if (i == 0 .and. getuid() /= 0) then
>     if (access(n,"w") == 0 .or. access(n,"W") == 0) call abort
>   end if
> #endif
> 
> or something along those lines.
>                       Jack

I considered that approach but took the easy way out.  I can probably 
get it to work if people think it is a better way to go.

	David



More information about the Fortran mailing list