[Bug 497559] [NEW] php5-curl not flushing files to disk correctly until script exits
Chuck
csyperski at gmail.com
Wed Dec 16 21:26:32 GMT 2009
Public bug reported:
Binary package hint: php5
Package: php5-curl
Distribution: Ubuntu 9.10
uname -a:
Linux administrator-desktop 2.6.31-16-generic-pae #53-Ubuntu SMP Tue Dec 8 05:20:21 UTC 2009 i686 GNU/Linux
apt-cache policy php5-curl
php5-curl:
Installed: 5.2.10.dfsg.1-2ubuntu6.3
Candidate: 5.2.10.dfsg.1-2ubuntu6.3
Version table:
*** 5.2.10.dfsg.1-2ubuntu6.3 0
500 http://us.archive.ubuntu.com karmic-updates/main Packages
500 http://security.ubuntu.com karmic-security/main Packages
100 /var/lib/dpkg/status
5.2.10.dfsg.1-2ubuntu6 0
500 http://us.archive.ubuntu.com karmic/main Packages
php5:
Installed: 5.2.10.dfsg.1-2ubuntu6.3
Candidate: 5.2.10.dfsg.1-2ubuntu6.3
Version table:
*** 5.2.10.dfsg.1-2ubuntu6.3 0
500 http://us.archive.ubuntu.com karmic-updates/main Packages
500 http://security.ubuntu.com karmic-security/main Packages
100 /var/lib/dpkg/status
5.2.10.dfsg.1-2ubuntu6 0
500 http://us.archive.ubuntu.com karmic/main Packages
Ran the following script which uses curl to download file from a remote web server:
<?php
$ch = curl_init();
echo "Downloading....\n";
curl_setopt($ch, CURLOPT_TIMEOUT, '600');
curl_setopt($ch, CURLOPT_URL, "http://downloads.sourceforge.net/freeghost/Kernel-2.6.32.1.kitchensink" );
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_BINARYTRANSFER, 1 );
$fp = fopen("/tmp/bzImage", 'wb');
if ( $fp )
{
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec ($ch);
curl_close ($ch);
fclose($fp);
}
for( $i = 0; $i < 3; $i++ )
{
echo filesize( "/tmp/bzImage" ) . "\n";
sleep( 10 );
}
?>
Expected:
file size to report the real size of 4142832 bytes
using
ls -l
during the running of the script (before it terminates) returns a
filesize of 4141056 but it should return 4142832 as it does when the
script exits.
This was confirmed on two desktops, and functions correctly on Fedora 9
This is a problem is you are chain operations in the same script,
because it appears as if the file doesn't get flushed to disk. So for
example, we attempt to ftp the file off after download, but it is
corrupted as only 4141056 bytes are sent.
Thanks in advance for any help you can provide.
** Affects: php5 (Ubuntu)
Importance: Undecided
Status: New
--
php5-curl not flushing files to disk correctly until script exits
https://bugs.launchpad.net/bugs/497559
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to php5 in ubuntu.
More information about the Ubuntu-server-bugs
mailing list