




















@@ -470,6 +470,28 @@ describe("resolvePreferredOpenClawTmpDir", () => {
470470expect(warn).not.toHaveBeenCalled();
471471});
472472473+it("uses fallback when chmod loses a concurrent fallback repair race", () => {
474+const fallbackPath = fallbackTmp();
475+const chmodSync = vi.fn((target: string, mode: number) => {
476+if (target === fallbackPath && mode === 0o700) {
477+throw nodeErrorWithCode("EACCES");
478+}
479+});
480+const warn = vi.fn();
481+const states = [0o40777, 0o40777, 0o40700];
482+483+const resolved = resolveWithReadOnlyTmpFallback({
484+ fallbackPath,
485+fallbackLstatSync: vi.fn(() => makeDirStat({ mode: states.shift() ?? 0o40700 })),
486+ chmodSync,
487+ warn,
488+});
489+490+expect(resolved).toBe(fallbackPath);
491+expect(chmodSync).toHaveBeenCalledWith(fallbackPath, 0o700);
492+expect(warn).not.toHaveBeenCalled();
493+});
494+473495it("throws when the fallback directory cannot be created", () => {
474496expect(() =>
475497resolvePreferredOpenClawTmpDir({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。