svn commit: r317709 - head/usr.bin/csplit

Pedro Giffuni pfg at FreeBSD.org
Wed May 3 18:18:33 UTC 2017



On 05/03/17 09:56, Pedro Giffuni wrote:
>
> ...
>
>> Grepping for fputs in /usr/src shows too many instances to check (mostly
>> without any error handling).  The simplest filter 'if (fputs' found the
>> dependency on the old FreeBSD behaviour in csplit and 2 other places:
>>
>> contrib/mdocml/main.c:        if (fputs(cp, stdout)) {
>> contrib/mdocml/main.c-            fclose(stream);

I can't find the above on the version in FreeBSD-current (or 11-stable).
>> contrib/libreadline/examples/rlcat.c: if (fputs (x, stdout) != 0)
>> contrib/libreadline/examples/rlcat.c-        return 1;
>>

This is an example so it's luckily not under use. Hopefully libreadline is
going away from base but it's still important to report this upstream 
(will do).

>> More complicated filters like 'if ([^(]]*[^a-z_]fputs' failed to find
>> any problems since I messed up the regexp.
>>
>
> I admittedly ignored contrib, plus I only skimmed for comparisons to 
> zero.
>
> Now I am worried: the classic BSD implementation is ubiquitous and 
> this bug
> is not easy to find, particularly in ports.
>

I went though the OpenOffice code, and it's dependencies, and I couldn't 
find any
place where a similar issue happens. I did find several places where 
there was a
correct comparison to EOF or >=0, but the vast majority of code just 
call fputs()
without checking the return value.

> Do you guys think it we should revert to the previous behavior, at 
> least for 11.1?
> The bugs should be reported upstream but it is not really our battle 
> to fix the world
> for Apple is it?
>
It seems like most code may have already adapted to the Apple variant.

Pedro.





More information about the svn-src-head mailing list