Skip to content

repl: ignore non-regular history files and only read the tail of large ones - #38217

Open
robobun wants to merge 2 commits into
mainfrom
farm/5171eed1/repl-history-hostile-files
Open

repl: ignore non-regular history files and only read the tail of large ones#38217
robobun wants to merge 2 commits into
mainfrom
farm/5171eed1/repl-history-hostile-files

test: derive the kept-entries slice from the constants

86ebf2c
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 13, 2026 in 15m 28s

Code review found 1 important issue

Found 2 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/runtime/cli/repl.rs:244-251 O_NONBLOCK on Windows opens history file as an asynchronous handle, breaking pread/write

Annotations

Check failure on line 251 in src/runtime/cli/repl.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

O_NONBLOCK on Windows opens history file as an asynchronous handle, breaking pread/write

On Windows, `sys::O::NONBLOCK` passed to `File::openat` makes `openat_windows_impl` drop `FILE_SYNCHRONOUS_IO_NONALERT` from `NtCreateFile`, so `open_file` now returns an *asynchronous* HANDLE — but `save()`'s `write_all` calls `WriteFile` with `lpOverlapped=NULL` and `load()`'s `pread_all` passes a stack-local `OVERLAPPED` whose SAFETY comment requires a synchronous handle. Before this PR both paths opened synchronous handles, so this regresses Windows history persistence (and the three new non