At present, the FatFileSystemType classes

Project:JNode Core
Category:bug report
Status:patch (code needs review)

At present, the FatFileSystemType classes in fat and jfat are too strict. They require the partition table itself to say that the filesystem is FAT.

However due to the average user's knowledge of partition tables, often the information in the partition table is incorrect, and the users end up with an "NTFS" partition which actually contains FAT32. This happens naturally if you have a disk which someone knowledgable formatted as NTFS, and then overwrite it with FAT-32 using normal formatting tools.

Attached patch fixes this by looking internally at the magic numbers instead of trusting the partition table's opinion. It assumes that "fat" will only be used for FAT-16 and that "jfat" will only be used for FAT-32. If this is not correct the change can be adjusted accordingly.

issues_383.23 KB


In fact IMO, we should never use the partition table to determine the filesystem type. It should perhaps be taken out of the API, to discourage future filesystem identification from using it. A similar issue happened with NTFS previously, and there is currently an issue with Ext2's also, which I'll raise separately.

Report the problem rather than hide it

The OS should query the partition tables as well as the partion and see what each says, they should agree. If they do not, an error should occur; and the logic dictates to ignore the table and trust the contents of the partition. The error should at least be logged, and/or reported to the user.

All too often systems cover internal errors like this when they should be reported and fixed.


Status:active» patch (code needs review)

Fixing title, my bad. Smiling