FTP size incorrect for files > 4GB
5 Message(s) by 3 Author(s) originally posted in ruby programming
| From: Raymond OConnor |
Date: Saturday, October 27, 2007
|
The net/ftp size
method is supposed to return the size of a remote
file ,
but when the size of the remote file is > 4GB it seems to return the
wrong size.
The size of the remote file I'm
testing is about 4.5 GB and size()
returns about 0.5 GB. Anyone having the same problems? Is there
somewhere I can report this problem?
Thanks
--
Posted via
http://www.ruby-forum.com/.
| From: Jano Svitok |
Date: Saturday, October 27, 2007
|
wrote in message:
The net/ftp size method is supposed to return the size of a remote file,
but when the size of the remote file is > 4GB it seems to return the
wrong size.
The size of the remote file I'm testing is about 4.5 GB and size()
returns about 0.5 GB. Anyone having the same problems? Is there
somewhere I can report this problem?
It works for me. Can you 1. post test
code to reproduce, 2. specify
ruby
version and operating system?
You may try checking '12345678923456'.to_i as to_i is used to convert
string response to integer.
Finally, try running the ftp
command manually, to see the precise ftp
server response. The code in net/ftp strips first three and the last
character. Maybe your server responds in a slightly different format.
For more details see net/ftp source, It's pure ruby and easy to
understand (at least the size method).
Jano
ruby -v:
ruby 1.8.5 (2006-08-25) [i386-mswin32] (one-click, xp sp2)
require 'net/ftp'
require 'test/unit'
class TestFtp < Test::Unit::TestCase
def setup
@xxxxxxxxxxx = Net::
FTP .new('ftp.tuwien.ac.at')
@xxxxxxxxxxx
@xxxxxxxxxxx('opsys/linux/Mandrake-iso/2008.0')
end
def test_size
assert_equal 4612227072,
@xxxxxxxxxxx('mandriva-linux-2008.0-free-dvd-x86_64.iso')
end
def teardown
@xxxxxxxxxxx
end
end
| From: Raymond OConnor |
Date: Saturday, October 27, 2007
|
RE: Jano Svitok
Thanks for your help. I tried out size on the mandriva iso and it came
out correctly, so I'm not sure what the problem is, but my guess at this
point is something is set up oddly on the ftp server I
connect to
(Unfortunately its private so I can not post its information).
I did do calculations and for some reason on the ftp server I connect
to, the size of files over 4 GB is reported as actual size - 4 GB.
--
Posted via
http://www.ruby-forum.com/.
| From: Tammo Tjarks |
Date: Sunday, October 28, 2007
|
Hello,
I am not sure, but coud it be that the OS has only 32bit? Normally then
files bigger as $G shouldn't be
support ed. But maybe also some of the
wrote in message:
The net/ftp size method is supposed to return the size of a remote file,
but when the size of the remote file is > 4GB it seems to return the
wrong size.
The size of the remote file I'm testing is about 4.5 GB and size()
returns about 0.5 GB. Anyone having the same problems? Is there
somewhere I can report this problem?
Thanks
| From: Jano Svitok |
Date: Sunday, October 28, 2007
|
wrote in message:
RE: Jano Svitok
Thanks for your help. I tried out size on the mandriva iso and it came
out correctly, so I'm not sure what the problem is, but my guess at this
point is something is set up oddly on the ftp server I connect to
(Unfortunately its private so I can not post its information).
I did do calculations and for some reason on the ftp server I connect
to, the size of files over 4 GB is reported as actual size - 4 GB.
You may try connecting manually, using a cmdline client. Then use
CHDIR and SIZE commands to see what the server reports. The odds are
that the server itself does not support files larger than 2^32
(4294967296). The possible reasons are ftp software, the OS or used
filesystem. Look up ftpd version, and search the internet for possible
issues.
Next Message: open-uri + OpenSSL