cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[ curl-Bugs-3517441 ] Incorrect exit codes with multiple file transfer

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Tue, 17 Apr 2012 15:32:48 -0700

Bugs item #3517441, was opened at 2012-04-13 02:46
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3517441&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: client module
Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Daniel Theron (blackcat101)
>Assigned to: Daniel Stenberg (bagder)
Summary: Incorrect exit codes with multiple file transfer

Initial Comment:
Hi there,

I have noticed this bug since I started using cURL (7.19.6), but only reporting it now.
I am using the latest version 7.25.0 now, and the bug still persists.

In some cases when a failure occurs when sending multiple files with cURL an incorrect exit code "0" is given. Please see my tests below:

$ uname -a
SunOS V240-rd-2 5.10 Generic_147440-12 sun4u sparc SUNW,Sun-Fire-V240

$ curl --version
curl 7.25.0 (sparc-sun-solaris2.10) libcurl/7.25.0 OpenSSL/1.0.1 zlib/1.2.6 libidn/1.24 libssh2/1.4.1
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

TEST 1: All files transferred successfully - correct exit code:

$ curl --connect-timeout 10 --retry 8 --ftp-port - -# -T {file1,file10,file11,file12,file13,file2,file3,file4,file5,file6,file7,file8,file9} -u athed:Helpme12 ftp://172.21.2.232/
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%

$ echo $?
0

TEST 2: Now first half of files transferred successfully - correct exit code:

$ curl --connect-timeout 10 --retry 8 --ftp-port - -# -T {file1,file10,file11,file12,file13,file2,file3,file4,file5,file6,file7,file8,file9} -u athed:Helpme12 ftp://172.21.2.232/
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
####################################### 55.2%
curl: (55) Failed sending data to the peer
                                                                           0.0%Warning: Transient problem: timeout Will retry in 1 seconds. 1 retries left.
                                                                           0.0%
curl: (28) connect() timed out!
                                                                           0.0%
curl: (7) couldn't connect to host
                                                                           0.0%
curl: (7) couldn't connect to host
                                                                           0.0%
curl: (7) couldn't connect to host
                                                                           0.0%
curl: (7) couldn't connect to host

$ echo $?
7

TEST 3: Now a connection drop occurs in the middle of the transfer, 1 file was not successfully transferred, but an incorrect exit code 0 was given:
$ curl --connect-timeout 10 --retry 8 --ftp-port - -# -T {file1,file10,file11,file12,file13,file2,file3,file4,file5,file6,file7,file8,file9} -u athed:Helpme12 ftp://172.21.2.232/
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
                                                                           0.6%
curl: (55) Send failure: Broken pipe
                                                                           0.0%
Warning: Transient problem: timeout Will retry in 1 seconds. 8 retries left.
                                                                           0.0%
Warning: Transient problem: timeout Will retry in 2 seconds. 7 retries left.
                                                                           0.0%
Warning: Transient problem: timeout Will retry in 4 seconds. 6 retries left.
                                                                           0.0%
Warning: Transient problem: timeout Will retry in 8 seconds. 5 retries left.
                                                                           0.0%
Warning: Transient problem: timeout Will retry in 16 seconds. 4 retries left.
                                                                           0.0%
Warning: Transient problem: timeout Will retry in 32 seconds. 3 retries left.
                                                                           0.0%
Warning: Transient problem: timeout Will retry in 64 seconds. 2 retries left.
                                                                           0.0%
Warning: Transient problem: timeout Will retry in 128 seconds. 1 retries left.
                                                                           0.0%
curl: (28) connect() timed out!
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%

$ echo $?
0

TEST 4: Now there is a connection drop in beginning of transfer, and connection has gone up after first few files failed, but has given an incorrect exit code of 0:
$ curl --connect-timeout 1 --retry 1 --ftp-port - -# -T {file1,file10,file11,file12,file13,file2,file3,file4,file5,file6,file7,file8,file9} -u athed:Helpme12 ftp://172.21.2.232/
Warning: Transient problem: timeout Will retry in 1 seconds. 1 retries left.

curl: (7) couldn't connect to host

curl: (7) couldn't connect to host

curl: (7) couldn't connect to host

curl: (7) couldn't connect to host

curl: (7) couldn't connect to host

curl: (7) couldn't connect to host

curl: (7) couldn't connect to host
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%

$ echo $?
0

Is it possible to fix this bug? cURL to give correct exit codes for the failures above?

Thanks,
Daniel

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2012-04-17 15:32

Message:
But really, when you do multiple requests in a single command line, why
should the failed ones override the successful ones? I mean, if you'd get
your way what would stop someone from coming in and asking for exactly the
reverse?

IMHO there's no clear right or wrong here but more a matter of documenting
exactly how it works...

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3517441&group_id=976
Received on 2012-04-18

These mail archives are generated by hypermail.

donate! Page updated January 05, 2012.
web site info

File upload with ASP.NET