-
Notifications
You must be signed in to change notification settings - Fork 452
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
Assumptions on (fs::File).fullName() not being full #2781
Comments
LittleFS should not care if you try and I wouldn't mind a PR that prefixes a Could you give a small MCVE that shows the problem? That would help me track down what you're seeing and why... |
Thanks for your reply 👍 The context of my project is to compress LittleFS contents to a .tar.gz archive. That archive can eventually be decompressed on a chdir capable system, where the difference between relative and absolute paths may matter. It tried to prefix the I figured the So I was just misled by my habits with esp32 core. I thought the error was caused by the lack of leading slash, but it's not. It's still a good reminder to not expect perfect consistency across arduino cores :) Should I close this now that my assumptions are fixed? |
Thanks for the update. I'll close this one then. FWIW, accessing the filesystem in parallel from both cores is not going to work very well without much care. Like most libraries, the LittleFS lib doesn't explicitly support multicore parallel access. For example, one core could update the filesystem structures at the same time another is updating them, leading to corruption. If you protect all calls yourself (with a separate mutex so that only 1 core at a time calls anything which could update state), then it should work. But if you miss a mutex around a call it could cause corruption to the filesystem and a crash or data loss at some point later on. |
hi,
thanks for maintaining this 👍
A library project I'm working on uses Arduino's
fs::FS
andfs::File
as common grounds for RP2040, ESP32 and ESP8266, it implements a recursive directory parser to build a list of files and folders under a given path. That parser usesopenNextFile()
in a loop, and goes recursive when the returned item is a folder.Cross device portability is done with a couple of C macros that will use either
fs::File::path()
(ESP32) orfs::File::fullName()
(RP2040/ESP8266).Assumptions (mostly based on experiences with esp32):
When
rootdir = fs.open("/")
, anyfs::File
returned byrootdir.openNextFile()
should have its::fullName()
prefixed by/
.e.g. if
fs::File blah
exist and is in the root folder, thenblah.fullName()
should be/blah.txt
, notblah.txt
.I can't store
filename = file.fullName()
and use it later withfs.open(filename)
as it will produce afile not found
error.So I'm wondering if this is some legacy behaviour I should address by prefixing the
/
myself, or if this is a bug in LittleFS where/
should be prefixed to::fullName()
when the directory is/
.The text was updated successfully, but these errors were encountered: