Hello,

        When I extract a tar archive over existing contents, I’m seeing:

/usr/bin/gtar: mail/dovecot-uidvalidity.5e8a8de1: Cannot open: Permission denied

        The file in question has 0444 permissions but is owned by the same user 
as the one running tar. I guess tar doesn’t chmod() the file in order to 
overwrite it?

        Anyway, I then tried adding “--unlink-first”, but that produced a bunch 
of warnings about unlink()ing nonempty directories. (bug?)

        I next tried “--recursive-unlink”, and this seems to fix my problem, 
though I wonder about the disk I/O hit if it’s a large hierarchy being 
overwritten.

        What if tar were instead to overwrite files instead by writing to a 
temporary file in the same directory, then rename()ing the newly-written file 
into place? Then directory hierarchies could stay as they are during 
extraction, and the 0444-perms-as-user problem would be avoided as well. (It 
would assume, of course, that the user has write permission on the directories.)

        Thank you for your time!

-Felipe Gasper

Reply via email to