On macOS, files cp writes are not recorded as outputs, although fspy swaps cp for its bundled coreutils
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start with crates/fspy_shared_unix/src/spawn/macos.rs and the linked COREUTILS_FUNCTIONS entry, then trace how the preload records filesystem reads and writes. Check interception coverage for clonefile, clonefileat, fclonefileat, and copyfile; reproduce with the cp task described in the issue. Done means copied destinations are recorded as outputs and restored on a cache hit.
由索引模型根據 Issue 內容生成。
描述
Written by an AI agent (Claude) on behalf of @jasonkuhrt.
Problem
On macOS, a task that copies files into place with cp gets a cache entry without them, so a cache hit restores nothing.
fspy already swaps /bin/cp for its bundled coreutils so that copies can be tracked (spawn/macos.rs, COREUTILS_FUNCTIONS), and the swap does happen: inside vp run, cp --version prints cp (uutils coreutils) 0.4.0. But cp's writes still aren't recorded, while those of other swapped tools are.
Reproduction on vite-plus 1.4.0, macOS, APFS, with no remote cache:
// vite.config.ts
import { defineConfig } from 'vite-plus';
export default defineConfig({
run: {
tasks: {
generate: {
command: 'node generate.mjs',
cache: { input: ['generate.mjs'] },
},
},
},
});
// generate.mjs: makes a file in the OS temp folder, then copies it into place
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { execFileSync } from 'node:child_process';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
const t = mkdtempSync(join(tmpdir(), 'gen-'));
writeFileSync(join(t, 'a.ts'), 'export const a = 1;\n');
rmSync('generated', { recursive: true, force: true });
mkdirSync('generated');
execFileSync('cp', [join(t, 'a.ts'), 'generated/a.ts']);
$ vp run generate # generated/a.ts now exists
$ ls node_modules/.vite/task-cache/v18/*.tar.zst
ls: no matches found # no output archive was stored
$ rm -rf generated
$ vp run generate
vp run: cache hit, 103ms saved.
$ ls generated
ls: generated: No such file or directory
The same task, with only the line that puts generated/a.ts in place changed:
How generated/a.ts gets there |
Recorded as output |
|---|---|
fs.copyFileSync (Node) |
yes |
sh -c 'cat "$0" > generated/a.ts' (swapped shell) |
yes |
mkdir + touch (swapped coreutils) |
yes |
Homebrew python3 shutil.copytree |
yes |
cp src generated/a.ts (swapped coreutils) |
no |
cp -R src_dir generated |
no |
cp -R --reflink=never src_dir generated |
no |
Cause
The swapped cp creates its destination with clonefile(src, dst, 0), which the preload doesn't intercept; std::fs::copy's fallback, fclonefileat, isn't intercepted either. Evidence and experiments: see the first comment.
Proposal
Record the source of the macOS clone and copy calls as a read and the destination as a write: clonefile, clonefileat, fclonefileat, and copyfile. That fixes the swapped cp, and any other tool that copies the same way.
Related: #908 (files renamed into place aren't recorded either).
- 主要語言
- Rust
- 星號
- 485
- 分支
- 51
- 平均合併
- 1 天 5 小時
- 30 天內合併 PR
- 63
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
voidzero-dev/vite-task 的其他 Issue
-
難度 5/5 一週以上 新手友好度 35/100
voidzero-dev/vite-task#921 ·
維護者通常 1 天內回覆
-
Automatic output tracking misses files a task renames into place, so a cache hit restores nothing未關閉
難度 4/5 3-5 天 新手友好度 48/100
voidzero-dev/vite-task#908 ·
維護者通常 1 天內回覆
-
Export OpenTelemetry client spans for the native remote cache可能已有人在做 @jasonkuhrt 於 2 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 25/100
voidzero-dev/vite-task#906 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 56/100
voidzero-dev/vite-task#905 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 55/100
voidzero-dev/vite-task#904 ·
維護者通常 1 天內回覆
查看 voidzero-dev/vite-task 的全部 Issue
相似的 Issue
-
auto:doc-drift auto:producer
難度 2/5 1-3 小時 新手友好度 60/100
fritzprix/libr-agent#2458 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
yantrikos/yantrik-os#1048 ·
維護者通常 1 天內回覆
-
rust
難度 2/5 1-3 小時 新手友好度 80/100
vllm-project/vllm#64939 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆