landley / toybox

toybox
http://landley.net/toybox
BSD Zero Clause License
2.44k stars 338 forks source link

Append missing in tar #331

Open MrVeink opened 2 years ago

MrVeink commented 2 years ago

Using Toybox tar and the flag -r ain't there. Couldn't find in --help any other flag for append.

landley commented 2 years ago

Nobody had asked for it yet. I'll try to take a look in the morning. (Does it strip off the trailing null blocks or do they not cause a problem...?)

landley commented 2 years ago

$ tar c xargs.diff > woot.tar $ tar c zapdots.patch >> woot.tar $ tar tvf woot.tar -rw-r--r-- landley/landley 2213 2019-10-21 16:50 xargs.diff

It's gotta strip. Ok.

landley commented 2 years ago

I despise github's Gratuitous Wiki Syntax in replies.

landley commented 2 years ago

Except the archives can be compressed, at which point stripping off the trailing null blocks is nontrivial. Depending on the compression format, you may have to recompress the whole archive. And it's ALREADY nontrivial because you have to parse from the beginning to see how many trailing null blocks are padding and how many are potentially payload from the last file...

MrVeink commented 2 years ago

Except the archives can be compressed, at which point stripping off the trailing null blocks is nontrivial. Depending on the compression format, you may have to recompress the whole archive. And it's ALREADY nontrivial because you have to parse from the beginning to see how many trailing null blocks are padding and how many are potentially payload from the last file...

Where we're using it, it's a simple .tar without any compression but I don't know how GNU tar does it. We archive a ./usr into a tar, list everything that's in it into a text file and then inject that list afterwards to the archive. Then we use XZ and compress it.