Hi, recently I stumbled across a bug in curl for 64-bit Cygwin regarding the -i option. This bug has already been discussed in April 2013:
http://cygwin.1069669.n5.nabble.com/Difference-in-32-64-bit-curl-td98083.html (I can't reply directly since I was not subscribed to this mailinglist back then.) The problem is that the current version of curl always includes the protocol headers in the output (no matter if -i or --include or --no-include are used or not). This bug breaks scripts which use curl and expect it to not include the headers in the output. After some debugging I found out that the cause of the problem is a missing cast of the third argument of my_setopt in tool_operate.c:886 (line numbers from curl 7.29.0) my_setopt(curl, CURLOPT_HEADER, config->include_headers); Here, config->include_headers is of type bool (1 byte) and my_setopt is a macro which calls curl_easy_setopt() and is defined in tool_setopt.h as follows: #define my_setopt(x,y,z) \ SETOPT_CHECK(tool_setopt(x, FALSE, config, #y, y, z)) tool_setopt() is implemented in tool_setopt.c and uses va_arg(arg, long) to get the value of its sixth argument (which is config->include_headers). However, sizeof(long) == 8, but sizeof(bool) == 1 and thus va_arg(arg, long) returns a value != 0 even if config->include_headers == 0. I am not sure why there is no problem with other boolean configuration options like CURLOPT_FAILONERROR (corresponding to -f or --fail) which are processed in exactly the same way, e.g., in tool_operate.c:930 my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror); Also, there is no problem in 32-bit Cygwin and in 32/64-bit Linux. Maybe the bug is triggered by some missing or incorrect (alignment related) compiler switches? Anyway, I have attached an updated cygport file together with a patch to fix this bug (tested with cygport --32 and cygport --64). @Yaakov: Could you please test my patch and update the curl package? Best regards, Andreas
NAME="curl" VERSION=7.29.0 RELEASE=1 CATEGORY="Net Web" SUMMARY="Multi-protocol file transfer tool" DESCRIPTION="curl is a command line tool and library for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate...), file transfer resume, proxy tunneling and a busload of other useful tricks." HOMEPAGE="http://curl.haxx.se/" SRC_URI="http://curl.haxx.se/download/${P}.tar.lzma" PKG_NAMES="${PN} lib${PN}4 lib${PN}-devel" curl_CONTENTS="usr/bin/curl.exe usr/share/doc/ usr/share/man/man1/curl.*" libcurl4_SUMMARY="Multi-protocol file transfer library (runtime)" libcurl4_CONTENTS="usr/bin/cygcurl-4.dll" libcurl_devel_SUMMARY="Multi-protocol file transfer library (development)" libcurl_devel_CONTENTS="usr/bin/curl-config usr/include/ usr/lib/ usr/share/man/man1/curl-config.* usr/share/man/man3/" PATCH_URI="include-headers-cygwin.patch" DIFF_EXCLUDES="Makefile curlbuild.h curl_config.h" # librtmp: not in Fedora due to unchallenged DMCA action CYGCONF_ARGS=" --enable-debug --enable-optimize --disable-hidden-symbols --disable-ares --enable-ldap --disable-sspi --with-gssapi --without-krb4 --with-libidn --with-libmetalink --without-librtmp --with-libssh2 --without-spnego --with-ssl --with-zlib --with-ca-bundle=/usr/ssl/certs/ca-bundle.crt " DOCS="docs/BINDINGS docs/BUGS docs/CONTRIBUTE docs/DISTRO-DILEMMA docs/FAQ docs/FEATURES docs/HISTORY docs/HTTP-COOKIES docs/INTERNALS docs/KNOWN_BUGS docs/LICENSE-MIXING docs/MAIL-ETIQUETTE docs/MANUAL docs/RESOURCES docs/SSLCERTS docs/THANKS docs/TheArtOfHttpScripting docs/TODO docs/VERSIONS" KEEP_LA_FILES="none"
diff -uNpr curl-7.29.0/src/tool_operate.c curl-7.29.0/src/tool_operate.c --- curl-7.29.0/src/tool_operate.c 2013-02-06 10:47:19.000000000 +0100 +++ curl-7.29.0/src/tool_operate.c 2013-08-11 21:21:47.397377700 +0200 @@ -877,13 +877,13 @@ int operate(struct Configurable *config, my_setopt(curl, CURLOPT_NOPROGRESS, config->noprogress); if(config->no_body) { my_setopt(curl, CURLOPT_NOBODY, 1); - my_setopt(curl, CURLOPT_HEADER, 1); + my_setopt(curl, CURLOPT_HEADER, (long)1); } /* If --metalink is used, we ignore --include (headers in output) option because mixing headers to the body will confuse XML parser and/or hash check will fail. */ else if(!config->use_metalink) - my_setopt(curl, CURLOPT_HEADER, config->include_headers); + my_setopt(curl, CURLOPT_HEADER, (long)config->include_headers); #if !defined(CURL_DISABLE_PROXY) {
signature.asc
Description: OpenPGP digital signature