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

Some directories do not delete #16

Open
jfseaman opened this issue Aug 15, 2024 · 2 comments
Open

Some directories do not delete #16

jfseaman opened this issue Aug 15, 2024 · 2 comments

Comments

@jfseaman
Copy link

Going to restate a little bite from previsus now to be closed issue #15.

I significantly altered the provided example to do stress testing. I made it run a loop from .begin to .end to find any leaks and determine robustness. Once an application level error was addressed. No leaks.

To the problem at hand...

I added code to delete all created files and directories. I found that some directories resist .rmdir. I tried several methods of exclusion to isolate the issue but have not found it.

Specifically, all files delete properly. some directories do not seem to respond to rmdir. These do not remove:
/this
/this/folder
/this/folder/does
/this/folder/does/really

My suspicion is a combination from PSRamFS_test.ino lines:
492: writeFile(PSRamFS, "/this/folder/does/not/exist/yet/goodbye.txt", "you say hello, I say goodbye"); // should succeed and create all subfolders
and
505: PSRamFS.rename("/this/folder/does/not", "/this/folder/does/really" );

I am writing a from scratch "sketch" to see if I can isolate the source in a smaller sketch or determine that it is application level with example.

@tobozo
Copy link
Owner

tobozo commented Aug 15, 2024

hi,

the description is consistent with the state of the code, folder implementation in pfs.c is incomplete

PSRamFS codebase initially reused directory support model from SPIFFS (see struct _pfs_dir_t) but openDir behaved strangely and the unit tests wouldn't pass; so a couple of changes were applied to add recursion but since SPIFFS directory model is flawed (which I didn't know at the time of writing the code) it only pushed the problems one level deeper.

then later I discovered that SPIFFS directory support is incomplete 🤦

as lame as it may sound, PSRamFS directory support is broken because the model it relies upon is flawed, and it can only be fixed by using a better model

obviously PSRamFS should use LittleFS directory model instead (i.e. struct lfs_mlist and lfs_info instead of _pfs_dir_t/_pfs_file_t linked lists), but this requires a massive refactoring of the vfs layer (pfs.c/pfs.h) 😅

@jfseaman
Copy link
Author

Thank you for creating and maintaining it. I am willing to help if you want.

The library is truly great to have, other options do not suit my needs.

The explanation works for me.

Converting to LittleFS model = large effort. Not sure if justified as my use case is not as complicated as the provided example even though I and deep diving into the library.

We can close this one.

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

2 participants