-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
makedir() reorders files, moving system files, making MS-DOS 5 non-bootable #24
Comments
|
When flushing directory entries back to disk, the files have been reordered due to a usage of `set()` and a `walk()`-like mechanism. This had the advantage of automatically getting rid of duplicate directory entries on flush to disk but also had the effect that it essentially always re-ordered files due to the nature of `set()`. In some cases like with IO.SYS on MS-DOS, a strict ordering is required, otherwise rendering the system unbootable. Instead, a list of dentries is now directly passed to the flush method, leaving ordering as-is.
Thanks for your bug report! I wasn't aware that some system-files are required in a certain order. I've made a WIP fix that seems to work well (for what I was able to test), feel free to check it out (54640fb). Regarding the performance issues: Yes, rewriting everything completely back to disk all the time certainly slows PyFatFS down a fair amount and there's currently no elegant way to improve performance but it is something I have on my roadmap but performance isn't something I aimed for in the 1.0 release. |
Thanks for the quick fix! I tested with 96ae6bc (whose parent is the commit referenced above) and it works well!
That's definitely fair. |
When flushing directory entries back to disk, the files have been reordered due to a usage of `set()` and a `walk()`-like mechanism. This had the advantage of automatically getting rid of duplicate directory entries on flush to disk but also had the effect that it essentially always re-ordered files due to the nature of `set()`. In some cases like with IO.SYS on MS-DOS, a strict ordering is required, otherwise rendering the system unbootable. Instead, a list of dentries is now directly passed to the flush method, leaving ordering as-is.
Fixed on master, will be in the upcoming release |
When flushing directory entries back to disk, the files have been reordered due to a usage of `set()` and a `walk()`-like mechanism. This had the advantage of automatically getting rid of duplicate directory entries on flush to disk but also had the effect that it essentially always re-ordered files due to the nature of `set()`. In some cases like with IO.SYS on MS-DOS, a strict ordering is required, otherwise rendering the system unbootable. Instead, a list of dentries is now directly passed to the flush method, leaving ordering as-is.
With pyfatfs 1.0.3, if I open a bootable MS-DOS 5 floppy as
fs
and then invoke:it is no longer possible to boot from the floppy. This is what Central Point PC Tools 9's Disk Editor shows after the above:
Note that the new directory appears first, and the files are listed in some unknown order.
This is what it looked like prior to adding the directory:
Note that the files are listed in some different, unknown order, but that IO.SYS and MSDOS.SYS are the first two entries. https://en.wikipedia.org/wiki/IO.SYS notes that:
It would be safer to mimic what I think DOS does and just use the first available directory entry for the entry being added rather than rewriting the entire directory. I noticed that adding files one by one to a directory seems a bit slow compared to shelling out to
mtools
to copy all of the files in one batch, and I wonder if that is because the entire directory is being rewritten each time?The text was updated successfully, but these errors were encountered: