tar fs copy

David Herron, NPR Lover david at ukma.UUCP
Sat Sep 21 16:09:27 AEST 1985


In article <249 at investor.UUCP> rbp at investor.UUCP (Bob Peirce) writes:
>>> following runs fine.
>>> 
>>> if [ $# -ne 2 ]
>>> then
>>> 	echo usage: cphier frompath topath
>>> fi
>>> exec tar cf - $1 | (cd $2; tar xf - )
>> 
>> directory it does a fork/exec of mkdir, then waits for all of its
>> children to die, including the first tar. Now if the first tar is
>> nearly finished then it will write its output to the pipe and exit,
>> which allows the second tar to continue. However, if the first tar
>> has to write more than what will fit in the pipe then the whole mess
>> hangs up, because the first tar is waiting for the second tar to
>> read from the pipe, and the second tar is waiting for the first tar
>> to exit.

huh?  This can't work as you're suggesting.  If so, then the standard
tar pipeline (as documented in tar(1)) wouldn't work at all.

I've often (read, any time I copy directory heirarchies) used that
pipeline, and IT'S JUST WORKED.  This is for both simple directory
trees (one or two levels) all the way to very complicated ones (like,
the System V troff/nroff tree).

Tar HAS to be able to exec mkdir at any time and work correctly.  It
can't be waiting for all it's children to exit like you say.....

By The Way ... I always use the complete form as in:

	(cd $1; tar cf - .) | (cd $2; tar xf -)

but there was this wonderfull shell script posted to net.sources
around last may or so that did all sorts of error checking and
creating of target directories and all.  So that's what I use
instead of doing the above directly.  (Look in your sources archive
for "cpdir(1)").

-- 
--- David Herron
--- ARPA-> ukma!david at ANL-MCS.ARPA
--- UUCP-> {ucbvax,unmvax,boulder,oddjob}!anlams!ukma!david
---        {ihnp4,decvax,ucbvax}!cbosgd!ukma!david

Hackin's in me blood.  My mother was known as Miss Hacker before she married!



More information about the Comp.unix.wizards mailing list