@ai-ecoverse/slicc-kernel 1.146.2 → 1.146.3

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.
@@ -2927,7 +2927,7 @@ var KERNEL_VERSION, OS_RELEASE;
2927
2927
  var init_version = __esm({
2928
2928
  "src/version.ts"() {
2929
2929
  "use strict";
2930
- KERNEL_VERSION = true ? "1.146.2" : "0.0.0-dev";
2930
+ KERNEL_VERSION = true ? "1.146.3" : "0.0.0-dev";
2931
2931
  OS_RELEASE = "6.0.0-slicc";
2932
2932
  }
2933
2933
  });
@@ -9525,10 +9525,9 @@ var init_wasi_fds = __esm({
9525
9525
  if (exclusive && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
9526
9526
  return this.regular(path, void 0, oflags, rights, fdflags, mode, true);
9527
9527
  }
9528
- if ((exclusive || nofollow) && this.isLink(path)) {
9529
- throw new WasiError(exclusive ? "EEXIST" : "ELOOP");
9530
- }
9531
- const s = this.statOrMissing(path);
9528
+ if (exclusive && !nofollow && this.isLink(path)) throw new WasiError("EEXIST");
9529
+ const s = nofollow ? this.lstatOrMissing(path) : this.statOrMissing(path);
9530
+ if (s?.isSymbolicLink) throw new WasiError(exclusive ? "EEXIST" : "ELOOP");
9532
9531
  if (exclusive && s) throw new WasiError("EEXIST");
9533
9532
  if (s?.escape !== void 0) {
9534
9533
  refuseWrite({ readonly: true }, oflags, rights);
@@ -9547,6 +9546,11 @@ var init_wasi_fds = __esm({
9547
9546
  return this.regular(path, s, oflags, rights, fdflags, mode);
9548
9547
  }
9549
9548
  nofollow = false;
9549
+ inos = /* @__PURE__ */ new WeakMap();
9550
+ otherFile(buffer, st) {
9551
+ const ino = this.inos.get(buffer);
9552
+ return ino !== void 0 && st?.ino !== void 0 && ino !== st.ino;
9553
+ }
9550
9554
  openSpecial(path, oflags, rights, fdflags, exclusive) {
9551
9555
  if (exclusive && namedDevice(path)) throw new WasiError("EEXIST");
9552
9556
  const device2 = deviceOf(path);
@@ -9604,6 +9608,7 @@ var init_wasi_fds = __esm({
9604
9608
  buffer = void 0;
9605
9609
  }
9606
9610
  buffer ??= this.sharing(path, existing);
9611
+ if (buffer && this.nofollow && this.otherFile(buffer, existing)) buffer = void 0;
9607
9612
  const want = wantOf2(oflags, rights);
9608
9613
  if (buffer) {
9609
9614
  if (this.fs.owners) this.fs.access?.(path, want, "open");
@@ -9648,6 +9653,7 @@ var init_wasi_fds = __esm({
9648
9653
  const buffer = new FileBuffer(io, path, empty, st.maxFile, ranged, st.version, watch);
9649
9654
  buffer.moved = (missing2) => this.followRenames(missing2);
9650
9655
  buffer.handle = handle;
9656
+ if (st.ino !== void 0) this.inos.set(buffer, st.ino);
9651
9657
  this.buffers.set(path, buffer);
9652
9658
  const id = this.identity(st);
9653
9659
  if (id !== void 0) this.know(buffer, id);
@@ -9730,6 +9736,14 @@ var init_wasi_fds = __esm({
9730
9736
  return false;
9731
9737
  }
9732
9738
  }
9739
+ lstatOrMissing(path) {
9740
+ try {
9741
+ return this.fs.lstat(path);
9742
+ } catch (e) {
9743
+ if (e.code === "ENOENT") return void 0;
9744
+ throw e;
9745
+ }
9746
+ }
9733
9747
  statOrMissing(path) {
9734
9748
  try {
9735
9749
  return this.fs.stat(path);