bugGNU Octave - Bugs: bug #63573, Build warnings from curl library

 
 

bug #63573: Build warnings from curl library

Submitter:  Arun Giridhar <arungiridhar>
Submitted:  Sun 25 Dec 2022 04:27:20 PM UTC
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  9.1.0 (current default) Planned Release:  9.1.0 (current default)
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Wed 25 Jan 2023 08:42:04 PM UTC, comment #9: 

Sorry, crossed with your comment.

Yes, your latest patch eliminates the build warning for me.

Arun Giridhar <arungiridhar>
Project Member
Wed 25 Jan 2023 08:37:23 PM UTC, comment #8: 

Looking at my trial patch, I could eliminate that warning but it needed a line like `curl_easy_setopt (easy, CURLOPT_MIMEPOST, mime);` where `easy` was defined by `CURL *easy = curl_easy_init ()`. Not sure if that was needed.

Arun Giridhar <arungiridhar>
Project Member
Wed 25 Jan 2023 08:36:40 PM UTC, comment #7: 

Oops, I missed one renaming.  Try pulling and building again with cset 17ec50a2f044.

Rik <rik5>
Project Administrator
Wed 25 Jan 2023 08:12:39 PM UTC, comment #6: 

I'm still getting a gcc warning

In file included from ../liboctave/util/url-transfer.cc:44:
../liboctave/util/url-transfer.cc: In member function 'virtual void octave::curl_transfer::form_data_post(const Array<std::__cxx11::basic_string<char> >&)':
../liboctave/util/url-transfer.cc:737:17: warning: 'CURLOPT_HTTPPOST' is deprecated: since 7.56.0. Use CURLOPT_MIMEPOST [-Wdeprecated-declarations]
  737 |         SETOPT (CURLOPT_HTTPPOST, mime);
      |                 ^~~~~~~~~~~~~~~~
../liboctave/util/url-transfer.cc:737:9: note: in expansion of macro 'SETOPT'
  737 |         SETOPT (CURLOPT_HTTPPOST, mime);
      |         ^~~~~~
/usr/include/curl/curl.h:1195:3: note: declared here
 1195 |   CURLOPTDEPRECATED(CURLOPT_HTTPPOST, CURLOPTTYPE_OBJECTPOINT, 24,
      |   ^~~~~~~~~~~~~~~~~

but I'm more confused by the fact that the structure pointer "mime" is never changed to something other than nullptr before it is used. Where is mime assigned to a valid mime struct?

Arun Giridhar <arungiridhar>
Project Member
Wed 25 Jan 2023 07:36:14 PM UTC, comment #5: 

It turns out the recoding away from curl_formadd() was rather tricky.  I made the changes in this changeset: http://hg.savannah.gnu.org/hgweb/octave/rev/22b12276375e.

I don't have a version of gcc that produces any warnings so I'm marking this as Ready for Test by someone who does.

Rik <rik5>
Project Administrator
Fri 13 Jan 2023 07:21:43 PM UTC, comment #4: 

I am attaching a trial patch for this bug. It builds and passes "make check" but I have no idea if this is the right way to do it. It needed a lot of changes with the new curl API. Pls review.

Resources used to make this patch:

(file #54221)

Arun Giridhar <arungiridhar>
Project Member
Wed 11 Jan 2023 05:59:05 PM UTC, comment #3: 

Changing the constants was OK but changing the function names requires more thought to ensure the wrapping is correct.

WIP patch that removes two of the warnings:

diff -r d6b208b30d4c liboctave/util/url-transfer.cc
--- a/liboctave/util/url-transfer.cc    Tue Jan 10 14:32:34 2023 -0800
+++ b/liboctave/util/url-transfer.cc    Wed Jan 11 12:58:23 2023 -0500
@@ -577,7 +577,7 @@ public:
     curl_easy_getinfo (m_curl, CURLINFO_FILETIME, &ft);
     filetime = ft;
     double fs;
-    curl_easy_getinfo (m_curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fs);
+    curl_easy_getinfo (m_curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &fs);
     filesize = fs;

     SETOPT (CURLOPT_WRITEFUNCTION, write_data);
@@ -712,11 +712,13 @@ public:
   // path of the file as its value.
   void form_data_post (const Array<std::string>& param)
   {
+    // FIXME: change type curl_httppost* to type curl_mime*
     struct curl_httppost *post = nullptr;
     struct curl_httppost *last = nullptr;

     SETOPT (CURLOPT_URL, m_host_or_url.c_str ());

+    // FIXME: change curl_formfree needs to curl_mime_free()
     unwind_action cleanup_httppost ([=] () { curl_formfree (post); });

     if (param.numel () >= 2)
@@ -727,14 +729,16 @@ public:
             std::string data = param(i+1);

             if (name == "file")
+              // FIXME: change curl_formadd to curl_mime_init()
               curl_formadd (&post, &last, CURLFORM_COPYNAME, name.c_str (),
                             CURLFORM_FILE, data.c_str (), CURLFORM_END);
             else
+              // FIXME: change curl_formadd to curl_mime_init()
               curl_formadd(&post, &last, CURLFORM_COPYNAME, name.c_str (),
                            CURLFORM_COPYCONTENTS, data.c_str (), CURLFORM_END);
           }

-        SETOPT (CURLOPT_HTTPPOST, post);
+        SETOPT (CURLOPT_MIMEPOST, post);
       }

     perform ();

Arun Giridhar <arungiridhar>
Project Member
Wed 11 Jan 2023 04:14:00 PM UTC, comment #2: 

@Arun: I think you can go ahead and upgrade to the new names for Curl constants.

Rik <rik5>
Project Administrator
Mon 26 Dec 2022 03:37:16 AM UTC, comment #1: 

The curl release history is available at https://curl.se/docs/releases.html.

Curl 7.55.0 was released in Aug. 19th, 2017 and is 5 years old so changing to CURLINFO_CONTENT_LENGTH_DOWNLOAD_T seem reasonable.

Curl 7.56.0 was released in Oct. 4th, 2017 and is also 5 years old.

I think it is fine to change this, but not on the stable branch right now before the 8.1 release.  I would do it on the development branch.

Rik <rik5>
Project Administrator
Sun 25 Dec 2022 04:27:20 PM UTC, original submission:  

After a recent system update to the curl utility and libcurl libraries, there are build warnings about calling the curl library in a deprecated manner. It does not break any functionality yet.

hg id 96d321d59ee3 (stable)

Compilers: gcc, g++, gfortran 12.2.0

Curl version 7.87.0

In file included from ../liboctave/util/url-transfer.cc:44:
../liboctave/util/url-transfer.cc: In member function 'virtual void octave::curl_transfer::get_fileinfo(const std::string&, double&, int64_t&, bool&)':
../liboctave/util/url-transfer.cc:580:32: warning: 'CURLINFO_CONTENT_LENGTH_DOWNLOAD' is deprecated: since 7.55.0. Use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T [-Wdeprecated-declarations]
  580 |     curl_easy_getinfo (m_curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fs);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:2853:3: note: declared here
 2853 |   CURLINFO_CONTENT_LENGTH_DOWNLOAD
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../liboctave/util/url-transfer.cc: In lambda function:
../liboctave/util/url-transfer.cc:720:60: warning: 'void curl_formfree(curl_httppost*)' is deprecated: since 7.56.0. Use curl_mime_free() [-Wdeprecated-declarations]
  720 |     unwind_action cleanup_httppost ([=] () { curl_formfree (post); });
      |                                              ~~~~~~~~~~~~~~^~~~~~
/usr/include/curl/curl.h:2606:1: note: declared here
 2606 | curl_formfree(struct curl_httppost *form);
      | ^~~~~~~~~~~~~
../liboctave/util/url-transfer.cc: In member function 'virtual void octave::curl_transfer::form_data_post(const Array<std::__cxx11::basic_string<char> >&)':
../liboctave/util/url-transfer.cc:730:43: warning: 'CURLFORM_COPYNAME' is deprecated: since 7.56.0. Use curl_mime_name() [-Wdeprecated-declarations]
  730 |               curl_formadd (&post, &last, CURLFORM_COPYNAME, name.c_str (),
      |                                           ^~~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:2495:3: note: declared here
 2495 |   CURLFORM_COPYNAME        CURL_DEPRECATED(7.56.0, "Use curl_mime_name()"),
      |   ^~~~~~~~~~~~~~~~~
../liboctave/util/url-transfer.cc:731:29: warning: 'CURLFORM_FILE' is deprecated: since 7.56.0. Use curl_mime_filedata() [-Wdeprecated-declarations]
  731 |                             CURLFORM_FILE, data.c_str (), CURLFORM_END);
      |                             ^~~~~~~~~~~~~
/usr/include/curl/curl.h:2504:3: note: declared here
 2504 |   CURLFORM_FILE            CURL_DEPRECATED(7.56.0, "Use curl_mime_filedata()"),
      |   ^~~~~~~~~~~~~
../liboctave/util/url-transfer.cc:730:28: warning: 'CURLFORMcode curl_formadd(curl_httppost**, curl_httppost**, ...)' is deprecated: since 7.56.0. Use curl_mime_init() [-Wdeprecated-declarations]
  730 |               curl_formadd (&post, &last, CURLFORM_COPYNAME, name.c_str (),
      |               ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  731 |                             CURLFORM_FILE, data.c_str (), CURLFORM_END);
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:2570:1: note: declared here
 2570 | curl_formadd(struct curl_httppost **httppost,
      | ^~~~~~~~~~~~
../liboctave/util/url-transfer.cc:733:42: warning: 'CURLFORM_COPYNAME' is deprecated: since 7.56.0. Use curl_mime_name() [-Wdeprecated-declarations]
  733 |               curl_formadd(&post, &last, CURLFORM_COPYNAME, name.c_str (),
      |                                          ^~~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:2495:3: note: declared here
 2495 |   CURLFORM_COPYNAME        CURL_DEPRECATED(7.56.0, "Use curl_mime_name()"),
      |   ^~~~~~~~~~~~~~~~~
../liboctave/util/url-transfer.cc:734:28: warning: 'CURLFORM_COPYCONTENTS' is deprecated: since 7.56.0. Use curl_mime_data() [-Wdeprecated-declarations]
  734 |                            CURLFORM_COPYCONTENTS, data.c_str (), CURLFORM_END);
      |                            ^~~~~~~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:2498:3: note: declared here
 2498 |   CURLFORM_COPYCONTENTS    CURL_DEPRECATED(7.56.0, "Use curl_mime_data()"),
      |   ^~~~~~~~~~~~~~~~~~~~~
../liboctave/util/url-transfer.cc:733:27: warning: 'CURLFORMcode curl_formadd(curl_httppost**, curl_httppost**, ...)' is deprecated: since 7.56.0. Use curl_mime_init() [-Wdeprecated-declarations]
  733 |               curl_formadd(&post, &last, CURLFORM_COPYNAME, name.c_str (),
      |               ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  734 |                            CURLFORM_COPYCONTENTS, data.c_str (), CURLFORM_END);
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:2570:1: note: declared here
 2570 | curl_formadd(struct curl_httppost **httppost,
      | ^~~~~~~~~~~~
../liboctave/util/url-transfer.cc:737:17: warning: 'CURLOPT_HTTPPOST' is deprecated: since 7.56.0. Use CURLOPT_MIMEPOST [-Wdeprecated-declarations]
  737 |         SETOPT (CURLOPT_HTTPPOST, post);
      |                 ^~~~~~~~~~~~~~~~
../liboctave/util/url-transfer.cc:737:9: note: in expansion of macro 'SETOPT'
  737 |         SETOPT (CURLOPT_HTTPPOST, post);
      |         ^~~~~~
/usr/include/curl/curl.h:1195:3: note: declared here
 1195 |   CURLOPTDEPRECATED(CURLOPT_HTTPPOST, CURLOPTTYPE_OBJECTPOINT, 24,
      |   ^~~~~~~~~~~~~~~~~

Arun Giridhar <arungiridhar>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #54221:  curl.patch added by arungiridhar (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by arungiridhar (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 project members can vote.

     

     

     

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-26 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2023-01-25 rik5 StatusPatch Submitted Ready For Test
        Fixed ReleaseNone 9.1.0 (current default)
    2023-01-13 arungiridhar StatusConfirmed Patch Submitted
    2023-01-13 arungiridhar Attached File- Added curl.patch, #54221
    2023-01-11 rik5 StatusNone Confirmed
        Releasestable dev
    2022-12-26 rik5 Planned ReleaseNone 9.1.0 (current default)

    Back to the top

    Powered by Savane 3.10