9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] tar (was: a dumb question)
@ 2002-06-27  9:52 Geoff Collyer
  0 siblings, 0 replies; only message in thread
From: Geoff Collyer @ 2002-06-27  9:52 UTC (permalink / raw)
  To: 9fans

To inject a few more facts:

1.  Tar *was* written to copy trees; here's an excerpt from the first
tar man page I've been able to find (V7 Unix, 1979):

          f         causes tar to use the next argument as the name of
                    the archive instead of /dev/mt?. If the name of
                    the file is `-', tar writes to standard output or
                    reads from standard input, whichever is appropri-
                    ate. Thus, tar can be used as the head or tail of
                    a filter chain Tar can also be used to move hier-
                    archies with the command
                      cd fromdir; tar cf - . | (cd todir; tar xf -)

2.  The original tar archive format is limited to 100 bytes for a path
name.  There is an ANSI or POSIX standard that extends that to 256
bytes by using 156 previously-unused bytes elsewhere in the header
block.

3.  I've profiled tar and the main costs incurred by tar other than
the obvious open, read, write, and close system calls are the cost of
checksumming the header blocks and in-memory copies of blocks to block
and unblock (if using a blocking factor other than 1).  The latter
cost can be reduced by copying pointers rather than data where
possible and I've got a version of tar that does so, but at some cost
in complexity.  The cost of converting integers to ascii and back can
be pretty minimal, since they are represented in octal and thus
needn't involve multiplication nor division.

My dircp is

	@ {cd $1 && tar cf /fd/1 .} | @ {cd $2 && tar xTf /fd/0}

since the use of named files (/fd/?)  triggers use of a blocking
factor of 20 which is faster than using a blocking factor of 1, at
least once tar has been modified to not copy data so much internally.
I also like to preserve mod. times.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-06-27  9:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-27  9:52 [9fans] tar (was: a dumb question) Geoff Collyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).