kern/60089: UDF filesystem appends garbage to files
gordonb at airmail.net
Tue Dec 9 13:00:42 PST 2003
>Synopsis: UDF filesystem appends garbage to files
>Arrival-Date: Tue Dec 09 13:00:38 PST 2003
>Originator: Gordon Burditt
>Release: FreeBSD 5.1-RELEASE i386
System: FreeBSD hammy.burditt.org 4.9-STABLE FreeBSD 4.9-STABLE #7: Sat Nov 22 14:13:11 CST 2003 gordon at hammy.burditt.org:/scratch5/i386-obj/usr/src/sys/HAMMY i386
(Reporting this from a FreeBSD-4.9 system even though the
DVD drive is installed on a 5.1-RELEASE system and the
bug is observed on 5.1-RELEASE. FreeBSD 4.9-RELEASE does
not have mount_udf).
Generic Cheap DVD+/-R+/-RW recorder (reproducible without this)
If you build a UDF filesystem image of compressed files
(using mkisofs), then mount it (either burning it to DVD and mounting
it, or mounting the image with mdconfig/mount), different programs
will see the file length differently (either correct, or apparently
rounded up to the next 64k in size). In my case I used compressed
ls -l says the original var.dump.gz and the one in the UDF
filesystem are the same length.
cmp says the files are identical (not EOF on one of the files).
wc says the UDF filesystem file is longer.
6909 40703 1900544 /mnt/book/var.dump.gz (UDF filesystem)
6905 40385 1863645 /backups/dumps/0/book/var.dump.gz
gzip -tv says there is trailing garbage at the end of the UDF file,
but the checksum is OK.
hd shows extra stuff at the end of the UDF file.
md5 says that the checksums are different.
Not all files have their sizes rounded up to the next 64k, in
particular not small files. Files with the observed problem
range from 326KB to almost 396MB. Files without the problem
range from 109 bytes to 6.5KB. As it happens, there were no files
between 6.5KB and 326KB. I do not know for sure that this
is strictly a file size issue.
Whether or not mkisofs is producing a corrupted UDF filesystem,
it does seem strange that some programs see the file as one size
and others see it as another size.
Build a directory tree of large (e.g. 2MB to 400MB) gzipped files.
Using mkisofs 2.0, build a UDF filesystem image from these files.
Either (a) Use mdconfig and mount the image, or (b) burn the
image to a CD-R/DVD-R and mount it. Run gzip -tv on the
gzipped files. Note message about "decompression OK, trailing
garbage ignored". Verify that this message does not occur on
the original files used to build the UDF filesystem image.
Gordon L. Burditt
More information about the freebsd-bugs