Suspicious code in jfat.Fat.getLast()

Project:JNode FS
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Fat.getLast is implemented as follows:

    public final long getLast(int fatnum) {
        return getLast(fatnum) + offset(size() - 1);
    }

This is clearly going to recurse infinitely, I'm thinking that the only reason it isn't a problem is that nothing is calling the method. Smiling

#1

Hi Daniel,

I'm glad you are checking the JFat code because it has no maintainer at the moment.
It needs serious performance improvements and it still may contain several bugs too.
In spite of these problems it's a frequently used file system in my setup and FAT32 being a relatively simple file system I think it would be important to make JFat work reliably and perform well as it will be useful for smaller JNode setups on various devices and for compatibility with the huge number of FAT32 file systems out there.
If you would like to continue the work on JFat I can send you more information provided to me by its original author Giuseppe Vitillaro.

Regards,
Levente

#2

In reality the real issue for us is the infinite recursion in the older FAT driver which has caused a customer an issue on FAT-16 (issue 2886).

I found this potential bug in JFAT when I was looking to see how hard it would be to add FAT-16 support to the newer driver, rather than fixing a bug in a driver which the JNode project considers obsolete.

Some help in that department (bringing JFAT up to support other FATs) would probably be helpful. As you probably know, there is also "exFAT" which is basically FAT-64, and this new filesystem is already being used. So supporting both FAT-32 and exFAT would seem to be a good idea anyway, and I suspect that once enough abstraction is there for supporting 2 FATs, there will be enough to support the older ones as well. There may already be enough abstraction, but I don't know.