libaums icon indicating copy to clipboard operation
libaums copied to clipboard

Delete failing with javafs (fat16)

Open Metske opened this issue 7 years ago • 8 comments

Hi, first I would like to say how great the library is! It has helped me so much!

I have reading from a fat16 device working really well, but I am stuck on deleting files and then writing.

I understand that the javafs integration is experimental at the moment but I cannot figure out why the delete function is not working. I am getting this info from the log:

W/System.err: java.io.IOException: free entry in chain at: 31254 at org.jnode.fs.jfat.FatChain$ChainIterator.next(FatChain.java:711) at org.jnode.fs.jfat.FatChain.freeAllClusters(FatChain.java:323) at org.jnode.fs.jfat.FatEntry.freeAllClusters(FatEntry.java:96) at org.jnode.fs.jfat.FatDirectory.remove(FatDirectory.java:363) W/System.err: at com.github.magnusja.libaums.javafs.wrapper.fs.UsbFileWrapper.delete(UsbFileWrapper.java:222)

Any help would be very much appreciated!!

Metske avatar May 16 '18 21:05 Metske

Hey

I actually dont know why that happens. I think there is another fat implementation in JNode. Try commenting out his line: https://github.com/magnusja/libaums/blob/develop/javafs/src/main/java/com/github/magnusja/libaums/javafs/JavaFsFileSystemCreator.java#L50

magnusja avatar May 17 '18 14:05 magnusja

I tried commenting out "fsTypes.add(new FatFileSystemType());" and .listFiles(); seemed to stop working beyond the root directory.

"Caused by: java.lang.NullPointerException: Attempt to get length of null array"

I commented out "fsTypes.add(new org.jnode.fs.fat.FatFileSystemType());" instead and got:

W/System.err: java.io.IOException: circular chain at: 0 W/System.err: at org.jnode.fs.jfat.FatChain$ChainIterator.next(FatChain.java:708) at org.jnode.fs.jfat.FatChain.freeAllClusters(FatChain.java:323) at org.jnode.fs.jfat.FatEntry.freeAllClusters(FatEntry.java:96) at org.jnode.fs.jfat.FatDirectory.remove(FatDirectory.java:363) at com.github.magnusja.libaums.javafs.wrapper.fs.UsbFileWrapper.delete(UsbFileWrapper.java:222)

Thank you so much for your help and time!

Metske avatar May 17 '18 19:05 Metske

Well, that's bad. I really don't know whats wrong here.

You could try to update https://github.com/magnusja/java-fs with recent changes from https://github.com/tmyroadctfig/jnode and see if it works then.

magnusja avatar May 23 '18 16:05 magnusja

@Metske I saw that you forked java-fs, any luck with updating from jnode master?

magnusja avatar May 29 '18 09:05 magnusja

Hi, Yeah I forked it and committed the changes not sure exactly how to link up with these changes though. The javafs module in the Libuams development library has "com.github.magnusja:java-fs:0.1.3" as a dependency. ( "https://github.com/magnusja/java-fs" is version 0.1.2 ?)

I tried importing my fork in as a module and refactoring but I got into a whole load of compiling issues.

Sorry still fairly new to github and not 100% sure what to do.

Metske avatar May 29 '18 17:05 Metske

Used jitpack and added my fork as the dependency, still getting a lot of "W/System.err: java.io.IOException: circular chain at: 0" errors!

Metske avatar May 29 '18 21:05 Metske

What happens if you remove the comment you added, and use the other FAT32 implementation? Maybe there are some recent fixes.

magnusja avatar Jun 03 '18 13:06 magnusja

Finally had some time to sit down and look at this again, I still haven't managed to get anywhere. One time I tried and it started working a bit and it was writing fine up until the last file then it crashed with "Free entry in chain at: 1" I haven't been able to reproduce this again. I tried with the other implementation but it won't initialize due to UnixFSAccessRights issues.

One thing I don't think I've mentioned is I get this when initializing:

I/ScsiBlockDevice: Block size: 512 I/ScsiBlockDevice: Last block address: 786431 I/FileSystemPartitionTable: Found a device without partition table, yay! W/FileSystemPartitionTable: fs capacity is not multiple of block size

Metske avatar Jun 20 '18 20:06 Metske

Should be fixed in v0.9.4

magnusja avatar Mar 11 '23 11:03 magnusja