@ai-ecoverse/slicc-kernel 1.146.5 → 1.146.7

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.
@@ -3221,13 +3221,7 @@ var OpfsFs = class {
3221
3221
  }
3222
3222
  }
3223
3223
  async place(handle, dir, name2, copies) {
3224
- const move = handle.move;
3225
- if (move) this.others++;
3226
- const moved2 = await move?.call(handle, dir, name2).then(
3227
- () => true,
3228
- () => false
3229
- );
3230
- if (moved2) return true;
3224
+ if (await this.moved(handle, dir, name2)) return true;
3231
3225
  const before = this.fileMoves;
3232
3226
  try {
3233
3227
  await this.copy(handle, dir, name2, copies);
@@ -3240,6 +3234,23 @@ var OpfsFs = class {
3240
3234
  return false;
3241
3235
  }
3242
3236
  fileMoves = 0;
3237
+ async moved(handle, dir, name2) {
3238
+ const move = handle.move;
3239
+ if (!move) return false;
3240
+ for (let attempt = 0; ; attempt++) {
3241
+ this.others++;
3242
+ const failed3 = await move.call(handle, dir, name2).then(
3243
+ () => void 0,
3244
+ (err) => ({ err })
3245
+ );
3246
+ if (!failed3) return true;
3247
+ const error = failed3.err?.name;
3248
+ if (handle.kind !== "file" || !LOCKED.has(error)) return false;
3249
+ const delay = SYNC_BACKOFF_MS[attempt];
3250
+ if (delay === void 0) throw fsError("EBUSY", name2);
3251
+ await new Promise((resolve2) => setTimeout(resolve2, delay));
3252
+ }
3253
+ }
3243
3254
  async copy(handle, dir, name2, copies, rest2 = "") {
3244
3255
  if (handle.kind === "file" && movable(handle)) {
3245
3256
  this.others++;
@@ -7774,7 +7785,7 @@ function satisfies(version, range2) {
7774
7785
  }
7775
7786
 
7776
7787
  // src/version.ts
7777
- var KERNEL_VERSION = true ? "1.146.5" : "0.0.0-dev";
7788
+ var KERNEL_VERSION = true ? "1.146.7" : "0.0.0-dev";
7778
7789
  var OS_RELEASE = "6.0.0-slicc";
7779
7790
  function procVersion() {
7780
7791
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -23877,15 +23888,7 @@ var WasmProcess = class {
23877
23888
  }
23878
23889
  });
23879
23890
  } else {
23880
- await this.unmissed(
23881
- () => this.openPath(req, marked),
23882
- async (at) => {
23883
- await this.stillOpen(at, req.handle);
23884
- return nodes.identify(at);
23885
- },
23886
- (id2, at) => this.fds.installAt(fd, this.openVfsFile({ ...open2, path: at }, id2, fs)),
23887
- { at: path, gen }
23888
- );
23891
+ await this.openExisting(req, marked, fd, open2, fs, { at: path, gen });
23889
23892
  }
23890
23893
  if (req.existing && !await present3(fs, path, true)) {
23891
23894
  throw new KernelError("ENOENT");
@@ -23945,7 +23948,22 @@ var WasmProcess = class {
23945
23948
  const inherited2 = req.orphan || req.contents !== void 0 || req.handle !== void 0;
23946
23949
  if (guard2?.links === void 0 || !noLinks || inherited2 || req.pin !== void 0)
23947
23950
  return void 0;
23948
- return (await walk(guard2.fs, this.cred, req.path, !req.exclusive, guard2.links)).path;
23951
+ const follow2 = !req.exclusive && req.nofollow !== true;
23952
+ return (await walk(guard2.fs, this.cred, req.path, follow2, guard2.links)).path;
23953
+ }
23954
+ async openExisting(req, marked, fd, open2, fs, first) {
23955
+ const nodes = this.nodes;
23956
+ const own = unfollowed(req);
23957
+ await this.unmissed(
23958
+ this.openPath.bind(this, req, marked),
23959
+ async (at) => {
23960
+ if (own) await notLink(this.options.fs, at);
23961
+ await this.stillOpen(at, req.handle);
23962
+ return nodes.identify(at);
23963
+ },
23964
+ (id2, at) => this.fds.installAt(fd, this.openVfsFile({ ...open2, path: at }, id2, fs)),
23965
+ first
23966
+ );
23949
23967
  }
23950
23968
  async openPath(req, marked) {
23951
23969
  const nodes = this.nodes;
@@ -23953,6 +23971,7 @@ var WasmProcess = class {
23953
23971
  if (req.exclusive) return nodes.entryKey(marked ?? req.path);
23954
23972
  if (marked !== void 0) return marked;
23955
23973
  if (req.create) return nodes.targetKey(req.path);
23974
+ if (unfollowed(req)) return nodes.entryKey(req.path);
23956
23975
  return this.keptOr(await nodes.targetKey(req.path), req.handle);
23957
23976
  }
23958
23977
  async mayOpen(req) {
@@ -24248,7 +24267,9 @@ var WasmProcess = class {
24248
24267
  given = void 0;
24249
24268
  await r?.settled(at);
24250
24269
  const found = await look(at);
24251
- if (!r || !r.missed(at) && !r.changedSince(at, gen)) return make(found, at);
24270
+ if (!r || !r.missed(at) && !r.changedSince(at, gen) && !r.inFlight?.(at)) {
24271
+ return make(found, at);
24272
+ }
24252
24273
  }
24253
24274
  }
24254
24275
  async stillOpen(at, handle) {
@@ -24776,6 +24797,13 @@ var WasmProcess = class {
24776
24797
  await this.options.http?.closeAll();
24777
24798
  }
24778
24799
  };
24800
+ function unfollowed(req) {
24801
+ return req.nofollow === true && req.handle === void 0;
24802
+ }
24803
+ async function notLink(fs, path) {
24804
+ const st = await fs.lstat?.(path);
24805
+ if (st?.isSymbolicLink) throw new KernelError("ELOOP");
24806
+ }
24779
24807
 
24780
24808
  // src/kernel/protocol.ts
24781
24809
  var WASM_PROCESS_INIT = "wasm-process-init";