[Toybox] [PATCH] xargs: fix -E.

Rob Landley rob at landley.net
Mon Oct 21 19:47:14 PDT 2019


Sorry, my description for 4e0d246ec98f wasn't helpful, but it included:

-      if (TT.E && strstart(&save, TT.E)) return (char *)2;
+      if (TT.E && strstart(&ss, TT.E) && ss == s) return (char *)2;

$ echo one potato two | ./toybox xargs -n1 -E pot
one
potato
two

I started down that rathole because adding a ran_once special case variable
seemed a bit inelegant and when I started reexamining the logic it was one of
those "pull the thread on the sweater" things and I really want  to redo the
whole thing based on do_lines... but I think I should hold off on the working
stuff and focus on the pending directory for now.

Rob

On 10/21/19 12:39 AM, enh via Toybox wrote:
> ping?
> 
> On Fri, Oct 18, 2019 at 5:22 PM enh <enh at google.com> wrote:
>>
>> 89a8d00e470f1999a62ceea81269af2f39c655ba broke -E by switching to a
>> prefix match. Add the missing test and fix the bug, but caching the
>> length of the -E argument because the call to strlen(3) on every single
>> piece of input presumably motivated the change that introduced the bug.
>> ---
>>  tests/xargs.test   | 2 +-
>>  toys/posix/xargs.c | 6 +++++-
>>  2 files changed, 6 insertions(+), 2 deletions(-)
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
> .
> 



More information about the Toybox mailing list