[aklug] Re: tar overwriting

From: Arthur Corliss <acorliss@nevaeh-linux.org>
Date: Sun Apr 10 2011 - 14:50:20 AKDT

On Sun, 10 Apr 2011, Christopher Howard wrote:

> 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?

I misunderstood your question, then. I thought you were concerned that
restores wouldn't use the permissions from the time of the backup. That
said, I don't know of any way to do that on an arbitrary per-file basis.
You could use some shell one-liners to do record previous perms and reset
the newly restored files. In a nutshell, however, what you're asking for
is an unintended and unanticipated use for tar. Typically, when you
restore, you either restore the content, or the content & meta data. Not
content mutated by existing meta data.

:-) Sounds like a good contest idea for shell one-liners...

         --Arthur Corliss
           Live Free or Die
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sun Apr 10 14:50:33 2011

This archive was generated by hypermail 2.1.8 : Sun Apr 10 2011 - 14:50:33 AKDT