Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!std-unix
From: mmengel@cuuxb.uucp (Marc W. Mengel)
Newsgroups: comp.std.unix
Subject: Re: tar vs. cpio
Message-ID: <637@uunet.UU.NET>
Date: Mon, 13-Jul-87 14:30:17 EDT
Article-I.D.: uunet.637
Posted: Mon Jul 13 14:30:17 1987
Date-Received: Fri, 17-Jul-87 01:48:36 EDT
References: <8440@ut-sally.UUCP>
Sender: std-unix@uunet.UU.NET
Reply-To: mmengel@cuuxb.uucp (Marc W. Mengel)
Organization: AT&T-DSD, System Engineering for Resellers, Lisle IL
Lines: 53
Approved: jsq@uunet (Moderator, John Quarterman)

From: mmengel@cuuxb.uucp (Marc W. Mengel)

In article <8440@ut-sally.UUCP>;
>I noted Marc Mengel's suggestion that tar write out the contents of a file
>when the last link to a file is encountered, rather than the first.  This
>would be nice, but I don't see how it could be done in a way that is
>backward compatible with the current tar format.  


Maybe I was too brief in my attempt at describing it... What you do
is make two recursive descents of the directory tree.  

In the first recursive descent, you generate a table that looks like

	file id #	last place seen in recursive descent
	123		foo/bar/baz
	333		foo/baz/bleem
...

Each time you encounter a file in the recursive descent you either add it
to the list, if its file id # isn't there, or replace its pathname in 
the second half of the table.

In the second recursive descent, you look up each file you see in the table,
(by file id #) and if its path-from-the-table matches the current path,
you write out the file on the archive, otherwise you mark the current 
path as a link to path-from-the-table in the archive.

Since our two recursive descents of the file tree should be identical, we
should always have only the last reference to a given file with data, and
all earlier references to that file listed as links to the one later on
the archive.

(Of course we only need to put files in the table that have multiple
links...)

So I am asking that a notation be put in the tar archive format for a
link to another file in the archive, along with the requirement that 
link-to-file-"foo" nodes in the archive must always precede file-"foo"
nodes.


[ If you want to make a proposal to the P1003.1 Working Group,
you need to supply actual wording for the standard.  -mod ]

-- 
 Marc Mengel
 attmail!mmengel
	or
 ...!{moss|lll-crg|mtune|ihnp4}!cuuxb!mmmengel


Volume-Number: Volume 11, Number 90