bugGNU Octave - Bugs: bug #35649, fix urlwrite.cc to be backwards...

 
 

bug #35649: fix urlwrite.cc to be backwards compatible with libcurl 7.15.5 for RHEL/CentOS 5

Submitter:  Mike Miller <mtmiller>
Submitted:  Mon 27 Feb 2012 11:15:27 PM UTC
   
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  Postponed Assigned to:  jordigh
Originator Name:  Mike Miller Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 05 Mar 2012 03:07:09 PM UTC, comment #5: 

Okay, I decided I don't care in this instance too much what is the right thing. If this ever becomes a problem, we can revisit this issue.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Thu 01 Mar 2012 05:44:43 PM UTC, comment #4: 

I know the usual approach is to test for features rather than versions, but in this case I thought the approach was acceptable.  First, it is an easy test to implement.  Second, I don't think this will stay in the Octave code base for very long.  Octave has minimum requirements for certain external dependencies like automake, etc.  At some point, Octave will simply declare that it won't support older versions of libcurl.  I thought this patch could be a temporary bridge until that point.  The release date for curl-7.17.0, which includes the functionality we use, was 9/13/2007.  So this September will be 5 years on and would be a fine time to drop support for earlier curl revisions.

Here is the relevant part of curl.h:


#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
                          the obsolete stuff removed! */

/* Backwards compatibility with older names */
/* These are scheduled to disappear by 2011 */

/* This was added in version 7.19.1 */
#define CURLOPT_POST301 CURLOPT_POSTREDIR

/* These are scheduled to disappear by 2009 */

/* The following were added in 7.17.0 */
#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
#define CURLOPT_FTPAPPEND CURLOPT_APPEND
#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
#define CURLOPT_FTP_SSL CURLOPT_USE_SSL

/* The following were added earlier */

#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL

#else


We could program in a test into configure.ac and undef CURL_NO_OLDIES based on the results.  However, if the only feature we are using is CURLOPT_FTPLISTONLY then I think Jordi's solution would be fine.

Rik <rik5>
Group administrator
Thu 01 Mar 2012 03:24:05 PM UTC, comment #3: 

I agree, but unfortunately most constants in curl including this one are enums instead of defines.

One option would be to test for a completely unrelated define that first showed up in the same version, 7.17.0, but I think that's worse.

Another option would be to just use the old constant again, which is defined by curl to be backwards compatible, as long as CURL_NO_OLDIES is not defined by the user.

One more option would be something perverse like


#ifndef CURLOPT_FTPLISTONLY
#define CURLOPT_DIRLISTONLY CURLOPT_FTPLISTONLY
#endif


If it is not defined, then it's an enum, but that just looks wrong.

Mike Miller <mtmiller>
Group Member
Thu 01 Mar 2012 01:42:59 PM UTC, comment #2: 

I'm not sure this is the correct patch. We generally check for features, not for versions. Would it be ok to do this instead?


#if !defined (CURLOPT_DIRLISTONLY) //Or perhaps some other check?
#define CURLOPT_DIRLISTONLY CURLOPT_FTPLISTONLY
#endif


Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Thu 01 Mar 2012 07:08:18 AM UTC, comment #1: 

The change was committed to the Mercurial development branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/c267a3522d6c).  The fix will be available in version 3.8 or the reporter can build from development sources.

Rik <rik5>
Group administrator
Mon 27 Feb 2012 11:15:27 PM UTC, original submission:  

It was suggested in this thread

http://octave.1599824.n4.nabble.com/undeclared-variable-error-td3675728.html

that a patch be submitted to make urlwrite.cc compatible with the older libcurl API in question.  As far as I can tell that was never followed up on.  Here is a patch that works for me, building from the current development source.



diff -r 59e20a5e2ca8 src/DLD-FUNCTIONS/urlwrite.cc
--- a/src/DLD-FUNCTIONS/urlwrite.cc     Mon Feb 27 07:50:26 2012 -0500
+++ b/src/DLD-FUNCTIONS/urlwrite.cc     Mon Feb 27 17:35:07 2012 -0500
@@ -55,6 +55,11 @@
 #include <curl/curlver.h>
 #include <curl/easy.h>

+// Backwards compatibility for curl < 7.17.0
+#if LIBCURL_VERSION_NUM < 0x071100
+#define CURLOPT_DIRLISTONLY CURLOPT_FTPLISTONLY
+#endif
+
 static int
 write_data (void *buffer, size_t size, size_t nmemb, void *streamp)
 {



I was able to compile, run, and verify curl is working on both RHEL 5.x and CentOS 5.7, with the following caveats:

  • ./configure --disable-docs CC=gcc44 CXX=g++44 F77=gfortran44
  • I had to rebuild LAPACK/BLAS because the libraries built by Red Hat have a broken dlamch (see https://bugzilla.redhat.com/show_bug.cgi?id=557977)
  • gnuplot 4.0.0 provided with RHEL/CentOS 5.x is not compatible with latest Octave


Hope you can use this, let me know if I can clarify or test anything.

Mike Miller <mtmiller>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-05-13 mtmiller Dependencies- bugs #38977 is dependent
    2012-03-05 jordigh StatusNeed Info Postponed
        Open/ClosedOpen Closed
    2012-03-01 jordigh StatusFixed Need Info
        Assigned toNone jordigh
        Open/ClosedClosed Open
    2012-03-01 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code