Re: [hackers] tar ownership/mode fixups

From: Brad Barden <b+suckless_AT_13os.net>
Date: Sun, 6 Dec 2015 05:31:20 -0600

On Fri Nov 20, 2015 at 09:59:00AM +0000, Dimitris Papastamos wrote:
> Thanks for these patches, I've applied them.
>

Shame on me, I have introduced a very stupid bug. I neglected to include
a commit in the patches I sent and didn't notice; all was well for me,
but I subtly broke tar. I only noticed after use of upstream with these
patches for a while.

chmod is being performed on HARDLINK type entities, but without the
missing change, mode is uninitialized for that type leading to an
unpredictable mode being set on those links. Any hard links and their
targets may be affected.

What I'd done is drop reading mode in each entity type, and read it
unconditionally like mtime.

An alternative would be to skip the mtime/chown/chmod altogether for
hard links. It shouldn't really be necessary, though I think in the case
of different permissions on a hard link to an earlier file (maybe a tar
which has been added to), later mode should override any previous.

Attached are patches for either fix. I prefer the first, I think it
cleans things up a bit.

Sorry for my mistake.

I'm also including a patch that is a very slight clarity improvement
over the earlier creation mode fix, if it's worth changing again. A new
file's mode is available at creation time, so there's no reason not to
use it directly (similar to what all the other types do).

Hope this is useful,

-Brad

Received on Sun Dec 06 2015 - 12:31:20 CET

This archive was generated by hypermail 2.3.0 : Sun Dec 06 2015 - 12:36:13 CET