-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
file.seek problem #7323
Comments
It is legal to seek past the end of a file: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html You should be checking for error on the |
I understand, I will look at your link and better check what happens, if I can handle the error that returns. Thank you |
SPIFFS has limitations, that is one of several reasons it was deprecated. SPIFFS should NOT be considered a reference for compatibility. Instead, check that LittleFS is compliant with standard expected behavior for file handling, as linked above. |
How can I do this verification on LittleFS? |
I just checked and the SEEK function in SPIFFS returns 0 if it reaches the end of the file and 1 if it doesn't. |
Your expectation of fseek failing after end of file is not correct. As I said, SPIFFS is not the reference, it has issues and wrong behavior. |
I see, how can I solve this problem? Suggest me something? |
Fixes esp8266#7323 While I'm not a fan, the Arduino FileSeek API online shows that a seek() past EOF should return FALSE. https://www.arduino.cc/en/Reference/FileSeek SPIFFS and SDFS obey this, but LittleFS followed the POSIX standard or allowing seeks past EOF. Update LittleFS::seek() to follow the Arduino API and add tests for it.
After looking at this again I do have to grudgingly admit that |
Great! |
Fixes #7323 While I'm not a fan, the Arduino FileSeek API online shows that a seek() past EOF should return FALSE. https://www.arduino.cc/en/Reference/FileSeek SPIFFS and SDFS obey this, but LittleFS followed the POSIX standard or allowing seeks past EOF. Update LittleFS::seek() to follow the Arduino API and add tests for it.
Basic Infos
Platform
Settings in IDE
Problem Description
I have a project that uses the SPIFFS system, but now I have been informed that this system will be discontinued. So I switched to LittleFS.
However when doing this I have a problem with the SEEK function!
When using the function it is not working as expected!
I still don't understand what is happening, because it advances infinitely ...
Below I put 2 examples, one using SPIFFS and then LittleFS.
I don't know if this change affects other things.
INCREMENT FOREVER...
The text was updated successfully, but these errors were encountered: