Skip to content

paths: size the thread-local join output buffers to MAX_PATH_BYTES on Windows - #36340

Open
robobun wants to merge 8 commits into
mainfrom
farm/81bdda88/join-buf-windows-max-path
Open

paths: size the thread-local join output buffers to MAX_PATH_BYTES on Windows#36340
robobun wants to merge 8 commits into
mainfrom
farm/81bdda88/join-buf-windows-max-path

ffi: report ENAMETOOLONG instead of stale dlerror when the fallback i…

04a8f09
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 29, 2026 in 21m 59s

Code review found 1 potential issue

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

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/ffi/ffi_body.rs:1503-1515 dlopen fallback overwrites last_err with ENAMETOOLONG, discarding valid dlerror() from first attempt

Annotations

Check warning on line 1515 in src/runtime/ffi/ffi_body.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

dlopen fallback overwrites last_err with ENAMETOOLONG, discarding valid dlerror() from first attempt

On macOS/BSD (`MAX_PATH_BYTES = 1024`, `TL_JOIN_BUF_LEN = 4096`), a short library name whose `abs()` result lands in `[1024, 4096)` makes the fallback `DynLib::open` short-circuit with `ENAMETOOLONG` without calling the loader — overwriting `last_err` and reporting `"file name too long"` for what the user typed as a ~20-byte name, discarding the still-fresh `dlerror()` from the first attempt. Pre-04a8f090 called `get_dl_error()` unconditionally and correctly returned that message, so this is a (