Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 483516

Summary: doins ${FILESDIR}/foo fails to work when ${FILESDIR} is on ZFS with portage 2.2.1 and FEATURES=xattr
Product: Gentoo Linux Reporter: Rick Farina (Zero_Chaos) <zerochaos>
Component: New packagesAssignee: Richard Yao (RETIRED) <ryao>
Status: RESOLVED FIXED    
Severity: major CC: hardened, nikoli
Priority: High Keywords: Bug, PATCH, REGRESSION
Version: autobuilds   
Hardware: All   
OS: Linux   
Whiteboard: Python xattr.list() reads regular file attributes, which are present in ZFS, but unimplemented in ZFSOnLinux
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 465000    
Attachments: portage-2.1.12.2 build.log
portage-2.2.1 build.log

Description Rick Farina (Zero_Chaos) gentoo-dev 2013-09-03 19:18:33 UTC
In the 1000+ ebuilds I install every day, it looks like just one, net-wireless/hidclient, fails with this.  I can install hidclient with sys-apps/portage-2.1.12.2 but not 2.2.1.
Comment 1 Rick Farina (Zero_Chaos) gentoo-dev 2013-09-03 19:19:18 UTC
Created attachment 357784 [details]
portage-2.1.12.2 build.log
Comment 2 Rick Farina (Zero_Chaos) gentoo-dev 2013-09-03 19:19:51 UTC
Created attachment 357786 [details]
portage-2.2.1 build.log
Comment 3 Rick Farina (Zero_Chaos) gentoo-dev 2013-09-03 20:09:03 UTC
debug patches from Zac show this:

>>> Install hidclient-20120728 into /var/tmp/portage/net-wireless/hidclient-20120728/image/ category net-wireless
Traceback (most recent call last):
  File "/usr/lib64/portage/bin/install.py", line 180, in copy_xattrs
    _copyxattr(s, abs_path, exclude=exclude)
  File "/usr/lib64/portage/pym/portage/util/movefile.py", line 112, in _copyxattr
    (_unicode_decode(src),))
portage.exception.OperationNotSupported: Filesystem containing file '/usr/portage/net-wireless/hidclient/files/README' does not support listing of extended attributes
!!! install: copy_xattrs failed with the following arguments: -m0644 /usr/portage/net-wireless/hidclient/files/README /var/tmp/portage/net-wireless/hidclient-20120728/image/usr/share/doc/hidclient-20120728//
!!! dodoc: /usr/portage/net-wireless/hidclient/files/README does not exist
 * ERROR: net-wireless/hidclient-20120728::gentoo failed (install phase):
 *   dodoc failed


Does ZFS lack xattr support?
Comment 5 Richard Yao (RETIRED) gentoo-dev 2013-09-03 20:23:06 UTC
It looks like the listxattr VFS call is broken on ZFS. This can be reproduced easily by doing `listxattr /path/to/anything` on ZFS.

I am reassigning this to myself putting the hardened team on CC.
Comment 6 Richard Yao (RETIRED) gentoo-dev 2013-09-04 01:48:37 UTC
A fix has been sent upstream for review:

https://github.com/zfsonlinux/zfs/pull/1693

I consider this to be a high priority issue, so I intend to merge the fix into the zfs-kmod package by committing 0.6.2-r1 soon. I would like Rick Farina to confirm that it resolves the problem for him before I do that. The patch can be installed via epatch_user:

mkdir -p /etc/portage/patches/sys-fs/zfs-kmod-0.6.2
curl https://github.com/zfsonlinux/zfs/pull/1693.patch > /etc/portage/patches/sys-fs/zfs-kmod-0.6.2/zfs-kmod-read-file-attribute-support.patch

A rebuild of zfs-kmod, a rebuild of any initramfs being used and a reload of the module (a reboot if ZFS is your rootfs) will apply the patch.
Comment 7 Richard Yao (RETIRED) gentoo-dev 2013-09-04 06:44:19 UTC
Upstream confirmed that the fix was sane, but refused to merge it because they would like support for both getting and setting file attributes to be implemented at the same time. Additionally, they pointed out that this regression was caused by the following commit:

https://github.com/zfsonlinux/zfs/commit/88c2839

I have rewritten the patch and refreshed the pull request. It now includes support for reading and writing file attributes. I had feedback from upstream while working on it, so it should be sane. As soon as I get confirmation from upstream that it is sane and Rick that it fixes his issue, I will commit -r1 with the fix.
Comment 8 Richard Yao (RETIRED) gentoo-dev 2013-09-04 06:47:37 UTC
Also, I should mention that the commmit that python's xattr.list() checks both regular file attributes and extended file attributes. Had it not been for that, there would not have been a problem when the return values in zpl_ioctl() were changed.
Comment 9 Rick Farina (Zero_Chaos) gentoo-dev 2013-09-17 17:37:36 UTC
Traceback (most recent call last):
  File "/usr/lib64/portage/bin/install.py", line 248, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/lib64/portage/bin/install.py", line 243, in main
    returncode = copy_xattrs(opts, files)
  File "/usr/lib64/portage/bin/install.py", line 179, in copy_xattrs
    _copyxattr(s, abs_path, exclude=exclude)
  File "/usr/lib64/portage/pym/portage/util/movefile.py", line 101, in _copyxattr
    attrs = xattr.list(src)
IOError: [Errno 95] Operation not supported

After patch, rebuild of zfs-kmod, and reboot.
Comment 10 Rick Farina (Zero_Chaos) gentoo-dev 2013-09-30 14:41:32 UTC
Where are we on this? I haven't been able for weeks (since the update to portage 2.2).  I'm about ready to clear ZFS from the system.
Comment 11 Richard Yao (RETIRED) gentoo-dev 2014-05-01 17:37:35 UTC
(In reply to Rick Farina (Zero_Chaos) from comment #10)
> Where are we on this? I haven't been able for weeks (since the update to
> portage 2.2).  I'm about ready to clear ZFS from the system.

A proper fix was merged upstream today:

https://github.com/zfsonlinux/zfs/commit/9d317793aa66d05a8c44410ea24a9a4166a89bbd

I need to try to reproduce this to verify that commit fixes it. I will backport the commit shortly if it does, but I suspect that is the case.
Comment 12 Richard Yao (RETIRED) gentoo-dev 2014-06-24 16:45:50 UTC
I am fairly confident that this was fixed in either 0.6.2-r5 or 0.6.3. I am closing it as such.