Bug 109670 - update of ports/ftp/curl to the version 7.16.1
Summary: update of ports/ftp/curl to the version 7.16.1
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Peter Pentchev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-28 12:00 UTC by Eygene Ryabinkin
Modified: 2007-03-09 15:24 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (1.69 KB, patch)
2007-02-28 12:00 UTC, Eygene Ryabinkin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eygene Ryabinkin 2007-02-28 12:00:12 UTC
Curl 7.16.1 was out at January 29th 2007 and the most notable fix
as compared with 7.16.0 is the 'SIGSEGV when disconnecting on a
transfer on a re-used handle when the host name didn't resolve'.
I hit the SEGV when tried to upgrade the ports/devel/git to the
recent version. 7.16.1 didn't solved my problems, but I've already
identified most of them and hopefully the patch will be submitted
to the curl developers.

Fix: Attached is the patch that does the upgrade to 7.16.1 and adds
the 'DEBUG' option to produce curl library with debugging functions.
How-To-Repeat: See http://curl.haxx.se/docs/verdiff.cgi?r1=7.16.1&r2=7.16.0 and
http://curl.haxx.se/changes.html for the 7.16.1 fixes.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-02-28 12:00:24 UTC
Responsible Changed
From-To: freebsd-ports-bugs->roam

Over to maintainer
Comment 2 Eygene Ryabinkin 2007-03-02 11:04:45 UTC
Spotted an error in a distinfo's patch: wrong file name in a SIZE
clause. Corrected patch version is below.

diff -urN curl.orig/Makefile curl/Makefile
--- curl.orig/Makefile	Tue Feb 27 13:31:52 2007
+++ curl/Makefile	Tue Feb 27 13:32:40 2007
@@ -6,8 +6,7 @@
 #
 
 PORTNAME=	curl
-PORTVERSION=	7.16.0
-PORTREVISION=	1
+PORTVERSION=	7.16.1
 CATEGORIES=	ftp ipv6 www
 MASTER_SITES=	http://curl.haxx.se/download/ \
 		${MASTER_SITE_SOURCEFORGE} \
@@ -57,7 +56,8 @@
 		KERBEROS4 "Kerberos 4 authentication" off \
 		LIBIDN "Internationalized Domain Names via libidn" off \
 		NTLM "NTLM authentication" off \
-		OPENSSL "OpenSSL support" on
+		OPENSSL "OpenSSL support" on \
+		DEBUG "Debugging code" off
 
 .include <bsd.port.pre.mk>
 
@@ -127,6 +127,10 @@
 CONFIGURE_ARGS+=	--enable-ntlm
 .else
 CONFIGURE_ARGS+=	--disable-ntlm
+.endif
+
+.if defined(WITH_DEBUG)
+CONFIGURE_ARGS+=	--enable-debug
 .endif
 
 post-patch:
diff -urN curl.orig/distinfo curl/distinfo
--- curl.orig/distinfo	Tue Feb 27 13:31:52 2007
+++ curl/distinfo	Tue Feb 27 13:34:07 2007
@@ -1,3 +1,3 @@
-MD5 (curl-7.16.0.tar.bz2) = 5819f56e93d04cde2992fe88b54cbfad
-SHA256 (curl-7.16.0.tar.bz2) = fc8dcda5a933c370c15c832bf1e7316a0690f473fdd6000454d233edaa33bc23
-SIZE (curl-7.16.0.tar.bz2) = 1566391
+MD5 (curl-7.16.1.tar.bz2) = acdab0b0467c55e10ed02d2afed80575
+SHA256 (curl-7.16.1.tar.bz2) = 257b204acf1d80314694b4cf63cccbc7c70bccee75cb3d9924bbb061ec6bccef
+SIZE (curl-7.16.1.tar.bz2) = 1592074
diff -urN curl.orig/files/patch-configure curl/files/patch-configure
--- curl.orig/files/patch-configure	Tue Feb 27 13:31:52 2007
+++ curl/files/patch-configure	Tue Feb 27 13:36:35 2007
@@ -11,12 +11,3 @@
      ;;
    esac
  
-@@ -35638,7 +35640,7 @@
- main ()
- {
- #ifndef basename
--  char *p = (char *) basename;
-+  char *(*p)(const char *) = basename;
-   return !p;
- #endif
- 
--- lib/multi.c.orig	Sat Jan 27 21:22:02 2007
+++ lib/multi.c	Wed Feb 28 17:40:26 2007
@@ -1986,3 +1986,51 @@
   }
 }
 #endif
+
+/*
+ * Walks through all easy handles and returns the number of
+ * easy connections in the multi stack that are using the
+ * given 'connection'.
+ */
+int Curl_multi_connection_used(struct Curl_multi *multi,
+                               struct connectdata *connection)
+{
+  int count = 0;
+  struct Curl_one_easy *easy;
+
+  easy = multi->easy.next;
+  while (easy) {
+    if (easy->easy_conn == connection) {
+      fprintf(stderr, "Used in easy = 0x%x\n", easy);
+      count++;
+    }
+    easy=easy->next;
+  }
+
+  fprintf(stderr, "Connection 0x%x, multi 0x%x: %d references.\n",
+    connection, multi, count);
+
+  return count;
+}
+
+/*
+ * Walks through all easy handles and sets the easy_conn fields
+ * that are equal to 'connection' to NULL. Also sets easy's state
+ * to CURLM_STATE_COMPLETED.
+ */
+void Curl_multi_dissociate_connection(struct Curl_multi *multi,
+                                      struct connectdata *connection)
+{
+  struct Curl_one_easy *easy;
+
+  easy = multi->easy.next;
+  while (easy) {
+    if (easy->easy_conn == connection) {
+      easy->easy_conn = NULL;
+      easy->state = CURLM_STATE_COMPLETED;
+    }
+    easy=easy->next;
+  }
+
+  return;
+}
--- lib/url.c.orig	Sun Jan 28 22:45:22 2007
+++ lib/url.c	Wed Feb 28 17:53:14 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. */
@@ -1835,6 +1839,18 @@
     signalPipeClose(conn->recv_pipe);
   }
 
+  /* This connection can be used by some other easy thingy. If
+   * not, then we should clean the easy's easy_conn field to
+   * avoid storing the freed pointer. */
+  if (data->magic == CURLEASY_MAGIC_NUMBER) {
+    if (Curl_multi_connection_used(data->multi, conn) > 1000) {
+      return CURLE_OK;
+    } else {
+      Curl_multi_dissociate_connection(data->multi, conn);
+    }
+  }
+
+  fprintf(stderr, "Freeing connection 0x%x\n", conn);
   conn_free(conn);
 
   return CURLE_OK;
--- lib/multiif.h.orig	Mon Oct 23 06:47:06 2006
+++ lib/multiif.h	Wed Feb 28 16:53:47 2007
@@ -32,6 +32,12 @@
 
 bool Curl_multi_canPipeline(struct Curl_multi* multi);
 
+int Curl_multi_connection_used(struct Curl_multi *multi,
+                               struct connectdata *connection);
+
+void Curl_multi_dissociate_connection(struct Curl_multi *multi,
+                                      struct connectdata *connection);
+
 /* the write bits start at bit 16 for the *getsock() bitmap */
 #define GETSOCK_WRITEBITSTART 16
Comment 3 Eygene Ryabinkin 2007-03-05 12:49:31 UTC
Li-Wen, good day!

> I think there might be some problems in your patch-2.diff
> 
> I made a new patch. Could you check it?

Sorry, but the patch you attached it just the same as mine. At least
I've failed to find any differences both by eyes and by diff. Could you
please describe what is wrong with the patch-2.diff?

Thank you!
-- 
Eygene
Comment 4 Peter Pentchev 2007-03-05 13:04:26 UTC
On Mon, Mar 05, 2007 at 12:50:15PM +0000, Eygene Ryabinkin wrote:
>  Li-Wen, good day!
>  
>  > I think there might be some problems in your patch-2.diff
>  > 
>  > I made a new patch. Could you check it?
>  
>  Sorry, but the patch you attached it just the same as mine. At least
>  I've failed to find any differences both by eyes and by diff. Could you
>  please describe what is wrong with the patch-2.diff?


Your second patch seemed to contain some diffs to extra files - lib/multi.c,
lib/multiif.h, and lib/url.c;  I was about to ignore them anyway :)

Thanks to both of you for your work on this update; I'm taking a look at
it right now.

G'luck,
Peter

-- 
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
This would easier understand fewer had omitted.
Comment 5 Li-Wen Hsu 2007-03-05 13:44:34 UTC
On Mon, Mar 05, 2007 at 15:04:26 +0200, Peter Pentchev wrote:
> On Mon, Mar 05, 2007 at 12:50:15PM +0000, Eygene Ryabinkin wrote:
> >  Li-Wen, good day!
> >  > I think there might be some problems in your patch-2.diff
> >  > I made a new patch. Could you check it?
> >  Sorry, but the patch you attached it just the same as mine. At least
> >  I've failed to find any differences both by eyes and by diff. Could you
> >  please describe what is wrong with the patch-2.diff?
> Your second patch seemed to contain some diffs to extra files - lib/multi.c,
> lib/multiif.h, and lib/url.c;  I was about to ignore them anyway :)
> Thanks to both of you for your work on this update; I'm taking a look at
> it right now.


Thanks for the explanation of Peter, that's it.
And another PR sent by me, ports/109905, needs this one.
Thanks for both your help. :)

-- 
Best Regards,
Li-Wen Hsu
Comment 6 Eygene Ryabinkin 2007-03-05 14:22:41 UTC
Peter, Li-Wen,

> >  Sorry, but the patch you attached it just the same as mine. At least
> >  I've failed to find any differences both by eyes and by diff. Could you
> >  please describe what is wrong with the patch-2.diff?
> 
> Your second patch seemed to contain some diffs to extra files - lib/multi.c,
> lib/multiif.h, and lib/url.c;  I was about to ignore them anyway :)

Whoops, sorry: attached the wrong file to the end of the actual
patch. Li-Wei, thanks for spotting the bug.
-- 
Eygene
Comment 7 Peter Pentchev 2007-03-05 15:49:46 UTC
On Fri, Mar 02, 2007 at 11:10:07AM +0000, Eygene Ryabinkin wrote:
[snip]
>  +		DEBUG "Debugging code" off

[snip]
>  +.if defined(WITH_DEBUG)
>  +CONFIGURE_ARGS+=	--enable-debug
>   .endif


Errrr...  but isn't there already a CURL_DEBUG option in the port (and
listed in the OPTIONS variable) that does pretty much the same? :)

Anyway, I'm working on a patch and will probably commit the update
itself (along with a new option for SCP and SFTP transfers using
libssh2) later today.

G'luck,
Peter

-- 
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
because I didn't think of a good beginning of it.
Comment 8 Eygene Ryabinkin 2007-03-05 15:54:13 UTC
> [snip]
> >  +		DEBUG "Debugging code" off
> [snip]
> >  +.if defined(WITH_DEBUG)
> >  +CONFIGURE_ARGS+=	--enable-debug
> >   .endif
> 
> Errrr...  but isn't there already a CURL_DEBUG option in the port (and
> listed in the OPTIONS variable) that does pretty much the same? :)

Was not my day: when I did the patch I was failed to find this option.
Perhaps I am too used to the WITH_DEBUG :((
-- 
Eygene
Comment 9 dfilter service freebsd_committer freebsd_triage 2007-03-09 14:45:37 UTC
roam        2007-03-09 14:45:32 UTC

  FreeBSD ports repository

  Modified files:
    ftp/curl             Makefile distinfo 
    ftp/curl/files       patch-configure 
  Added files:
    ftp/curl/files       patch-tests::data::test62 
  Log:
  Update to curl 7.16.1, loosely based on the PR.  Also:
  - add a LIBSSH2 option for SCP and SFTP support using security/libssh2;
  - add a patch from the cURL CVS repository to fix an expired cookie in
    test 62.
  
  PR:             109670
  Submitted by:   Eygene Ryabinkin <rea-fbsd@codelabs.ru>
  
  Revision  Changes    Path
  1.85      +13 -2     ports/ftp/curl/Makefile
  1.48      +3 -3      ports/ftp/curl/distinfo
  1.7       +0 -9      ports/ftp/curl/files/patch-configure
  1.1       +15 -0     ports/ftp/curl/files/patch-tests::data::test62 (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 10 Peter Pentchev freebsd_committer freebsd_triage 2007-03-09 15:23:35 UTC
State Changed
From-To: open->closed

I have committed an update to curl-7.16.1. 
Once again, thanks to both of you for your work on this update!