Re: Segfault downloading two files with -O -J

2011-08-22 Thread Yang Tse
2011/8/21 Daniel Stenberg wrote:

 Thanks. I've pushed commit 61ae7e9ce77a now which I believe now makes the
 fix more complete. Sorry about that.

And from commit 61ae7e9ce77a description:

 At times HEADERFUNCTION+HEADERDATA was set only to have only
 HEADERDATA set in the subsequent loop which could cause a NULL
 to get sent as userdata to 'header_callback' which wasn't made
 to handle that.

 Now HEADERFUNCTION is explicitly set to NULL if it isn't set to
 the callback.

Something I'm wondering...

Shouldn't this take in account that there might exist cached data due
to write being paused, or no longer paused but still with cached data,
when the header write callback is reset on the fly, and somehow deal
with it?


-- 
-=[Yang]=-
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-22 Thread Daniel Stenberg

On Mon, 22 Aug 2011, Yang Tse wrote:


At times HEADERFUNCTION+HEADERDATA was set only to have only
HEADERDATA set in the subsequent loop which could cause a NULL
to get sent as userdata to 'header_callback' which wasn't made
to handle that.

Now HEADERFUNCTION is explicitly set to NULL if it isn't set to the 
callback.


Shouldn't this take in account that there might exist cached data due to 
write being paused, or no longer paused but still with cached data, when the 
header write callback is reset on the fly, and somehow deal with it?


No. This setting of the HEADERFUNCTION option is only done between calls to 
curl_easy_perform() so there will be nothing in particular cached that would 
be ruined because of this.


(I realize this thread should've been on the curl-users list from the 
beginning but since I didn't notice early enough I've just kept it here.)


--

 / daniel.haxx.se
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-22 Thread Yang Tse
2011/8/22 Daniel Stenberg wrote:

 No. This setting of the HEADERFUNCTION option is only done between calls to
 curl_easy_perform() so there will be nothing in particular cached that would
 be ruined because of this.

Thanks for the clarification.

-- 
-=[Yang]=-
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-21 Thread Paul Howarth
On Sat, 20 Aug 2011 00:30:43 +0200 (CEST)
Daniel Stenberg dan...@haxx.se wrote:

 On Thu, 18 Aug 2011, Paul Howarth wrote:
 
  https://github.com/bagder/curl/commit/5eb2396cd15cbbf73b02
 
  It doesn't for me:
 
 Hm, ok then perhaps something else fixed it since with my git version
 I cannot reproduce. I also ran it successfully with valgrind to
 verify a little extra.
 
 Can you try the git version and check in your end?

I've tried with the 20110821 daily snapshot and get slightly different
output but still a core dump:

$ curl -O -J 
'http://koji.fedoraproject.org/koji/getfile?taskID=3281612name=ibus-1.3.99.20110419-15.fc15.x86_64.rpm'
 
'http://koji.fedoraproject.org/koji/getfile?taskID=3281612name=ibus-libs-1.3.99.20110419-15.fc15.x86_64.rpm'
 /dev/null
  % Total% Received % Xferd  Average Speed   TimeTime Time  Current
 Dload  Upload   Total   SpentLeft  Speed
  0 00 00 0  0  0 --:--:-- --:--:-- --:--:-- 
0Warning: Refusing to overwrite ibus-1.3.99.20110419-15.fc15.x86_64.rpm: File 
Warning: exists
  0  388k0  10400 0   2369  0  0:02:48 --:--:--  0:02:48  2482
curl: (23) Failed writing body (0 != 1040)
Segmentation fault (core dumped)

Paul.
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-21 Thread Paul Howarth
On Sun, 21 Aug 2011 10:38:25 +0100
Paul Howarth p...@city-fan.org wrote:

 On Sat, 20 Aug 2011 00:30:43 +0200 (CEST)
 Daniel Stenberg dan...@haxx.se wrote:
 
  On Thu, 18 Aug 2011, Paul Howarth wrote:
  
   https://github.com/bagder/curl/commit/5eb2396cd15cbbf73b02
  
   It doesn't for me:
  
  Hm, ok then perhaps something else fixed it since with my git
  version I cannot reproduce. I also ran it successfully with
  valgrind to verify a little extra.
  
  Can you try the git version and check in your end?
 
 I've tried with the 20110821 daily snapshot and get slightly different
 output but still a core dump:
 
 $ curl -O -J
 'http://koji.fedoraproject.org/koji/getfile?taskID=3281612name=ibus-1.3.99.20110419-15.fc15.x86_64.rpm'
 'http://koji.fedoraproject.org/koji/getfile?taskID=3281612name=ibus-libs-1.3.99.20110419-15.fc15.x86_64.rpm'
 /dev/null % Total% Received % Xferd  Average Speed   Time
 Time Time  Current Dload  Upload   Total   SpentLeft  Speed
 0 00 00 0  0  0 --:--:-- --:--:--
 --:--:-- 0Warning: Refusing to overwrite
 ibus-1.3.99.20110419-15.fc15.x86_64.rpm: File 
 Warning: exists
   0  388k0  10400 0   2369  0  0:02:48 --:--:--
 0:02:48  2482 curl: (23) Failed writing body (0 != 1040)
 Segmentation fault (core dumped)

I got this backtrace from gdb:

#0  0x004067ce in header_callback (ptr=0x62a150, size=optimized out, 
nmemb=optimized out, stream=0x0) at main.c:4610
#1  0x77d9c04b in Curl_client_write (conn=0x62be30, type=optimized 
out, 
ptr=0x62a150 Content-Disposition: attachment; 
filename=ibus-libs-1.3.99.20110419-15.fc15.x86_64.rpm\r\n, len=88) at 
sendf.c:483
#2  0x77d9ab9e in Curl_http_readwrite_headers (data=0x621560, 
conn=0x62be30, nread=0x7fffd5a0, stop_reading=0x7fffd5af) at http.c:3397
#3  0x77dae33a in readwrite_data (done=0x7fffd63f, 
didwhat=read_sleb128: Corrupted DWARF expression.
) at transfer.c:464
#4  Curl_readwrite (conn=0x62be30, done=0x7fffd63f) at transfer.c:1025
#5  0x77dafb84 in Transfer (conn=0x62be30) at transfer.c:1392
#6  Curl_do_perform (data=0x621560) at transfer.c:2133
#7  0x00404369 in operate (argv=optimized out, argc=0, 
config=0x7fffd720) at main.c:5643
#8  main (argc=0, argv=optimized out) at main.c:5968

Paul.
 
 Paul.
 ---
 List admin: http://cool.haxx.se/list/listinfo/curl-library
 Etiquette:  http://curl.haxx.se/mail/etiquette.html
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-21 Thread Daniel Stenberg

On Sun, 21 Aug 2011, Paul Howarth wrote:


I got this backtrace from gdb:


Thanks. I've pushed commit 61ae7e9ce77a now which I believe now makes the fix 
more complete. Sorry about that.


--

 / daniel.haxx.se
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-21 Thread Paul Howarth
On Sun, 21 Aug 2011 13:02:29 +0200 (CEST)
Daniel Stenberg dan...@haxx.se wrote:

 On Sun, 21 Aug 2011, Paul Howarth wrote:
 
  I got this backtrace from gdb:
 
 Thanks. I've pushed commit 61ae7e9ce77a now which I believe now makes
 the fix more complete. Sorry about that.

Thanks, that seems to have nailed it here.

Paul.
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html



Re: Segfault downloading two files with -O -J

2011-08-19 Thread Daniel Stenberg

On Thu, 18 Aug 2011, Paul Howarth wrote:


https://github.com/bagder/curl/commit/5eb2396cd15cbbf73b02


It doesn't for me:


Hm, ok then perhaps something else fixed it since with my git version I cannot 
reproduce. I also ran it successfully with valgrind to verify a little extra.


Can you try the git version and check in your end?

--

 / daniel.haxx.se
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-18 Thread Paul Howarth

On 08/04/2011 10:26 PM, Daniel Stenberg wrote:

On Thu, 21 Jul 2011, Paul Howarth wrote:


This is from http://bugzilla.redhat.com/723075

curl segfaults when running this:


Thanks for the report, this commit fixed the issue for me:

https://github.com/bagder/curl/commit/5eb2396cd15cbbf73b02


It doesn't for me:

$ curl -O -J \

'http://koji.fedoraproject.org/koji/getfile?taskID=3281612name=ibus-1.3.99.20110419-15.fc15.x86_64.rpm'
 \

'http://koji.fedoraproject.org/koji/getfile?taskID=3281612name=ibus-libs-1.3.99.20110419-15.fc15.x86_64.rpm'
 \
 /dev/null
  % Total% Received % Xferd  Average Speed   TimeTime Time 
 Current
 Dload  Upload   Total   SpentLeft 
 Speed
100  388k  100  388k0 0   172k  0  0:00:02  0:00:02 --:--:-- 
 199k

Segmentation fault (core dumped)

It doesn't for the original reporter either 
(http://bugzilla.redhat.com/723075)


Paul.
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-16 Thread Yang Tse
2011/8/4 Daniel Stenberg wrote:

 Thanks for the report, this commit fixed the issue for me:

 https://github.com/bagder/curl/commit/5eb2396cd15cbbf73b02

It seems that there's still some dangling bit somewhere ;-)

Test case numbers 1311, 1312 and 1313 fail with some specific
configurations, all seem related with builds in which no SSL library
is used.

-- 
-=[Yang]=-
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-08-04 Thread Daniel Stenberg

On Thu, 21 Jul 2011, Paul Howarth wrote:


This is from http://bugzilla.redhat.com/723075

curl segfaults when running this:


Thanks for the report, this commit fixed the issue for me:

https://github.com/bagder/curl/commit/5eb2396cd15cbbf73b02

--

 / daniel.haxx.se
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Segfault downloading two files with -O -J

2011-07-22 Thread Daniel Stenberg

On Thu, 21 Jul 2011, Paul Howarth wrote:


This is from http://bugzilla.redhat.com/723075


Thanks for the report. I can repeat it too with this stacktrace on current git 
version:


Program received signal SIGSEGV, Segmentation fault.
0x08054803 in header_callback (ptr=0x8140034, size=1, nmemb=75, stream=0x0)
at main.c:4574
4574outs-filename = filename;
(gdb) p outs
$1 = (struct OutStruct *) 0x0
(gdb) bt
#0  0x08054803 in header_callback (ptr=0x8140034, size=1, nmemb=75, 
stream=0x0)

at main.c:4574
#1  0x0805db06 in Curl_client_write (conn=0x81412a4, type=2,
ptr=0x8140034 Content-Disposition: attachment; 
filename=python26-boto-2.0-1.el5.src.rpm\r\n, len=75) at sendf.c:489

#2  0x080760f1 in Curl_http_readwrite_headers (data=0x812e754, conn=0x81412a4,
nread=0xbfffe984, stop_reading=0xbfffe982) at http.c:3414
#3  0x080873cc in readwrite_data (data=0x812e754, conn=0x81412a4, k=0x812e768,
didwhat=0xbfffea00, done=0xbfffea67) at transfer.c:481
#4  0x08088496 in Curl_readwrite (conn=0x81412a4, done=0xbfffea67)
at transfer.c:1042
#5  0x08088fc7 in Transfer (conn=0x81412a4) at transfer.c:1409
#6  0x08089f01 in Curl_do_perform (data=0x812e754) at transfer.c:2150
#7  0x0808a198 in Curl_perform (data=0x812e754) at transfer.c:2274
#8  0x08060a5a in curl_easy_perform (curl=0x812e754) at easy.c:553
#9  0x08057c16 in operate (config=0xbfffef74, argc=5, argv=0xb224)
at main.c:5587
#10 0x0805855a in main (argc=5, argv=0xb224) at main.c:5910

I'll take off on a little journey for some 10 days ahead but if nobody else 
gets around to working on it, I'll get to it at least when I get back home 
again.


--

 / daniel.haxx.se
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Segfault downloading two files with -O -J

2011-07-21 Thread Paul Howarth

This is from http://bugzilla.redhat.com/723075

curl segfaults when running this:

curl -O -J \
'http://koji.fedoraproject.org/koji/getfile?taskID=3208065name=python26-boto-2.0-1.el5.noarch.rpm' 
\

'http://koji.fedoraproject.org/koji/getfile?taskID=3208065name=python26-boto-2.0-1.el5.src.rpm'

It downloads the first file and then crashes before starting the second one.

Original reporter posted this backtrace from gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00405d74 in header_callback (ptr=value optimized out, 
size=value

optimized out,
nmemb=value optimized out, stream=0x0) at main.c:4389
4389 outs-filename = filename;
(gdb) bt
#0  0x00405d74 in header_callback (ptr=value optimized out,
size=value optimized out,
nmemb=value optimized out, stream=0x0) at main.c:4389
#1  0x00343761a3b9 in Curl_client_write (conn=value optimized out,
type=value optimized out,
ptr=0x62c120 Content-Disposition: attachment;
filename=python26-boto-2.0-1.el5.src.rpm\r\n, len=75)
at sendf.c:487
#2  0x003437618f2f in Curl_http_readwrite_headers (data=0x623560,
conn=0x62ddd0, nread=0x7fffd6d0,
stop_reading=0x7fffd6de) at http.c:3779
#3  0x00343762c632 in readwrite_data (conn=0x62ddd0, 
done=0x7fffd78e)

at transfer.c:455
#4  Curl_readwrite (conn=0x62ddd0, done=0x7fffd78e) at transfer.c:1004
#5  0x00343762dd47 in Transfer (data=0x623560) at transfer.c:1367
#6  Curl_do_perform (data=0x623560) at transfer.c:2053
#7  0x0040890c in operate (argc=0, argv=value optimized out) at
main.c:5358
#8  main (argc=0, argv=value optimized out) at main.c:5683

The original reporter was using curl 7.21.0 on Fedora 14 but I have 
reproduced the crash with curl 7.21.7 on Fedora 15.


Paul.
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html