@ai-ecoverse/slicc-kernel 1.32.1 → 1.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -781,6 +781,7 @@ function createNodeOps(h) {
781
781
  }
782
782
  const path = liveNodePath(node);
783
783
  if (attr2.mode !== void 0 && attr2.mode !== null) {
784
+ if (Fs.isLink(node.mode)) throw new Fs.ErrnoError(wasiErrno("EOPNOTSUPP"));
784
785
  const perm = attr2.mode & PERM_MASK;
785
786
  if (perm !== (node.mode & PERM_MASK)) {
786
787
  metadataCall(() => bridgeOf(node).chmod(path, perm));
@@ -2086,6 +2087,12 @@ function wrapCloexecSyscalls(imports, glue, deps) {
2086
2087
  }
2087
2088
  }
2088
2089
  }
2090
+ function pathOpensLinks(Fs) {
2091
+ const fs = Fs;
2092
+ const { mayOpen, isLink } = fs;
2093
+ if (!mayOpen || !isLink) return;
2094
+ fs.mayOpen = (node, flags) => flags & O_PATH && isLink.call(fs, node.mode) ? 0 : mayOpen.call(fs, node, flags);
2095
+ }
2089
2096
  function noFollowUtimes(imports, fs, glue) {
2090
2097
  for (const namespace of namespaces(imports)) {
2091
2098
  const key = Object.keys(namespace).find(
@@ -2403,7 +2410,7 @@ function useMounts(Fs, env = {}, live = false) {
2403
2410
  }
2404
2411
  };
2405
2412
  }
2406
- var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE, O_CREAT2, field, NAME;
2413
+ var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE, O_CREAT2, field, NAME;
2407
2414
  var init_process_fds = __esm({
2408
2415
  "src/process/process-fds.ts"() {
2409
2416
  "use strict";
@@ -2430,6 +2437,7 @@ var init_process_fds = __esm({
2430
2437
  EBADF = 8;
2431
2438
  AT_SYMLINK_NOFOLLOW = 256;
2432
2439
  EMSCRIPTEN_EPERM = 63;
2440
+ O_PATH = 2097152;
2433
2441
  DIR_MODE = 16749;
2434
2442
  LINK_MODE = 41408;
2435
2443
  CHAR_DEVICE = 8630;
@@ -3750,6 +3758,7 @@ async function runWasmProcess(init, port, deps = {}) {
3750
3758
  if (!hasStreams(m)) return;
3751
3759
  const fs = m.FS;
3752
3760
  trackCloseOnExec(fs);
3761
+ pathOpensLinks(fs);
3753
3762
  try {
3754
3763
  fs.mkdirTree(init.cwd);
3755
3764
  fs.chdir(init.cwd);