[Toybox] A couple of minor fixes

enh enh at google.com
Fri Jun 10 09:03:55 PDT 2016


On Fri, Jun 10, 2016 at 1:34 AM, Mike Moreton
<Mike.Moreton at frontier-silicon.com> wrote:
>> can you give an example that fails? toybox 0.7.1 works fine for me on Ubuntu's 14.04's 2.19 (ldd (Ubuntu
>> EGLIBC 2.19-0ubuntu6.9) 2.19).
>
> I guess first off I should say that we're using a library provided by a supplier, so who knows what patches it could have in it, or how it's been compiled.
>
> It's the following line that appears to give the problem:
>
> if (line) xprintf("%.*s%c", trim ? trim : INT_MAX/2, line, TT.outdelim);
>
> For example "echo hello | grep hello" produces no output, while "echo hello | grep -n hello" gives "1:".
>
> We're also cross-compiling for a 32 bit target on a 64 bit host, which made me suspicious about picking up the wrong include files, but I printed out INT_MAX/2 from grep, and it was 0x3fffffff, so that's OK.
>
> I know this problem is in GLibC

except it's not, afaics. we already work around the glibc bug. this
seems like a bug your supplier introduced.

/tmp/toybox$ ldd --version
ldd (Ubuntu EGLIBC 2.19-0ubuntu6.9) 2.19
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
/tmp/toybox$ echo hello | ./toybox grep hello
hello
/tmp/toybox$ echo hello | ./toybox grep -n hello
1:hello
/tmp/toybox$

> and should be fixed there, but in something like Toybox I think it's wise to be resilient and not use the "outer space" of the system unless there is no alternative.  But then as my contribution level is low, the weight of my opinion is also low!

have you reported this bug to your supplier?

have you experimented to work out what they largest value they _can_
cope with is? does your version work with INT_MAX? (maybe your
supplier backported the "fix" that's introduced a new bug?)

-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.


More information about the Toybox mailing list