@ai-ecoverse/slicc-kernel 1.144.0 → 1.145.0

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.
@@ -1461,7 +1461,8 @@ function createSyncFsSabBridge(transport, opts = {}) {
1461
1461
  const mode = (held2 ? 1 : 0) | (open ? 2 : 0);
1462
1462
  if (mode === 3) {
1463
1463
  const at = seen.gen !== void 0 ? { gen: seen.gen } : {};
1464
- return json2({ op: "hold", path, mode: mode | want, ...at }, path);
1464
+ const link = seen.nofollow ? { nofollow: true } : {};
1465
+ return json2({ op: "hold", path, mode: mode | want, ...at, ...link }, path);
1465
1466
  }
1466
1467
  run({ op: "hold", path, mode, ...handle !== void 0 ? { handle } : {} }, path);
1467
1468
  return void 0;
@@ -2913,7 +2914,7 @@ var KERNEL_VERSION, OS_RELEASE;
2913
2914
  var init_version = __esm({
2914
2915
  "src/version.ts"() {
2915
2916
  "use strict";
2916
- KERNEL_VERSION = true ? "1.144.0" : "0.0.0-dev";
2917
+ KERNEL_VERSION = true ? "1.145.0" : "0.0.0-dev";
2917
2918
  OS_RELEASE = "6.0.0-slicc";
2918
2919
  }
2919
2920
  });
@@ -9493,23 +9494,21 @@ var init_wasi_fds = __esm({
9493
9494
  const flags = want === 6 ? O_RDWR5 : want === 2 ? O_WRONLY5 : 0;
9494
9495
  return openDevice2.call(this.kernel.sys, flags);
9495
9496
  }
9496
- open(path, oflags, rights, fdflags, mode) {
9497
+ open(path, oflags, rights, fdflags, mode, nofollow = false) {
9497
9498
  this.made = void 0;
9498
9499
  this.created = false;
9500
+ this.nofollow = nofollow;
9499
9501
  const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
9500
- if (exclusive && namedDevice(path)) throw new WasiError("EEXIST");
9501
- const device2 = deviceOf(path);
9502
- if (device2) return this.install({ type: "device", device: device2 });
9503
- const kernelDevice = this.openKernelDevice(path, oflags, fdflags, rights);
9504
- if (kernelDevice !== void 0) return kernelDevice;
9505
- const alias = stdioAlias(path);
9506
- if (alias !== void 0) return this.reopen(alias);
9502
+ const special = this.openSpecial(path, oflags, rights, fdflags, exclusive);
9503
+ if (special !== void 0) return special;
9507
9504
  const outside = this.escaped(path, oflags, rights);
9508
9505
  if (outside !== void 0) return this.open(outside, oflags, rights, fdflags, mode);
9509
9506
  if (exclusive && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
9510
9507
  return this.regular(path, void 0, oflags, rights, fdflags, mode, true);
9511
9508
  }
9512
- if (exclusive && this.isLink(path)) throw new WasiError("EEXIST");
9509
+ if ((exclusive || nofollow) && this.isLink(path)) {
9510
+ throw new WasiError(exclusive ? "EEXIST" : "ELOOP");
9511
+ }
9513
9512
  const s = this.statOrMissing(path);
9514
9513
  if (exclusive && s) throw new WasiError("EEXIST");
9515
9514
  if (s?.escape !== void 0) {
@@ -9528,6 +9527,18 @@ var init_wasi_fds = __esm({
9528
9527
  refuseWrite(s, oflags, rights);
9529
9528
  return this.regular(path, s, oflags, rights, fdflags, mode);
9530
9529
  }
9530
+ nofollow = false;
9531
+ openSpecial(path, oflags, rights, fdflags, exclusive) {
9532
+ if (exclusive && namedDevice(path)) throw new WasiError("EEXIST");
9533
+ const device2 = deviceOf(path);
9534
+ if (device2) return this.install({ type: "device", device: device2 });
9535
+ const kernelDevice = this.openKernelDevice(path, oflags, fdflags, rights);
9536
+ if (kernelDevice !== void 0) return kernelDevice;
9537
+ const alias = stdioAlias(path);
9538
+ if (alias === void 0) return void 0;
9539
+ if (this.nofollow) throw new WasiError("ELOOP");
9540
+ return this.reopen(alias);
9541
+ }
9531
9542
  escaped(path, oflags, rights) {
9532
9543
  const outside = this.fs.escape?.(path);
9533
9544
  if (outside === void 0) return void 0;
@@ -9597,7 +9608,8 @@ var init_wasi_fds = __esm({
9597
9608
  const ranged = st.ranged ? st.size : void 0;
9598
9609
  const asked = (want & 4 ? HOLD_READ : 0) | (want & 2 ? HOLD_WRITE : 0) | (made ? HOLD_CREATED : 0);
9599
9610
  const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0, {
9600
- gen: st.gen
9611
+ gen: st.gen,
9612
+ ...this.nofollow ? { nofollow: true } : {}
9601
9613
  });
9602
9614
  const io = handle !== void 0 && this.fs.pinned ? this.fs.pinned(handle) : this.fs;
9603
9615
  const view = this.fs.changes;
@@ -11323,7 +11335,7 @@ var init_wasi_host = __esm({
11323
11335
  if (alias && !alias.stdio) this.openFd(alias.fd);
11324
11336
  const path = alias && !alias.stdio ? `/dev/fd/${alias.fd}` : asked;
11325
11337
  if (deviceOf(path)) this.interrupted?.();
11326
- mem.view().setUint32(out, fds.open(path, oflags, rights, fdflags), true);
11338
+ mem.view().setUint32(out, fds.open(path, oflags, rights, fdflags, void 0, !follow3), true);
11327
11339
  if (fds.created) this.created(path, 438);
11328
11340
  } catch (err) {
11329
11341
  if (err.code !== "ENOENT") throw err;
@@ -11331,7 +11343,7 @@ var init_wasi_host = __esm({
11331
11343
  const joined2 = raw.startsWith("/") ? raw : `${fds.dir(dirfd).path}/${raw}`;
11332
11344
  const resolved2 = this.resolveForDev(joined2, follow3);
11333
11345
  if (!resolved2) throw err;
11334
- mem.view().setUint32(out, fds.open(resolved2, oflags, rights, fdflags), true);
11346
+ mem.view().setUint32(out, fds.open(resolved2, oflags, rights, fdflags, void 0, !follow3), true);
11335
11347
  }
11336
11348
  },
11337
11349
  path_filestat_get: (dirfd, lookup2, p, l, out) => {
@@ -12282,13 +12294,18 @@ function importsContext({
12282
12294
  open(path, o = {}) {
12283
12295
  const abs = host.fds.resolve(3, path);
12284
12296
  const fresh = o.create === true && o.exclusive === true && owners && fs.create !== void 0;
12285
- if (!fresh && o.nofollow && fs.exists(abs) && fs.lstat(abs).isSymbolicLink)
12286
- throw new WasiError("ELOOP");
12287
12297
  const existed = !fresh && fs.exists(abs);
12288
12298
  const oflags = (o.create ? OFLAGS.CREAT : 0) | (o.exclusive ? OFLAGS.EXCL : 0) | (o.truncate ? OFLAGS.TRUNC : 0) | (o.directory ? OFLAGS.DIRECTORY : 0);
12289
12299
  const rights = (o.write ? RIGHTS.FD_WRITE : 0n) | (o.read || !o.write ? RIGHTS.FD_READ : 0n);
12290
12300
  const flags = o.append ? FDFLAGS.APPEND : 0;
12291
- const fd = host.fds.open(abs, oflags, rights, flags, fresh ? o.mode : void 0);
12301
+ const fd = host.fds.open(
12302
+ abs,
12303
+ oflags,
12304
+ rights,
12305
+ flags,
12306
+ fresh ? o.mode : void 0,
12307
+ o.nofollow === true
12308
+ );
12292
12309
  if (o.mode !== void 0 && !existed && !fresh) fs.chmod(abs, o.mode);
12293
12310
  return fd;
12294
12311
  },