Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can not delete open file #178

Open
voedipus opened this issue Feb 22, 2024 · 3 comments
Open

Can not delete open file #178

voedipus opened this issue Feb 22, 2024 · 3 comments

Comments

@voedipus
Copy link

What is the reason for this?

if(esp_littlefs_get_fd_by_name(efs, path) >= 0) {

@BrianPugh
Copy link
Member

I'm not sure the exact inner workings of littlefs, but I imagine writing/reading from a deleted file may lead to corrupt results (either in memory, or on disk).

@voedipus
Copy link
Author

I'm not sure the exact inner workings of littlefs, but I imagine writing/reading from a deleted file may lead to corrupt results (either in memory, or on disk).

No. I open a file on STM32 and without closing the file delete it. No data is corrupted. But in this wrapper it is not possible to delete file without closing it first.

@BrianPugh
Copy link
Member

So from your experience, and this comment by geky, it seems like it might be ok?

Would you be available to open up a PR along with a unit test for this?

I worry that some logic in vfs_littlefs_close will also need to be changed. For example, if a file is deleted before it's closed, the file handle can never be forfeited with the current logic. Maybe the filehandle also needs to be freed in the error-handling logic.

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

No branches or pull requests

2 participants