Skip to content
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

Inconsistent handling of f_open #52

Open
stevesims opened this issue Apr 1, 2024 · 2 comments
Open

Inconsistent handling of f_open #52

stevesims opened this issue Apr 1, 2024 · 2 comments

Comments

@stevesims
Copy link
Contributor

It's been observed that the emulator can overwrite files, where on a real Agon you will see an Access denied error being reported.

This applies to saving files from BASIC, and copying or renaming files where the destination file already exists. Other applications that are using the mos_save API are also affected (it is strongly suggested that nano exhibits this behaviour too).

The underlying cause of this seems to incorrect behaviour of the fatfs f_open function.

Specifically when the MOS API uses f_open to create new files up to write them, it sets the flags FA_WRITE and FA_CREATE_NEW. When FA_CREATE_NEW is set and the file already exists, fatfs is supposed to return FR_EXISTS. It seems that in the emulator it must be returning FR_OK.

Essentially it seems that calling f_open with the FA_CREATE_NEW is currently behaving identically as if the FA_CREATE_ALWAYS flag was set, which is incorrect.

@stevesims
Copy link
Contributor Author

related to this, I believe that f_opendir is succeeding in the emulator for non-existent paths instead of reporting FR_NOPATH

@stevesims
Copy link
Contributor Author

my latter comment here about f_opendir is addressed via #65

I've not investigated the f_open issue any further at this time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant