Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 503946 - =dev-python/pyxattr-0.5.2 - tests for pyxattr assume that newly created temporary files have no extended attributes
Summary: =dev-python/pyxattr-0.5.2 - tests for pyxattr assume that newly created tempo...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL: https://github.com/iustin/pyxattr/pull/5
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-03-09 02:49 UTC by Sean Santos
Modified: 2018-04-28 11:20 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Handle TEST_DIR and TEST_IGNORE_XATTRS (pyxattr-TEST_DIR-and-TEST_IGNORE_XATTRS.patch,1010 bytes, patch)
2016-05-23 19:33 UTC, gentoo_usr
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Santos 2014-03-09 02:49:24 UTC
This is a straightforward issue. The tests for pyxattr assume that newly created temporary files have no extended attributes. Therefore most of them fail if security.selinux is set on these test files.

See a somewhat ugly workaround in the pull request I sent upstream:

https://github.com/iustin/pyxattr/pull/5

I don't find this very concerning, because it only affects the tests and not the package itself. But if someone is feeling motivated, they could patch with either the workaround I linked to above, or something more elegant.
Comment 1 Sean Santos 2014-03-10 03:05:34 UTC
Update: I made my proposed change nicer:

https://github.com/iustin/pyxattr/pull/5

With this change, I could get the tests to pass with:

TEST_IGNORE_XATTRS="security.selinux"
Comment 2 Sean Santos 2014-09-17 16:27:29 UTC
The workaround is available in version 0.5.3, but the above TEST_IGNORE_XATTRS line needs to be added to the ebuild (perhaps conditionally just for selling systems).
Comment 3 Ian Delaney (RETIRED) gentoo-dev 2014-09-24 05:18:19 UTC
*pyxattr-0.5.3 (03 Jun 2014)

  03 Jun 2014; Ian Delaney <idella4@gentoo.org> +pyxattr-0.5.3.ebuild:
  bump; drop py2.6 pypy2_0 add py3.4 support, add IUSE doc, dep, doc build
Comment 4 Sean Santos 2014-09-27 22:54:44 UTC
This still requires an additional ebuild change for 0.5.3, because the environment variable TEST_IGNORE_XATTRS must be set during the test phase to a comma-separated list of attributes that may be present on new files. That is, for SELinux you need at least:

TEST_IGNORE_XATTRS="security.selinux"

Doing this for everyone (including non-SELinux systems) should be harmless.
Comment 5 gentoo_usr 2016-05-23 19:33:15 UTC
Created attachment 435128 [details, diff]
Handle TEST_DIR and TEST_IGNORE_XATTRS


In case anyone stumbles across this bug report, here is a workaround:

TEST_DIR="/path/to/fs/with/xattr/support" \
TEST_IGNORE_XATTRS="security.selinux" emerge pyxattr

So, now for the original problem. Here is a patch (also attached) doing four things:

* Fixing the typo for the TEST_DIR (note the underscore) variable.
* Respect a user set TEST_DIR (in case /var/tmp is on a file system not supporting extended attributes)
* Exporting TEST_IGNORE_XATTRS="security.selinux", so test pass on SELinux systems. The user's choice is honoured here, too.
* Inform the user about all that.

--- a/dev-python/pyxattr/pyxattr-0.5.5.ebuild
+++ b/dev-python/pyxattr/pyxattr-0.5.5.ebuild
@@ -39,10 +39,25 @@
 src_test() {
        # Perform the tests in /var/tmp; that location is more likely
        # to have xattr support than /tmp which is often tmpfs.
-       export TESTDIR=/var/tmp
+       # However, respect the user choice for TEST_DIR. (Bug #503946)
+       if [ -z "${TEST_DIR}" ]; then
+               export TEST_DIR=/var/tmp
+       fi
+       if [ -z "${TEST_IGNORE_XATTRS}" ]; then
+               export TEST_IGNORE_XATTRS="security.selinux"
+       fi
 
        einfo 'Please note that the tests fail if xattrs are not supported'
        einfo 'by the filesystem used for /var/tmp.'
+       einfo 'To use a different location than /var/tmp set the environment'
+       einfo 'variable TEST_DIR to that location, e.g.'
+       einfo
+       einfo '    $ export TEST_DIR="/my/test/place"'
+       einfo
+       einfo 'For even more control TEST_IGNORE_XATTRS (Bug #503946) can also'
+       einfo 'be set. Refer to the documentation in the source code for further'
+       einfo 'information.'
+
        distutils-r1_src_test
 }
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-04-24 16:03:11 UTC
Thanks for your diff.  I'm going to rewrite it a bit, split into separate commits and finally fix this bug.
Comment 7 Larry the Git Cow gentoo-dev 2018-04-24 16:09:07 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cfb464fb47e64a219859329ed65692293cc7197

commit 1cfb464fb47e64a219859329ed65692293cc7197
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-04-24 16:02:41 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-04-24 16:08:58 +0000

    dev-python/pyxattr: Allow overriding TEST_*
    
    Closes: https://bugs.gentoo.org/503946

 dev-python/pyxattr/pyxattr-0.6.0-r1.ebuild | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7c2a7c30cca0da599fc17eb78653dabc94b5732

commit d7c2a7c30cca0da599fc17eb78653dabc94b5732
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-04-24 15:59:56 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-04-24 16:08:58 +0000

    dev-python/pyxattr: Ignore selinux xattrs by default
    
    Bug: https://bugs.gentoo.org/503946

 dev-python/pyxattr/pyxattr-0.6.0-r1.ebuild | 2 ++
 1 file changed, 2 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8dbfb45817bd641214cd98bf29c8f076d4d71b07

commit 8dbfb45817bd641214cd98bf29c8f076d4d71b07
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-04-24 15:53:28 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-04-24 16:08:58 +0000

    dev-python/pyxattr: Fix TEST_DIR variable name
    
    Bug: https://bugs.gentoo.org/503946

 dev-python/pyxattr/pyxattr-0.6.0-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)}
Comment 8 gentoo_usr 2018-04-28 11:20:50 UTC
Hi Michał

Thanks for taking care of this issue!