Re: [Libguestfs] RFC: copy-attributes command

Pino Toscano
2014-01-09T16:41:30Z

On Tuesday 07 January 2014 21:04:36 Richard W.M. Jones
wrote:
> On Tue, Jan 07, 2014 at 04:06:43PM +0100, Pino Toscano wrote:
> > diff --git a/daemon/xattr.c b/daemon/xattr.c
> > index af8bfd4..97a94d5 100644
> > --- a/daemon/xattr.c
> > +++ b/daemon/xattr.c
> > @@ -545,8 +545,98 @@ do_lgetxattr (const char *path, const char
> > *name, size_t *size_r)>
> >    return buf; /* caller frees */
> >
> >  }
> >
> > +int
> > +copy_xattrs (const char *src, const char *dest)
> > +{
> > +#if defined(HAVE_LISTXATTR) && defined(HAVE_GETXATTR)
&&
> > defined(HAVE_SETXATTR)
> I wonder if there are any platforms that lack one of listxattr,
> getxattr and setxattr, but at the same time have one of these calls.
> The xattr code (in general) is incredibly complex because of all these
> tests.
>
> I guess Mac OS X probably has none of them, and RHEL 5 / Ubuntu 10.10
> probably had only some of them.

At least in the gnu/stubs-$bits.h of RHEL 5 they are not declared as
__stub_*, so they should be implemented (and being Linux, it means that
most probably there are the right syscalls for them).
So I would not think the change proposed below (and implemented) would
cause regressions in such old Linux systems.

> We don't care about RHEL 5 since it
> now has its own branch ("oldlinux"), so the code might be made
simpler
> by an accompanying patch which reduces all of the HAVE_*XATTR* macros
> down to a single one (HAVE_LINUX_XATTRS).

Sounds reasonable; attached a patch for it.

--
Pino Toscano