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

Bug 315267

Summary: dev-python/pyxattr-0.5.0 fails tests on system without xattr support
Product: Gentoo Linux Reporter: Myckel Habets (work) <m.e.j.habets>
Component: [OLD] LibraryAssignee: Robin Johnson <robbat2>
Status: IN_PROGRESS ---    
Severity: minor CC: nikoli, pacho, phajdan.jr, python
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 714478    
Attachments: skip tests if we cannot set extended attributes

Description Myckel Habets (work) 2010-04-14 14:39:15 UTC
The pyxattr package seems to fail its tests on a system without xattr support, giving the following errors:

 * Testing of dev-python/pyxattr-0.4.0 with CPython 2.6...
EEEEEEEEEEEEEE..EE
======================================================================
ERROR: test binary values
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 311, in testBinaryPayload
    xattr.set(fname, self.USER_ATTR, BINVAL)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test binary values (deprecated functions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 300, in testBinaryPayloadDeprecated
    xattr.setxattr(fname, self.USER_ATTR, BINVAL)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test attribute setting on directories
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 265, in testDirOps
    self._checkListSetGet(dname)
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 107, in _checkListSetGet
    nofollow=symlink)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test attribute setting on directories (deprecated functions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 260, in testDirOpsDeprecated
    self._checkDeprecated(dname)
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 69, in _checkDeprecated
    xattr.setxattr(item, self.USER_ATTR, self.USER_VAL, 0, symlink)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test file descriptor operations
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 202, in testFileByDescriptor
    self._checkListSetGet(fh)
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 107, in _checkListSetGet
    nofollow=symlink)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test file descriptor operations (deprecated functions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 196, in testFileByDescriptorDeprecated
    self._checkDeprecated(fh)
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 69, in _checkDeprecated
    xattr.setxattr(item, self.USER_ATTR, self.USER_VAL, 0, symlink)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test set and retrieve one attribute by file name
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 189, in testFileByName
    self._checkListSetGet(fname)
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 107, in _checkListSetGet
    nofollow=symlink)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test set and retrieve one attribute by file name (deprecated)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 183, in testFileByNameDeprecated
    self._checkDeprecated(fname)
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 69, in _checkDeprecated
    xattr.setxattr(item, self.USER_ATTR, self.USER_VAL, 0, symlink)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test file descriptor operations
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 217, in testFileByObject
    self._checkListSetGet(fo)
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 107, in _checkListSetGet
    nofollow=symlink)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test file descriptor operations (deprecated functions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 210, in testFileByObjectDeprecated
    self._checkDeprecated(fo)
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 69, in _checkDeprecated
    xattr.setxattr(item, self.USER_ATTR, self.USER_VAL, 0, symlink)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test many ops
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 340, in testManyOps
    xattr.set(fh, self.USER_ATTR, self.USER_VAL)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test many ops (deprecated functions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 326, in testManyOpsDeprecated
    xattr.setxattr(fh, self.USER_ATTR, self.USER_VAL)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test mixed access to file
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 240, in testMixedAccess
    xattr.set(fname, self.USER_ATTR, self.USER_VAL)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test mixed access to file (deprecated functions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 226, in testMixedAccessDeprecated
    xattr.setxattr(fname, self.USER_ATTR, self.USER_VAL)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test symlink operations
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 288, in testSymlinkOps
    xattr.set(target, self.USER_ATTR, self.USER_VAL)
IOError: [Errno 95] Operation not supported

======================================================================
ERROR: test symlink operations (deprecated functions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pyxattr-0.4.0/work/pyxattr-0.4.0/test/test_xattr.py", line 274, in testSymlinkOpsDeprecated
    xattr.setxattr(target, self.USER_ATTR, self.USER_VAL)
IOError: [Errno 95] Operation not supported

----------------------------------------------------------------------
Ran 18 tests in 0.010s

Although this is expected in this case, the tests should not fail in this way. The ebuild or tests should check if xattr is supported by the host system and disable them when they can't be executed.

Reproducible: Always

Steps to Reproduce:
1. emerge pyxattr with test USE flag on a system that doesn't support xattr.
2.
3.

Actual Results:  
Ebuild dies due to failed tests

Expected Results:  
Ebuild finishes, with tests skipped and possible a notice that xattr is not available on the host system.

emerge --info

Portage 2.1.8.3 (default/linux/x86/10.0, gcc-4.3.4, glibc-2.10.1-r1, 2.6.33-co-0.8.0 i686)
=================================================================
System uname: Linux-2.6.33-co-0.8.0-i686-Intel-R-_Core-TM-2_Duo_CPU_E4500_@_2.20GHz-with-gentoo-1.12.13
Timestamp of tree: Wed, 14 Apr 2010 07:15:01 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.4-r1
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.10.3, 1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -mtune=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -mtune=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests collision-protect distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict test unmerge-logs unmerge-orphans userfetch userpriv"
GENTOO_MIRRORS="ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ ftp://mirror.datapipe.net/gentoo"
LDFLAGS="-Wl,-O1,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X berkdb bzip2 cgi cleartype cli cracklib crypt cxx dbus dri examples fastcgi fortran gdbm gpm hal iconv ipv6 jpeg libnotify logrotate mmx modules mudflap mysql ncurses nptl nptlonly openmp pam pcre pdf perl php pic png posix pppd python readline reflection session spl sqlite sse sse2 ssl startup-notification svg sysfs tcpd threads thunar tiff truetype unicode x86 xcb xcomposite xft xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="vesa"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-05-02 22:38:45 UTC
Hmm, I'm tempted to just disable src_test entirely in this case, as I'm not sure of any reliable test to find our present mountpoint, and then test for it having xattr support.

Python team:
any opinions?
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-05-03 16:39:09 UTC
(In reply to comment #1)

Maybe create a test file in "${T}" and check if setfattr on this file succeeds.
Comment 3 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-12-18 20:30:20 UTC
*** Bug 321229 has been marked as a duplicate of this bug. ***
Comment 4 Arfrever Frehtes Taifersar Arahesis 2012-01-27 01:37:50 UTC
Fixed in Progress Overlay.
Comment 5 Neil Leathers 2012-04-25 23:40:49 UTC
(In reply to comment #1)
> Hmm, I'm tempted to just disable src_test entirely in this case, as I'm not
> sure of any reliable test to find our present mountpoint, and then test for
> it having xattr support.
> 
> Python team:
> any opinions?

This seems to be working as intended. The python xattr support would not be able to function without xattr so the test are failing correctly. I would suggest closing this as RESOLVED INVALID except it is useful to leave it open so people can search for it.
Comment 6 Marien Zwart (RETIRED) gentoo-dev 2012-04-26 12:24:12 UTC
Created attachment 310175 [details]
skip tests if we cannot set extended attributes

I agree with comment #2: if setting an extended attribute fails with EOPNOTSUPP we should assume the filesystem lacks support and skip the tests. I can't think of a nice way of being that specific without using pyxattr, which would be a bit circular. So I'd suggest something like this, which just sets an attribute using the "attr" utility (which we must depend on for libattr anyway) and assumes failure is caused by missing filesystem support.

I've tested this by building on tmpfs (which misses xattr support on my kernel) and ext4 (which has it). It seems to work. Python 3 fails the tests, but that's an unrelated problem I think should be upstreamed.

Are you ok with me committing this?
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-12-21 13:29:36 UTC
(In reply to comment #6)
> Created attachment 310175 [details]
> skip tests if we cannot set extended attributes
> 
> I agree with comment #2: if setting an extended attribute fails with
> EOPNOTSUPP we should assume the filesystem lacks support and skip the tests.
> I can't think of a nice way of being that specific without using pyxattr,
> which would be a bit circular. So I'd suggest something like this, which
> just sets an attribute using the "attr" utility (which we must depend on for
> libattr anyway) and assumes failure is caused by missing filesystem support.
> 
> I've tested this by building on tmpfs (which misses xattr support on my
> kernel) and ext4 (which has it). It seems to work. Python 3 fails the tests,
> but that's an unrelated problem I think should be upstreamed.
> 
> Are you ok with me committing this?

Hmm, using 'attr' means the ebuild needs to dep on sys-apps/attr, I think. I'm wondering if it wouldn't be enough to add a minimal Python snippet which would try to use the lib and check for appropriate errno.

Or, even better, fix the test suite to 'skip' tests in that case.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-12-21 13:53:59 UTC
I have partially addressed the issue in -r1 through adding an 'einfo' before the test phase and setting TESTDIR=/var/tmp. This will make the tests meaningful on systems where /tmp is tmpfs but /var/tmp is a regular filesystem with xattr support. It's not a perfect solution, though.
Comment 9 Mart Raudsepp gentoo-dev 2020-04-01 20:24:28 UTC
This is happening en masse on tmpfs in 0.7.1 again, while 0.6.0-r1 all passed (or perhaps skipped) on tmpfs