[Toybox] Tar --transform is weird.

scsijon scsijon at lamiaworks.com
Fri May 20 16:02:46 PDT 2022


On 21/5/22 00:05, Rob Landley wrote:
> On 5/19/22 18:55, scsijon wrote:
>> Sorry for the toppost but i don't know where this should go.
> Eh, it was pretty long. :)
>
>> My understanding is that you should be putting the S flag at the START
>> of the transform= line, not the end as it's actioned in order from the =
>> and s is also a transform flag so is actioned first and would overwrite
>> the S flag, ie the S would be ignored.
>>
>> https://www.gnu.org/software/tar/manual/html_section/transform.html#transform
>> is the refreance page for this. Look about halfway down for 's' and 'S'.
> I did:
>
> The expression is a sed-like replace expression of the form:
> s/regexp/replace/[flags]

try

s,regexp/replace/[flags]

it should use sed correctly then, the problem is that transform looks for it's flags first and can 'mess-up'. they have been told, and the easy fix, but ignored the email.

> Supported flags are:
> ‘g’ Apply the replacement to all matches to the regexp, not just the first.
>
> In addition, several transformation scope flags are supported, that control to
> what files transformations apply. These are:
> ‘r’ Apply transformation to regular archive members.
>
> Where do you get "flags go at the start?" from that? The s at the start (lower
> case, not upper case) is the sed search-and-replace command, not a flag. The S I
> was talking about is the flag:
>
> ‘S’ Do not apply transformation to symbolic link targets.
>
> (Specifying _any_ of the lower case srh seems useless because they're the
> default, you'd only use them after an SRH to undo it again and... why? There's
> no P to not print after a p... No G to say "I didn't really mean to say global,
> actually just do the first one"...)
>
> I've tried to find an example of anyone actually USING the select-by-filetype
> flags with tar transform, and so far have not managed to. Do you have an
> example? (Could you get it to work?)
>
> Also, why doesn't --strip apply equally to create and extract? Why does the
> --show-transformed option exist? (Why would you NOT show the names you're using?
> You can always cat "tar.tar | tar t | tar x --transform" if you want the output
> NOT to match what it's actually doing, why would you make it the DEFAULT?)
>
> This whole feature does not appear thought out.
>
> (Oh hey, there's a -P option to disable stripping / off the start of extracted
> names. Maybe I should implement that? I wonder if that also disables the
> ../../.. stripping? It doesn't say. Time to test!)
>
> 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?
>
> Rob



More information about the Toybox mailing list