ESP32-PsRamFS icon indicating copy to clipboard operation
ESP32-PsRamFS copied to clipboard

Some directories do not delete

Open jfseaman opened this issue 1 year ago • 2 comments

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.

jfseaman avatar Aug 15 '24 04:08 jfseaman

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) 😅

tobozo avatar Aug 15 '24 09:08 tobozo

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.

jfseaman avatar Aug 16 '24 16:08 jfseaman