cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Bug in libcurl for rev 7.40.0

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Sun, 22 Feb 2015 18:06:54 -0500

On 2/22/2015 1:10 AM, Tom Martin wrote:
> The bug I found earlier doesn't appear to be in libcurl, but might be
> due to older systems/kernels.
>
> The bug appears while using curl 7.40.0 (and the latest Feb28-2015
> build of 7.41.x) on an older Centos 5 system and a older Fedora 14
> system, but NOT on a Centos 6.6 system.
>
> On all 3 systems, I sent smtp-tls.c mail to 3 different servers- my
> own, yahoo and gmail, and each one acted the same as the other two.
>
> All I can say at this point is that older systems / kernels might show
> the same problem that I found, but Centos 6.6 and libcurl 7.40.0 seem
> to work fine.

I was able to reproduce what you described in a Fedora 14 x64 VM but
only when I used the included libcurl.
libcurl/7.21.0 NSS/3.12.10.0 zlib/1.2.5 libidn/1.18 libssh2/1.2.4

I tried building curl from curl-7_40_0 with the latest OpenSSL but I
could not reproduce:
libcurl/7.40.0-DEV OpenSSL/1.0.2

My guess is it was a problem in an earlier version of libcurl and has
been fixed. I think the reason you still see it may be because the
shared libcurl that is loaded is the one that's included with Fedora,
not the version you built and installed in /usr/local (I assume..).
Check your program using ldd see what comes up. Also try this:

cat << EOF > a.c
#include <curl/curl.h>
int main() {
printf("%s\n", curl_version());
return 0;
}
EOF
gcc a.c -lcurl
./a.out

What do you see, is it the packaged libcurl version or the one you built
and installed? It will probably be the packaged version. So assuming
this is the problem you'll have to make sure the right libcurl gets
loaded by the apps you build. I use rpath to do that, but I spend most
of my time in windows so maybe someone here can tell me that is wrong.
Here's how I built and installed it:

./buildconf
LDFLAGS='-Wl,-rpath,/usr/local/ssl/lib -Wl,-rpath,/usr/local/lib'
./configure --with-ssl=/usr/local/ssl --disable-static --enable-shared
make
sed -i~ 's/\(echo \${CURLLIBDIR}\)\(-lcurl\)/\1
-Wl,-rpath,\/usr\/local\/ssl\/lib -Wl,-rpath,\/usr\/local\/lib
-L\/usr\/local\/ssl\/lib \2/' curl-config
sudo make install

So basically I am forcing the OpenSSL I want to be loaded from
/usr/local/ssl (OpenSSL default location when you build and install it)
and then I changed the curl config so it adds to the --libs shared
option rpaths /usr/local/ssl/lib for openssl and /usr/local/lib for libcurl.

After installing run the config and check:
curl-config --libs --cflags
-L/usr/local/lib -Wl,-rpath,/usr/local/ssl/lib -Wl,-rpath,/usr/local/lib
-L/usr/local/ssl/lib -lcurl -lssl -lcrypto -lssl -lcrypto -lrt
-I/usr/local/include

gcc a.c `curl-config --libs --cflags`
Assuming you're working from libcurl 7.40.0 tag and OpenSSL 1.0.2 you
should see:
libcurl/7.40.0-DEV OpenSSL/1.0.2

I'm not sure if this is a good idea or not but it works. Someone who
spends most of their time in Linux will have a better idea probably.
When you reply to the discussion can you please not put my name in the
topic because it starts a new thread in my Yahoo Mail instead of
continuing the existing.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-02-23