[aklug] Re: tar overwriting

From: Christopher Howard <christopher.howard@frigidcode.com>
Date: Sun Apr 10 2011 - 13:38:52 AKDT

On 04/09/2011 08:36 PM, Arthur Corliss wrote:
> On Sat, 9 Apr 2011, Christopher Howard wrote:
>
>> Can tar overwrite files, but make the new files (I'm presuming they are
>> deleted and recreated) have the same ownership/permissions as the old
>> (overwritten) files? I.e., rather than using the ownership/permissions
>> from the archive, or simply using the standard permissions for newly
>> created files. I went through the man/info pages a time or two, but I'm
>> still a bit unclear as to what precise switch voodoo would make this
>> happen. (Assuming it is even capable of doing that.)
>>
>> Something I run into when doing upgrades on software packages in Web
>> directories: I set special permissions on certain files, but I lose a
>> lot of them when I overlay the old files with the new files from the
>> upgrade package.
>
> You're looking for the 'p' flag, e.g, tar xvpfj foo.tar.bz2
>
> --Arthur Corliss
> Live Free or Die
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>

Correct me if I understand this wrong, but the man page says:

[code]
       -p, --preserve-permissions, --same-permissions
              extract all protection information
[/code]

Or from the info page:

[code]
Setting Access Permissions
..........................

To set the modes (access permissions) of extracted files to those
recorded for those files in the archive, use `--same-permissions' in
conjunction with the `--extract' (`--get', `-x') operation.

`--preserve-permissions'
`--same-permissions'
`-p'
     Set modes of extracted archive members to those recorded in the
     archive, instead of current umask settings. Use in conjunction
     with `--extract' (`--get', `-x').
[/code]

In other words, -p would use the permissions stored in the archive. But
in my case I want the permissions used from the files that are about to
be overwritten. In other words, lets say I had created file foo with
permissions "rwx" but the foo in the archive has permissions "r-x". I do
want the new foo from the archive to overwrite the old foo, but I want
the new foo to have the permissions "rwx" (like the old foo).

Clear as mud yet?

-- 
frigidcode.com
theologia.indicium.us
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sun Apr 10 13:38:42 2011

This archive was generated by hypermail 2.1.8 : Sun Apr 10 2011 - 13:38:42 AKDT