[Toybox] [PATCH] sed: fix substitution of empty capturing groups.

Rob Landley rob at landley.net
Tue Feb 12 19:39:05 PST 2019


On 2/12/19 6:35 PM, enh via Toybox wrote:
> The test for \N where N was larger than the number of capturing groups
> in the regular expression was incorrect, and firing for cases such as
> matching __(ARM_)?NR_([a-z]*) against __NR_read, where the first group is
> empty (because it failed to match) but the second group did match "read".
> 
> Use regex_t's re_nsub for the error check, and treat rm_so == -1 as a
> signal to just copy nothing into the result.
> 
> (Found trying to build minijail in AOSP.)

I know it's cheating for me to hand-edit a patch I apply with "git am". My
excuse is you mixed tabs and spaces, not the extra curly brackets. :)

Rob



More information about the Toybox mailing list