cURL / Mailing Lists / curl-library / Single Mail

curl-library

Segfault with CURLOPT_STDERR (was: How to use CURLOPT_DEBUGFUNCTION with Perl)

From: Jan Theofel <theofel_at_etes.de>
Date: Mon, 24 May 2004 14:17:50 +0200

Hello again,

my system:
curl version libcurl/7.11.2 OpenSSL/0.9.7d ipv6 zlib/1.2.1
This is perl, v5.8.3 built for i586-linux-thread-multi
SuSE Linux 9.1 (i586)
Linux newtux 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux

On Fri, May 21, 2004 at 11:45:59AM +0200, Jan Theofel wrote:
>
> can someone tell me how to use the CURLOPT_DEBUGFUNCTION option from libcurl
> in Perl?

Meanwhile I tried some other workarounds. And I got another seg fault this
way:

      open(DEBUG, ">$curldebug_filename") || die "ERROR: Can't create temporary file $curldebug_filename ($!)\n";

      $curl->setopt(CURLOPT_URL, 'ftp://FQDN/' . $uploadfilenamebase);
      $curl->setopt(CURLOPT_USERPWD, 'USER:PASS');
      $curl->setopt(CURLOPT_UPLOAD, 1);
      $curl->setopt(CURLOPT_HEADER, 0);
      $curl->setopt(CURLOPT_FTP_USE_EPSV, 0);
      $curl->setopt(CURLOPT_FTP_SSL, 1);
      $curl->setopt(CURLOPT_SSL_VERIFYPEER, 1);
      $curl->setopt(CURLOPT_INFILE, $fh_in);
      $curl->setopt(CURLOPT_INFILESIZE, $filesize);
      $curl->setopt(CURLOPT_VERBOSE, 1);
      $curl->setopt(CURLOPT_CAINFO, "alles.pem");
      $curl->setopt(CURLOPT_STDERR, *DEBUG);

      if ($curl->perform() != 0)
      {
        &debug(2**0, "ar-export.pl", "main", "ERROR: UPLOAD FAILED", __LINE__);
        &debug(2**0, "ar-export.pl", "main", $curl->errbuf, __LINE__);
      };

      close(DEBUG);

The seg fault occurs, when calling $curl->perform().

Here's the strace (last part):

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 7
connect(7, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.42.1")}, 28) = 0
send(7, ";\260\1\0\0\1\0\0\0\0\0\0\4sftp\17adress-researc"..., 41, 0) = 41
gettimeofday({1085400804, 685561}, NULL) = 0
poll([{fd=7, events=POLLIN, revents=POLLIN}], 1, 5000) = 1
ioctl(7, FIONREAD, [101]) = 0
recvfrom(7, ";\260\201\200\0\1\0\0\0\1\0\0\4sftp\17adress-researc"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.42.1")}, [16]) = 101
close(7) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 7
connect(7, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.42.1")}, 28) = 0
send(7, ";\261\1\0\0\1\0\0\0\0\0\0\4sftp\17adress-researc"..., 49, 0) = 49
gettimeofday({1085400804, 687731}, NULL) = 0
poll([{fd=7, events=POLLIN, revents=POLLIN}], 1, 5000) = 1
ioctl(7, FIONREAD, [108]) = 0
recvfrom(7, ";\261\205\203\0\1\0\0\0\1\0\0\4sftp\17adress-researc"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.42.1")}, [16]) = 108
close(7) = 0
time([1085400804]) = 1085400804
gettimeofday({1085400804, 689401}, NULL) = 0
gettimeofday({1085400804, 689629}, NULL) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

This looks very much like the strace I get when I try to use the
CURLOPT_DEBUGFUNCTION as written in my last mail:

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 7
connect(7, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.42.1")}, 28) = 0
send(7, "pB\1\0\0\1\0\0\0\0\0\0\4sftp\17adress-researc"..., 41, 0) = 41
gettimeofday({1085400642, 773124}, NULL) = 0
poll([{fd=7, events=POLLIN, revents=POLLIN}], 1, 5000) = 1
ioctl(7, FIONREAD, [101]) = 0
recvfrom(7, "pB\201\200\0\1\0\0\0\1\0\0\4sftp\17adress-researc"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.42.1")}, [16]) = 101
close(7) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 7
connect(7, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.42.1")}, 28) = 0
send(7, "pC\1\0\0\1\0\0\0\0\0\0\4sftp\17adress-researc"..., 49, 0) = 49
gettimeofday({1085400642, 774851}, NULL) = 0
poll([{fd=7, events=POLLIN, revents=POLLIN}], 1, 5000) = 1
ioctl(7, FIONREAD, [108]) = 0
recvfrom(7, "pC\205\203\0\1\0\0\0\1\0\0\4sftp\17adress-researc"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.16.42.1")}, [16]) = 108
close(7) = 0
time([1085400642]) = 1085400642
gettimeofday({1085400642, 776206}, NULL) = 0
gettimeofday({1085400642, 776394}, NULL) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

Can someone please tell me how to get these seg faults away?

Thanks in advance,
Jan Theofel

-- 
Jan Theofel                              Fon:  +49 (7 11) 48 90 83 - 0
ETES - EDV-Systemhaus GbR                Fax:  +49 (7 11) 48 90 83 - 50
Libanonstrasse 58 A * D-70184 Stuttgart  Web: http://www.etes.de
Received on 2004-05-24