diff --git a/pycups-requested_attributes.patch b/pycups-requested_attributes.patch new file mode 100644 index 0000000..26f0374 --- /dev/null +++ b/pycups-requested_attributes.patch @@ -0,0 +1,60 @@ +diff -U0 pycups-1.9.40/ChangeLog.requested_attributes pycups-1.9.40/ChangeLog +--- pycups-1.9.40/ChangeLog.requested_attributes 2008-06-20 17:58:49.000000000 +0100 ++++ pycups-1.9.40/ChangeLog 2008-07-10 16:52:05.000000000 +0100 +@@ -0,0 +1,5 @@ ++2008-07-09 Tim Waugh ++ ++ * cupsconnection.c (Connection_getPrinterAttributes): Fixed ++ requested_attributes parameter. ++ +diff -up pycups-1.9.40/cupsconnection.c.requested_attributes pycups-1.9.40/cupsconnection.c +--- pycups-1.9.40/cupsconnection.c.requested_attributes 2008-06-20 10:36:50.000000000 +0100 ++++ pycups-1.9.40/cupsconnection.c 2008-07-10 16:52:05.000000000 +0100 +@@ -2240,6 +2240,7 @@ Connection_getPrinterAttributes (Connect + char *uri; + PyObject *requested_attrs = NULL; + char **attrs = NULL; /* initialised to calm compiler */ ++ size_t n_attrs; + ipp_t *request, *answer; + ipp_attribute_t *attr; + char consuri[HTTP_MAX_URI]; +@@ -2269,16 +2270,16 @@ Connection_getPrinterAttributes (Connect + } + + if (requested_attrs) { +- int i, n; ++ int i; + + if (!PyList_Check (requested_attrs)) { + PyErr_SetString (PyExc_TypeError, "List required"); + return NULL; + } + +- n = PyList_Size (requested_attrs); +- attrs = malloc ((n + 1) * sizeof (char *)); +- for (i = 0; i < n; i++) { ++ n_attrs = PyList_Size (requested_attrs); ++ attrs = malloc ((n_attrs + 1) * sizeof (char *)); ++ for (i = 0; i < n_attrs; i++) { + PyObject *val = PyList_GetItem (requested_attrs, i); // borrowed ref + if (!PyString_Check (val)) { + PyErr_SetString (PyExc_TypeError, "String required"); +@@ -2294,7 +2295,7 @@ Connection_getPrinterAttributes (Connect + + attrs[i] = strdup (PyString_AsString (val)); + } +- attrs[n] = NULL; ++ attrs[n_attrs] = NULL; + } + + debugprintf ("-> Connection_getPrinterAttributes(%s)\n", +@@ -2318,8 +2319,7 @@ Connection_getPrinterAttributes (Connect + "printer-uri", NULL, uri); + if (requested_attrs) + ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, +- "requested-attributes", +- sizeof (attrs) / sizeof (attrs[0]), NULL, ++ "requested-attributes", n_attrs, NULL, + (const char **) attrs); + debugprintf ("trying request with uri %s\n", uri); + answer = cupsDoRequest (self->http, request, "/"); diff --git a/system-config-printer.spec b/system-config-printer.spec index 04b1a3b..051a177 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -15,6 +15,7 @@ Source0: http://cyberelk.net/tim/data/system-config-printer/1.0.x/system-config- Source1: http://cyberelk.net/tim/data/pycups/pycups-%{pycups_version}.tar.bz2 Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2 +Patch0: pycups-requested_attributes.patch Patch1: pysmbc-debug.patch BuildRequires: cups-devel >= 1.2 @@ -63,6 +64,10 @@ the configuration tool. %prep %setup -q -a 1 -a 2 +pushd pycups-%{pycups_version} +%patch0 -p1 -b .requested_attributes +popd + pushd pysmbc-%{pysmbc_version} %patch1 -p1 -b .debug popd @@ -154,6 +159,8 @@ exit 0 %changelog * Thu Jul 10 2008 Tim Waugh 1.0.4-1 - 1.0.4. +- Applied upstream patch for pycups to fix getPrinterAttributes when + requested_attributes is specified. * Tue Jul 8 2008 Tim Waugh 1.0.3-2 - Better debugging for pysmbc.