bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only s


From: Ondřej Vašík
Subject: Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files
Date: Mon, 07 Sep 2009 09:49:47 +0200

Hi,

Jim Meyering wrote:
> Pádraig Brady wrote:
> > Ondřej Vašík wrote:
> >> As reported in
> >> http://lists.gnu.org/archive/html/bug-coreutils/2009-08/msg00342.html by
> >> Ernest N. Mamikonyan, cp/mv fails to preserve extended attributes for
> >> read-only source files.
> >> Following patch fixes the issue for me, although maybe it's not perfect
> >> solution. But I don't know about better one at the moment.
> >> Test included...
> >
> > Thanks for that, and especially the test.
> > It looks to me that the cause of this is actually a bug
> > in fsetxattr() (called by attr_copy_fd) as it's being
> > passed a writable fd, but still giving permission denied?
> >
> Hi Ondřej,
> 
> Thanks for working on that.
> Note that your patch relaxes permissions
> on the destination and does not restore them.
> 
> If you continue to work on this, please use the adjusted patch below.
> It makes the test script detect that failure, and also removes most
> of the redirections to /dev/null.  Now that nearly all test-related
> output is directed to a log file, there's no point in redirecting small
> outputs like that, and seeing them in the log can even make it easier
> to diagnose problems.
> 
> Since this problem affects only users of file systems
> mounted with "user_xattr", I may defer the fix until coreutils-7.7.

Ah, I knew I forgot to do something :). Thanks for spotting this.

Restoring to dest_mode & ~omitted_permissions done in attached patch,
dropped redirections from the test as well. Additionally - I modified
the copy.c patch a bit - failure of mode change now doesn't mean that I
don't try to preserve extended attributes (as it still could pass). 
Pádraig is right that it looks like some kind of bug in libattr and
fsetxattr() function, as the descriptor should be writable, anyway this
should workaround it - at least until they'll fix/change it or other way
of solution will be found.
Ok with passing to 7.7, although with such small impact and relatively
low danger, it could maybe included to 7.6 (if more snapshots will be
before real release).

Greetings,
         Ondřej

Attachment: cp-extended-attributes-readonly.patch
Description: Text Data

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy


reply via email to

[Prev in Thread] Current Thread [Next in Thread]