From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9682 invoked by alias); 18 Feb 2013 21:25:04 -0000 Received: (qmail 9199 invoked by uid 55); 18 Feb 2013 21:24:35 -0000 From: "tkoenig at netcologne dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/30162] [4.7/4.8 Regression] I/O with named pipes does not work on Darwin Date: Mon, 18 Feb 2013 21:25: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-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tkoenig at netcologne dot de X-Bugzilla-Status: NEW X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.3 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2013-02/txt/msg01852.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30162 --- Comment #47 from tkoenig at netcologne dot de 2013-02-18 21:24:31 UTC --- Am 18.02.2013 21:16, schrieb jb at gcc dot gnu.org: >> Look at this piece of code: >> > >> > /* Seek to the head and overwrite the bogus length with the real >> > length. */ >> > >> > if (unlikely (sseek (dtp->u.p.current_unit->s, - m - 2 * record_marker, >> > SEEK_CUR) < 0)) >> > goto io_error; >> > >> >This works if it happens within a buffer, but you cannot rely on that. >> > >> >I would therefore suggest to resolve this PR by issuing a well-defined >> >error if we encounter a pipe on opening. >> > >> >I'll prepare a patch. > As I explained in comment #23, this is already handled. When opening a file, we > stat() the fd, and use the buffered I/O functions only if it's a regular file, > otherwise the unbuffered raw I/O functions are used. This is part of the precipitate, not part of the solution ;-) For unformatted sequential, we first write a dummy record marker, write the data and the final record marker, then seek to the first marker and re-write that. Of course, this fails for an unbuffered fifo. If we want this to work, we should make sure we always use _buffered_ I/O for unformatted sequential, setting a maximum record length on open that we can handle with our buffer.