[Toybox] New diff.c

Rob Landley rob at landley.net
Tue Aug 9 16:16:55 PDT 2022



On 8/9/22 10:17, enh wrote:
> 
> 
> On Tue, Aug 9, 2022 at 1:35 AM Rob Landley <rob at landley.net
> <mailto:rob at landley.net>> wrote:
> 
>     On 8/8/22 10:30, enh wrote:
>     >> Anyway, the attached is still buggy and incomplete, but it gives the general
>     >> idea. If this ACTUALLY pending code this would be at least my third
>     checkin of
>     >> the new plumbing, but since people are building and using stuff out of
>     pending I
>     >> can't replace it until the new stuff fully works, which means you don't
>     get to
>     >> see all the development history. So here's a checkpoint since I've been kinda
>     >> quiet otherwise. :)
>     >
>     > no history is always a mistake that ends up being regretted...
> 
>     I know. That's why I posted a working checkpoint to the list.
> 
>     > just
>     > check in as diff2, ndiff (new), tdiff (toybox), rdiff (rob) and then
>     > rename or delete when you make your final decision?
> 
>     Except every time I've tried that the new one winds up getting abandoned, for
>     reasons vaguely related to https://xkcd.com/927/ <https://xkcd.com/927/> .
> 
> 
> ah, you're worried that people will start to depend on it, and any bugs it might
> have?

It's that I can't get rid of the OLD one. If people still depend on the old one
I have to fix bugs or field patches against the old one, and thus keep the
mental state of both loaded in my head. I can't remove the old one until the new
one is "good enough" which is a moving target and will always disappoint
somebody with a corner case.

There's always pressure to keep both, which winds up like busybox's two whole
netcat implementations:

http://lists.busybox.net/pipermail/busybox/2010-June/072735.html

I just checked and that's still in current busybox, where it #includes
nc_bloaty.c which is apparently the entire other implementation.

What I need to do is finish making the new one good enough to displace the old
one. Accomodations for having two of them persist in parallel are never
temporary in my experience.

> you could always have a non-master branch?
This is mostly stuff I've learned NOT to do over the years, so haven't done
recently. (I have a rowte.c locally I haven't checked in because route.c works,
albeit via the wrong API that doesn't support multiple routing tables. It's one
of the two commands I switch on in mkroot. I need to fix that.)

The high water mark of this was probably bbsh back in busybox, which was the
FIFTH shell implementation busybox had at the time (after lash, hush, ash, and
the minix shell): I didn't get to finish it in that context, and it wound up
getting removed again. My tinycc fork had to follow a moving target for years
(which stopped when I stopped and started up again when I started up again for
several years).
 
I'm trying to clean stuff up and collapse duplicated things together, not create
more parallel instances of things both needing support. I have both historical
scars here and a _conceptual_ objection.

People using code out of pending is a problem I'm trying to fix by doing work to
move code OUT of pending.

Also, in this case, I recently noticed:

$ diff -w -u <(busybox diff --help 2>&1) <(./diff --help)
--- /dev/fd/63  2022-08-09 17:19:14.415993160 -0500
+++ /dev/fd/62  2022-08-09 17:19:14.415993160 -0500
@@ -1,9 +1,4 @@
-BusyBox v1.31.0 (2019-08-13 06:54:37 CDT) multi-call binary.
-
-Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2
-
-Compare files line by line and output the differences between them.
-This implementation supports unified diffs only.
+usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
@@ -20,3 +15,4 @@
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
+

Which can't be good from a licensing perspective. (I know I rejected a patch for
doing that sort of thing before, here on the list, but Google isn't finding it.
In fact site:lists.landley.net isn't finding half the stuff in my mbox, Maybe
when the lists site was down Google discarded half its cached search stuff and
didn't notice when it went back up, or something?)

If the help text was copied verbatim I don't trust the REST of that code not to
have licensing issues, so it's a good thing I'm replacing it...

Rob


More information about the Toybox mailing list