[Toybox] Tar --transform is weird.

Rob Landley rob at landley.net
Fri May 20 20:40:04 PDT 2022


On 5/20/22 09:05, Rob Landley wrote:
> And again, why a --show-stored-names if it's the default? There isn't an "rm -r
> --do-not-recurse". How does this HELP?

And of course, using that one/two/three/four/five/six hierarchy where six is a
file and the ones before it are directories:

diff -u <(tar c one --xform=s at three/four/@zero@ | hd) \
      <(./tar c one --xform=s at three/four/@zero@ | hd)
--- /dev/fd/63	2022-05-20 20:54:05.239891396 -0500
+++ /dev/fd/62	2022-05-20 20:54:05.239891396 -0500
@@ -40,14 +40,13 @@
 00000520  00 00 00 00 00 00 00 00  00 6c 61 6e 64 6c 65 79  |.........landley|
 00000530  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
-00000600  6f 6e 65 2f 74 77 6f 2f  74 68 72 65 65 2f 66 6f  |one/two/three/fo|
-00000610  75 72 2f 00 00 00 00 00  00 00 00 00 00 00 00 00  |ur/.............|
-00000620  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000600  6f 6e 65 2f 74 77 6f 2f  7a 65 72 6f 00 00 00 00  |one/two/zero....|
+00000610  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *

Because the filename the gnu/dammit version is actually SAVING INTO THE TAR ends
with a / (it adds one to all directory entries!) but the slash was added AFTER
it did the regex.

Full bug-for-bug compatibility with this feature is just ACTIVELY STUPID. I
think I'm just going to implement something that makes sense and wait for people
to complain with specific test cases where they explicitly want the stupid.
(Which means "how do I write test cases that both the host and toybox pass"
remains annoying. My tendency to probe all the weird corner cases of a command
to see what it does is not finding a coherent design here, it's finding bad
implementation details bubbling to the surface...)

Rob



More information about the Toybox mailing list