[curl] fixes for rhbz #617757 and #622520

Kamil Dudka kdudka at fedoraproject.org
Thu Aug 19 14:03:06 UTC 2010


commit ec7f823e5f5c69369d20cd5f2bb8ef8b6b85c570
Author: Kamil Dudka <kdudka at redhat.com>
Date:   Thu Aug 19 15:59:54 2010 +0200

    fixes for rhbz #617757 and #622520
    
    Both of them are already pushed upstream.

 0001-curl-7.21.1-a6e088e.patch         |  183 ++++++++++++++++++++++++++++++++
 0002-curl-7.21.1-5907777.patch         |   36 ++++++
 0107-curl-7.21.0-disable-test575.patch |   12 --
 curl.spec                              |   25 +++--
 4 files changed, 235 insertions(+), 21 deletions(-)
---
diff --git a/0001-curl-7.21.1-a6e088e.patch b/0001-curl-7.21.1-a6e088e.patch
new file mode 100644
index 0000000..d099898
--- /dev/null
+++ b/0001-curl-7.21.1-a6e088e.patch
@@ -0,0 +1,183 @@
+ CHANGES                      |    5 ++
+ include/curl/typecheck-gcc.h |  135 ++++++++++++++++++++++++-----------------
+ 2 files changed, 84 insertions(+), 56 deletions(-)
+
+diff --git a/CHANGES b/CHANGES
+index 7d50c18..35868ff 100644
+--- a/CHANGES
++++ b/CHANGES
+@@ -6,6 +6,11 @@
+ 
+                                   Changelog
+ 
++Kamil Dudka (12 Aug 2010)
++- typecheck-gcc: work around gcc upstream bug #32061
++  
++  original bug report at https://bugzilla.redhat.com/617757
++
+ Version 7.21.1 (11 Aug 2010)
+ 
+ Daniel Stenberg (11 Aug 2010)
+diff --git a/include/curl/typecheck-gcc.h b/include/curl/typecheck-gcc.h
+index 62883f5..e6f74a9 100644
+--- a/include/curl/typecheck-gcc.h
++++ b/include/curl/typecheck-gcc.h
+@@ -25,11 +25,16 @@
+ /* wraps curl_easy_setopt() with typechecking */
+ 
+ /* To add a new kind of warning, add an
+- *   if(_curl_is_sometype_option(_curl_opt) && ! _curl_is_sometype(value))
+- *     _curl_easy_setopt_err_sometype();
++ *   if(_curl_is_sometype_option(_curl_opt))
++ *     if(!_curl_is_sometype(value))
++ *       _curl_easy_setopt_err_sometype();
+  * block and define _curl_is_sometype_option, _curl_is_sometype and
+  * _curl_easy_setopt_err_sometype below
+  *
++ * NOTE: We use two nested 'if' statements here instead of the && operator, in
++ *       order to work around gcc bug #32061.  It affects only gcc 4.3.x/4.4.x
++ *       when compiling with -Wlogical-op.
++ *
+  * To add an option that uses the same type as an existing option, you'll just
+  * need to extend the appropriate _curl_*_option macro
+  */
+@@ -37,51 +42,66 @@
+ __extension__ ({                                                              \
+   __typeof__ (option) _curl_opt = option;                                     \
+   if (__builtin_constant_p(_curl_opt)) {                                      \
+-    if (_curl_is_long_option(_curl_opt) && !_curl_is_long(value))             \
+-      _curl_easy_setopt_err_long();                                           \
+-    if (_curl_is_off_t_option(_curl_opt) && !_curl_is_off_t(value))           \
+-      _curl_easy_setopt_err_curl_off_t();                                     \
+-    if (_curl_is_string_option(_curl_opt) && !_curl_is_string(value))         \
+-      _curl_easy_setopt_err_string();                                         \
+-    if (_curl_is_write_cb_option(_curl_opt) && !_curl_is_write_cb(value))     \
+-      _curl_easy_setopt_err_write_callback();                                 \
+-    if ((_curl_opt) == CURLOPT_READFUNCTION && !_curl_is_read_cb(value))      \
+-      _curl_easy_setopt_err_read_cb();                                        \
+-    if ((_curl_opt) == CURLOPT_IOCTLFUNCTION && !_curl_is_ioctl_cb(value))    \
+-      _curl_easy_setopt_err_ioctl_cb();                                       \
+-    if ((_curl_opt) == CURLOPT_SOCKOPTFUNCTION && !_curl_is_sockopt_cb(value))\
+-      _curl_easy_setopt_err_sockopt_cb();                                     \
+-    if ((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION &&                          \
+-            !_curl_is_opensocket_cb(value))                                   \
+-      _curl_easy_setopt_err_opensocket_cb();                                  \
+-    if ((_curl_opt) == CURLOPT_PROGRESSFUNCTION &&                            \
+-            !_curl_is_progress_cb(value))                                     \
+-      _curl_easy_setopt_err_progress_cb();                                    \
+-    if ((_curl_opt) == CURLOPT_DEBUGFUNCTION && !_curl_is_debug_cb(value))    \
+-      _curl_easy_setopt_err_debug_cb();                                       \
+-    if ((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION &&                            \
+-            !_curl_is_ssl_ctx_cb(value))                                      \
+-      _curl_easy_setopt_err_ssl_ctx_cb();                                     \
+-    if (_curl_is_conv_cb_option(_curl_opt) && !_curl_is_conv_cb(value))       \
+-      _curl_easy_setopt_err_conv_cb();                                        \
+-    if ((_curl_opt) == CURLOPT_SEEKFUNCTION && !_curl_is_seek_cb(value))      \
+-      _curl_easy_setopt_err_seek_cb();                                        \
+-    if (_curl_is_cb_data_option(_curl_opt) && !_curl_is_cb_data(value))       \
+-      _curl_easy_setopt_err_cb_data();                                        \
+-    if ((_curl_opt) == CURLOPT_ERRORBUFFER && !_curl_is_error_buffer(value))  \
+-      _curl_easy_setopt_err_error_buffer();                                   \
+-    if ((_curl_opt) == CURLOPT_STDERR && !_curl_is_FILE(value))               \
+-      _curl_easy_setopt_err_FILE();                                           \
+-    if (_curl_is_postfields_option(_curl_opt) && !_curl_is_postfields(value)) \
+-      _curl_easy_setopt_err_postfields();                                     \
+-    if ((_curl_opt) == CURLOPT_HTTPPOST &&                                    \
+-            !_curl_is_arr((value), struct curl_httppost))                     \
+-      _curl_easy_setopt_err_curl_httpost();                                   \
+-    if (_curl_is_slist_option(_curl_opt) &&                                   \
+-            !_curl_is_arr((value), struct curl_slist))                        \
+-      _curl_easy_setopt_err_curl_slist();                                     \
+-    if ((_curl_opt) == CURLOPT_SHARE && !_curl_is_ptr((value), CURLSH))       \
+-      _curl_easy_setopt_err_CURLSH();                                         \
++    if (_curl_is_long_option(_curl_opt))                                      \
++      if (!_curl_is_long(value))                                              \
++        _curl_easy_setopt_err_long();                                         \
++    if (_curl_is_off_t_option(_curl_opt))                                     \
++      if (!_curl_is_off_t(value))                                             \
++        _curl_easy_setopt_err_curl_off_t();                                   \
++    if (_curl_is_string_option(_curl_opt))                                    \
++      if (!_curl_is_string(value))                                            \
++        _curl_easy_setopt_err_string();                                       \
++    if (_curl_is_write_cb_option(_curl_opt))                                  \
++      if (!_curl_is_write_cb(value))                                          \
++        _curl_easy_setopt_err_write_callback();                               \
++    if ((_curl_opt) == CURLOPT_READFUNCTION)                                  \
++      if (!_curl_is_read_cb(value))                                           \
++        _curl_easy_setopt_err_read_cb();                                      \
++    if ((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                 \
++      if (!_curl_is_ioctl_cb(value))                                          \
++        _curl_easy_setopt_err_ioctl_cb();                                     \
++    if ((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                               \
++      if (!_curl_is_sockopt_cb(value))                                        \
++        _curl_easy_setopt_err_sockopt_cb();                                   \
++    if ((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                            \
++      if (!_curl_is_opensocket_cb(value))                                     \
++        _curl_easy_setopt_err_opensocket_cb();                                \
++    if ((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                              \
++      if (!_curl_is_progress_cb(value))                                       \
++        _curl_easy_setopt_err_progress_cb();                                  \
++    if ((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                 \
++      if (!_curl_is_debug_cb(value))                                          \
++        _curl_easy_setopt_err_debug_cb();                                     \
++    if ((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                              \
++      if (!_curl_is_ssl_ctx_cb(value))                                        \
++        _curl_easy_setopt_err_ssl_ctx_cb();                                   \
++    if (_curl_is_conv_cb_option(_curl_opt))                                   \
++      if (!_curl_is_conv_cb(value))                                           \
++        _curl_easy_setopt_err_conv_cb();                                      \
++    if ((_curl_opt) == CURLOPT_SEEKFUNCTION)                                  \
++      if (!_curl_is_seek_cb(value))                                           \
++        _curl_easy_setopt_err_seek_cb();                                      \
++    if (_curl_is_cb_data_option(_curl_opt))                                   \
++      if (!_curl_is_cb_data(value))                                           \
++        _curl_easy_setopt_err_cb_data();                                      \
++    if ((_curl_opt) == CURLOPT_ERRORBUFFER)                                   \
++      if (!_curl_is_error_buffer(value))                                      \
++        _curl_easy_setopt_err_error_buffer();                                 \
++    if ((_curl_opt) == CURLOPT_STDERR)                                        \
++      if (!_curl_is_FILE(value))                                              \
++        _curl_easy_setopt_err_FILE();                                         \
++    if (_curl_is_postfields_option(_curl_opt))                                \
++      if (!_curl_is_postfields(value))                                        \
++        _curl_easy_setopt_err_postfields();                                   \
++    if ((_curl_opt) == CURLOPT_HTTPPOST)                                      \
++      if (!_curl_is_arr((value), struct curl_httppost))                       \
++        _curl_easy_setopt_err_curl_httpost();                                 \
++    if (_curl_is_slist_option(_curl_opt))                                     \
++      if (!_curl_is_arr((value), struct curl_slist))                          \
++        _curl_easy_setopt_err_curl_slist();                                   \
++    if ((_curl_opt) == CURLOPT_SHARE)                                         \
++      if (!_curl_is_ptr((value), CURLSH))                                     \
++        _curl_easy_setopt_err_CURLSH();                                       \
+   }                                                                           \
+   curl_easy_setopt(handle, _curl_opt, value);                                 \
+ })
+@@ -92,15 +112,18 @@ __extension__ ({                                                              \
+ __extension__ ({                                                              \
+   __typeof__ (info) _curl_info = info;                                        \
+   if (__builtin_constant_p(_curl_info)) {                                     \
+-    if (_curl_is_string_info(_curl_info) && !_curl_is_arr((arg), char *))     \
+-      _curl_easy_getinfo_err_string();                                        \
+-    if (_curl_is_long_info(_curl_info) && !_curl_is_arr((arg), long))         \
+-      _curl_easy_getinfo_err_long();                                          \
+-    if (_curl_is_double_info(_curl_info) && !_curl_is_arr((arg), double))     \
+-      _curl_easy_getinfo_err_double();                                        \
+-    if (_curl_is_slist_info(_curl_info) &&                                    \
+-           !_curl_is_arr((arg), struct curl_slist *))                         \
+-      _curl_easy_getinfo_err_curl_slist();                                    \
++    if (_curl_is_string_info(_curl_info))                                     \
++      if (!_curl_is_arr((arg), char *))                                       \
++        _curl_easy_getinfo_err_string();                                      \
++    if (_curl_is_long_info(_curl_info))                                       \
++      if (!_curl_is_arr((arg), long))                                         \
++        _curl_easy_getinfo_err_long();                                        \
++    if (_curl_is_double_info(_curl_info))                                     \
++      if (!_curl_is_arr((arg), double))                                       \
++        _curl_easy_getinfo_err_double();                                      \
++    if (_curl_is_slist_info(_curl_info))                                      \
++      if (!_curl_is_arr((arg), struct curl_slist *))                          \
++        _curl_easy_getinfo_err_curl_slist();                                  \
+   }                                                                           \
+   curl_easy_getinfo(handle, _curl_info, arg);                                 \
+ })
diff --git a/0002-curl-7.21.1-5907777.patch b/0002-curl-7.21.1-5907777.patch
new file mode 100644
index 0000000..3708c46
--- /dev/null
+++ b/0002-curl-7.21.1-5907777.patch
@@ -0,0 +1,36 @@
+ CHANGES    |    5 +++++
+ src/main.c |    5 ++++-
+ 2 files changed, 9 insertions(+), 1 deletions(-)
+
+diff --git a/CHANGES b/CHANGES
+index 35868ff..1e3a501 100644
+--- a/CHANGES
++++ b/CHANGES
+@@ -6,6 +6,11 @@
+ 
+                                   Changelog
+ 
++Kamil Dudka (15 Aug 2010)
++- curl -T: ignore file size of special files
++  
++  original bug report at https://bugzilla.redhat.com/622520
++
+ Kamil Dudka (12 Aug 2010)
+ - typecheck-gcc: work around gcc upstream bug #32061
+   
+diff --git a/src/main.c b/src/main.c
+index 5585c17..3b78d60 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -4925,7 +4925,10 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
+             goto quit_urls;
+           }
+           infdopen=TRUE;
+-          uploadfilesize=fileinfo.st_size;
++
++          /* we ignore file size for char/block devices, sockets, etc. */
++          if(S_IFREG == (fileinfo.st_mode & S_IFMT))
++            uploadfilesize=fileinfo.st_size;
+ 
+         }
+         else if(uploadfile && stdin_upload(uploadfile)) {
diff --git a/curl.spec b/curl.spec
index f40b4d1..9e5946d 100644
--- a/curl.spec
+++ b/curl.spec
@@ -1,13 +1,19 @@
 Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
 Name: curl
 Version: 7.21.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: MIT
 Group: Applications/Internet
 Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma
 Source2: curlbuild.h
 Source3: hide_selinux.c
 
+# modify system headers to work around gcc bug (#617757)
+Patch1: 0001-curl-7.21.1-a6e088e.patch
+
+# curl -T now ignores file size of special files (#622520)
+Patch2: 0002-curl-7.21.1-5907777.patch
+
 # patch making libcurl multilib ready
 Patch101: 0101-curl-7.20.0-multilib.patch
 
@@ -26,9 +32,6 @@ Patch105: 0105-curl-7.20.0-disable-test1112.patch
 # disable valgrind for certain test-cases (libssh2 problem)
 Patch106: 0106-curl-7.21.0-libssh2-valgrind.patch
 
-# exclude test575 from the test suite (fails on s390(x))
-Patch107: 0107-curl-7.21.0-disable-test575.patch
-
 Provides: webclient
 URL: http://curl.haxx.se/
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -97,6 +100,10 @@ for f in CHANGES README; do
     mv -f ${f}.utf8 ${f}
 done
 
+# upstream patches (already applied)
+%patch1 -p1
+%patch2 -p1
+
 # Fedora patches
 %patch101 -p1
 %patch102 -p1
@@ -108,11 +115,6 @@ done
 %patch105 -p1
 rm -f tests/data/test1112
 
-%ifarch s390 s390x
-%patch107 -p1
-rm -f tests/data/test575
-%endif
-
 autoreconf
 
 # replace hard wired port numbers in the test suite
@@ -215,6 +217,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/aclocal/libcurl.m4
 
 %changelog
+* Thu Aug 19 2010 Kamil Dudka <kdudka at redhat.com> 7.21.1-2
+- re-enable test575 on s390(x), already fixed (upstream commit d63bdba)
+- modify system headers to work around gcc bug (#617757)
+- curl -T now ignores file size of special files (#622520)
+
 * Thu Aug 12 2010 Kamil Dudka <kdudka at redhat.com> 7.21.1-1
 - new upstream release
 


More information about the scm-commits mailing list