* [Bug libfortran/65200] Handle EPERM when opening files
2015-02-25 10:28 [Bug libfortran/65200] New: Handle EPERM when opening files jb at gcc dot gnu.org
@ 2015-02-25 21:17 ` jvdelisle at gcc dot gnu.org
2015-02-25 21:31 ` jvdelisle at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-02-25 21:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65200
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu.org
--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
*** Bug 65203 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/65200] Handle EPERM when opening files
2015-02-25 10:28 [Bug libfortran/65200] New: Handle EPERM when opening files jb at gcc dot gnu.org
2015-02-25 21:17 ` [Bug libfortran/65200] " jvdelisle at gcc dot gnu.org
@ 2015-02-25 21:31 ` jvdelisle at gcc dot gnu.org
2015-03-06 12:20 ` jb at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-02-25 21:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65200
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jvdelisle at gcc dot gnu.org
--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
>From PR65203 Thomas comment:
Currently, when encountering EACCES or EROFS upon opening, we fall back towards
opening the file read-only.
This is
a) not documented
b) surprising for some users (an inconsistency has been commented upon)
c) causes inconsistencies with NFS v4, which appears to return EPERM for a
read-only file for no reason that I can see.
The original report can be found at
http://stackoverflow.com/questions/28696539/fortran-open-call-differs-on-nfsv3-vs-nfsv4
.
My suggestion would be to a) document and c) extend the behavior to EPERM.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/65200] Handle EPERM when opening files
2015-02-25 10:28 [Bug libfortran/65200] New: Handle EPERM when opening files jb at gcc dot gnu.org
2015-02-25 21:17 ` [Bug libfortran/65200] " jvdelisle at gcc dot gnu.org
2015-02-25 21:31 ` jvdelisle at gcc dot gnu.org
@ 2015-03-06 12:20 ` jb at gcc dot gnu.org
2015-03-06 13:00 ` dominiq at lps dot ens.fr
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jb at gcc dot gnu.org @ 2015-03-06 12:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65200
--- Comment #4 from Janne Blomqvist <jb at gcc dot gnu.org> ---
Suggested doc patch:
Index: gfortran.texi
===================================================================
--- gfortran.texi (revision 221234)
+++ gfortran.texi (working copy)
@@ -1328,6 +1328,22 @@
also force cache validation and flushing dirty data and metadata.
+@node Files opened without an explicit ACTION= specifier
+@section Files opened without an explicit ACTION= specifier
+@cindex open, action
+
+The Fortran standard says that if an @code{OPEN} statement is executed
+without an explicit @code{ACTION=} specifier, the default value is
+processor dependent. GNU Fortran behaves as follows:
+
+@enumerate
+@item Attempt to open the file with @code{ACTION='READWRITE'}
+@item If that fails, try to open with @code{ACTION='READ'}
+@item If that fails, try to open with @code{ACTION='WRITE'}
+@item If that fails, generate an error
+@end enumerate
+
+
@c ---------------------------------------------------------------------
@c Extensions
@c ---------------------------------------------------------------------
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/65200] Handle EPERM when opening files
2015-02-25 10:28 [Bug libfortran/65200] New: Handle EPERM when opening files jb at gcc dot gnu.org
` (2 preceding siblings ...)
2015-03-06 12:20 ` jb at gcc dot gnu.org
@ 2015-03-06 13:00 ` dominiq at lps dot ens.fr
2015-03-06 13:17 ` burnus at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-03-06 13:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65200
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-03-06
Ever confirmed|0 |1
--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed per comment 3.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/65200] Handle EPERM when opening files
2015-02-25 10:28 [Bug libfortran/65200] New: Handle EPERM when opening files jb at gcc dot gnu.org
` (3 preceding siblings ...)
2015-03-06 13:00 ` dominiq at lps dot ens.fr
@ 2015-03-06 13:17 ` burnus at gcc dot gnu.org
2015-03-11 21:34 ` jb at gcc dot gnu.org
2015-03-11 21:40 ` jb at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2015-03-06 13:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65200
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Janne Blomqvist from comment #3)
> + char tmpmsg[256];
> char *path = fc_strdup (opp->file, opp->file_len);
> - size_t msglen = opp->file_len + 51;
> + size_t msglen = opp->file_len + 22 + 256;
> + snprintf (msg, msglen, "Cannot open file '%s': %s", path,
> + gf_strerror (errno, tmpmsg, 256));
How about "sizeof (tmpmsg)" instead of 256?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/65200] Handle EPERM when opening files
2015-02-25 10:28 [Bug libfortran/65200] New: Handle EPERM when opening files jb at gcc dot gnu.org
` (4 preceding siblings ...)
2015-03-06 13:17 ` burnus at gcc dot gnu.org
@ 2015-03-11 21:34 ` jb at gcc dot gnu.org
2015-03-11 21:40 ` jb at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jb at gcc dot gnu.org @ 2015-03-11 21:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65200
--- Comment #7 from Janne Blomqvist <jb at gcc dot gnu.org> ---
Author: jb
Date: Wed Mar 11 21:34:22 2015
New Revision: 221361
URL: https://gcc.gnu.org/viewcvs?rev=221361&root=gcc&view=rev
Log:
PR 65200 Handle EPERM in addition to EACCES.
gcc/fortran ChangeLog:
2015-03-11 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/65200
* gfortran.texi: Document behavior when opening files without
explicit ACTION= specifier.
libgfortran ChangeLog:
2015-03-11 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/65200
* io/open.c (new_unit): Use gf_strerror rather than hardcoding
error messages for different errno values.
* io/unix.c (regular_file2): Handle EPERM in addition to EACCES.
gcc/testsuite ChangeLog:
2015-03-11 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/65200
* gfortran.dg/open_errors.f90: Update checks for iomsg string.
* gfortran.dg/open_new_segv.f90: Fix error message pattern.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/gfortran.texi
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/open_errors.f90
trunk/gcc/testsuite/gfortran.dg/open_new_segv.f90
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/open.c
trunk/libgfortran/io/unix.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/65200] Handle EPERM when opening files
2015-02-25 10:28 [Bug libfortran/65200] New: Handle EPERM when opening files jb at gcc dot gnu.org
` (5 preceding siblings ...)
2015-03-11 21:34 ` jb at gcc dot gnu.org
@ 2015-03-11 21:40 ` jb at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jb at gcc dot gnu.org @ 2015-03-11 21:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65200
Janne Blomqvist <jb at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Janne Blomqvist <jb at gcc dot gnu.org> ---
Fixed on trunk, closing.
^ permalink raw reply [flat|nested] 8+ messages in thread