File size descrepancy via IO#write or IO#syswrite

(Zach Dennis) #1

I have a gzipped xml file, which I get from a Java Client on a Windows machine. The file size is 9934 bytes. I send a MD5 sum with my transmission.

I send this file over the network to a Linux server. I receive 9934 bytes (i run MD5.hexdigest to make sure the received file is the same as the one sent).

When I write the file to disk the file on disk has 11214 bytes to it.

Ruby tells me that it wrote 9934 bytes, but the filesystem is showing me different.

Any clues? Thanks,

Zach

(Zach Dennis) #2

Zach Dennis wrote:

I have a gzipped xml file, which I get from a Java Client on a Windows machine. The file size is 9934 bytes. I send a MD5 sum with my transmission.

I send this file over the network to a Linux server. I receive 9934 bytes (i run MD5.hexdigest to make sure the received file is the same as the one sent).

When I write the file to disk the file on disk has 11214 bytes to it.

Ruby tells me that it wrote 9934 bytes, but the filesystem is showing me different.

Any clues? Thanks,

After restarting the ruby process, the problem still occurred. After rebooting the linux server, the problem went away.

Zach

(Brian Schröder) #3

Just a wild guess:
Maybe you were shown the space the file occupied, this may be more due
to the block structure of the filesystem.

regards,

Brian

···

On 11/08/05, Zach Dennis <zdennis@mktec.com> wrote:

Zach Dennis wrote:
> I have a gzipped xml file, which I get from a Java Client on a Windows
> machine. The file size is 9934 bytes. I send a MD5 sum with my
> transmission.
>
> I send this file over the network to a Linux server. I receive 9934
> bytes (i run MD5.hexdigest to make sure the received file is the same as
> the one sent).
>
> When I write the file to disk the file on disk has 11214 bytes to it.
>
> Ruby tells me that it wrote 9934 bytes, but the filesystem is showing me
> different.
>
> Any clues? Thanks,

After restarting the ruby process, the problem still occurred. After
rebooting the linux server, the problem went away.

Zach

--
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/