mirage / ocaml-fat

Read and write FAT format filesystems from OCaml
ISC License
26 stars 18 forks source link

Multiple errors with image files #53

Open g2p opened 7 years ago

g2p commented 7 years ago

I'm using the mirage-dev OPAM repository.

If I run a unikernel that uses a fat image (fat_of_files ~regexp:".gitignore" () in config.ml):

2016-10-14 15:06:45 +02:00: ERR [mirage-block-unix] read: Invalid argument in read '' at file /path/to/unikernel/fat_block1.img offset 0 with buffer of length 512
2016-10-14 15:06:45 +02:00: ERR [application] main: Fs.Make(B)(M).Block_device_error(_)
Raised at file "format.ml", line 185, characters 41-52
Called from file "format.ml", line 427, characters 6-24

See https://github.com/g2p/irc-unikernel/tree/fat-test-case for a full test case. Use the unix target.

The image isn't properly formatted and doesn't contain .gitignore (only the message about Dave being a dull boy). If I try to recreate the image:

$ fat create fat_block1.img $((16*2**20)) || echo FAIL
fat: fat_block1.img already exists
FAIL
$ rm -f fat_block1.img
$ fat create fat_block1.img $((16*2**20)) || echo FAIL
fat: connect buffered:fat_block1.img: failed to open file
FAIL

The image did appear, despite the exit status. But it's still badly formatted and the unikernel can't use it.

Using mkfs.vfat, the unikernel fails with the same error.

yomimono commented 7 years ago

Very belated thanks for this report and the reproduction instructions, @g2p.

fat_of_filesis implemented by the mirage front-end tool ( see https://github.com/mirage/mirage/blob/master/lib/mirage.ml#L391 ) which resulted in your initial error report. We should investigate this problem and try to integrate building FAT into the automated mirage tests.

I was also able to reproduce the strange results from fat create:

$ ls -alh fat_block1.img
ls: cannot access fat_block1.img: No such file or directory
$ fat create fat_block1.img $((16*2*20))
fat: connect buffered:fat_block1.img: failed to open file
$ ls -alh fat_block1.img 
-rw-r--r-- 1 user user 25K Nov 15 12:50 fat_block1.img
goldenHairDafo commented 7 years ago

Hi, I have the same problem with the mirage and mirage3-beta packages from the OPAM Repository. Is their an workaround to create working fat image?

Thanks