This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Fix ftell with fdopen for all cases and fopen with a+ mode (#16532)
- From: Rich Felker <dalias at aerifal dot cx>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 19 Feb 2014 00:50:53 -0500
- Subject: Re: [PATCH v2] Fix ftell with fdopen for all cases and fopen with a+ mode (#16532)
- Authentication-results: sourceware.org; auth=none
- References: <20140218160649 dot GA20628 at spoyarek dot pnq dot redhat dot com> <20140218162735 dot GQ184 at brightrain dot aerifal dot cx> <20140218164449 dot GN27461 at spoyarek dot pnq dot redhat dot com>
On Tue, Feb 18, 2014 at 10:14:49PM +0530, Siddhesh Poyarekar wrote:
> On Tue, Feb 18, 2014 at 11:27:35AM -0500, Rich Felker wrote:
> > Having the flush/seek sync the offset is not valid, since it's
> > permissible to switch to using a different active handle (e.g. the
> > underlying fd or a copy of the FILE in a forked child) at this point
> > and adjust the offset before switching back to this FILE. Instead,
> > explicit flush/seek operations need to reset the offset status to
> > "unknown" so that future ftell operations will query it again like
> > they did the first time. Implicit flush from the buffer filling up
> > does not need to do this.
>
> Then this would be wrong in existing code anyway. Could you file a
> bug so that I can take a look at it as a separate problem?
Submitted as https://sourceware.org/bugzilla/show_bug.cgi?id=16605
> Also, does the fix look OK? It's OK if you don't want to give an ack
> for the patch, but I'd like your opinion on it since you had pointed
> out problems with the earlier fix.
I looked briefly at the patch and I don't see anything particularly
wrong about it; at least it doesn't seem to make anything worse and
looks like it fixes the particular issue. But I suspect you might end
up removing or at least rewriting/moving this logic in fixing #16605.
Rich