[Toybox] find crash

Rob Landley rob at landley.net
Sun Sep 13 16:15:51 PDT 2015


On 09/09/2015 09:59 PM, enh wrote:
> mentioned on https://android-review.googlesource.com/#/c/170020/:

I should have opened that page before I got on the plane. :)

I'm applying reworked versions of Daniel's fixes. Only worked through
the first half on the flight to Tokyo though. (It was a full flight, and
macs do not fit on those tv trays nearly as well as my netbook did, so I
didn't get much typing done.)

> touch file1
> touch file2
> touch file2
> ./toybox find . -mindepth 1 -newer file1 -exec ls {} ;
> 
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  do_find (new=0x133a190) at toys/posix/find.c:179
> 179            if (dl->prev == (void *)1 || !new->parent)
> 
> 
> the "-mindepth 1" appears to be a necessary condition.
> 
> 
> (really they wanted to use '+' but found that wasn't working, and hit
> this crash when investigating.)

Sigh. It worked at one point in testing, let's see...

Ok, it looks like kernel commit b6a2fea39318 in 2007 (linux 2.6.22)
removed the 131072 byte environment limit, so the logic I'm doing to
count that up can go away (and from xargs too). The new limit is 131072
bytes _per_string) times 2 billion strings, so essentially no limit.

(Do I want to check against MAX_ARG_STRINGS I.E. 0x7fffffff ? Hmmm.
Maybe? find and xargs can both hit that. I'm more likely to put an
arbitrary lower limit like 64k bach in there just to keep memory usage
down to a dull roar...)

> (but really they wanted -delete, and to not have to deal with -exec at all.)

Send me a patch, but after I get this checked in...

(I hate testing deletes. I've had things run away and eat my filesystem
more than once. I really need to get that qemu test environment set up
and automated/documented...)

Rob

 1442186151.0


More information about the Toybox mailing list