Windows: `scriptc build` in a OneDrive-synced folder can exit 1 with `EPERM: rmdir '.scriptc-native-<id>\input'` after the executable was already written
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
- 领域
- build-system, devtools
调研方向
从 packages/compiler/src/native/compiler.ts 开始,报告将其列为暂存区清理的入口点;阅读 finally 块和附近对 .scriptc-library- 的清理代码。在 Windows 上的 OneDrive 同步文件夹中使用冷缓存复现,然后验证即使清理时遇到临时锁,成功的构建仍以退出码 0 结束,并且清理失败不会留下错误级别的构建结果。
由索引模型根据 Issue 内容生成。
描述
Disclosure: this report was produced with the help of an AI agent (Claude Code). The agent wrote the test program, ran every command shown, and drafted this text; a human reviewed it and decided to file it. The commands and outputs are real runs.
Environment: scriptc 0.4.14 and 0.4.5 (npm install -g scriptc, Node 24.22.1; 0.4.5 also from the standalone win32-x64-msvc archive), Windows 11 Pro 10.0.26100 x64, Zig 0.16.0 as the linker. The project folder is under C:\Users\<me>\OneDrive\Desktop\..., i.e. inside a OneDrive-synced tree.
What happens
The build compiles and links, writes the executable, and then fails while removing its own staging directory:
$ cd C:\Users\<me>\OneDrive\Desktop\tools\Claude-Usage-Monitor\daemon
$ scriptc build usage-daemon.ts -o usage-daemon.exe
scriptc: EPERM: operation not permitted, rmdir 'C:\Users\<me>\OneDrive\Desktop\tools\Claude-Usage-Monitor\daemon\.scriptc-native-3xha7w\input'
$ echo %ERRORLEVEL%
1
$ dir /b
.scriptc-native-3xha7w
usage-daemon.exe
...
usage-daemon.exe is complete and runs correctly (its output matches node usage-daemon.ts byte-for-byte across 20 differential cases). The failed cleanup turns a successful build into exit code 1 and leaves .scriptc-native-<id>/ behind in the project.
The program is a ~300-line typed Node program (fetch, node:http, timers); nothing about it is special.
How often
Each row is a build with SCRIPTC_CACHE_DIR pointed at a new empty directory, same source, same Zig:
| scriptc | Folder | Builds | Failed with EPERM |
|---|---|---|---|
| 0.4.5 | OneDrive-synced | 3 | 3 |
| 0.4.5 | %LOCALAPPDATA%\Temp\... (not synced) |
2 | 0 |
| 0.4.14 | OneDrive-synced | 9 | 1 (the first build after installing 0.4.14) |
| 0.4.14 | %LOCALAPPDATA%\Temp\... (not synced) |
2 | 0 |
Builds with a warm cache in the OneDrive folder passed every time (1/1 on 0.4.5, 4/4 on 0.4.14). So it is a race, it only shows up in the synced folder, and 0.4.14 hits it much less often than 0.4.5 did — on 0.4.5 the leftover staging directory also held runtime/artifacts/release/runtime/default/*.o and the .pdb, so there was more for the sync client to pick up.
Expected: a build whose executable was written and linked exits 0. If the staging directory can't be removed, a warning is enough.
Likely cause: the staging directory is created next to the output and removed in a finally with a single attempt (packages/compiler/src/native/compiler.ts on main):
stage = mkdtempSync(join(dirname(output), ".scriptc-native-"));
...
} finally {
if (stage !== null) rmSync(stage, { recursive: true, force: true });
When the output is in a synced folder, the OneDrive client can still hold a handle on a subdirectory whose files were just written, and rmdir on it returns EPERM on Windows. rmSync accepts maxRetries / retryDelay for exactly this (it retries EBUSY, EMFILE, ENFILE, ENOTEMPTY and EPERM), so rmSync(stage, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }) would likely be enough. The same pattern is used for the .scriptc-library- staging directory further down. Alternatively the staging directory could live under the system temp directory, or a failed removal could be downgraded to a warning.
Workarounds: build from a folder outside OneDrive, or run the build again.
- 主要语言
- TypeScript
- 星标
- 6.6k
- 派生
- 216
- 平均合并
- 9 小时 35 分钟
- 30 天内合并 PR
- 775
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vercel-labs/scriptc 的其他 Issue
-
Support undici 8.x request() through the built-in implementation可能已有人在做 @younggglcy 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
vercel-labs/scriptc#3894 ·
维护者通常 1 天内回复
-
A native program crashes with SIGSEGV when a string or JSON builder grows past 4 MiB可能已有人在做 @alantriesagain 于 5 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 22/100
vercel-labs/scriptc#3642 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 22/100
vercel-labs/scriptc#3613 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 42/100
vercel-labs/scriptc#3605 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 12/100
vercel-labs/scriptc#3595 ·
维护者通常 1 天内回复
查看 vercel-labs/scriptc 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
milind-soni/OpenMausBot#6730 ·
维护者通常 1 天内回复
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)未关闭area: @angular/build
难度 2/5 1-3 小时 新手友好度 65/100
angular/angular-cli#34764 ·
维护者通常 1 天内回复
-
status/need-triage
难度 2/5 1-3 小时 新手友好度 76/100
google-gemini/gemini-cli#30384 · 1 条评论 ·
维护者通常 1 天内回复
-
P2
难度 1/5 1 小时以内 新手友好度 84/100
维护者通常 1 天内回复
-
area:image documentation good first issue
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复