Matt Randolph wrote:

Matt Randolph wrote:


This may be a case of a different paradigm being used by 7-zip than that used by traditional (*nix) compression tools. If my memory serves me, the 7-zip format is very similar to the pkzip format in its usage. By that I mean that one is not required to make a tarball before compressing multiple files. The format allows you to skip the tar step and make an archive consisting of whichever files and directories you wish.

The problem, I'm guessing, is that the 7-zip archive format was developed in the Windows world where users and groups and permissions have no meaning (I think that has changed or is changing in the NT/XP world, but I don't know and don't especially care). Hence, these attributes aren't accomodated by this format. I assume the 7-zip extractor program sets the user and group of the extracted files to that of whomever extracts them.

What everyone has rightly pointed out, namely that you can make a tarball and then compress that, is exactly right. That IS how one would use 7-zip with a proper operating system.

The original poster most likely used the 7-zip archiver as a stand-alone tool, rather than using it in conjunction with tar. This is not altogether surprising as one typically compresses a directory with a single tar command (and an implied pipe) rather than explicitly piping the output of tar to the compression utility. Since there is no --7-zip switch in tar, the OP couldn't simply 'tar -7cf backup.tar.7zip lib/'. The OP probably simply 7-zipped his directory without tarring it first and consequently ran into the limitations of the archive format.

"-rw-r--r--  1 root root  3536665 Aug 13 00:01 backup.tar.7z"

Oops!  I should read more carefully.


In an effort to put this matter to rest (and to save a little face), I have tested 7-zip.

I created a directory containing two empty files. These files were then assigned arbitrary users and groups. Next I created a tarball of the directory. I changed the ownership of the tarball too. Finally, I 7-zipped the tarball. When I extracted the tarball it was given the user and group of the extractor (eg. myusername:users) rather than what it was assigned above. When I untarred the tarball, however, the contents were exactly as you would expect; they had the user and group settings that I assigned them previously.

I once again feel that my original hypothesis is essentially correct. 7-zip doesn't support user, group and permission data because it was originally developed for Windows. But this is a limitation that can be worked around by making a tarball first. The OP noticed that the ownership and permissions of the tarball changed and made a comment about that. This fact has little relevance for most users since we will only care about the contents of the tarball, not the tarball itself.

--
gentoo-user@gentoo.org mailing list

Reply via email to