Your message dated Sun, 28 Oct 2012 10:32:27 +0000
with message-id <[email protected]>
and subject line Bug#690187: fixed in pycurl 7.19.0-6
has caused the Debian Bug report #690187,
regarding PyCurl segfault while invoking reset() function multiple times
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
690187: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690187
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python-pycurl
Version: 7.19.0-5
Severity: important
Tags: patch
Hi,
PyCurl segfault while invoking reset() function multiple times. Here is
an example on how to reproduce the crash:
$ printf "import pycurl\nc = pycurl.Curl()\nfor i in
xrange(100000):\n\tc.reset()\n" | python
This bug has been fixed upstream for ages[1][2].
Attached is a patch which includes the upstream fix reworked to apply
cleanly on the Debian sources.
Regards,
[1]
http://sourceforge.net/tracker/?func=detail&aid=2893665&group_id=28236&atid=392777
[2]
http://pycurl.cvs.sourceforge.net/viewvc/pycurl/pycurl/src/pycurl.c?r1=1.148&r2=1.149
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From fd77939ffbd90f43c7749781b2f8ae5c9d86e91d Mon Sep 17 00:00:00 2001
From: Emmanuel Bouthenot <[email protected]>
Date: Wed, 10 Oct 2012 21:56:03 +0000
Subject: [PATCH] Fix refcount bug/segfault in reset() function
---
debian/changelog | 8 ++
debian/patches/20_fix_refcount_bug.patch | 159 ++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 168 insertions(+)
create mode 100644 debian/patches/20_fix_refcount_bug.patch
diff --git a/debian/changelog b/debian/changelog
index 0aa84ab..df41cbf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+pycurl (7.19.0-5.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Add a patch to fix refcount bug in reset() function which leads to
+ a segfault in some cases.
+
+ -- Emmanuel Bouthenot <[email protected]> Wed, 10 Oct 2012 21:45:56 +0000
+
pycurl (7.19.0-5) unstable; urgency=low
* debian/rules
diff --git a/debian/patches/20_fix_refcount_bug.patch b/debian/patches/20_fix_refcount_bug.patch
new file mode 100644
index 0000000..000e75e
--- /dev/null
+++ b/debian/patches/20_fix_refcount_bug.patch
@@ -0,0 +1,159 @@
+Description: Fix refcount bug in reset() function which leads to a segfault in some cases
+Forwarded: not-needed
+Origin: upstream, http://pycurl.cvs.sourceforge.net/viewvc/pycurl/pycurl/src/pycurl.c?r1=1.148&r2=1.149
+Bug: http://sourceforge.net/tracker/?func=detail&aid=2893665&group_id=28236&atid=392777
+Author: Emmanuel Bouthenot <[email protected]>
+Last-Update: 2012-10-10
+--- a/src/pycurl.c
++++ b/src/pycurl.c
+@@ -748,64 +748,84 @@
+ }
+
+
+-/* constructor - this is a module-level function returning a new instance */
+-static CurlObject *
+-do_curl_new(PyObject *dummy)
++/* initializer - used to intialize curl easy handles for use with pycurl */
++static int
++util_curl_init(CurlObject *self)
+ {
+- CurlObject *self = NULL;
+ int res;
+ char *s = NULL;
+
+- UNUSED(dummy);
+-
+- /* Allocate python curl object */
+- self = util_curl_new();
+- if (self == NULL)
+- return NULL;
+-
+- /* Initialize curl handle */
+- self->handle = curl_easy_init();
+- if (self->handle == NULL)
+- goto error;
+-
+ /* Set curl error buffer and zero it */
+ res = curl_easy_setopt(self->handle, CURLOPT_ERRORBUFFER, self->error);
+- if (res != CURLE_OK)
+- goto error;
++ if (res != CURLE_OK) {
++ return (-1);
++ }
+ memset(self->error, 0, sizeof(self->error));
+
+ /* Set backreference */
+ res = curl_easy_setopt(self->handle, CURLOPT_PRIVATE, (char *) self);
+- if (res != CURLE_OK)
+- goto error;
++ if (res != CURLE_OK) {
++ return (-1);
++ }
+
+ /* Enable NOPROGRESS by default, i.e. no progress output */
+ res = curl_easy_setopt(self->handle, CURLOPT_NOPROGRESS, (long)1);
+- if (res != CURLE_OK)
+- goto error;
++ if (res != CURLE_OK) {
++ return (-1);
++ }
+
+ /* Disable VERBOSE by default, i.e. no verbose output */
+ res = curl_easy_setopt(self->handle, CURLOPT_VERBOSE, (long)0);
+- if (res != CURLE_OK)
+- goto error;
++ if (res != CURLE_OK) {
++ return (-1);
++ }
+
+ /* Set FTP_ACCOUNT to NULL by default */
+ res = curl_easy_setopt(self->handle, CURLOPT_FTP_ACCOUNT, NULL);
+- if (res != CURLE_OK)
+- goto error;
++ if (res != CURLE_OK) {
++ return (-1);
++ }
+
+ /* Set default USERAGENT */
+ s = (char *) malloc(7 + strlen(LIBCURL_VERSION) + 1);
+- if (s == NULL)
+- goto error;
++ if (s == NULL) {
++ return (-1);
++ }
+ strcpy(s, "PycURL/"); strcpy(s+7, LIBCURL_VERSION);
+ res = curl_easy_setopt(self->handle, CURLOPT_USERAGENT, (char *) s);
+ if (res != CURLE_OK) {
+ free(s);
+- goto error;
++ return (-1);
+ }
++
+ self->options[ OPT_INDEX(CURLOPT_USERAGENT) ] = s; s = NULL;
+
++ return (0);
++}
++
++/* constructor - this is a module-level function returning a new instance */
++static CurlObject *
++do_curl_new(PyObject *dummy)
++{
++ CurlObject *self = NULL;
++ int res;
++
++ UNUSED(dummy);
++
++ /* Allocate python curl object */
++ self = util_curl_new();
++ if (self == NULL)
++ return NULL;
++
++ /* Initialize curl handle */
++ self->handle = curl_easy_init();
++ if (self->handle == NULL)
++ goto error;
++
++ res = util_curl_init(self);
++ if (res < 0)
++ goto error;
++
+ /* Success - return new object */
+ return self;
+
+@@ -1424,6 +1444,7 @@
+ static PyObject*
+ do_curl_reset(CurlObject *self)
+ {
++ int res;
+ unsigned int i;
+
+ curl_easy_reset(self->handle);
+@@ -1452,6 +1473,14 @@
+ }
+ }
+
++ res = util_curl_init(self);
++ if (res < 0) {
++ Py_DECREF(self); /* this also closes self->handle */
++ PyErr_SetString(ErrorObject, "resetting curl failed");
++ return NULL;
++ }
++
++ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+--- a/tests/test_internals.py
++++ b/tests/test_internals.py
+@@ -245,6 +245,11 @@
+ if opts.verbose >= 1:
+ print "Tracked objects:", len(gc.get_objects())
+
++# Ensure that the refcounting error in 'reset' is fixed
++if 1:
++ c = Curl()
++ for i in xrange(100000):
++ c.reset()
+
+ # /***********************************************************************
+ # // done
diff --git a/debian/patches/series b/debian/patches/series
index fdf6a58..8c3336a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
10_setup.py.patch
+20_fix_refcount_bug.patch
--
1.7.10.4
--- End Message ---
--- Begin Message ---
Source: pycurl
Source-Version: 7.19.0-6
We believe that the bug you reported is fixed in the latest version of
pycurl, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Sandro Tosi <[email protected]> (supplier of updated pycurl package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Sun, 28 Oct 2012 11:20:44 +0100
Source: pycurl
Binary: python-pycurl python-pycurl-dbg
Architecture: source amd64
Version: 7.19.0-6
Distribution: experimental
Urgency: low
Maintainer: Debian Python Modules Team
<[email protected]>
Changed-By: Sandro Tosi <[email protected]>
Description:
python-pycurl - Python bindings to libcurl
python-pycurl-dbg - Python bindings to libcurl (debug extension)
Closes: 690187
Changes:
pycurl (7.19.0-6) experimental; urgency=low
.
* debian/patches/20_remove_string_options.patch
- No longer keep copies of string options since this is managed by libcurl,
needed to have pycurl.c in sync with upstream CVS, and apply further
patches
* debian/patches/30_fix_refcounts_calling_reset_twice.patch
- Fixes refcount bug and provides better organization of PyCurl object,
allowing to call reset() multiple time; thansk to Emmanuel Bouthenot for
the report; Closes: #690187
* debian/patches/40_add_CURLOPT_SEEKFUNCTION_and_CURLOPT_SEEKDATA.patch
- Added CURLOPT_SEEKFUNCTION, CURLOPT_SEEKDATA
* debian/control
- bump Standards-Version t0 3.9.3 (no changes needed)
Checksums-Sha1:
4e52b34ec04213d91d4cd6efed16d9885fd6c052 1520 pycurl_7.19.0-6.dsc
a7a50da5599cf7ed8b33501c9b4e4b1fd86d22e9 10523 pycurl_7.19.0-6.debian.tar.gz
84de3bb83df702cae85b606f80e041d0020218cc 87554 python-pycurl_7.19.0-6_amd64.deb
8fbea0f53663b8de6b7c654f284672054f462135 243646
python-pycurl-dbg_7.19.0-6_amd64.deb
Checksums-Sha256:
dc26c6091dd010caf3c71117a2f9f0f37688f56dbb437a0d9259caccbd60a7fb 1520
pycurl_7.19.0-6.dsc
b26566785cd0cd74e0e37503dc66d61deecf200a604c6d274c4e15a02b6f8e98 10523
pycurl_7.19.0-6.debian.tar.gz
a0c5dde9e11de1b00d6bc0a26acf9b39db01eabb6aefb5eea0359a4e51565be4 87554
python-pycurl_7.19.0-6_amd64.deb
062a50f7c62dd15b1f759ba6faa3100337364b0df51e037208e13b04aef6f634 243646
python-pycurl-dbg_7.19.0-6_amd64.deb
Files:
979a9abf413d6df88b3bcc7cfa901ff1 1520 python optional pycurl_7.19.0-6.dsc
96e0678bb7c07ab4979adf06e2939c54 10523 python optional
pycurl_7.19.0-6.debian.tar.gz
4f1abece2a38fb6e10410f1b73a65d50 87554 python optional
python-pycurl_7.19.0-6_amd64.deb
b13d3078fe1ce7885a24c8f66f6a824c 243646 debug extra
python-pycurl-dbg_7.19.0-6_amd64.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlCNB3EACgkQAukwV0RN2VDwPwCfaDMi5WyZEBKH9oR8DNmhavME
0SEAnibu1scdU3hVsXvwX80do4atN4GH
=0UYI
-----END PGP SIGNATURE-----
--- End Message ---
_______________________________________________
Python-modules-team mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team