[Nottingham] Calculating the overhead of "tar"
Paul Sladen
notlug at paul.sladen.org
Sun Dec 12 19:33:23 GMT 2004
On Sun, 12 Dec 2004, Mike Cardwell wrote:
Hello Mister Cardwell.
> I was hoping to not have to reverse engineer tar. :(
"Reverse Engineer?". ...You have the source code!
> > A Google search might find some docs...
> That's the problem. It doesn't. :)
file:///usr/include/tar.h
Complete with a nice description of the file format; the code would be
something like:
total = 1024 # 2*512 Null termination blocks at end, plus
for f in files:
total += (filesize(f) + 1023) & ~511 # 512 header + n*512 data
GNU tar appears to round up to the nearest 20 blocks (10kB), so also:
total = ((total + 10239) / 10240) * 10240
depending on what your perl library does.
-Paul
--
Is there no safe way to travel? Mataro, ES
More information about the Nottingham
mailing list