Skip to content

Fixed stale first clusters in already-open FileX readers - #116

Draft
fdesbiens wants to merge 1 commit into
eclipse-threadx:devfrom
fdesbiens:fix/open-read-first-cluster
Draft

fdesbiens wants to merge 1 commit into
eclipse-threadx:devfrom
fdesbiens:fix/open-read-first-cluster

Conversation

@fdesbiens

Copy link
Copy Markdown
Contributor

Fixes #97

When a writer allocates a zero-length file's first cluster, FileX updates other open handles but leaves their first cluster at zero. A later seek uses that stale value and reads the wrong sector.

Copy the first cluster when initializing other handles opened before the allocation. A RAM-disk regression checks ordinary and fast readers after seeking, and CTest now recognizes failures reported by its standalone test harness. @rahmanih, please review this PR; I am happy to change the approach if you disagree.

GCC 14 CMake/Ninja: the regression failed on dev and passed in ThreadX, standalone, no-cache, and fault-tolerant builds with the fix. Three existing read/write and seek regressions passed. The new assignment was exercised. No hardware test.

Fixes eclipse-threadx#97

When a writer allocates a zero-length file's first cluster, FileX updates
other open handles but leaves their first cluster at zero. A later seek uses
that stale value and reads the wrong sector.

Copy the first cluster when initializing other handles opened before the
allocation. Add a RAM-disk regression for ordinary and fast readers, and make
CTest recognize failures reported by its standalone test harness.

GCC 14 CMake/Ninja: the regression failed on dev and passed in four build
configurations with the fix. Three existing read/write and seek regressions
passed. The new assignment was exercised. No hardware test.

Assisted-by: Codex (GPT-6-Sol) <noreply@openai.com>
@fdesbiens
fdesbiens requested a review from rahmanih September 30, 2026 20:27

This branch has not been deployed

No deployments
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.

1 participant