On macOS, files cp writes are not recorded as outputs, although fspy swaps cp for its bundled coreutils
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 56/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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).
- Vorherrschende Sprache
- Rust
- Sterne
- 480
- Forks
- 50
- Ø Merge
- 1 T. 5 Std.
- Gemergte PRs (30 T.)
- 63
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/vite-task
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
voidzero-dev/vite-task#921 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Automatic output tracking misses files a task renames into place, so a cache hit restores nothingOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
voidzero-dev/vite-task#908 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Export OpenTelemetry client spans for the native remote cacheEvtl. vergeben @jasonkuhrt hat das vor 1 Tag übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
voidzero-dev/vite-task#906 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 56/100
voidzero-dev/vite-task#905 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
voidzero-dev/vite-task#904 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/vite-task
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
penso/herdr-gpui#934 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Y-ASLant/ElegantClipboard#178 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
linxiv-dev/linXiv#384 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
priority middle
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
KATO-Hiro/AtCoderClans#12945 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug drawings ui
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
userFRM/egui-charts#1595 ·
Maintainer antworten meist innerhalb von 1 Tag