Repository navigation
fix: content re-open reads only a regular file - #1646
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_textinvtab.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.txtis swapped, and the next statement reads its content. The swaps are a directory, a device symlink (/dev/null;\\.\NULon Windows), and a FIFO on Unix.packages/rust/tests/path_table_content_non_regular_e2e.rs(CLI e2e): a worker function swapsd/b.txtpartway through a singledirsql query.path_table_content_non_regularfails withleft: [("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 aNULsymlink there gives no content.E2E Verification
contentre-open)path_table_content_non_regular_e2e,path_table_content_prefetch)packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)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_prefetchd/b.txtpartway through the query for a FIFO, a/dev/zerosymlink, a/dev/nullsymlink or a directory. Each run returnscontent: nulland exits 0. Before the fix, the FIFO hung and/dev/zerowas OOM-killed.Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (or:skip-changelogtrailer on a commit with reason)<root>/<pkg>/migrations.d/for each changed package (every subsection but Summary_None._when nothing breaks)