The attached file (gzip-compressed to save

Project:JNode Core
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:patch (code needs review)
Description

The attached file (gzip-compressed to save space) is an 100MB NTFS image created on Windows XP.

Unless I'm using the API wrong, the following unit test should pass for this image:

public void testTrivial() throws Exception {
Device device = new FileDevice(getDataFile("diskimages/test.ntfs"), "r");
FSBlockDeviceAPI blockDeviceAPI = device.getAPI(FSBlockDeviceAPI.class);
byte[] firstSector = new byte[blockDeviceAPI.getSectorSize()];
blockDeviceAPI.read(0, ByteBuffer.wrap(firstSector));
assertTrue("NTFS driver should support an NTFS disk image",
new NTFSFileSystemType().supports(null, firstSector, blockDeviceAPI));
}

AttachmentSize
issues_1234.02 KB

Whoops. Left a bit of our

Whoops. Left a bit of our framework in that one. Smiling

You can replace this:
getDataFile("diskimages/test.ntfs")

With this:
new File("test.ntfs")

Side effect ?

Daniel,

Are you sure this patch does'nt have any side effect on other filesystem types (Ext2, jfat, ...) detection.

I would like the advice of other developers before committing this patch (if it's possible)

Thanks,

Fabien L.

It's safe

I'm checking 8 characters worth of magic number instead of 4 characters worth now. So this patch actually decreases the chance of another filesystem mistakenly being identified as NTFS, while allowing for user error in creating the partition table (extremely common) and permitting for disk images which aren't an image of the entire disk.

Status check

Did this go in yet?

#1

Status:active» patch (code needs review)

Here's a patch which is more forgiving -- allows the image to work as long as the magic number is present, ignoring anything related to partition tables.