[Toybox] "bad xform" not very helpful
Rob Landley
rob at landley.net
Tue Aug 16 01:50:53 PDT 2022
On 8/15/22 18:50, enh via Toybox wrote:
> and here's their minimized repro case:
>
> echo > /tmp/foo.txt; echo /tmp/foo.txt > /tmp/find.txt
>
> cat /tmp/find.txt | prebuilts/build-tools/path/linux-x86/tar czf /tmp/out.tar.gz \
> --absolute-names \
> --transform 's,^/,,' -T -
>
> This fails with
>
> tar: bad xform
Hmmm...
$ echo > /tmp/foo.txt; echo /tmp/foo.txt > /tmp/find.txt
$ cat /tmp/find.txt | PATH=$PWD/sub9:$PATH ./tar czf out.tar.gz \
--absolute-names --transform 's,^/,,' -T -
$ tar tvf /tmp/out.tar.gz
-rw-r--r-- landley/landley 1 2022-08-16 01:53 tmp/foo.txt
Working for me? (The sub9 bit was because I stuck toybox sed in the $PATH to
make sure that wasn't it...)
> However, if the file names are fed via the -T /tmp/find.txt, it works:
Hmmm... the child process shouldn't have access to the parent's stdin, we
replaced it with a pipe? There was a potential bug in that area, but commit
dc8b46d5ddab should have fixed it last month and I don't _think_ it would have
applied here anyway...
> echo > /tmp/foo.txt; echo /tmp/foo.txt > /tmp/find.txt
>
> prebuilts/build-tools/path/linux-x86/tar czf /tmp/out.tar.gz \
> --absolute-names \
> --transform 's,^/,,' -T /tmp/find.txt
>
> (the "prebuilts/build-tools/path/linux-x86/" stuff is just a directory full of
> symlinks to toybox.)
Multiplexer instead of standalone build shouldn't make a difference if you've
disabled command recursion. (Modulo you're calling tar out a specific path but
it then grabs sed out of the $PATH, but I haven't yet implemented the extra
argument processing that would specifically require toybox sed...)
(The extra error message is a little tricker than my first guess because you can
have multiple --xform things which turn into a list of -e entries to sed...
Possibly instead of error_exit() I should error_msg(), dump the sed command line
on a second line, and then xexit()...)
Rob
More information about the Toybox
mailing list