File corruption: Small files are padded with null bytes

========================================================================
File corruption: Small files are padded with null bytes
========================================================================

------------------------------------------------------------------------
BUG DESCRIPTION:
------------------------------------------------------------------------

When downloading small files (less than 4097 bytes) they are padded with null bytes, so that the file size increases up to the nearest 16 byte boundary. This happens both with text and binary files. File sizes are however reported correctly by the Wuala GUI.

------------------------------------------------------------------------
CONFIRMED IN ENVIRONMENTS:
------------------------------------------------------------------------

* Wuala version 74 (linux), Sun Java 6, Ubuntu 7.10, JFS filesystem
* Wuala version 74 (linux), Sun Java 6, Xubuntu 7.10, EXT2 filesystem
* Wuala version 74 (linux), Sun Java 6, Xubuntu 7.10, VFAT filesystem

------------------------------------------------------------------------
STEPS TO REPRODUCE:
------------------------------------------------------------------------

1. Create a directory named "original" and enter it:

$ mkdir original
$ cd original

2. Download the GPLv3 license text (or any other text file):

$ wget http://www.gnu.org/licenses/gpl-3.0.txt

3. Create small extracts of the larger file, ca 4096 bytes in size:

$ for i in `seq 4094 4099`; do (head -c $i gpl-3.0.txt > $i-gpl.txt); done;

4. Go up one level.

$ cd ..

5. Verify the file sizes:

$ ls -l original
-rw-r--r-- 1 hugo hugo 4094 2008-02-24 20:02 4094-gpl.txt
-rw-r--r-- 1 hugo hugo 4095 2008-02-24 20:02 4095-gpl.txt
-rw-r--r-- 1 hugo hugo 4096 2008-02-24 20:02 4096-gpl.txt
-rw-r--r-- 1 hugo hugo 4097 2008-02-24 20:02 4097-gpl.txt
-rw-r--r-- 1 hugo hugo 4098 2008-02-24 20:02 4098-gpl.txt
-rw-r--r-- 1 hugo hugo 4099 2008-02-24 20:02 4099-gpl.txt
-rw-r--r-- 1 hugo hugo 35147 2007-07-02 01:00 gpl-3.0.txt

6. Create a small PNG image (as an example binary file) with for example The GIMP. Check its size:

$ ls -l original/image.png
-rw-r--r-- 1 hugo hugo 129 2008-02-24 20:05 image.png

7. Upload all files into Wuala.

8. Download and "Export to..." all files into a directory named "downloaded".

9. Compare the two directories, and see that original files smaller than 4097 bytes are no longer the same after download:

$ diff -r original downloaded
Binary files original/4094-gpl.txt and downloaded/4094-gpl.txt differ
Binary files original/4095-gpl.txt and downloaded/4095-gpl.txt differ
diff -r original/4096-gpl.txt downloaded/4096-gpl.txt
84c84
_ To "modify" a work means to copy fro
\ No newline at end of file
---
_ To "modify" a work means to copy fro
\ No newline at end of file
Binary files original/image.png and downloaded/image.png differ

10. Compare the file sizes. You should see that the downloaded file sizes are all evenly divisible by 16, for all files whose original file size was less than 4097 bytes:

$ ls -l downloaded
-rw-r--r-- 1 hugo hugo 4096 2008-02-24 20:07 4094-gpl.txt
-rw-r--r-- 1 hugo hugo 4096 2008-02-24 20:07 4095-gpl.txt
-rw-r--r-- 1 hugo hugo 4112 2008-02-24 20:07 4096-gpl.txt
-rw-r--r-- 1 hugo hugo 4097 2008-02-24 20:07 4097-gpl.txt
-rw-r--r-- 1 hugo hugo 4098 2008-02-24 20:07 4098-gpl.txt
-rw-r--r-- 1 hugo hugo 4099 2008-02-24 20:07 4099-gpl.txt
-rw-r--r-- 1 hugo hugo 35147 2008-02-24 20:07 gpl-3.0.txt
-rw-r--r-- 1 hugo hugo 144 2008-02-24 20:07 image.png

11. Inspect the downloaded files and see that they are indeed padded with null bytes (indicated by the 'less' program with '^@'):

(Answer 'y' when asked to display the file even though 'less' considers it binary. Press 'End' to jump to end of file and press 'q' to quit.)

$ less downloaded/4094-gpl.txt
$ less downloaded/4095-gpl.txt
$ less downloaded/4096-gpl.txt
$ cat downloaded/image.png | less

These files should not have any null bytes at the end:

$ less downloaded/4097-gpl.txt
$ less downloaded/4098-gpl.txt
$ less downloaded/4099-gpl.txt
$ less downloaded/gpl-3.0.txt

(
NOTE: I have performed all uploads above to a shared folder at
"http://wua.la/hugojosefson/wuala bugs/File corruption - Small files are padded with null bytes"

Clickable link that redirects there correctly:
http://tinyurl.com/2ya6jy
)
 
sad I’m concerned
Inappropriate?
2 people have this problem

User_default_medium