[FFmpeg-devel] [PATCH 00/13] check all fclose usage

wm4 nfxjfg at googlemail.com
Wed Jan 13 10:05:29 CET 2016

On Tue, 12 Jan 2016 10:07:08 -0500
Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:

> On Tue, Jan 12, 2016 at 9:43 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> > Hi,
> >
> > On Tue, Jan 12, 2016 at 7:52 AM, Ganesh Ajjanagadde <gajjanag at mit.edu>
> > wrote:
> >  
> >> On Tue, Jan 12, 2016 at 4:38 AM, wm4 <nfxjfg at googlemail.com> wrote:  
> >> > This makes no sense. Even if fclose() should fail for
> >> > whatever obscure reasons there might be, reading already worked
> >> > without errors, and thus closing failure has no meaning to use.  
> >>
> >> Well, reading may not have worked, and the fclose may have been called
> >> in a failure path.  
> >
> >
> > Then the error should be in the code path of fread(), not fclose().
> > Displaying an error (in whatever way) related to close while the actual
> > problem was reading data is going to be confusing to the user.  
> Read the rest of it; checking for every fread/fseek is not productive;
> there are at least 3 of fread/fseek in the example I gave. Printing at
> the time of closure is a natural means of doing things, again see:
> https://www.gnu.org/ghm/2011/paris/slides/jim-meyering-goodbye-world.pdf
> (particularly slide 7).
> Again, this is more important for write than read. Or put in other

Indeed, the slides don't mention reading AT ALL.

A quick grep shows that we apparently do at least _something_ with the
return value of every single fread() call, and most if not all are in
test/example code.

> words: if the approach of checking at close is going to be nacked no
> matter what the contents of the message is; I will wash my hands off
> this issue wrt files opened read-only.
> >  
> >> Just what is the point?
> >>
> >> Can you please stop trolling patches with such gratuitous statements at
> >> the end?  

Isn't my question justified? Yes, I might be missing something here,
but so far I couldn't yet think of a reason why you'd check fclose()
return values if the file is read-only and if all fread()s are checked
already. Wasting my time with reading a PDF that exclusively handling
_writing_ to _stdout_ (which you do not fclose()) did not help at all.
Maybe I'm just insane?

> >
> >
> > ... Can we not be defensive, please? ...  
> There was nothing "defensive" here. Can you stop dismissing technical
> comments as "defensive"? This is not the first time you are doing
> this, and not the first time wm4 has added such useless, provocative
> statements...

Sorry for pointing out that some of your patches literally do nothing.
It's in the nature of the thing: if you flood the ML with many such
patches (with the threat included of applying them if nobody reviews
them), people _might_ be more quick to dismiss them, especially if they
find strangenesses like this one. Why are you surprised.

This is not so say that these patches are "useless" in general, but if
they're spiked with definitely useless ones (like the read-only fclose
so far appear to me to be), then I'll be critical of it. (And to be
honest, I'll just assume that the other supposedly more useful patches
were done with the same carelessness and equally superficial reasoning.)

Sorry for possibly causing drama, I'll go away now. I guess I'll
concentrate on doing actual work instead, who cares if non-sense gets
pushed to the FFmpeg repo.

More information about the ffmpeg-devel mailing list