Skip to content

fix(fs): set RealFs mtime with FILE_WRITE_ATTRIBUTES on Windows - #2391

Merged
chaliy merged 1 commit into
mainfrom
fix-2388-touch-windows
Sep 10, 2026
Merged

chaliy merged 1 commit into
mainfrom
fix-2388-touch-windows

Conversation

@chaliy

@chaliy chaliy commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #2388.

What

Builtin touch failed on Windows with io error: Access denied (os error 5).
RealFs::set_modified_time opened the file read-only; Windows SetFileTime
requires FILE_WRITE_ATTRIBUTES on the handle (Unix futimens ignores the
fd open mode, so only Windows broke). The open now happens inside the blocking
worker with FILE_WRITE_ATTRIBUTES on Windows; the Unix path is unchanged.

Proof

Before: touch <file> on Windows -> os error 5 (see issue).
After:

  • New regression test realfs_touch_sets_mtime_issue_2388 (touch via
    Bash::exec on a RealFs mount, asserts exit 0 + mtime updated) passes.
  • Full realfs_tests suite green (43 passed), clippy/fmt clean on Linux,
    cargo check + clippy clean for x86_64-pc-windows-msvc.
  • windows-containment CI job now runs the touch test, so the fixed
    Windows code path is runtime-covered (previously only windows_containment
    filters ran there).

Note: just pre-pr locally shows one unrelated failure
(malformed_command_substitution_aborts_like_bash) caused by this sandbox's
bash 3.2 printing ab for echo 'a$(|)b'; main CI is green. Unrelated to
this diff (parser untouched).

Produced by yolop

Read-only open made SetFileTime fail with ERROR_ACCESS_DENIED,
breaking builtin touch on Windows. Open with FILE_WRITE_ATTRIBUTES
inside the blocking worker; Unix path unchanged.

Cover with realfs touch regression test and run it in the
windows-containment CI job. Fixes #2388.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit f495a4e Commit Preview URL

Branch Preview URL
Sep 10 2026, 08:04 PM

@chaliy
chaliy merged commit 16727ff into main Sep 10, 2026
43 checks passed
@chaliy
chaliy deleted the fix-2388-touch-windows branch September 10, 2026 20:40
@chaliy chaliy mentioned this pull request Sep 10, 2026
3 tasks
chaliy added a commit that referenced this pull request Sep 11, 2026
## What changed
Release preparation for v0.18.0: version bumped to 0.18.0 across Cargo
workspace, JS/WASM packages, and doc examples; CHANGELOG entry with
Highlights, Added, Fixed, Changed, and What's Changed for the 31 PRs
since v0.17.1.

Headliners: read-only filesystem mounts for host bindings (#2393) and
host-directory mounts over the C ABI (#2371), plus targeted correctness
fixes (awk lexer #2392, Windows RealFs mtime #2391, uutils drift #2385,
sqlite budgeting #2369, SVG docs #2368, russh 0.63.1 #2365).

## Why
Monthly minor release per release process.

## Before / After
No runtime behavior change in this PR itself — version metadata +
changelog only. `just release-check` running as the gate.

## Risk
- Low: version strings and changelog prose only.

## Checklist
- [x] Changelog entry added
- [x] Version bumped (Cargo, JS/WASM, docs)
- [ ] `just release-check` green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

built-in touch command returns io error: Access denied (os error 5) on Windows

1 participant