-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
rename() fails and file size 0. #60
Comments
I just tried the same application with the same workflow using spifFS. All files that littleFS reports as 0 in size are reported as 1024 bytes in size. |
The test for rename is here and works fine: https://github.com/joltwallet/esp_littlefs/blob/master/src/test/test_littlefs.c#L275 Do you have some odd concurrency going on? If your application is hanging inside |
Thanks a lot Brian, Due to the problems with rename(), I switched to spifFS, but as soon as I have time I'll go back to littleFS and try again. At the moment, I'm really not sure how can semaphore be taken and not released by some other file operation and how can rename() be affected by the file name string size (and it looks like it is). |
so I'm not sure if these are issues with my port, or just upstream littlefs. Here are few upstream issues that may be relevant: lfs_rename sometimes very slow I'll add more if i find them |
so i think i might know what the issue is, it's related to by not-to-spec negative return codes. will update later. |
Thanks a lot Brian. |
Alright, so i revamped some of the error handling in #75 ; there were some unforeseen bad interactions between my port and the esp vfs. I wasn't quite following the functions to spec; i now return exactly I imagine in your scenario I was previously returning a negative value (indicating an error), but Once you confirm this fixes your issue, i'll probably cut a new version in the next few days. |
Thank you very much Brian, but due to this problem I decided to switch to SpifFS so at the moment I'm not able to test your change. However, I will gladly find a "blank" ESP32 and run my software with LittleFS enabled instead of SpifFS. I'll certainly let you know how it goes. |
I just pushed a fix for a broken If your problem was exactly as described, I don't believe it would have caused your issues, but it could have if your destination was a folder that did not already exist. |
I'm going to mark this as resolved for now. If it isn't actually we can always re-open. |
Hi.
I have a problem renaming a file in littleFS.
Here is the simple code:
Why is the newName changed twice?
The first time it didn't work. The application would hang inside "rename" and there was no further debug output that should be there. After changing the code to a shorter newName, everything started working again. However, even the first "newName" is shorter than 32 characters, so I'm wondering what has happened and of course, how come that rename() function would completely and silently mess up the application? I also tried to skip calling rename() and in this case the rest of the application was executed correctly.
Output from the listed code:
Also, one more question.
Both stat() and fseek(end)/ftell show file size 0 for some small files that were opened in append mode, test appended with occasional flushing, closed, opened again in read mode, their content read and listed and then closed again.
Any ideas why?
Thanks a lot
The text was updated successfully, but these errors were encountered: