mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
fix(core): fall back to a direct write when link() is denied with EACCES (#7474)
* fix(core): fall back to a direct write when link() is denied with EACCES On Android app data (Termux, SELinux enforcing), link(2) fails with EACCES in a folder the temp file was just written to. createFileAtomically() and the studio history owner lock treated that as fatal, so `hyperframes init` left a half-scaffolded project and every render logged a recordRenderSuccess failure. Both now take their existing exclusive direct-write path, as they already do for EPERM. Fixes #7473 * fix(share): treat EACCES as no hard links in the project share lock Same Termux/SELinux link() denial as core and the studio history lock: the share lock's link-then-exclusive-create fallback now covers it too. Folds the Android note into the existing comment so no file's comment share rises.
This commit is contained in:
@@ -242,7 +242,7 @@ describe("createFileAtomically", () => {
|
||||
};
|
||||
}
|
||||
|
||||
it.each(["EPERM", "ENOTSUP", "EOPNOTSUPP", "EXDEV", "EISDIR"])(
|
||||
it.each(["EPERM", "ENOTSUP", "EOPNOTSUPP", "EXDEV", "EISDIR", "EACCES"])(
|
||||
"writes directly on a volume without hard links (%s)",
|
||||
(code) => {
|
||||
const dir = tempDir();
|
||||
|
||||
@@ -7,9 +7,9 @@ import { renameWithRetry } from "./renameWithRetry.js";
|
||||
type SiblingFileSystem = Pick<typeof fs, "writeFileSync" | "chmodSync" | "unlinkSync">;
|
||||
type DirectFileSystem = SiblingFileSystem & Pick<typeof fs, "openSync" | "closeSync">;
|
||||
|
||||
// Codes a volume without hard links (FAT, exFAT, some network shares) answers link() with.
|
||||
// Codes a volume without hard links (FAT, exFAT, some network shares, Android app data) answers link() with.
|
||||
// EISDIR: libuv maps Windows ERROR_INVALID_FUNCTION (FAT/exFAT refusing a link) to it; nodejs/node#65817.
|
||||
const NO_HARD_LINKS = new Set(["EPERM", "ENOTSUP", "EOPNOTSUPP", "EXDEV", "EISDIR"]);
|
||||
const NO_HARD_LINKS = new Set(["EPERM", "ENOTSUP", "EOPNOTSUPP", "EXDEV", "EISDIR", "EACCES"]);
|
||||
const MAX_LINK_HOPS = 40;
|
||||
const TEMP_NAME_TRIES = 3;
|
||||
const TEMP_SUFFIX = /\.hf[0-9a-f]{6}\.tmp$/;
|
||||
|
||||
@@ -95,7 +95,7 @@ function withoutHardLinks(code = "ENOTSUP"): void {
|
||||
}
|
||||
|
||||
describe("takeHistoryOwnership on a drive without hard links", () => {
|
||||
it.each(["ENOTSUP", "EOPNOTSUPP", "ENOSYS", "EPERM"])(
|
||||
it.each(["ENOTSUP", "EOPNOTSUPP", "ENOSYS", "EPERM", "EACCES"])(
|
||||
"takes the lock when linking fails with %s",
|
||||
async (code) => {
|
||||
withoutHardLinks(code);
|
||||
|
||||
@@ -16,7 +16,7 @@ export class HistoryBusyError extends Error {
|
||||
}
|
||||
|
||||
const WINDOWS_BUSY = new Set(["EPERM", "EBUSY", "EACCES"]);
|
||||
const NO_HARD_LINKS = new Set(["ENOTSUP", "EOPNOTSUPP", "ENOSYS", "EPERM"]);
|
||||
const NO_HARD_LINKS = new Set(["ENOTSUP", "EOPNOTSUPP", "ENOSYS", "EPERM", "EACCES"]);
|
||||
const TAKING_MS = 2_000;
|
||||
const BOOT_SLACK_MS = 60_000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user