add Mark Hamzy's patch to fix issue with PPC builds

See https://bugzilla.redhat.com/show_bug.cgi?id=1127310
This commit is contained in:
Marcin Zajaczkowski 2014-08-07 11:30:35 +02:00
parent 24d7240bb4
commit 3699be0d13
2 changed files with 133 additions and 5 deletions

127
0001-use-Py_ssize_t.patch Normal file
View File

@ -0,0 +1,127 @@
From 50f7c251523f6be3be3426aa6499e5495a18b442 Mon Sep 17 00:00:00 2001
From: Mark Hamzy <hamzy@us.ibm.com>
Date: Wed, 6 Aug 2014 14:06:45 -0500
Subject: [PATCH] use Py_ssize_t
>Starting with Python 2.5 the type of the length argument can be controlled by
>defining the macro PY_SSIZE_T_CLEAN before including Python.h. If the macro is
>defined, length is a Py_ssize_t rather than an int.
dmalcolm@redhat.com says:
"and IIRC that *does* in fact affect "et#" and the other hash-suffixed codes
i.e. PyArg_ParseTupleAndKeywords was expecting bufsize to be a Py_ssize_t, not an int."
So, changing size_t to Py_ssize_t and ints used as sizes to Py_ssize_t.
---
xattr.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/xattr.c b/xattr.c
index cc1fa44..2529e90 100644
--- a/xattr.c
+++ b/xattr.c
@@ -193,7 +193,7 @@ static int merge_ns(const char *ns, const char *name,
return 0;
}
-static ssize_t _list_obj(target_t *tgt, char *list, size_t size) {
+static Py_ssize_t _list_obj(target_t *tgt, char *list, Py_ssize_t size) {
if(tgt->type == T_FD)
return flistxattr(tgt->fd, list, size);
else if (tgt->type == T_LINK)
@@ -202,8 +202,8 @@ static ssize_t _list_obj(target_t *tgt, char *list, size_t size) {
return listxattr(tgt->name, list, size);
}
-static ssize_t _get_obj(target_t *tgt, const char *name, void *value,
- size_t size) {
+static Py_ssize_t _get_obj(target_t *tgt, const char *name, void *value,
+ Py_ssize_t size) {
if(tgt->type == T_FD)
return fgetxattr(tgt->fd, name, value, size);
else if (tgt->type == T_LINK)
@@ -213,7 +213,7 @@ static ssize_t _get_obj(target_t *tgt, const char *name, void *value,
}
static int _set_obj(target_t *tgt, const char *name,
- const void *value, size_t size, int flags) {
+ const void *value, Py_ssize_t size, int flags) {
if(tgt->type == T_FD)
return fsetxattr(tgt->fd, name, value, size, flags);
else if (tgt->type == T_LINK)
@@ -242,7 +242,7 @@ static int _remove_obj(target_t *tgt, const char *name) {
*/
const char *matches_ns(const char *ns, const char *name) {
- size_t ns_size;
+ Py_ssize_t ns_size;
if (ns == NULL || *ns == '\0')
return name;
ns_size = strlen(ns);
@@ -275,7 +275,7 @@ pygetxattr(PyObject *self, PyObject *args)
int nofollow = 0;
char *attrname = NULL;
char *buf;
- ssize_t nalloc, nret;
+ Py_ssize_t nalloc, nret;
PyObject *res;
/* Parse the arguments */
@@ -352,7 +352,7 @@ xattr_get(PyObject *self, PyObject *args, PyObject *keywds)
const char *fullname;
char *buf;
const char *ns = NULL;
- ssize_t nalloc, nret;
+ Py_ssize_t nalloc, nret;
PyObject *res;
static char *kwlist[] = {"item", "name", "nofollow", "namespace", NULL};
@@ -451,7 +451,7 @@ get_all(PyObject *self, PyObject *args, PyObject *keywds)
const char *ns = NULL;
char *buf_list, *buf_val;
const char *s;
- ssize_t nalloc, nlist, nval;
+ Py_ssize_t nalloc, nlist, nval;
PyObject *mylist;
target_t tgt;
static char *kwlist[] = {"item", "nofollow", "namespace", NULL};
@@ -604,7 +604,7 @@ pysetxattr(PyObject *self, PyObject *args)
int nofollow = 0;
char *attrname = NULL;
char *buf = NULL;
- int bufsize;
+ Py_ssize_t bufsize;
int nret;
int flags = 0;
target_t tgt;
@@ -670,7 +670,7 @@ xattr_set(PyObject *self, PyObject *args, PyObject *keywds)
int nofollow = 0;
char *attrname = NULL;
char *buf = NULL;
- int bufsize;
+ Py_ssize_t bufsize;
int nret;
int flags = 0;
target_t tgt;
@@ -856,7 +856,7 @@ pylistxattr(PyObject *self, PyObject *args)
{
char *buf;
int nofollow=0;
- ssize_t nalloc, nret;
+ Py_ssize_t nalloc, nret;
PyObject *myarg;
PyObject *mylist;
Py_ssize_t nattrs;
@@ -956,7 +956,7 @@ xattr_list(PyObject *self, PyObject *args, PyObject *keywds)
{
char *buf;
int nofollow = 0;
- ssize_t nalloc, nret;
+ Py_ssize_t nalloc, nret;
PyObject *myarg;
PyObject *res;
const char *ns = NULL;
--
2.0.0

View File

@ -2,16 +2,14 @@
Name: pyxattr
Summary: Extended attributes library wrapper for Python
Version: 0.5.3
Release: 2%{?dist}
Release: 3%{?dist}
License: LGPLv2+
Group: Development/Libraries
URL: http://pyxattr.k1024.org/
Source: https://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
Patch0: 0001-use-Py_ssize_t.patch
BuildRequires: libattr-devel
BuildRequires: python2-devel, python-setuptools
%if %{?with_python3}
BuildRequires: python3-devel, python3-setuptools
%endif # with_python3
@ -33,13 +31,13 @@ Python 3 version.
%prep
%setup -q
%patch0 -p1
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3
%build
CFLAGS="%{optflags}" %{__python2} setup.py build
@ -89,6 +87,9 @@ popd
%endif # with_python3
%changelog
* Thu Aug 7 2014 Marcin Zajaczkowski <mszpak ATT wp DOTT pl> - 0.5.3-3
- add Mark Hamzy's patch to fix issue with PPC builds (bug 1127310)
* Mon Aug 4 2014 Tom Callaway <spot@fedoraproject.org> - 0.5.3-2
- fix license handling