Read NuGet and Cargo crawler project files through the FIFO-safe reader (#592) - #602
Mikola Lysenko (mikolalysenko) wants to merge 5 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A FIFO planted in a checkout at obj/project.assets.json or at vendor/<crate>/Cargo.toml blocked open(2) forever, so scan, get and apply hung on that repository. The NuGet assets read, both Cargo crate-manifest reads and the Pipenv .venv read now go through the shared FIFO-safe readers in utils::fs; an unreadable entry is skipped exactly as before. Fixes #592. Assisted-by: Claude Code:claude-opus-5-5
An architecture test now fails when crawler production code reads a file with a bare read_to_string, fs::read or File::open, so the FIFO hang fixed for #592 cannot come back. The two machine-repository Maven POM reads are allowlisted by count. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
The timeout cleanup in the #592 FIFO regression tests opened the FIFO for writing in blocking mode. If no reader was blocked on it (the timeout had another cause), that open itself hung the suite. Open it with O_NONBLOCK so it fails with ENXIO instead. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
On a Windows core.autocrlf checkout the crawler guard's "#[cfg(test)]\nmod tests" marker never matched, so it counted a test-only Maven read as production code and failed the Windows test job. Normalize CRLF to LF before locating the test module. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a024719. Configure here.
|
[burn-down agent] Labeled Ready for review at
Generated by Claude Code |
|
Reviewed The four call-site changes preserve regular-file and symlink behavior while using the existing descriptor-based guard to reject FIFOs and other nonregular inputs. Errors still skip the affected entry, and discovery continues for readable siblings. The watchdog cleanup and CRLF-aware architecture guard also look correct. Validation: 517 crawler tests passed. Independent public-API tests passed 33 file-kind scenarios across Cargo, NuGet, and Pipenv; the CRLF guard control and two shared-reader contract tests also passed. These local checks ran on macOS; I did not rebuild the full CLI/network matrix. The exact head has 335 successful and seven skipped checks, a clean Bugbot review, and no unresolved threads. It merges cleanly with current main |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #592
Summary
A FIFO in a checkout at
obj/project.assets.json(NuGet) orvendor/<crate>/Cargo.toml(Cargo) blockedopen(2)forever, soscan,getandapplyhung on that repository. Those reads, and the Pipenv.venvread, now go through the shared FIFO-safe readers inutils::fs. A new architecture test stops crawler production code from using a bare file read again.Why (leverage)
doc/06-discovery-vex.md).redirect/mod.rs, Unify hosted NuGet routing and XML splice anchors #597), Vendored→hosted takeover drops the vendored ledger entry when the revert drift-keeps the artifact #568 (scan/hosted.rs, Fix hosted scan from a workspace member pinning nothing or the wrong files (#590, #417) #598) and E37 (vendor/cargo.rs, Fix hosted scan from a workspace member pinning nothing or the wrong files (#590, #417) #598).What changed
crawlers/nuget_crawler.rsparse_project_assets_package_folders:tokio::fs::read_to_string→utils::fs::read_regular_to_string.crawlers/cargo_crawler.rsverify_crate_at_path(find_by_purls):tokio::fs::read_to_string→read_regular_to_string.read_crate_cargo_toml(blocking-poolcrawl_all):std::fs::read_to_string→read_regular_to_string_sync.crawlers/python_crawler.rsPipenv.venv:std::fs::read_to_string→read_regular_to_string_sync. Before, only theis_file()check guarded this read, which left a TOCTOU window. The issue called this read out of scope, but the new guard needs it fixed; it is one line.crawlers/mod.rs:architecture_tests::crawlers_read_project_files_fifo_safelyfails on anyfs::read_to_string(,fs::read(orFile::open(in crawler production code. The only allowlisted reads are the two machine-repository Maven POM reads inmaven_crawler.rs, which NuGet and Cargo crawlers hang on a FIFO at obj/project.assets.json or vendor/<crate>/Cargo.toml #592 left out of scope.Deleted / diff
git diff --stat origin/main...HEAD: 4 files, +245 / −4.Behavior
None for regular files. Unreadable entries are still skipped. A non-regular file (FIFO, device, directory) at one of these paths is now skipped right away instead of hanging.
Test evidence
main's reads (the three call sites temporarily reverted on this branch):fifo_crate_manifest_is_skipped_not_blocked_onFAILED (5 s deadline);fifo_project_assets_is_skipped_not_blocked_onFAILED (5 s deadline);crawlers_read_project_files_fifo_safelyFAILED.cargo test -p socket-patch-core --lib -- crawlers: 516 passed.cargo test -p socket-patch-core --lib: 4843 passed. The 4 failures are the known root-sandbox ones that also fail onmain:copy_tree::relax_loop_must_not_traverse_symlinked_root,vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry,pypi_poetry::wire_write_failure_maps_error_and_leaves_lock_untouchedandpypi_requirements::wire_failure_rolls_back_already_written_files. They pass in CI.cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --all-featureswith--test in_process_scan,in_process_cargo_apply,crawl_fd_limit_e2e,e2e_nugetande2e_cargo: all green.a024719. Before that,ac9becefailed onlytest (windows-latest). On a CRLF checkout the guard's#[cfg(test)]\nmod testsmarker never matched, so it counted a test-only Maven read as production code. The fix is a024719, which normalizes CRLF first. Reproduced locally with a CRLFmaven_crawler.rs: before the fix it reports 3 reads against 2 allowed and fails; after, it passes.Bugbot round 1 found that the test watchdog's blocking writer open could hang the suite. That is fixed in ac9bece (
O_NONBLOCK), and later rounds, including one ona024719, are clean.Risk
Low. Four one-line call-site swaps onto readers that every other crawler already uses. The FIFO regression tests are
#[cfg(unix)]; the architecture guard runs on every platform.🤖 Generated with Claude Code
Generated by Claude Code