Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Skill folder import: open files on macOS with O_NOFOLLOW_ANY alone, which Darwin refuses together with O_NOFOLLOW

milind-soni160f64671331
diff --git a/electron/skill-folder-import.mjs b/electron/skill-folder-import.mjs
index 180566d4de..b710ca9c15 100644
--- a/electron/skill-folder-import.mjs
+++ b/electron/skill-folder-import.mjs
@@ -5,9 +5,10 @@ import { join } from "node:path";
import { planSkillFolder, SKILL_FOLDER_LIMITS, SKILL_IMPORT_SKIP_REPORT_MAX, skillFilePathProblem } from "./skill-folder-plan.mjs";
const MAX_ENTRIES = 4096;
-// Darwin rejects links in every path component with O_NOFOLLOW_ANY.
-const NOFOLLOW_ANY = process.platform === "darwin" ? 0x20000000 : 0;
-const OPEN_FILE = NOFOLLOW_ANY | constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0);
+// Darwin rejects links in every path component with O_NOFOLLOW_ANY (Node omits it), and refuses it together with
+// O_NOFOLLOW (EINVAL), so it takes O_NOFOLLOW's place there.
+const O_NOFOLLOW_ANY = 0x20000000;
+const OPEN_FILE = constants.O_RDONLY | (constants.O_NONBLOCK ?? 0) | (process.platform === "darwin" ? O_NOFOLLOW_ANY : (constants.O_NOFOLLOW ?? 0));
async function selectedFile(target, expected) {
const file = await open(target, OPEN_FILE);