clone 556012 -1 tags 556012 + patch retitle 556012 Incorrect use of CURLOPT_INFILESIZE reassign -1 libcurl3 retitle -1 CURLOPT_INFILESIZE does not handle correctly -1 thanks
Hi! I get the same problem here. Enabling debug (with -o ftpfs_debug=3), I get some additional information : 1260707694 ftpfs.c:534 write problem: 18(Transferred a partial file) text=Uploaded unaligned file size (1072275 out of 4294967295 bytes) 1260707694 ftpfs.c:540 leaving streaming write thread #1 curl_res=18 1260707694 ftpfs.c:591 finish_write_thread after pthread_join. write_fail_cause=18 > QUIT < 221 Goodbye. * Closing connection #0 ftpfs: operation ftpfs_flush failed because Input/output error unique: 639, error: -5 (Input/output error), outsize: 16 I don't quite understand the "Uploaded unaligned file size". Moreover, I don't understand why the size is 4294967295 bytes. Here is the corresponding part in libcurl: if(result || premature) /* the response code from the transfer showed an error already so no use checking further */ ; else if(data->set.upload) { if((-1 != data->set.infilesize) && (data->set.infilesize != *ftp->bytecountp) && !data->set.crlf && (ftp->transfer == FTPTRANSFER_BODY)) { failf(data, "Uploaded unaligned file size (%" FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes)", *ftp->bytecountp, data->set.infilesize); result = CURLE_PARTIAL_FILE; } It seems that data->set.infilesize is incorrectly set 4294967295 but the -1 != data->set.infilesize does not hold because data->set.infilesize is of type curl_off_t which is long long which is 64bit. I suppose that somewhere in curl, there is a unsigned long converted to long long. Looking at the source code, this seems because we have this in ftpfs.c : curl_easy_setopt_or_die(fh->write_conn, CURLOPT_INFILESIZE, -1); While in curl, we have : data->set.infilesize = va_arg(param, long); Therefore, I think the bug is present in both curlftpfs and in libcurl. I am not sure how to fix this correctly in libcurl, but I suppose that we should read "va_arg(param, curl_off_t)" like for INFILESIZE_LARGE or accurately handle -1 case. In curlftpfs, the best way is just to not set CURLOPT_INFILESIZE to -1 since this seems not needed or use CURLOPT_INFILESIZE_LARGE. Removing this line works fine for me. --- curlftpfs-0.9.2/ftpfs.c.old 2009-12-13 14:12:25.000000000 +0100 +++ curlftpfs-0.9.2/ftpfs.c 2009-12-13 14:12:32.000000000 +0100 @@ -503,7 +503,6 @@ curl_easy_setopt_or_die(fh->write_conn, CURLOPT_URL, fh->full_path); curl_easy_setopt_or_die(fh->write_conn, CURLOPT_UPLOAD, 1); - curl_easy_setopt_or_die(fh->write_conn, CURLOPT_INFILESIZE, -1); curl_easy_setopt_or_die(fh->write_conn, CURLOPT_READFUNCTION, write_data_bg); curl_easy_setopt_or_die(fh->write_conn, CURLOPT_READDATA, fh); curl_easy_setopt_or_die(fh->write_conn, CURLOPT_LOW_SPEED_LIMIT, 1); -- BOFH excuse #297: Too many interrupts -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org