Bug 231134

Summary: gfortan-generated code cannot handle r/o partitions.
Product: [Fedora] Fedora Reporter: Pawel Salek <pawsa>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: 4.1.2-4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-03-13 14:53:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Pawel Salek 2007-03-06 13:56:38 UTC
Description of problem:

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Compile following program with gfortran:
       program a
     & status='old')
       print *, "opening succeeded"
       goto 20
10     print *, "opening failed"
20     continue
2. touch aaa; sudo -s mount -oremount,ro /home
3. Run the compiled program
Actual results:
The program will fail to open the file.

Expected results:
The program should open the file in the read-only mode.

Additional info:
This feature worked with with g77. Following straces may be interesting:
g77-compiled code:
access("aaa", F_OK) = 0
open("aaa", O_RDWR|O_LARGEFILE) = -1 EROFS (Read-only file system)
open("aaa", O_RDONLY|O_LARGEFILE) = 3

gfortran-compiled code on r/o file on r/w partition:
open("afile", O_RDWR|O_LARGEFILE)       = -1 EACCES (Permission denied)
open("afile", O_RDONLY|O_LARGEFILE)     = 3

gfotran-compiled code on r/o partition:
open("aaa", O_RDWR|O_LARGEFILE) = -1 EROFS (Read-only file system)
write(1, " opening failed", 15 opening failed)         = 15

Comment 1 Jakub Jelinek 2007-03-13 14:53:42 UTC
Should be fixed in libgfortran-4.1.2-4 in rawhide.