<div dir="ltr"><a href="https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/scripts/Makefile.package#49">https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/scripts/Makefile.package#49</a> and <a href="https://android.googlesource.com/kernel/build/+/d68a8336a396a98820de2b3432ce5206fe70c854/build.sh#668">https://android.googlesource.com/kernel/build/+/d68a8336a396a98820de2b3432ce5206fe70c854/build.sh#668</a> are the only two usages i've ever seen (and internal code search didn't have any others when i asked it).<br><div><br></div><div>sadly i've forgotten how to search debian packages again... but apparently i did remember last time this came up: <a href="http://lists.landley.net/htdig.cgi/toybox-landley.net/2020-October/012074.html">http://lists.landley.net/htdig.cgi/toybox-landley.net/2020-October/012074.html</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 19, 2022 at 6:53 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The "only apply transforms to certain file types" selection is CONCEPTUALLY<br>
broken because the directories leading to those entries participate in the<br>
transform, and the directories have their own type (which is not listed), and<br>
each directory is stored in its own entry because tar x doesn't mkdir -p. So if<br>
you make a symlink and a file in a deepish hirerarchy but only adjust the<br>
directory names of SOME entries, it's not gonna extract right? Let's try:<br>
<br>
$ ln -s seven one/two/three/four/five/six<br>
$ touch one/two/three/four/five/eight<br>
<br>
And then tell debian's tar to modify the path of non-symlinks:<br>
<br>
$ tar cv one --xform=s/three/zero/S | tar t<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
one/<br>
one/two/<br>
one/two/zero/<br>
one/two/zero/four/<br>
one/two/zero/four/five/<br>
one/two/zero/four/five/eight<br>
one/two/zero/four/five/six<br>
<br>
The symlink's path is modified despite the S exclusion. What happens if I tell<br>
it to apply a different change that includes the filename:<br>
<br>
$ tar cv one --xform=s@five/six@seven@S | tar t<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/seven<br>
<br>
The "do not apply to symlink" got ignored? How about JUST the filename?<br>
<br>
8$ tar cv one --xform=s@six@seven@S | tar tone/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/seven<br>
<br>
What does the S exclusion MEAN here?<br>
<br>
landley@driftwood:~/toybox/toybox/sub8$ ls -ls one/two/three/four/five<br>
total 0<br>
0 -rw-r--r-- 1 landley landley 0 May 19 08:29 eight<br>
0 lrwxrwxrwx 1 landley landley 5 May 19 08:29 six -> seven<br>
<br>
$ tar cv one --xform=s@eight@nine@R | tar t<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
<br>
The "do not apply to regular files" exclusion is working...<br>
<br>
$ tar cv one --xform=s@three@zero@R | tar t<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
<br>
Including for directory entries?<br>
<br>
$ tar cv one --xform=s@three@zero@r | tar t<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
one/<br>
one/two/<br>
one/two/zero/<br>
one/two/zero/four/<br>
one/two/zero/four/five/<br>
one/two/zero/four/five/eight<br>
one/two/zero/four/five/six<br>
<br>
$ tar cv one --xform=s@six@seven@r | tar tone/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/six<br>
one/<br>
one/two/<br>
one/two/three/<br>
one/two/three/four/<br>
one/two/three/four/five/<br>
one/two/three/four/five/eight<br>
one/two/three/four/five/seven<br>
<br>
So it thinks directories are regular files. It also thinks (dangling) SYMLINKS<br>
are regular files...<br>
<br>
$ tar c ccc --xform s/ccc/abd/S | tar t<br>
abd<br>
$ tar c ccc --xform s/ccc/abd/R | tar t<br>
ccc<br>
<br>
Ok, non-dangling symlinks with no directory component are ALSO regular files. It<br>
seems to think EVERYTHING is a regular file. Great. (I have not poked much at<br>
hardlinks yet because it seems a bit obscure?)<br>
<br>
Sigh. I am trying to work out what to implement here, and it's... not well<br>
specified. (Can I just NOT implement the /RHS part yet and call it good? So far<br>
it looks like specifying "R" means "ignore this --xform" and everything else is<br>
a NOP? Modulo the H exclusion I haven't tested yet because hardlinks don't come<br>
up much...)<br>
<br>
Rob<br>
_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net" target="_blank">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" rel="noreferrer" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
</blockquote></div>