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

fix(littlefs): Use VFSImpl::exists() to avoid false error log #10217

Merged
merged 3 commits into from
Aug 30, 2024

Conversation

BlueAndi
Copy link
Contributor

@BlueAndi BlueAndi commented Aug 21, 2024

Description of Change

Use exists() from VFSImpl base class and avoid using open() to check whether the file exists, because open() will log an error in case a file doesn't exists which is confusing, but might be relevant in case a developer uses open() directly and expects that the file is there.

Related links

Closes #7615

@CLAassistant
Copy link

CLAassistant commented Aug 21, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

github-actions bot commented Aug 21, 2024

Messages
📖 You might consider squashing your 3 commits (simplifying branch history).

👋 Hello BlueAndi, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Addressing info messages (📖) is strongly recommended; they're less critical but valuable.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 22dfbfe

@BlueAndi BlueAndi changed the title [LittleFS] Use VFSImpl::exists() to avoid false error log fix(LittleFS): Use VFSImpl::exists() to avoid false error log Aug 21, 2024
Copy link
Contributor

github-actions bot commented Aug 21, 2024

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32S3💚 -840💚 -0.020.00000.000.00
ESP32S2💚 -760💚 -0.020.00000.000.00
ESP32C3💚 -480💚 -0.010.00000.000.00
ESP32C6💚 -480💚 -0.020.00000.000.00
ESP32H2💚 -500💚 -0.020.00000.000.00
ESP32💚 -840💚 -0.020.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
FFat/examples/FFat_Test💚 -560💚 -560000000💚 -560
FFat/examples/FFat_time💚 -560💚 -5600000--💚 -560
LittleFS/examples/LITTLEFS_test💚 -800💚 -720💚 -420💚 -420💚 -500💚 -800
LittleFS/examples/LITTLEFS_time💚 -840💚 -760💚 -480💚 -480--💚 -840

Copy link
Contributor

github-actions bot commented Aug 21, 2024

Test Results

 56 files   -  83   56 suites   - 83   4m 53s ⏱️ - 1h 37m 52s
 21 tests  -   9   21 ✅  -   9  0 💤 ±0  0 ❌ ±0 
135 runs   - 168  135 ✅  - 168  0 💤 ±0  0 ❌ ±0 

Results for commit 22dfbfe. ± Comparison against base commit 396def3.

This pull request removes 9 tests.
performance.coremark.test_coremark ‑ test_coremark
performance.fibonacci.test_fibonacci ‑ test_fibonacci
performance.psramspeed.test_psramspeed ‑ test_psramspeed
performance.ramspeed.test_ramspeed ‑ test_ramspeed
performance.superpi.test_superpi ‑ test_superpi
test_touch_errors
test_touch_interrtupt
test_touch_read
validation.periman.test_periman ‑ test_periman

♻️ This comment has been updated with latest results.

@BlueAndi BlueAndi force-pushed the master branch 2 times, most recently from dc67023 to cd80754 Compare August 21, 2024 23:34
@BlueAndi BlueAndi changed the title fix(LittleFS): Use VFSImpl::exists() to avoid false error log fix(littlefs): Use VFSImpl::exists() to avoid false error log Aug 21, 2024
@me-no-dev
Copy link
Member

I think the proper action here would be to make the error a warning or even debug.

@BlueAndi
Copy link
Contributor Author

I think the proper action here would be to make the error a warning or even debug.

This could be done additional. But I would not expext any log by using exists.

@me-no-dev
Copy link
Member

If you remove the method, then exists will stop functioning correctly. The log is there to let you know that the file was not found and will not be created. If the log is the issue, then that is where it should be fixed.

@igrr
Copy link
Member

igrr commented Aug 27, 2024

If you remove the method, then exists will stop functioning correctly.

Do you recall what is the issue with ::exists in the base class,

bool VFSImpl::exists(const char *fpath) {

for LittleFS?

@me-no-dev
Copy link
Member

I do not recall, because LittleFS was not implemented by us, but I see it being implemented much the same for the other file systems. Issue here seems the same as #6749 though for FFat. @lbernstone do you recall why FFat needs to open the file to check if it exists? If the issue is the error log, I do agree that it's a bit to much to issue an error, where a warning or even debug will suffice for the cases where one will need to get more information.

@VojtechBartoska VojtechBartoska added this to the 3.0.5 milestone Aug 28, 2024
@BlueAndi
Copy link
Contributor Author

If you remove the method, then exists will stop functioning correctly.

Didn't realize this in my tests. Whats exactly is the problem by using base class exists method?

@me-no-dev
Copy link
Member

@lucasssvaz can you please test this same solution with LittleFS, FFat and SPIFFS?

@ioviedodev
Copy link

I experiment the same issue in arduino esp32 version 3.0.4 as component idf with version 5.1.4

@aeljandro2
Copy link

Same here. Been struggling with the and then realized is just a log thing "Seems". Anyway I think supporting littleFS is kinda important.

@lucasssvaz
Copy link
Collaborator

@me-no-dev Tested for LittleFS, SPIFFS and FFat. This solution works for LittleFS and FFat. For SPIFFS this error does not appear and when trying this solution it causes exists() to always return true.

@me-no-dev me-no-dev added the Status: Pending Merge Pull Request is ready to be merged label Aug 30, 2024
@me-no-dev me-no-dev merged commit 019855f into espressif:master Aug 30, 2024
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Merge Pull Request is ready to be merged Status: Review needed Issue or PR is awaiting review
Projects
Development

Successfully merging this pull request may close these issues.

LittleFS.exists() is giving an error
8 participants