From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88559 invoked by alias); 20 Jul 2015 09:19:17 -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 88439 invoked by uid 48); 20 Jul 2015 09:19:13 -0000 From: "pinskia 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: Mon, 20 Jul 2015 09:19: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: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P5 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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-07/txt/msg01702.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66936 --- Comment #9 from Andrew Pinski --- (In reply to Keith Marshall from comment #8) > (In reply to kargl from comment #7) > > So add > > > > #define S_IRWXG 0 > > #define S_IRWXO 0 > > > > to the header file wherever mingw defines the available mask bits > > for umask(3). The bug is clearly in mingw were it gratuitously maps > > umask() to _umask() without properly adding the mappings for the > > mode_t argument bits of umask(3). > > Absolutely not! Those bits are utterly irrelevant for the windows (MinGW) > platform; to add them would be do nothing more than create confusion. The > mask bits for umask(), on the windows platform are S_IREAD | S_IWRITE; those > are the only mask bits YOUR code should be passing to non-POSIX > umask(5axxx3be.aspx). > > This is NOT a MinGW bug; it's a GCC bug, and that's where it should be > fixed. Until you do fix it, I have my work-around, (which I'm perfectly > willing to publish in MinGW forked source for GCC, prominently commented as > a ghastly hack to circumvent a gross upstream GCC bug). Well it is a libgfortran bug yes. What we could do add to io/unix.c: #if MINGW && !defined(S_IRWXG) #define S_IRWXG 0 #endif #if MINGW && !defined(S_IRWXO) #define S_IRWXO 0 #endif And that will allow it to work correctly.