DirectDownload ignores close-time write failures
Summary¶
DirectDownload::DownloadUrlToFile checks each _write, but it ignores the
final _close result. Some filesystems and volumes can report delayed write,
flush, or quota failures only at close time. The current code can therefore
report a downloaded update artifact as successful even when final persistence
failed.
This blocks Beta 0.7.3 for release update inputs because failed or partial downloaded artifacts must not be promoted as valid.
Evidence¶
srchybrid/DirectDownload.cpp:111opens the target with CRT write-only file APIs.srchybrid/DirectDownload.cpp:128checks short or failed_writecalls.srchybrid/DirectDownload.cpp:136calls_close(fdOut)and ignores the return value.srchybrid/DirectDownload.cpp:138deletes the target only when earlier loop logic setbSuccessfalse.
Execution Plan¶
- Revalidate all callers of
DownloadUrlToFile, especially GeoLocation and IPFilter update flows. - Treat
_closefailure as a download failure and preserve the existing temporary-file cleanup behavior. - Capture the correct close-time
errnobefore any cleanup can overwrite it. - Ensure an empty or failed artifact is not promoted by callers.
- Add focused seam coverage for successful write plus failed close.
- Re-run GeoLocation/IPFilter update-related tests and the smallest relevant app validation.
Acceptance Criteria¶
- Close-time persistence failure returns
falsefromDownloadUrlToFile. - Failed artifacts are deleted like earlier read/write failures.
- Error text preserves enough detail to diagnose full disk, quota, or volume failure.
- Existing successful download behavior is unchanged.
Validation¶
- 2026-05-08: Done in app commit
c237d48. python -m emule_workspace build app --workspace-root . --config Release --platform x64 --variant mainpassed; log rootworkspaces\v0.72a\state\build-logs\20260508-095637.python -m emule_workspace build tests --workspace-root . --config Release --platform x64 --test-run-variant mainpassed; log rootworkspaces\v0.72a\state\build-logs\20260508-095657.python -m emule_workspace validate --workspace-root .passed.- Focused doctest passed:
repos\emulebb-build-tests\build\eMulebb-workspace-v0.72a-eMule-main\x64\Release\emule-tests.exe --test-suite=parity --test-case="IP-filter update seam rejects markup download payloads". - Code validation:
DirectDownload::DownloadUrlToFilenow treats_closefailure as a failed download and deletes the target like earlier read/write failures.