Page 1 of 1
sdcard corruption
Posted: Tue Sep 01, 2020 4:29 pm
by Stefan
Hi,
I've been testing to write sequential files to the sdcard image using the standard KERNAL routines (SETNAM, SETLFS, OPEN, CHKOUT and CHROUT) in emulator R38.
I've noticed that files sometimes get corrupted. It seems to happen if the sdcard is mounted on the host computer's file system at the same time as it's attached to the emulator.
However, writing to the sdcard seems stable if it's not mounted to the host system at the same time. I'm running macOS Catalina.
sdcard corruption
Posted: Tue Sep 01, 2020 4:37 pm
by Yuki
Yeah, it's never recommended to open a disk image with anything while it's mounted in the host filesystem, mostly due to caching and weird stuff the operating system do. It's not just an emulator problem, I'd say.
sdcard corruption
Posted: Tue Sep 01, 2020 5:06 pm
by SerErris
Yep, I would not consider that a bug, other than that the emulator should exclusively mount it to avoid such tries.
sdcard corruption
Posted: Tue Sep 01, 2020 5:53 pm
by TomXP411
Yeah, there's no file contention management in the emulator OR in the host operating system. Disk images are not meant to be mounted by two different processes at once. In fact, I'm not sure how you actually managed that - the emulator and MacOS should have both set an exclusive lock on the file. The fact that you WERE able to open the image in the emulator while it was mounted in MacOS is actually the bug... MacOS should not have let you.
sdcard corruption
Posted: Tue Sep 01, 2020 6:15 pm
by SerErris
You can open with lock or without ... systemcalls for both exist and there is nothing wrong with it. But maybe the emulator should use a locked opening.
sdcard corruption
Posted: Tue Sep 01, 2020 7:18 pm
by Stefan
59 minutes ago, SerErris said:
You can open with lock or without ... systemcalls for both exist and there is nothing wrong with it. But maybe the emulator should use a locked opening.
Yes.
However, I think you may call it a feature, and keep the emulator as is
? No problem, as long as you're aware.
sdcard corruption
Posted: Wed Sep 02, 2020 3:04 pm
by SerErris
19 hours ago, Stefan said:
Yes.
However, I think you may call it a feature, and keep the emulator as is ? No problem, as long as you're aware.
Agreed ... as long as you do not write to it at the same time ... you might use it to read some debugging from PC side from it.