Skip to content

fix(FSCommon): add nRF52 LittleFS empty-name guard to getFiles()#10757

Merged
thebentern merged 4 commits into
masterfrom
copilot/fix-review-comment-3448366070
Jun 23, 2026
Merged

fix(FSCommon): add nRF52 LittleFS empty-name guard to getFiles()#10757
thebentern merged 4 commits into
masterfrom
copilot/fix-review-comment-3448366070

Conversation

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

getFiles() iterated with while (file) without the file.name()[0] guard that listDir() already uses to work around the Adafruit LittleFS nRF52 glue bug (issue 4395), where openNextFile() can return a File with an empty name. This could cause empty-name entries to be pushed into results and the loop to spin until maxCount was exhausted.

Changes

  • src/FSCommon.cpp — updated the loop condition in getFiles() to match listDir():
// Before
while (file) {

// After
while (file && file.name()[0]) { // file.name()[0] check is a workaround for a bug in the Adafruit LittleFS nrf52 glue (see issue 4395)

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

Copilot AI changed the title [WIP] Fix code based on review comment 3448366070 fix(FSCommon): add nRF52 LittleFS empty-name guard to getFiles() Jun 21, 2026
Copilot AI requested a review from thebentern June 21, 2026 12:39
@thebentern thebentern marked this pull request as ready for review June 21, 2026 12:58
@thebentern

Copy link
Copy Markdown
Contributor

@copilot trunk fmt

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot trunk fmt

Done — ran clang-format on src/FSCommon.cpp in 3dc8ab4.

Copilot AI requested a review from thebentern June 23, 2026 11:19
@thebentern thebentern merged commit e4c1374 into master Jun 23, 2026
1 of 3 checks passed
@thebentern thebentern deleted the copilot/fix-review-comment-3448366070 branch June 23, 2026 11:23
thebentern added a commit that referenced this pull request Jun 24, 2026
… getFiles (#10778)

Forward-port of #10754 and #10757 from master (2.7) into develop, so the
develop->master 2.8 promotion (#10777) doesn't drop them.

#10754: PhoneAPI no longer walks the filesystem to build the file manifest on
node-info-only config requests (SPECIAL_NONCE_ONLY_NODES), which never consume
it. getFiles() is now bounded (default 64 entries, depth 3) via collectFiles(),
takes an optional wasLimited out-param, and reserves capacity with a bad_alloc/
length_error fallback. The manifest vector is freed via swap (releaseFilesManifest).

#10757: getFiles()/collectFiles() now guard against empty file names returned by
the Adafruit LittleFS nRF52 glue (issue 4395).

Ported by hand rather than cherry-picked: master had reflowed FSCommon.cpp to a
different brace style (every line conflicted), #10754 already subsumes #10757,
and develop carries a MESHTASTIC_EXCLUDE_FILES_MANIFEST path (nRF54L15) that
master lacks. The exclude path is preserved and now also short-circuits + frees
the manifest. Verified: native Docker suite 448/448, clang-format clean.
raghumad pushed a commit to raghumad/mezulla-firmware that referenced this pull request Jun 25, 2026
… getFiles (meshtastic#10778)

Forward-port of meshtastic#10754 and meshtastic#10757 from master (2.7) into develop, so the
develop->master 2.8 promotion (meshtastic#10777) doesn't drop them.

meshtastic#10754: PhoneAPI no longer walks the filesystem to build the file manifest on
node-info-only config requests (SPECIAL_NONCE_ONLY_NODES), which never consume
it. getFiles() is now bounded (default 64 entries, depth 3) via collectFiles(),
takes an optional wasLimited out-param, and reserves capacity with a bad_alloc/
length_error fallback. The manifest vector is freed via swap (releaseFilesManifest).

meshtastic#10757: getFiles()/collectFiles() now guard against empty file names returned by
the Adafruit LittleFS nRF52 glue (issue 4395).

Ported by hand rather than cherry-picked: master had reflowed FSCommon.cpp to a
different brace style (every line conflicted), meshtastic#10754 already subsumes meshtastic#10757,
and develop carries a MESHTASTIC_EXCLUDE_FILES_MANIFEST path (nRF54L15) that
master lacks. The exclude path is preserved and now also short-circuits + frees
the manifest. Verified: native Docker suite 448/448, clang-format clean.
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

Successfully merging this pull request may close these issues.

2 participants