fixes for rhbz #617757 and #622520

Both of them are already pushed upstream.
This commit is contained in:
Kamil Dudka 2010-08-19 15:59:54 +02:00
parent e3cb81845c
commit ec7f823e5f
4 changed files with 235 additions and 21 deletions

View File

@ -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); \
})

View File

@ -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)) {

View File

@ -1,12 +0,0 @@
diff -up curl-7.21.0/tests/data/Makefile.am.s390 curl-7.21.0/tests/data/Makefile.am
--- curl-7.21.0/tests/data/Makefile.am.s390 2010-07-12 12:11:12.000000000 +0200
+++ curl-7.21.0/tests/data/Makefile.am 2010-07-12 12:11:25.000000000 +0200
@@ -60,7 +60,7 @@ EXTRA_DIST = test1 test108 test117 test1
test1072 test1073 test1074 test1075 test1076 test1077 test1078 test1079 \
test1080 test1081 test1082 test1083 test1084 test1085 test633 test634 \
test635 test636 test637 test558 test559 test1086 test1087 test1088 \
- test574 test575 test576 test577 test1113 test1114 \
+ test574 test576 test577 test1113 test1114 \
test1089 test1090 test1091 test1092 test1093 test1094 test1095 test1096 \
test1097 test560 test561 test1098 test1099 test562 test563 test1100 \
test564 test1101 test1102 test1103 test1104 test299 test310 test311 \

View File

@ -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@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@redhat.com> 7.21.1-1
- new upstream release