* fsetxattr() fails on a writable descriptor?
[not found] ` <1252318482.3852.18.camel@dhcp-lab-219.englab.brq.redhat.com>
@ 2009-09-08 11:29 ` Pádraig Brady
2009-09-08 18:40 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Pádraig Brady @ 2009-09-08 11:29 UTC (permalink / raw)
To: xfs; +Cc: CoreutilsBugs
fsetxattr() is failing for me when the permissions are readonly
but the descriptor is writable as demonstrated by the program below.
I've tried this on ext3 and ext4 with libattr-2.4.43-3.fc11.i586
and linux-2.6.30.5-43.fc11.i586
Is this expected?
cheers,
Pádraig.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <attr/libattr.h>
#include <stdio.h>
#include <unistd.h>
int main(void)
{
int wfd;
if ((wfd=open("writable", O_CREAT|O_WRONLY|O_EXCL, S_IRUSR)) == -1)
fprintf(stderr, "open('writable') error [%m]\n");
if (write(wfd, "data", 1) == -1)
fprintf(stderr, "write() error [%m]\n");
if (fsetxattr(wfd, "user.test", "test", 4, 0) == -1)
fprintf(stderr, "fsetxattr() error [%m]\n");
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fsetxattr() fails on a writable descriptor?
2009-09-08 11:29 ` fsetxattr() fails on a writable descriptor? Pádraig Brady
@ 2009-09-08 18:40 ` Christoph Hellwig
2009-09-09 21:23 ` Pádraig Brady
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2009-09-08 18:40 UTC (permalink / raw)
To: P??draig Brady; +Cc: linux-fsdevel, CoreutilsBugs, xfs
On Tue, Sep 08, 2009 at 12:29:49PM +0100, P??draig Brady wrote:
> fsetxattr() is failing for me when the permissions are readonly
> but the descriptor is writable as demonstrated by the program below.
> I've tried this on ext3 and ext4 with libattr-2.4.43-3.fc11.i586
> and linux-2.6.30.5-43.fc11.i586
That's not XFS specifci behaviour. For all xattr operations, fd-based
or not we always do the full permission checks, and have done so since
day one. Check the routined xattr_permission in fs/xattr.c of the
kernel tree. It seems a bit unusual, but I'm not sure changing it now
is a good idea - the xattr support has been around for a long time.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fsetxattr() fails on a writable descriptor?
2009-09-08 18:40 ` Christoph Hellwig
@ 2009-09-09 21:23 ` Pádraig Brady
2009-09-09 22:14 ` Michael Monnerie
0 siblings, 1 reply; 6+ messages in thread
From: Pádraig Brady @ 2009-09-09 21:23 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-fsdevel, CoreutilsBugs, xfs
Christoph Hellwig wrote:
> On Tue, Sep 08, 2009 at 12:29:49PM +0100, P??draig Brady wrote:
>> fsetxattr() is failing for me when the permissions are readonly
>> but the descriptor is writable as demonstrated by the program below.
>> I've tried this on ext3 and ext4 with libattr-2.4.43-3.fc11.i586
>> and linux-2.6.30.5-43.fc11.i586
>
> That's not XFS specifci behaviour. For all xattr operations, fd-based
> or not we always do the full permission checks, and have done so since
> day one. Check the routined xattr_permission in fs/xattr.c of the
> kernel tree. It seems a bit unusual, but I'm not sure changing it now
> is a good idea - the xattr support has been around for a long time.
Sorry if you get this twice. Resending using another server...
Thanks for this info Christoph.
http://lxr.linux.no/#linux+v2.6.30.5/fs/xattr.c
The specific issue we have is that `cp --preserve=xattr` gets an
error when copying xattrs from a read only file. Since this has been
an xattr issue since the start, we'll have to work around it.
We'll probably temporarily set u+w on the new file to apply xattrs.
cheers,
Pádraig.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fsetxattr() fails on a writable descriptor?
2009-09-09 21:23 ` Pádraig Brady
@ 2009-09-09 22:14 ` Michael Monnerie
2009-10-13 23:58 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Michael Monnerie @ 2009-09-09 22:14 UTC (permalink / raw)
To: xfs
On Mittwoch 09 September 2009 Pádraig Brady wrote:
> The specific issue we have is that `cp --preserve=xattr` gets an
> error when copying xattrs from a read only file. Since this has been
> an xattr issue since the start, we'll have to work around it.
In that context I would call it a bug - shouldn't it be fixed? When you
copy and want xattrs, and it fails sometimes, that's not what's
expected. So if xattr is broken from day one and it should stay like
this, should a bug report to "cp" be opened?
Do you get the same error when "rsync -aHAX"? I always use that to make
a 1:1 copy, but if said problem exists that would be troublesome.
> [ch writes:]
> It seems a bit unusual, but I'm not sure changing it now
> is a good idea - the xattr support has been around for a long time.
I don't understand the inner depths, and didn't from the OP code,
but a failing "cp" is not nice, too. Why shouldn't the behaviour be
fixed?
mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0660 / 415 65 31 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38 500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net Key-ID: 1C1209B4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fsetxattr() fails on a writable descriptor?
2009-09-09 22:14 ` Michael Monnerie
@ 2009-10-13 23:58 ` Christoph Hellwig
2009-10-14 1:17 ` Michael Monnerie
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2009-10-13 23:58 UTC (permalink / raw)
To: Michael Monnerie; +Cc: xfs
On Thu, Sep 10, 2009 at 12:14:10AM +0200, Michael Monnerie wrote:
> On Mittwoch 09 September 2009 P?draig Brady wrote:
> > The specific issue we have is that `cp --preserve=xattr` gets an
> > error when copying xattrs from a read only file. Since this has been
> > an xattr issue since the start, we'll have to work around it.
>
> In that context I would call it a bug - shouldn't it be fixed?
It seems pretty late for change behaviour that has been around
since 2002. But if this was a new interface I would agree with you
that the behaviour is illogical.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fsetxattr() fails on a writable descriptor?
2009-10-13 23:58 ` Christoph Hellwig
@ 2009-10-14 1:17 ` Michael Monnerie
0 siblings, 0 replies; 6+ messages in thread
From: Michael Monnerie @ 2009-10-14 1:17 UTC (permalink / raw)
To: xfs
On Mittwoch 14 Oktober 2009 Christoph Hellwig wrote:
> On Thu, Sep 10, 2009 at 12:14:10AM +0200, Michael Monnerie wrote:
> > On Mittwoch 09 September 2009 P?draig Brady wrote:
> > > The specific issue we have is that `cp --preserve=xattr` gets an
> > > error when copying xattrs from a read only file. Since this has
> > > been an xattr issue since the start, we'll have to work around
> > > it.
> >
> > In that context I would call it a bug - shouldn't it be fixed?
>
> It seems pretty late for change behaviour that has been around
> since 2002. But if this was a new interface I would agree with you
> that the behaviour is illogical.
I didn't restrict to fix xattr behaviour, but "cp" should be fixed.
After all, the bug exists since 2002, so "cp" should also work around it
to get it's own parameters right.
mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0660 / 415 65 31 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38 500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net Key-ID: 1C1209B4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-10-14 1:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1251987642.3855.36.camel@dhcp-lab-219.englab.brq.redhat.com>
[not found] ` <4AA1A3E6.2020606@draigBrady.com>
[not found] ` <87k50den1e.fsf@meyering.net>
[not found] ` <1252309787.3852.8.camel@dhcp-lab-219.englab.brq.redhat.com>
[not found] ` <4AA4C950.3080303@draigBrady.com>
[not found] ` <1252318482.3852.18.camel@dhcp-lab-219.englab.brq.redhat.com>
2009-09-08 11:29 ` fsetxattr() fails on a writable descriptor? Pádraig Brady
2009-09-08 18:40 ` Christoph Hellwig
2009-09-09 21:23 ` Pádraig Brady
2009-09-09 22:14 ` Michael Monnerie
2009-10-13 23:58 ` Christoph Hellwig
2009-10-14 1:17 ` Michael Monnerie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox