Skip to content

fix: content re-open reads only a regular file - #1646

Merged
thekevinbot merged 5 commits into
mainfrom
bot/1585-content-regular-file-1104
Nov 5, 2026
Merged

thekevinbot merged 5 commits into
mainfrom
bot/1585-content-regular-file-1104

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1585

Content is read by re-opening the path the scan found. If a FIFO or a device replaced the file between the scan and the read, the read blocked forever (FIFO) or never reached an end (/dev/zero). Now the re-open is non-blocking and checks the opened handle is a regular file. Anything else gives NULL content, the same as a file deleted in that window.

Sibling: #1584 (oversize file to NULL) also touches read_text in vtab.rs. This PR leaves the size handling alone.

Tests (red first)

  • packages/rust/tests/path_table_content_non_regular.rs (integration): the scan runs in one statement, b.txt is swapped, and the next statement reads its content. The swaps are a directory, a device symlink (/dev/null; \\.\NUL on Windows), and a FIFO on Unix.
  • packages/rust/tests/path_table_content_non_regular_e2e.rs (CLI e2e): a worker function swaps d/b.txt partway through a single dirsql query.
  • Red CI run (red-test commit): https://github.com/thekevinscott/dirsql/actions/runs/41924028186/job/126903600358. On Linux, path_table_content_non_regular fails with left: [("directory", Some(None)), ("device", Some(Some(""))), ("fifo", None)]: the device reads as "" and the FIFO read never returns. On Windows both new tests already pass, because opening a directory or a NUL symlink there gives no content.

E2E Verification

  • Ran e2e suites locally for every affected SDK (the content-reading tests only; the fix is confined to the content re-open)
  • Python SDK e2e: pass (17 passed)
  • TypeScript SDK e2e: pass (16 passed)
  • Rust core e2e (if applicable): pass (path_table_content_non_regular_e2e, path_table_content_prefetch)
  • packages/python/e2e-attestations/<branch>.json receipt written if packages/python changed (just e2e-attest-python)
  • packages/ts/e2e-attestations/<branch>.json receipt written if packages/ts changed (just e2e-attest-ts)
  • Command(s) run: uv run maturin develop --release; cargo build --release -p dirsql --features cli; testing-conventions e2e attest 'uv run python -m pytest tests/e2e/fresh_declared_repros_test.py tests/e2e/query_contract_test.py tests/e2e/root_at_construction_test.py -x -q'; pnpm build; testing-conventions e2e attest 'pnpm exec vitest run --dir tests/e2e fresh-declared-repros query-contract query-params'; cargo test -p dirsql --features cli --test path_table_content_non_regular --test path_table_content_non_regular_e2e --test path_table_content_prefetch
  • Result summary: all pass. Checked by hand with the release binary: a worker swaps d/b.txt partway through the query for a FIFO, a /dev/zero symlink, a /dev/null symlink or a directory. Each run returns content: null and exits 0. Before the fix, the FIFO hung and /dev/zero was OOM-killed.

Changelog / Migrations

  • Changelog fragment added under <root>/<pkg>/changelog.d/ for each changed package (or: skip-changelog trailer on a commit with reason)
  • Migration fragment with the same slug added under <root>/<pkg>/migrations.d/ for each changed package (every subsection but Summary _None._ when nothing breaks)

@thekevinbot
thekevinbot merged commit 4a62374 into main Nov 5, 2026
102 of 104 checks passed
@thekevinbot
thekevinbot deleted the bot/1585-content-regular-file-1104 branch November 5, 2026 02:28
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.

Check content re-open is a regular file; FIFO swap hangs, /dev/zero OOMs

1 participant