From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50605 invoked by alias); 6 Aug 2015 16:57:20 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 50552 invoked by uid 48); 6 Aug 2015 16:57:16 -0000 From: "fxcoudert at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/66936] io/unix.c gratuitously uses S_IRWXG and S_IRWXO on the basis that umask() is available Date: Thu, 06 Aug 2015 16:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: fxcoudert at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P5 X-Bugzilla-Assigned-To: fxcoudert at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc assigned_to everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-08/txt/msg00445.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66936 Francois-Xavier Coudert changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-08-06 CC| |fxcoudert at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |fxcoudert at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #11 from Francois-Xavier Coudert --- What I do not understand is how this didn't show up before now, since the relevant libgfortran code was committed in 2012, and the mingw-w64 project has been providing gfortran builds throughout this time. Other than that, I would simply suggest we don't use umask() on mingw targets (no need to make useless system calls): Index: io/unix.c =================================================================== --- io/unix.c (revision 226632) +++ io/unix.c (working copy) @@ -1083,6 +1083,14 @@ set_close_on_exec (int fd __attribute__ } +/* On mingw, we don't use umask in the function below, because it + doesn't support the user/group/other-based permissions. */ + +#ifdef __MINGW32__ +#undef HAVE_UMASK +#endif + + /* Helper function for tempfile(). Tries to open a temporary file in the directory specified by tempdir. If successful, the file name is stored in fname and the descriptor returned. Returns -1 on Can someone (Keith?) actually confirm that this restores the build on mingw32? (It should, but double-checking never hurts.)