@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.
package/dist/node.js CHANGED
@@ -3305,7 +3305,7 @@ function satisfies(version, range2) {
3305
3305
  }
3306
3306
 
3307
3307
  // src/version.ts
3308
- var KERNEL_VERSION = true ? "1.146.5" : "0.0.0-dev";
3308
+ var KERNEL_VERSION = true ? "1.146.7" : "0.0.0-dev";
3309
3309
  var OS_RELEASE = "6.0.0-slicc";
3310
3310
  function procVersion() {
3311
3311
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -19829,15 +19829,7 @@ var WasmProcess = class {
19829
19829
  }
19830
19830
  });
19831
19831
  } else {
19832
- await this.unmissed(
19833
- () => this.openPath(req, marked),
19834
- async (at) => {
19835
- await this.stillOpen(at, req.handle);
19836
- return nodes.identify(at);
19837
- },
19838
- (id2, at) => this.fds.installAt(fd, this.openVfsFile({ ...open, path: at }, id2, fs)),
19839
- { at: path, gen }
19840
- );
19832
+ await this.openExisting(req, marked, fd, open, fs, { at: path, gen });
19841
19833
  }
19842
19834
  if (req.existing && !await present3(fs, path, true)) {
19843
19835
  throw new KernelError("ENOENT");
@@ -19897,7 +19889,22 @@ var WasmProcess = class {
19897
19889
  const inherited2 = req.orphan || req.contents !== void 0 || req.handle !== void 0;
19898
19890
  if (guard2?.links === void 0 || !noLinks || inherited2 || req.pin !== void 0)
19899
19891
  return void 0;
19900
- return (await walk(guard2.fs, this.cred, req.path, !req.exclusive, guard2.links)).path;
19892
+ const follow2 = !req.exclusive && req.nofollow !== true;
19893
+ return (await walk(guard2.fs, this.cred, req.path, follow2, guard2.links)).path;
19894
+ }
19895
+ async openExisting(req, marked, fd, open, fs, first) {
19896
+ const nodes = this.nodes;
19897
+ const own = unfollowed(req);
19898
+ await this.unmissed(
19899
+ this.openPath.bind(this, req, marked),
19900
+ async (at) => {
19901
+ if (own) await notLink(this.options.fs, at);
19902
+ await this.stillOpen(at, req.handle);
19903
+ return nodes.identify(at);
19904
+ },
19905
+ (id2, at) => this.fds.installAt(fd, this.openVfsFile({ ...open, path: at }, id2, fs)),
19906
+ first
19907
+ );
19901
19908
  }
19902
19909
  async openPath(req, marked) {
19903
19910
  const nodes = this.nodes;
@@ -19905,6 +19912,7 @@ var WasmProcess = class {
19905
19912
  if (req.exclusive) return nodes.entryKey(marked ?? req.path);
19906
19913
  if (marked !== void 0) return marked;
19907
19914
  if (req.create) return nodes.targetKey(req.path);
19915
+ if (unfollowed(req)) return nodes.entryKey(req.path);
19908
19916
  return this.keptOr(await nodes.targetKey(req.path), req.handle);
19909
19917
  }
19910
19918
  async mayOpen(req) {
@@ -20200,7 +20208,9 @@ var WasmProcess = class {
20200
20208
  given = void 0;
20201
20209
  await r?.settled(at);
20202
20210
  const found = await look(at);
20203
- if (!r || !r.missed(at) && !r.changedSince(at, gen)) return make(found, at);
20211
+ if (!r || !r.missed(at) && !r.changedSince(at, gen) && !r.inFlight?.(at)) {
20212
+ return make(found, at);
20213
+ }
20204
20214
  }
20205
20215
  }
20206
20216
  async stillOpen(at, handle) {
@@ -20728,6 +20738,13 @@ var WasmProcess = class {
20728
20738
  await this.options.http?.closeAll();
20729
20739
  }
20730
20740
  };
20741
+ function unfollowed(req) {
20742
+ return req.nofollow === true && req.handle === void 0;
20743
+ }
20744
+ async function notLink(fs, path) {
20745
+ const st = await fs.lstat?.(path);
20746
+ if (st?.isSymbolicLink) throw new KernelError("ELOOP");
20747
+ }
20731
20748
 
20732
20749
  // src/kernel/protocol.ts
20733
20750
  var WASM_PROCESS_INIT = "wasm-process-init";
@@ -25200,13 +25217,7 @@ var OpfsFs = class {
25200
25217
  }
25201
25218
  }
25202
25219
  async place(handle, dir, name2, copies) {
25203
- const move = handle.move;
25204
- if (move) this.others++;
25205
- const moved2 = await move?.call(handle, dir, name2).then(
25206
- () => true,
25207
- () => false
25208
- );
25209
- if (moved2) return true;
25220
+ if (await this.moved(handle, dir, name2)) return true;
25210
25221
  const before = this.fileMoves;
25211
25222
  try {
25212
25223
  await this.copy(handle, dir, name2, copies);
@@ -25219,6 +25230,23 @@ var OpfsFs = class {
25219
25230
  return false;
25220
25231
  }
25221
25232
  fileMoves = 0;
25233
+ async moved(handle, dir, name2) {
25234
+ const move = handle.move;
25235
+ if (!move) return false;
25236
+ for (let attempt = 0; ; attempt++) {
25237
+ this.others++;
25238
+ const failed3 = await move.call(handle, dir, name2).then(
25239
+ () => void 0,
25240
+ (err) => ({ err })
25241
+ );
25242
+ if (!failed3) return true;
25243
+ const error = failed3.err?.name;
25244
+ if (handle.kind !== "file" || !LOCKED.has(error)) return false;
25245
+ const delay = SYNC_BACKOFF_MS[attempt];
25246
+ if (delay === void 0) throw fsError("EBUSY", name2);
25247
+ await new Promise((resolve2) => setTimeout(resolve2, delay));
25248
+ }
25249
+ }
25222
25250
  async copy(handle, dir, name2, copies, rest2 = "") {
25223
25251
  if (handle.kind === "file" && movable(handle)) {
25224
25252
  this.others++;