9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Geoff Collyer <geoff@collyer.net>
To: 9fans@cse.psu.edu
Subject: [9fans] tar (was: a dumb question)
Date: Thu, 27 Jun 2002 02:52:01 -0700	[thread overview]
Message-ID: <c593f65e1ae0b07b072e004e7dfeafe7@collyer.net> (raw)

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.



                 reply	other threads:[~2002-06-27  9:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c593f65e1ae0b07b072e004e7dfeafe7@collyer.net \
    --to=geoff@collyer.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).