cURL / Mailing Lists / curl-users / Single Mail

curl-users

Bug: curl doesn't notice ENOSPACE if it writes a small amount of data.

From: Björn Augustsson <oggust_at_gmail.com>
Date: Mon, 23 Nov 2009 14:07:11 +0100

Hello folks!

Subject says it all, mostly. The steps below, hopefully the rest.

I have
$ curl --version
curl 7.19.6 (i386-redhat-linux-gnu) libcurl/7.19.6 NSS/3.12.4.1 Beta
zlib/1.2.3 libidn/1.9 libssh2/1.0
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile SSL libz
$

(That's the current version from Fedora 11)

Heres' a way to reproduce it:

$ sudo mkdir -p /space
$ sudo mount -t tmpfs -o size=10k,mode=0777 tmpfs /space
$ cd /space
$ cat /dev/zero >filler
cat: write error: No space left on device
$ curl -o short google.com
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
109 219 109 219 0 0 571 0 --:--:-- --:--:-- --:--:-- 1183
$

## So... All went well? Nope:

$ ls -l short
-rw-rw-r--. 1 aug aug 0 2009-11-23 14:00 short
$

( That "page" is just Google's country-redirect page:

$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
)

and then

$ curl -o long www.dn.se
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
101 4079 0 4079 0 0 39372 0 --:--:-- --:--:-- --:--:-- 61803
curl: (23) Failed writing body (17 != 1413)
$ echo $?
23
$

(As expected.)

/August.

-- 
Wrong on most accounts.  const Foo *foo; and Foo const *foo; mean the same: foo
being a pointer to const Foo.  const Foo const *foo; would mean the same but is
illegal (double const).  You are confusing this with Foo * const foo; and const
Foo * const foo; respectively. -David Kastrup, comp.os.linux.development.system
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-23