From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31193 invoked by alias); 27 May 2014 08:25:34 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 30811 invoked by uid 55); 27 May 2014 08:25:29 -0000 From: "cvs-commit at gcc dot gnu.org" To: glibc-bugs@sourceware.org Subject: [Bug stdio/16724] offset computation in ftell is incorrect when a read is followed by a write for files opened in a+ mode Date: Tue, 27 May 2014 08:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: siddhesh at redhat dot com 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://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg00208.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16724 --- Comment #4 from cvs-commit at gcc dot gnu.org --- This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, master has been updated via 2482ae433a4249495859343ae1fba408300f2c2e (commit) from bab900166e8b5f0f4081c5cf1afa0cd33b123714 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2482ae433a4249495859343ae1fba408300f2c2e commit 2482ae433a4249495859343ae1fba408300f2c2e Author: Siddhesh Poyarekar Date: Tue May 27 13:54:19 2014 +0530 Fix offset computation for append+ mode on switching from read (BZ #16724) The offset computation in write mode uses the fact that _IO_read_end is kept in sync with the external file offset. This however is not true when O_APPEND is in effect since switching to write mode ought to send the external file offset to the end of file without making the necessary adjustment to _IO_read_end. Hence in append mode, offset computation when writing should only consider the effect of unflushed writes, i.e. from _IO_write_base to _IO_write_ptr. The wiki has a detailed document that describes the rationale for offsets returned by ftell in various conditions: https://sourceware.org/glibc/wiki/File%20offsets%20in%20a%20stdio%20stream%20and%20ftell ----------------------------------------------------------------------- Summary of changes: ChangeLog | 9 +++ NEWS | 10 ++-- libio/Makefile | 4 +- libio/fileops.c | 12 +++- libio/tst-ftell-append.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++ libio/wfileops.c | 13 +++- 6 files changed, 207 insertions(+), 10 deletions(-) create mode 100644 libio/tst-ftell-append.c -- You are receiving this mail because: You are on the CC list for the bug.