[Toybox] "bad xform" not very helpful

Rob Landley rob at landley.net
Wed Sep 7 14:04:20 PDT 2022


On 9/6/22 18:16, enh wrote:
> and to the surprise of absolutely no-one ...
> 
> they got back to me with a test script to repro this with (which i assume will
> work in any kernel tree, and isn't specific to ACK)...
> ```
> #!/bin/bash
> 
> set -x
> 
> run () {
>   start_time=$(date +%s)
> 
>   find /usr/include/linux/ -name *.h -print0 | \
>       /usr/bin/perf record -g --               \
>       tar czf target.$1.tar.gz                 \
>       --absolute-names                         \
>       --dereference                            \
>       --transform "s,/usr/include/,,"          \
>       --null -T -
> 
>   mv perf.data perf.$1.data
> 
>   end_time=$(date +%s)
>   elapsed=$(( end_time - start_time ))
>   echo $elapsed s
> }
> ```
> 
> ...and reported that all the time is going into tar fork()ing and exec()ing sed :-(

Yeah, not surprised.

> so although NORECURSE was a clever hack to work around the _first_ tar+sed
> problem, it seems to have had the expected result of landing me back with the
> original tar+sed problem :-(

I just checked in some more test tweaking, which hopefully lets me park that for
a bit. (I still need to fix the chattr tests, which are skipped because root and
last worked who KNOWS when, the first test is failing the same way on the host
and with toybox because the output it expects is the wrong LENGTH... filesystem
type probably changed out from under it in a distro version upgrade. But I poked
them because that's the other remaining SKIPNEXT=1 usage I missed removing when
I changed the test plumbing's semantics.)

I'm also 2/3 of the way through adding toysh support for blockless functions ala
"x() echo hello; x" which of course spawned a couple tangents:

1) after parsing the function body gets pulled out of the current parse block
and moved to a linked list of defined functions because object lifetime: when
you exit the current block and it frees it the function that got defined needs
to persist, so I made a reference counted structure. But the transplant code
assumed it was starting in a block and didn't know when to end if it wasn't, so
it needed some massaging.

2) I was adding a placeholder type 'f' pipeline segment and I do NOT remember
why, it not only seems unnecessary but I have a TODO not to remove it?

And of course I want to get diff finished and checked in.

(And Moritz Weber sent me a git.c drop to help him debug, and reminded me we
were poking at host/nslookup, and that I was doing videos, and...)

I'm trying to get the symlink stuff converted so it passes better on mac, then
lemme try to get diff and sh parked, and then I need to implement the sed
extension so tar can use one persistent instance in a streaming manner. And then
I can finish the redo of readlink.c so I can have "make test_tar" detect the
output directory from "make install_airlock", and write up a FAQ entry about
doing that...

Sorry I'm not faster. :(

Rob


More information about the Toybox mailing list