[BusyBox] [PATCH] sed 'T' command

Rob Landley rob at landley.net
Fri May 20 19:01:31 UTC 2005


Darn it.

On Friday 20 May 2005 10:48 am, Rob Landley wrote:
> On Wednesday 18 May 2005 01:44 am, Rob Landley wrote:
> > On Tuesday 12 April 2005 01:41 pm, Colin Watson wrote:
> > > This patch implements the 'T' command in sed. This is a GNU extension,
> > > but one of the udev hotplug scripts uses it, so I need it in busybox
> > > anyway.
> > >
> > > Includes a test; 'svn add
> > > testsuite/sed/sed-branch-conditional-inverted' after applying.
> >
> > Applied, however I'm a bit concerned about the logic.
>
> I vill not buy thees logic, it ees scratched.
...
>Despite this, a patch is attached

that sucked as badly as the original problem, just in a different way.  (This 
time screwing up the 't' test...)

I'm not awake enough to come up with a variant that only has just one zeroing 
of substituted.  In the case of the first match finding a substitution did 
occur, we want to zero substituted before we fall through to the test for T 
so that T finds one _didn't_ occur and we fall through again to the branch.  
But if we jump straight into T and it finds there was a substitution (thus 
breaking instead of jumping), we have to zero it before the actual break 
because the logic is "did a substitution occur since last test", and we just 
tested (even though the test was false, it still selected which of two code 
paths to go down and counts as a test).

So to get both of these right, we need a zero before the 'T' test and another 
zero if 'T' triggers.  Sigh.

Less sucky patch.  (Still sleep deprived, but possibly Wright this time.  One 
of the brothers, at least...)

Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: walrus2.patch
Type: text/x-diff
Size: 606 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20050520/7e9c1c45/attachment.bin 


More information about the busybox mailing list