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

SPIFFS_eof() and SPIFFS_tell() return wrong value #72

Closed
ArtemPisarenko opened this issue Feb 29, 2016 · 2 comments
Closed

SPIFFS_eof() and SPIFFS_tell() return wrong value #72

ArtemPisarenko opened this issue Feb 29, 2016 · 2 comments

Comments

@ArtemPisarenko
Copy link

Two different cases.

  1. When SPIFFS_eof() called on just opened empty file, it returns 0.
    Debugging shows that fd->size = 0xFFFFFFFF at here, looking abnormal for me.
  2. When file opened with SPIFFS_APPEND, seeked to the middle and being written, calling SPIFFS_eof() returns 0 and calling SPIFFS_tell() returns value which would be in case if no SPIFFS_APPEND used.
@ArtemPisarenko ArtemPisarenko changed the title SPIFFS_eof() returns wrong value SPIFFS_eof() and SPIFFS_tell() return wrong value Feb 29, 2016
@pellepl
Copy link
Owner

pellepl commented Mar 1, 2016

Ok, thanks for reporting - I'll look into it.

Regarding length = 0xffffffff - this is valid for newly created files without content. Regard 0xffffffffff as 0. It is a minor optimization when actually writing something in the future. Instead of needing to allocate a new page,I just fill in the length. However, eof probably does not take this special case in account.

I remember I had to make something not so beautiful with file offsets when caches was created, I hope I can fix tell to be posix-compliant.

Anyhow, thanks again for reporting.

@ArtemPisarenko
Copy link
Author

Glad to help you with improvements. And thank YOU for such great work ! :)

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