[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new version of glibc xattr patch
From: |
Michael Banck |
Subject: |
Re: new version of glibc xattr patch |
Date: |
Sun, 19 Feb 2006 03:28:02 +0100 |
User-agent: |
Mutt/1.5.9i |
Hi,
On Sun, Mar 06, 2005 at 03:58:38PM -0800, Roland McGrath wrote:
> Not tested in the slightest.
Ben Asselstine and I tested and debugged this now. With a couple of
small changes, attr's getfattr/setfattr commands and star work fine for
gnu.translator and gnu.author.
> +error_t
> +_hurd_xattr_get (io_t port, const char *name, void *value, size_t *size)
[...]
> + if (!strcmp (name, "translator"))
> + {
> + char *buf = value;
> + size_t bufsz = value ? *size : 0;
> + error_t err = __file_get_translator (port, &buf, &bufsz);
> + if (err)
> + return err;
> + if (*size > bufsz)
> + *size = bufsz;
When getxattr gets called with VALUE as NULL and *SIZE as 0 (to
determine the length of the xattr value), SIZE will be smaller than
BUFSZ and subsequently the callee gets 0 returned and believes no xattrs
are present.
We propose this instead:
if (value != NULL && bufsz > *size)
return ERANGE;
*size = bufsz;
> Index: sysdeps/mach/hurd/fremovexattr.c
[...]
> + return err ? __hurd_dfail (fd, err) : size;
[...]
> Index: sysdeps/mach/hurd/removexattr.c
[...]
> + return err ? __hurd_fail (err) : size;
As was pointed out before, those should return 0 on success, and not
SIZE.
> Index: sysdeps/mach/hurd/setxattr.c
[...]
> + return err ? __hurd_fail (err) : size;
This (and fsetxattr) should return 0 on success as well.
> +error_t
> +_hurd_xattr_list (io_t port, void *buffer, size_t *size)
[...]
> + struct stat64 st;
> + error_t err = __io_stat (port, &st);
[...]
> + if (st.st_mode & S_IPTRANS)
> + add ("gnu.translator");
Our tests seemed to have shown that most (all?) passive translators do
not have the S_IPTRANS stat bit set, thus not reporting the
gnu.translator xattr through listxattr. Are we missing something here?
Note that nodes which have their passive translator set by setfattr
report S_IPTRANS back fine.
cheers,
Michael and Ben
--
"Thank God nobody's looking at this comment, or my reputation would be
ruined."
-- Gordon Matzigkeit
- Re: new version of glibc xattr patch,
Michael Banck <=