iustin / pyxattr Goto Github PK
View Code? Open in Web Editor NEWA python module for accessing filesystem Extended Attributes
Home Page: https://pyxattr.k1024.org/
License: GNU Lesser General Public License v2.1
A python module for accessing filesystem Extended Attributes
Home Page: https://pyxattr.k1024.org/
License: GNU Lesser General Public License v2.1
The file path in get(), set(), list(), ... should support pathlib's Path objects in python 3
Current you get this error
TypeError: argument must be string or int
+ /usr/bin/python3 setup.py build_sphinx -b man
running build_sphinx
Running Sphinx v4.0.2
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [100%] module
/home/tkloczko/rpmbuild/BUILD/pyxattr-0.7.2/doc/index.rst:11: WARNING: toctree contains reference to nonexisting document 'readme'
/home/tkloczko/rpmbuild/BUILD/pyxattr-0.7.2/doc/index.rst:11: WARNING: toctree contains reference to nonexisting document 'news'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... pyxattr.1 { module } /home/tkloczko/rpmbuild/BUILD/pyxattr-0.7.2/doc/index.rst:5: WARNING: unknown document: readme
done
build succeeded, 3 warnings.
When using the default docker image for python2.7, the compile fails in a really odd way. I'm not sure if this is a tricky thing for pyxattr or a problem with the docker python:2.7 images as compared to Debian Jessie.
Reproduce:
docker run --rm -it python:2.7 bash -c "apt-get update && apt-get install -y attr-dev && pip install pyxattr"
Error:
xattr.c: In function ‘pyremovexattr’: xattr.c:229:13: error: ‘tgt’ may be used uninitialized in this function [-Werror=maybe-uninitialized] else if (tgt->type == T_LINK) ^ xattr.c:784:14: note: ‘tgt’ was declared here target_t tgt; ^
This seems to work just fine on the official jessie image
docker run --rm -it debian:jessie bash -c "apt-get update && apt-get install -y attr-dev python-pip python-dev && pip install pyxattr"
...snipped..
Running setup.py install for pyxattr
building 'xattr' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D_XATTR_VERSION="0.5.5" -D_XATTR_AUTHOR="Iustin Pop" -D_XATTR_EMAIL="[email protected]" -I/usr/include/python2.7 -c xattr.c -o build/temp.linux-x86_64-2.7/xattr.o -Wall -Werror
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/xattr.o -lattr -o build/lib.linux-x86_64-2.7/xattr.soSuccessfully installed pyxattr
I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with --no-isolation
I'm using during all processes only locally installed modulesI would be glad to have any hints what could be wrong with all those units failing the same way.
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pyxattr-0.7.2-6.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pyxattr-0.7.2-6.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra tests
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pyxattr-0.7.2
collected 287 items
tests/test_xattr.py ........................FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 50%]
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF......................... [100%]
================================================================================= FAILURES =================================================================================
_________________________________________________________________ test_mixed_access[get_file_and_symlink] __________________________________________________________________
testdir = './tmpwkifmxad', gen = <function get_file_and_symlink at 0x7f9747b57160>
@pytest.mark.parametrize(
"gen", [ get_file_and_symlink, get_file_and_fobject ])
def test_mixed_access(testdir, gen):
"""test mixed access to file"""
with gen(testdir) as (a, b):
# Check empty
> lists_equal(xattr.list(a), [])
tests/test_xattr.py:239:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attrs = [b'security.selinux'], value = []
def lists_equal(attrs, value):
"""Helper to check list equivalence, skipping TEST_IGNORE_XATTRS."""
> assert ignore(attrs) == value
E AssertionError: assert [b'security.selinux'] == []
E Left contains one more item: b'security.selinux'
E Use -v to get more diff
tests/test_xattr.py:58: AssertionError
_________________________________________________________________ test_mixed_access[get_file_and_fobject] __________________________________________________________________
testdir = './tmptvyh297z', gen = <function get_file_and_fobject at 0x7f9747b57280>
@pytest.mark.parametrize(
"gen", [ get_file_and_symlink, get_file_and_fobject ])
def test_mixed_access(testdir, gen):
"""test mixed access to file"""
with gen(testdir) as (a, b):
# Check empty
> lists_equal(xattr.list(a), [])
tests/test_xattr.py:239:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[..]
attrs = [b'user.test', b'security.selinux'], value = [b'user.test']
def lists_equal(attrs, value):
"""Helper to check list equivalence, skipping TEST_IGNORE_XATTRS."""
> assert ignore(attrs) == value
E AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
E Left contains one more item: b'security.selinux'
E Use -v to get more diff
tests/test_xattr.py:58: AssertionError
______________________________________________________________ test_binary_payload[file via symlink (bytes)] _______________________________________________________________
subject = (b'/home/tkloczko/rpmbuild/BUILD/pyxattr-0.7.2/tmp7bsemk3d/xattr-z6ppkeyc.test.symlink', False)
def test_binary_payload(subject):
"""test binary values"""
item = subject[0]
BINVAL = b"abc\0def"
xattr.set(item, USER_ATTR, BINVAL)
> lists_equal(xattr.list(item), [USER_ATTR])
tests/test_xattr.py:433:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attrs = [b'user.test', b'security.selinux'], value = [b'user.test']
def lists_equal(attrs, value):
"""Helper to check list equivalence, skipping TEST_IGNORE_XATTRS."""
> assert ignore(attrs) == value
E AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
E Left contains one more item: b'security.selinux'
E Use -v to get more diff
tests/test_xattr.py:58: AssertionError
_______________________________________________________________ test_binary_payload[file via symlink (path)] _______________________________________________________________
subject = (PurePosixPath('/home/tkloczko/rpmbuild/BUILD/pyxattr-0.7.2/tmp3h1zgd0v/xattr-yf6x74lj.test.symlink'), False)
def test_binary_payload(subject):
"""test binary values"""
item = subject[0]
BINVAL = b"abc\0def"
xattr.set(item, USER_ATTR, BINVAL)
> lists_equal(xattr.list(item), [USER_ATTR])
tests/test_xattr.py:433:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attrs = [b'user.test', b'security.selinux'], value = [b'user.test']
def lists_equal(attrs, value):
"""Helper to check list equivalence, skipping TEST_IGNORE_XATTRS."""
> assert ignore(attrs) == value
E AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
E Left contains one more item: b'security.selinux'
E Use -v to get more diff
tests/test_xattr.py:58: AssertionError
========================================================================= short test summary info ==========================================================================
FAILED tests/test_xattr.py::test_mixed_access[get_file_and_symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_mixed_access[get_file_and_fobject] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file name-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file name-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file name (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file name (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file name (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file name (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file FD-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file FD-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file object-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file object-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file io stream-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file io stream-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[directory-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[directory-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[directory (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[directory (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[directory (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[directory (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file via symlink-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file via symlink-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file via symlink (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file via symlink (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file via symlink (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing[file via symlink (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file name-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file name-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file name (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file name (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file name (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file name (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file FD-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file FD-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file object-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file object-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file io stream-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file io stream-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[directory-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[directory-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[directory (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[directory (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[directory (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[directory (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file via symlink-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file via symlink-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file via symlink (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file via symlink (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file via symlink (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing[file via symlink (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file name-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file name-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file name (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file name (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file name (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file name (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file FD-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file FD-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file object-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file object-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file io stream-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file io stream-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[directory-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[directory-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[directory (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[directory (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[directory (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[directory (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file via symlink-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file via symlink-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file via symlink (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file via symlink (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file via symlink (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[file via symlink (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[valid symlink-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[valid symlink-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[valid symlink (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[valid symlink (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[dangling symlink-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[dangling symlink-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[dangling symlink (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing[dangling symlink (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file name-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file name-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file name (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file name (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file name (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file name (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file FD-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file FD-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file object-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file object-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file io stream-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file io stream-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[directory-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[directory-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[directory (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[directory (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[directory (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[directory (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file via symlink-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file via symlink-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file via symlink (bytes)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file via symlink (bytes)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file via symlink (path)-with namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove[file via symlink (path)-no namespace] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file name] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file name (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file name (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file FD] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file object] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file io stream] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[directory] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[directory (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[directory (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file via symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file via symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_replace_on_missing_deprecated[file via symlink (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file name] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file name (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file name (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file FD] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file object] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file io stream] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[directory] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[directory (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[directory (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file via symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file via symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_create_on_existing_deprecated[file via symlink (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file name] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file name (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file name (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file FD] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file object] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file io stream] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[directory] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[directory (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[directory (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file via symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file via symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[file via symlink (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[valid symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[valid symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[dangling symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_remove_on_missing_deprecated[dangling symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file name] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file name (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file name (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file FD] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file object] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file io stream] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[directory] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[directory (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[directory (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file via symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file via symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_set_get_remove_deprecated[file via symlink (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_many_ops[file name] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[file name (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[file name (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[file FD] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[file object] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[file io stream] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[directory] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[directory (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[directory (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[file via symlink] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[file via symlink (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops[file via symlink (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file name] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file name (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file name (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file FD] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file object] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file io stream] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[directory] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[directory (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[directory (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file via symlink] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file via symlink (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_many_ops_deprecated[file via symlink (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file name] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file name (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file name (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file FD] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file object] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file io stream] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[directory] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[directory (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[directory (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file via symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file via symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[file via symlink (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[valid symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[valid symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[dangling symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes_deprecated[dangling symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file name] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file name (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file name (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file FD] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file object] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file io stream] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[directory] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[directory (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[directory (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file via symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file via symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[file via symlink (path)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[valid symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[valid symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[dangling symlink] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_no_attributes[dangling symlink (bytes)] - AssertionError: assert [b'security.selinux'] == []
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file name] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file name (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file name (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file FD] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file object] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file io stream] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[directory] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[directory (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[directory (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file via symlink] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file via symlink (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload_deprecated[file via symlink (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file name] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file name (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file name (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file FD] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file object] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file io stream] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[directory] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[directory (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[directory (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file via symlink] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file via symlink (bytes)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
FAILED tests/test_xattr.py::test_binary_payload[file via symlink (path)] - AssertionError: assert [b'user.test'...rity.selinux'] == [b'user.test']
====================================================================== 238 failed, 49 passed in 4.35s ======================================================================
Some file systems, such as XFS, allow to store large amounts of data in extended attributes. In pyxattr I only see getxattr
to retrieve attribute value data, which returns all data. For large attribute values it would be useful to have means to do incremental reads and seeks.
Hi,
we've got a bug reported which actually didn't have anything to do with a file system full, but most probably to too big EAs on ext4 (according to man 5 xattr it has a limit of 1, 2 or 4KB):
touch xxx
python3
>>> x = '0123456789' * 1024 # 10KB size
>>> import xattr
>>> xattr.setxattr('xxx', 'user.comment', x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 28] No space left on device
The error message should be more helpful, something like "extended attribute too big for file system limit".
if between 1 and 3 the xattr list changes in the filesystem, the call fails.
at other places in the code I've seen a while loop for such cases.
BTW, I was looking at your code because we just had such a race condition in our code, discovered in the wild, in practical use. (borgbackup has xattr code for linux, freebsd, osx).
It seems like you accidentally created a standard signature instead of a detached signature:
gpg: Signature made Wed 25 Jul 2018 12:06:59 AM CEST
gpg: using RSA key CB94E3AA3B1755D61EBB19A5F66E3E419F84F4DE
gpg: Good signature from "Iustin Pop <[email protected]>" [unknown]
gpg: aka "Iustin Pop <[email protected]>" [unknown]
gpg: aka "Iustin Pop <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: CB94 E3AA 3B17 55D6 1EBB 19A5 F66E 3E41 9F84 F4DE
gpg: WARNING: not a detached signature; file 'pyxattr-0.6.1.tar.gz' was NOT verified!
I have tested current git with pypy1.9 and pypy2.0, and in both cases I get test failures like:
======================================================================
ERROR: test binary values (deprecated functions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/portage/dev-python/pyxattr-9999/work/pyxattr-9999/test/test_xattr.py", line 309, in testBinaryPayloadDeprecated
xattr.setxattr(fname, self.USER_ATTR, BINVAL)
IOError: [Errno 7] Argument list too long
It seems that the Python extension uses functions in some way which is incompatible with PyPy…
pip install pyxattr worked on Catalina 10.15.5 with python3.7.7 (and still does), but when I updated to python3.8.1 I get this error.
Building wheel for pyxattr (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/tmsincomb/anaconda3/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2c/fywj_5ks7n5bqyj_b6dx3zl80000gn/T/pip-install-sbiep0tc/pyxattr/setup.py'"'"'; __file__='"'"'/private/var/folders/2c/fywj_5ks7n5bqyj_b6dx3zl80000gn/T/pip-install-sbiep0tc/pyxattr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/2c/fywj_5ks7n5bqyj_b6dx3zl80000gn/T/pip-wheel-pstzqbbj
cwd: /private/var/folders/2c/fywj_5ks7n5bqyj_b6dx3zl80000gn/T/pip-install-sbiep0tc/pyxattr/
Complete output (11 lines):
running bdist_wheel
running build
running build_ext
building 'xattr' extension
creating build
creating build/temp.macosx-10.9-x86_64-3.8
x86_64-apple-darwin13.4.0-clang -fno-strict-aliasing -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O3 -pipe -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=/Users/tmsincomb/anaconda3=/usr/local/src/conda-prefix -flto -Wl,-export_dynamic -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O3 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -D_XATTR_VERSION="0.7.1" -D_XATTR_AUTHOR="Iustin Pop" -D_XATTR_EMAIL="[email protected]" -I/Users/tmsincomb/anaconda3/include/python3.8 -c xattr.c -o build/temp.macosx-10.9-x86_64-3.8/xattr.o -Wall -Werror -Wsign-compare
clang-10: error: -Wl,-export_dynamic: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-10: error: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-10: error: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk: 'linker' input unused [-Werror,-Wunused-command-line-argument]
error: command 'x86_64-apple-darwin13.4.0-clang' failed with exit status 1
However testing it with MacOS Mojave with python3.8.1 I do not get an error. From what I can tell is that this is a Catalina specific issue so please feel free to close this issue, it is very likely it will work itself out.
I just wanted to bring this to your attention incase of any usefulness that would come from it.
xattr and pyxattr both import as xattr
... 😕
I'm using pyxattr as module in my code, but in order to do so, I need to pip uninstall xattr
first - which then breaks the xattr command (OS: Xubuntu 20.04)
😢
Is there a way to have both pip packages installed, but import them differently?
I was honestly surprised that I install "pyxattr" and then not just simply import "pyxattr" 😉
Grateful for any advice!
(Here's a copy of the error message the broken xattr throws after making place for pyxattr, in case someone searches for it:)
Traceback (most recent call last):
File "/usr/bin/xattr", line 11, in
load_entry_point('xattr==0.9.6', 'console_scripts', 'xattr')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2451, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
ModuleNotFoundError: No module named 'xattr.tool'; 'xattr' is not a package
Unfortunately, I don't have the time to look into this more carefully, but trying to build a package in a clean chroot currently fails:
running build
running build_ext
building 'xattr' extension
creating build
creating build/temp.linux-x86_64-3.8
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -D_XATTR_VERSION="0.7.1" -D_XATTR_AUTHOR="Iustin Pop" -D_XATTR_EMAIL="[email protected]" -I/usr/include/python3.8 -c xattr.c -o build/temp.linux-x86_64-3.8/xattr.o -Wall -Werror -Wsign-compare
creating build/lib.linux-x86_64-3.8
gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.8/xattr.o -L/usr/lib -o build/lib.linux-x86_64-3.8/xattr.cpython-38-x86_64-linux-gnu.so
running build
running build_ext
building 'xattr' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -D_XATTR_VERSION="0.7.1" -D_XATTR_AUTHOR="Iustin Pop" -D_XATTR_EMAIL="[email protected]" -I/usr/include/python2.7 -c xattr.c -o build/temp.linux-x86_64-2.7/xattr.o -Wall -Werror -Wsign-compare
xattr.c: In function ‘convert_obj’:
xattr.c:144:8: error: implicit declaration of function ‘PyUnicode_FSConverter’; did you mean ‘PyUnicode_Concat’? [-Werror=implicit-function-declaration]
144 | if(PyUnicode_FSConverter(myobj, &(tgt->tmp))) {
| ^~~~~~~~~~~~~~~~~~~~~
| PyUnicode_Concat
xattr.c: At top level:
xattr.c:1178:15: error: variable ‘xattrmodule’ has initializer but incomplete type
1178 | static struct PyModuleDef xattrmodule = {
| ^~~~~~~~~~~
xattr.c:1179:5: error: ‘PyModuleDef_HEAD_INIT’ undeclared here (not in a function)
1179 | PyModuleDef_HEAD_INIT,
| ^~~~~~~~~~~~~~~~~~~~~
xattr.c:1179:5: error: excess elements in struct initializer [-Werror]
xattr.c:1179:5: note: (near initialization for ‘xattrmodule’)
xattr.c:1180:5: error: excess elements in struct initializer [-Werror]
1180 | "xattr",
| ^~~~~~~
xattr.c:1180:5: note: (near initialization for ‘xattrmodule’)
xattr.c:1181:5: error: excess elements in struct initializer [-Werror]
1181 | __xattr_doc__,
| ^~~~~~~~~~~~~
xattr.c:1181:5: note: (near initialization for ‘xattrmodule’)
xattr.c:1182:5: error: excess elements in struct initializer [-Werror]
1182 | 0,
| ^
xattr.c:1182:5: note: (near initialization for ‘xattrmodule’)
xattr.c:1183:5: error: excess elements in struct initializer [-Werror]
1183 | xattr_methods,
| ^~~~~~~~~~~~~
xattr.c:1183:5: note: (near initialization for ‘xattrmodule’)
xattr.c: In function ‘PyInit_xattr’:
xattr.c:1196:19: error: implicit declaration of function ‘PyModule_Create’; did you mean ‘PyModule_Check’? [-Werror=implicit-function-declaration]
1196 | PyObject *m = PyModule_Create(&xattrmodule);
| ^~~~~~~~~~~~~~~
| PyModule_Check
xattr.c:1196:19: error: initialization of ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
xattr.c:1198:16: error: ‘return’ with a value, in function returning void [-Werror=return-type]
1198 | return NULL;
| ^~~~
xattr.c:1189:1: note: declared here
1189 | PyInit_xattr(void)
| ^~~~~~~~~~~~
xattr.c:1232:12: error: ‘return’ with a value, in function returning void [-Werror=return-type]
1232 | return m;
| ^
xattr.c:1189:1: note: declared here
1189 | PyInit_xattr(void)
| ^~~~~~~~~~~~
xattr.c:1239:5: error: ‘return’ with a value, in function returning void [-Werror=return-type]
1239 | INITERROR;
| ^~~~~~~~~
xattr.c:1189:1: note: declared here
1189 | PyInit_xattr(void)
| ^~~~~~~~~~~~
xattr.c: At top level:
xattr.c:1178:27: error: storage size of ‘xattrmodule’ isn’t known
1178 | static struct PyModuleDef xattrmodule = {
| ^~~~~~~~~~~
cc1: all warnings being treated as errors
error: command 'gcc' failed with exit status 1
From https://github.com/readthedocs/recommonmark
Warning: recommonmark is now deprecated. We recommend using MyST for a docutils bridge going forward. See readthedocs/recommonmark#221 for background and discussion.
+ /usr/bin/sphinx-build -n -T -b man doc build/sphinx/man
Running Sphinx v7.1.2
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/sphinx/registry.py", line 441, in load_extension
mod = import_module(extname)
File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'recommonmark'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 285, in build_main
app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 229, in __init__
self.setup_extension(extension)
File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 402, in setup_extension
self.registry.load_extension(self, extname)
File "/usr/lib/python3.8/site-packages/sphinx/registry.py", line 444, in load_extension
raise ExtensionError(__('Could not import extension %s') % extname,
sphinx.errors.ExtensionError: Could not import extension recommonmark (exception: No module named 'recommonmark')
Extension error:
Could not import extension recommonmark (exception: No module named 'recommonmark')
I was wondering of there is any way to use pyxattr to access extended attributes used by MacOS on CIFS mounted drive. I am able to use pyxattr to read and write these attributes on a local ext4 volume. The attribute names used by MacOS seem to often contain the colon ":" character. I have set the smb.conf to allow the colon character in the main file stream names with options shown below, however these do not seem to apply to the extended attribute streams:
If I try to read the attributes from a file on Samba share that has MacOS attributes set, they are not retrieved by pyxattr code on remote machine, however same code on local file works fine.
If I try to write a attribute on the CIFS volume with a colon in it's name, the pyxattr module returns: error '[Errno 22] Invalid argument'
example of attribute I am trying to write, works fine on local ext4 volume, however fails on CIFS volume:
xattr.setxattr(zpath, b'user.DosStream.AFP_AfpInfo:$DATA', 'blab')
smb.conf
vfs objects = catia fruit streams_xattr
fruit:aapl = yes
fruit:encoding = native
fruit:locking = none
fruit:metadata = stream
fruit:resource = file
fruit:model = MacSamba
mangled names = no
I see that cli util xattr
can process many files like xattr -p user.attr file1 file2 ...
.
I'm not sure that it's a real batch operation in terms of internally one sys call for all the files, more likely one sys call per file.
Should i simply iterate files on my own and list, get, set, delete
them one by one explicitly or the library supports it?
$ pypy3.10 -c 'import pathlib, xattr; xattr.getxattr(pathlib.Path("/"), "user.test")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: Can't convert 'PosixPath' object to str implicitly
# but
$ python3.10 -c 'import pathlib, xattr; xattr.getxattr(pathlib.Path("/"), "user.test")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
OSError: [Errno 61] No data available
I think the line in question is:
Line 439 in 1d04275
I suppose CPython implicitly converts pathlib.Path
to a string, whereas PyPy throws an error.
CC @mattip
Currently, passing a file-like object is not really supported.
It would be very useful to be able to pass in the file as a StringIO object. Or the equivalent Python3 equivalent.
Hello,
I've started to use this project to annotate etag headers on downloaded files.
The example looks like it uses strings, but actually all strings get converted to bytes, so when reading it's all bytes… so initially it didn't match… because the type didn't match.
I understand that breaking API to just accept bytes and error out otherwise is maybe a bit much, but it'd be nice to have the examples use b'whatever' to reflect how it works.
Thanks
Looks like warnings-as-errors strikes again. That flag is generally evil for source deployments for reasons like this, IMO (in development, whatever floats yer boat though).
gcc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D_XATTR_VERSION="0.5.5" -D_XATTR_AUTHOR="Iustin Pop" -D_XATTR_EMAIL="[email protected]" -I/home/ahknight/.pyenv/versions/3.5.1/include/python3.5m -c xattr.c -o build/temp.linux-x86_64-3.5/xattr.o -Wall -Werror
xattr.c: In function ‘merge_ns’:
xattr.c:183:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if(cnt > new_size || cnt < 0) {
^
cc1: all warnings being treated as errors
error: command 'gcc' failed with exit status 1
$ python --version
Python 3.5.1
$ gcc --version 1
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
(Does the same in clang 3.6.2 FWIW.)
# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.0 (Ootpa)
# pip3 -V
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
# pip3 install pyxattr-0.5.3.tar.gz
xattr.c: In function ‘merge_ns’:
xattr.c:182:16: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
if(cnt > new_size || cnt < 0) {
^
xattr.c: In function ‘get_all’:
xattr.c:532:56: error: ‘ENOATTR’ undeclared (first use in this function); did you mean ‘ENOTTY’?
} else if(errno == ENODATA || errno == ENOATTR) {
^~~~~~~
ENOTTY
xattr.c:532:56: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errors
error: command 'gcc' failed with exit status 1
I notice your xattr_get
routine is missing a check for an error from the PyList_Append
call.
While I was at it, I took the opportunity to rework the xattr_get
logic to reduce the complexity of the control paths, eliminating all the goto
s. As you can see from the enclosed patch, it becomes much easier to verify that everything will be be correctly disposed regardless of what errors might occur.
Returning a new reference here:
Line 632 in c3466e7
my_tuple
goes out of scope without decreasing the refcnt.Line 639 in c3466e7
Returning a new reference here:
Line 1185 in c3466e7
goto
s in this function)Line 1201 in c3466e7
The documentation falsely states that capabilities are stored in system namespace:
.. data:: NS_SYSTEM
The system namespace, used by the kernel to store things such as
ACLs and capabilities.
However, on Linux at least, capabilities are stored in security.capability
xattr, which is in security namespace.
I first of all thank you for coding this module.
I download it so that I can compile it under Linux Mint Petra on a base x64 system. The first thing that I notice weird was that that there was not configure batch on the file. I downloaded the tar.gz file from here http://pyxattr.k1024.org/downloads/ specific the version pyxattr-0.5.5.tar.gz
.
Any insight on this will be helpful.
Regards.!!
pip install requires RHEL8 python3-devel package and gcc before it can install. Is there any way to make it more self-contained (i.e. you can install it without having to compile "C" code)?
What I don't understand: since xattr is basically just making system calls (right?), then why wasn't this functionality part of python's os module? And how does python's os module avoid having to compile "C" code?
As the subject says, all the relevant versions are in the following output:
Collecting pyxattr
Using cached https://files.pythonhosted.org/packages/36/1d/1a5f3165f330e1a0427636f2bd995dbcc02d0f7660e89458d64806a2ed1e/pyxattr-0.6.1.tar.gz
Installing collected packages: pyxattr
Running setup.py install for pyxattr: started
Running setup.py install for pyxattr: finished with status 'error'
Complete output from command c:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\IEUser\\AppData\\Local\\Temp\\pip-install-916xhtx4\\pyxattr\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\IEUser\AppData\Local\Temp\pip-record-g0n0thl0\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'xattr' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_XATTR_VERSION="0.6.1" "-D_XATTR_AUTHOR="Iustin Pop"" -D_XATTR_EMAIL="[email protected]" -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcxattr.c /Fobuild\temp.win-amd64-3.7\Release\xattr.obj -Wall -Werror -Wsign-compare
cl : Command line error D8021 : invalid numeric argument '/Werror'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\IEUser\\AppData\\Local\\Temp\\pip-install-916xhtx4\\pyxattr\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\IEUser\AppData\Local\Temp\pip-record-g0n0thl0\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\IEUser\AppData\Local\Temp\pip-install-916xhtx4\pyxattr\
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
non-zero return code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.