From rea-fbsd@codelabs.ru  Tue Mar 13 14:54:27 2007
Return-Path: <rea-fbsd@codelabs.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 56C6216A400;
	Tue, 13 Mar 2007 14:54:27 +0000 (UTC)
	(envelope-from rea-fbsd@codelabs.ru)
Received: from pobox.codelabs.ru (pobox.codelabs.ru [144.206.177.45])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A14D13C483;
	Tue, 13 Mar 2007 14:54:26 +0000 (UTC)
	(envelope-from rea-fbsd@codelabs.ru)
Received: from localdomain
	by pobox.codelabs.ru with local
	id 1HR8ON-000Psm-CE; Tue, 13 Mar 2007 17:54:23 +0300
Message-Id: <E1HR8ON-000Psm-CE@pobox.codelabs.ru>
Date: Tue, 13 Mar 2007 17:54:23 +0300
From: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Sender: rea-fbsd@codelabs.ru
Reply-To: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc: roam@freebsd.org
Subject: backport patch for ftp/curl from CURL's CVS
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         110270
>Category:       ports
>Synopsis:       backport patch for ftp/curl from CURL's CVS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    roam
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 13 15:00:11 GMT 2007
>Closed-Date:    Tue May 29 05:42:17 GMT 2007
>Last-Modified:  Tue May 29 05:42:17 GMT 2007
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
Code Labs
>Environment:
System: FreeBSD XXX 6.2-STABLE FreeBSD 6.2-STABLE #13: Mon Feb 12 15:59:07 MSK 2007 root@XXX:/usr/obj/usr/src/sys/XXX i386


>Description:
I fixed the bug that provoked SEGVs in Curl for the CVS version and
I will be happy if this patch will be incorporated to the FreeBSD
port: ports/devel/git is not very much usable over HTTP without the
patch.
>How-To-Repeat:
See http://cool.haxx.se/cvs.cgi/curl/lib/url.c, entries for 1.595
and 1.596.
>Fix:
The new version of url.c patch is below. I will be very grateful if
someone will tell me why the signal and thread handling is different
for FreeBSD, since I am trying to get the original patch for url.c
to be committed into the cURL mainstream, but I can not answer the
question why we need to set the 'data->set.no_signal' to 'TRUE'.

Thanks!

--- lib/url.c.orig	Mon Jan 29 01:45:22 2007
+++ lib/url.c	Tue Mar 13 17:36:31 2007
@@ -553,6 +553,10 @@
     data->set.httpauth = CURLAUTH_BASIC;  /* defaults to basic */
     data->set.proxyauth = CURLAUTH_BASIC; /* defaults to basic */
 
+#if defined(__FreeBSD_version)
+    data->set.no_signal = TRUE; /* different handling of signals and threads */
+#endif /* __FreeBSD_version */
+
     /* This no longer creates a connection cache here. It is instead made on
        the first call to curl_easy_perform() or when the handle is added to a
        multi stack. */
@@ -4151,9 +4155,6 @@
   if(data->set.reuse_forbid || conn->bits.close) {
     CURLcode res2 = Curl_disconnect(conn); /* close the connection */
 
-    *connp = NULL; /* to make the caller of this function better detect that
-                      this was actually killed here */
-
     /* If we had an error already, make sure we return that one. But
        if we got a new error, return that. */
     if(!result && res2)
@@ -4169,6 +4170,9 @@
           conn->connectindex,
           conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
   }
+
+  *connp = NULL; /* to make the caller of this function better detect that
+                    this was actually killed here */
 
   return result;
 }
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->roam 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Mar 13 15:00:26 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110270 
State-Changed-From-To: open->analyzed 
State-Changed-By: roam 
State-Changed-When: Tue Mar 13 15:11:46 UTC 2007 
State-Changed-Why:  
I'll take a look into this ASAP. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110270 

From: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org
Cc:  
Subject: Re: ports/110270: backport patch for ftp/curl from CURL's CVS
Date: Wed, 14 Mar 2007 17:13:03 +0300

 As was found yesterday and reported to Peter, I've found one more
 SEGV in the curl code that was fixed in the CVS release -- git's
 HTTP push utility provoked the SEGV. Tracked the problem to the
 specific commit to the CVS and backported the patch for the 7.16.1.
 See http://cool.haxx.se/cvs.cgi/curl/lib/url.c.diff?r2=1.585&r1=1.584&diff_format=u
 
 The new patch (not a patch to a patch, but a complete patchfile) for
 lib/url.c is below.
 
 Peter, I will appreciate the information about
 'data->set.no_signal = TRUE'.
 
 --- lib/url.c.orig	Wed Mar 14 16:48:31 2007
 +++ lib/url.c	Wed Mar 14 16:48:22 2007
 @@ -553,6 +553,10 @@
      data->set.httpauth = CURLAUTH_BASIC;  /* defaults to basic */
      data->set.proxyauth = CURLAUTH_BASIC; /* defaults to basic */
  
 +#if defined(__FreeBSD_version)
 +    data->set.no_signal = TRUE; /* different handling of signals and threads */
 +#endif /* __FreeBSD_version */
 +
      /* This no longer creates a connection cache here. It is instead made on
         the first call to curl_easy_perform() or when the handle is added to a
         multi stack. */
 @@ -1993,7 +1997,8 @@
                                    from the multi */
      }
  
 -    infof(data, "Examining connection #%ld for reuse\n", check->connectindex);
 +    DEBUGF(infof(data, "Examining connection #%ld for reuse\n",
 +                 check->connectindex));
  
      if(check->inuse && !canPipeline) {
        /* can only happen within multi handles, and means that another easy
 @@ -2019,11 +2024,11 @@
        continue;
      }
  
 -    if (data->state.is_in_pipeline && check->bits.close) {
 -        /* Don't pick a connection that is going to be closed */
 -        infof(data, "Connection #%ld has been marked for close, can't reuse\n",
 -              check->connectindex);
 -        continue;
 +    if (check->bits.close) {
 +      /* Don't pick a connection that is going to be closed. */
 +      infof(data, "Connection #%ld has been marked for close, can't reuse\n",
 +            check->connectindex);
 +      continue;
      }
  
      if((needle->protocol&PROT_SSL) != (check->protocol&PROT_SSL))
 @@ -4092,8 +4097,9 @@
  
  
  CURLcode Curl_done(struct connectdata **connp,
 -                   CURLcode status, bool premature) /* an error if this is called after an
 -                                       error was detected */
 +                   CURLcode status,  /* an error if this is called after an
 +                                        error was detected */
 +                   bool premature)
  {
    CURLcode result;
    struct connectdata *conn = *connp;
 @@ -4151,9 +4157,6 @@
    if(data->set.reuse_forbid || conn->bits.close) {
      CURLcode res2 = Curl_disconnect(conn); /* close the connection */
  
 -    *connp = NULL; /* to make the caller of this function better detect that
 -                      this was actually killed here */
 -
      /* If we had an error already, make sure we return that one. But
         if we got a new error, return that. */
      if(!result && res2)
 @@ -4169,6 +4172,9 @@
            conn->connectindex,
            conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
    }
 +
 +  *connp = NULL; /* to make the caller of this function better detect that
 +                    this was actually killed here */
  
    return result;
  }

From: Peter Pentchev <roam@ringlet.net>
To: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/110270: backport patch for ftp/curl from CURL's CVS
Date: Fri, 16 Mar 2007 17:52:59 +0200

 --p4qYPpj5QlsIQJ0K
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Wed, Mar 14, 2007 at 02:20:09PM +0000, Eygene Ryabinkin wrote:
 > The following reply was made to PR ports/110270; it has been noted by GNA=
 TS.
 >=20
 > From: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
 > To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org
 > Cc: =20
 > Subject: Re: ports/110270: backport patch for ftp/curl from CURL's CVS
 > Date: Wed, 14 Mar 2007 17:13:03 +0300
 >=20
 >  As was found yesterday and reported to Peter, I've found one more
 >  SEGV in the curl code that was fixed in the CVS release -- git's
 >  HTTP push utility provoked the SEGV. Tracked the problem to the
 >  specific commit to the CVS and backported the patch for the 7.16.1.
 >  See http://cool.haxx.se/cvs.cgi/curl/lib/url.c.diff?r2=3D1.585&r1=3D1.58=
 4&diff_format=3Du
 > =20
 >  The new patch (not a patch to a patch, but a complete patchfile) for
 >  lib/url.c is below.
 
 Unfortunately, it seems that this is still not quite enough - when I
 build the curl port with this patch, it fails test 530.
 
 It would appear that there have been some other changes to pipelining
 after 7.16.1 was released, and we might have to backport some of those
 changes, too.  I'll try to look into that during the weekend.
 
 G'luck,
 Peter
 
 --=20
 Peter Pentchev	roam@ringlet.net    roam@cnsys.bg    roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 If you think this sentence is confusing, then change one pig.
 
 --p4qYPpj5QlsIQJ0K
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.7 (FreeBSD)
 
 iD8DBQFF+r1b7Ri2jRYZRVMRAuQyAJ442YIi9QBDhElCMMJpQGYif/pe0QCfWtLe
 uw/XTf24LNKHa0uI51fzTaI=
 =OaIX
 -----END PGP SIGNATURE-----
 
 --p4qYPpj5QlsIQJ0K--

From: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To: Peter Pentchev <roam@ringlet.net>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/110270: backport patch for ftp/curl from CURL's CVS
Date: Sat, 17 Mar 2007 13:12:37 +0300

 Peter, good day.
 
 > >  As was found yesterday and reported to Peter, I've found one more
 > >  SEGV in the curl code that was fixed in the CVS release -- git's
 > >  HTTP push utility provoked the SEGV. Tracked the problem to the
 > >  specific commit to the CVS and backported the patch for the 7.16.1.
 > >  See http://cool.haxx.se/cvs.cgi/curl/lib/url.c.diff?r2=1.585&r1=1.584&diff_format=u
 > >  
 > >  The new patch (not a patch to a patch, but a complete patchfile) for
 > >  lib/url.c is below.
 > 
 > Unfortunately, it seems that this is still not quite enough - when I
 > build the curl port with this patch, it fails test 530.
 
 Arrgh, I completely forgot about the curl testsuite. Sorry.
 
 > It would appear that there have been some other changes to pipelining
 > after 7.16.1 was released, and we might have to backport some of those
 > changes, too.  I'll try to look into that during the weekend.
 
 From reading the CVS logs it seems that the url.c v. 1.590 is a good
 candidate. I will try to do something with it over the weekend too ;))
 
 I was thinking about starting the curl-devel port. Do you think it will
 be worth it?
 
 Thank you.
 -- 
 Eygene

From: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org
Cc:  
Subject: Re: ports/110270: backport patch for ftp/curl from CURL's CVS
Date: Tue, 29 May 2007 08:02:34 +0400

 cURL 7.16.2 is out, so this PR can be closed: bugfixes got to the
 release.
 -- 
 Eygene
State-Changed-From-To: analyzed->closed 
State-Changed-By: linimon 
State-Changed-When: Tue May 29 05:41:45 UTC 2007 
State-Changed-Why:  
Bugfixes have already made it into the next release. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110270 
>Unformatted:
