bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] make your tar archive even more anonymous


From: Denis Excoffier
Subject: Re: [Bug-tar] make your tar archive even more anonymous
Date: Thu, 5 Jul 2012 16:57:49 +0159
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jul 05, 2012 at 08:57:14AM +0200, Denis Excoffier wrote:
>> On Wed, Jul 04, 2012 at 11:47:17AM -0700, Tim Kientzle wrote:
>> >> On Jul 4, 2012, at 7:01 AM, Denis Excoffier wrote:
>> >> > 
>> >> > When tar (e.g. tar-1.26) creates an archive of a directory, the
>> >> > ordering of files (as shown by "ls -f") is preserved in the archive.
>> >> > 
>> >> > I would like an option to make this ordering constant (e.g. 
>> >> > alphanumeric),
>> >> > in order that two directories that compare equal (with "diff -r") would
>> >> > produce the same archive (provided of course that appropriate --mtime,
>> >> > --owner, --group and --mode options are also set to the same values).
>> >> 
>> >> Does this satisfy your requirement?
>> >> 
>> >> find dir | sort | tar cf output.tar -I -
>> >> 
>> >> The option you propose can have unpleasant implications
>> >> for tar's memory requirements.  Sorting each directory
>> >> requires first reading all the items in that directory
>> >> into memory.
>> >> 
>> >> Tim
>> >>
>> Yes, this is ok very often (you mean -T instead of -I)
>> but i have sometimes more than one single folder, and using a
>> temporary file seems mandatory, something like:
>> 
>> (cd dir1; find . -print | sort > /tmp/1)
>> (cd dir2; find . -print | sort > /tmp/2)
>> tar cf output.tar -C dir1 -T /tmp/1 -C dir2 -T /tmp/2
>> rm /tmp/1 /tmp/2
>> 
>> which is a little bit more tricky than
>> tar cf output.tar --sort-directories -C dir1 . -C dir2 .
>> 
>> I understand that in the most general case, the memory requirements
>> might be huge (or use temporary files like 'sort', or use 'sort'
>> itself). But it has to be taken into account that someone who stores,
>> say, 10000 files/subdirs in a single directory has probably the
>> necessary amount of memory to perform 'ls' (with default arguments) on
>> this directory, which also sorts the output.
>> 
>> For tar, --no-sort-directories would definitely be the default.
>> 
Just for the record, i forgot the '--no-recursion' option in
order to avoid to store the entries multiple times (when -T is used).

Denis Excoffier.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]