Backport patch from 0.6.1 to finally fix issues with ENOATTR

Original patch:
a799657a33
Upstream PR: https://github.com/iustin/pyxattr/pull/15
This commit is contained in:
Marcin Zajączkowski 2018-07-24 23:21:28 +02:00
parent 74837c13b4
commit 7689975662
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,39 @@
diff --git a/xattr.c.org b/xattr.c
index c792df3..a419b95 100644
--- a/xattr.c.org
+++ b/xattr.c
@@ -23,7 +23,9 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>
-#include <attr/xattr.h>
+#if defined(__APPLE__) || defined(__linux__)
+#include <sys/xattr.h>
+#endif
#include <stdio.h>
/* Compatibility with python 2.4 regarding python size type (PEP 353) */
@@ -551,11 +553,7 @@ get_all(PyObject *self, PyObject *args, PyObject *keywds)
buf_val = buf_val_tmp;
nalloc = realloc_size;
continue;
- } else if(
-#ifdef ENODATA
- errno == ENODATA ||
-#endif
- errno == ENOATTR) {
+ } else if (errno == ENODATA) {
/* this attribute has gone away since we queried
the attribute list */
missing = 1;
@@ -1137,8 +1135,7 @@ static char __xattr_doc__[] = \
" a :exc:`EnvironmentError`; under\n"
" Linux, the following ``errno`` values are used:\n"
"\n"
- " - ``ENOATTR`` and ``ENODATA`` mean that the attribute name is\n"
- " invalid\n"
+ " - ``ENODATA`` means that the attribute name is\n invalid\n"
" - ``ENOTSUP`` and ``EOPNOTSUPP`` mean that the filesystem does not\n"
" support extended attributes, or that the namespace is invalid\n"
" - ``E2BIG`` mean that the attribute value is too big\n"

View File

@ -2,11 +2,14 @@
Name: pyxattr
Summary: Extended attributes library wrapper for Python
Version: 0.5.6
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
Group: Development/Libraries
URL: http://pyxattr.k1024.org/
Source: https://pyxattr.k1024.org/downloads/%{name}-%{version}.tar.gz
# Bacported with modifications from 0.6.1
# https://github.com/iustin/pyxattr/commit/a799657a333b5fa44ae9bfb51b7bd40441123064
Patch0: 0002-use-system-xattr-h.patch
BuildRequires: gcc
BuildRequires: libattr-devel
BuildRequires: python2-devel, python2-setuptools
@ -43,6 +46,7 @@ Python 3 version.
%prep
%setup -q
%patch0 -p1
%if 0%{?with_python3}
rm -rf %{py3dir}
@ -96,6 +100,10 @@ popd
%endif # with_python3
%changelog
* Tue Jul 24 2018 Marcin Zajaczkowski <mszpak ATT wp DOTT pl> - 0.5.6-2
- Backport patch from 0.6.1 to fix issues with missing ENOATTR in libatttr 2.4.48
in Fedora 28/29 (#1603242, related to #1601482) - 0.5.6-1 was broken also in F28
* Thu Jul 19 2018 Marcin Zajaczkowski <mszpak ATT wp DOTT pl> - 0.5.6-1
- Upgrade to 0.5.6 (transitional step before 0.6.x for Fedora <29)
- Drop Py_ssize_t patch applied upstream