Files
ElyOffice/tasks/reviews/R3.1-r1.md
T

2.0 KiB

FAIL

  1. [P1] crates/ely-files/src/save.rs:195; crates/ely-office/src/save.rs:24 — Simplifying the parent before joining a missing filename can change which file the completed path names. On Windows, with guard.md open, exporting to the nonexistent extended path \\?\C:\…\guard.md returns success and overwrites guard.md: the parent loses its prefix, Win32 trims the filename's trailing space, and same_file incorrectly returns false. The intended literal target never exists. This violates FILE-06. The same branch also fails to save a new 273-UTF-16-unit path whose parent is short enough to simplify, violating FILE-09. Both scenarios reproduced against the rebuilt library; the original canonical-parent algorithm preserves the open file and successfully writes the long target. Preserve extended-path semantics until the complete prospective target is formed, then simplify only when the complete path is safe, in both helpers. Add Windows regression tests for the overwrite and new long target. Evidence: .work/R3.1-probe.log.

  2. [P2] crates/ely-files/src/save.rs:186 — Simplifying an existing target also breaks atomic saves when its sibling staging filename crosses Windows' path limit. Reproduced with a 250-UTF-16-unit directory and existing a.md (255 units total): save_atomic returns OS error 3, although the original algorithm succeeds. The target is short enough for dunce to strip its prefix, but tempfile's .tmp plus six random characters makes the staging path 261 units; tempfile passes that unprefixed path directly to SetFileAttributesW during persistence. This affects ordinary saves and autosaves of existing documents (FILE-04/FILE-09), independently of the missing-target branch. Ensure the complete staging and destination paths used by Win32 persistence retain extended syntax whenever required, while keeping displayed paths simplified. Add a Windows regression test with an existing short filename in a directory near this limit. Evidence: .work/R3.1-probe.log, existing_short_file_in_long_directory_keeps_saving.