@ai-ecoverse/slicc-kernel 1.143.4 → 1.143.5

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/README.md CHANGED
@@ -910,13 +910,13 @@ A process's working directory is the directory it changed into, not just its pat
910
910
  - its relative lookups and creates are `ENOENT`;
911
911
  - `..` still reaches the parent.
912
912
  - an Emscripten program (bash, coreutils, …) and its forked subshells and children: relative paths resolve against `<path> (deleted)`, so `ls` fails with `cannot open directory '.'`, a glob matches nothing, and a relative create is `ENOENT`. `getcwd` is `ENOENT`, as on Linux, so a shell started there says `shell-init: error retrieving current directory` and its `pwd` fails, while bash's own `$PWD`, `cd ..` and `cd /abs` keep working.
913
- - a JS program: `ctx.fs` and `ctx.sync.fs` with relative paths are `ENOENT`, and `../x` reaches the parent. `ctx.cwd` (and `process.cwd()`) keeps the plain path, as a WASIX program's `getcwd` does. This needs the sync lane, which JS programs have where `SharedArrayBuffer` is available.
913
+ - a JS program: `ctx.fs` and `ctx.sync.fs` with relative paths are `ENOENT`, and `../x` reaches the parent. `ctx.cwd` (and `process.cwd()`) keeps the plain path, as an older WASIX program's `getcwd` does. This needs the sync lane, which JS programs have where `SharedArrayBuffer` is available.
914
914
  - **Detection costs nothing in the steady state:**
915
915
  - each held directory has a counter in memory the kernel shares with the process. It moves only when this kernel, another tab, or a `postFsNotice` reports a change at that directory or above it: the kernel's own watcher paths, and every path and tree of a peer change or notice.
916
916
  - a process checks the counter, a memory read, before each relative lookup. Only after it moved does it ask the kernel once (`cwd-check`), and the kernel compares the inode at the path with the one it recorded.
917
917
  - **The `rm` record:** so that `rm -r d; mkdir d` can be told apart, removing a directory leaves the same small record a rename leaves at the name it vacates (see [Metadata](#metadata)).
918
918
  - **Limits:**
919
- - a WASIX program's C library keeps the working directory as a string and turns relative paths into absolute ones before they reach the kernel. So a WASIX program still sees the new directory through relative paths, and `getcwd` still returns the path, until wasix-sysroot resolves relative paths against the working directory's descriptor ([#1164](https://github.com/ai-ecoverse/slicc-kernel/issues/1164) stays open for that).
919
+ - a WASIX program built on wasix-sysroot 2025.9.30-41 or later (its `slicc.libc` marker) resolves relative paths, and `*at(AT_FDCWD)`, against the working directory's descriptor, as a WASI program does: listing `.`, a relative create and a `stat` are `ENOENT`, `getcwd` is `ENOENT` as on Linux, and `chdir("..")` reaches the parent ([#1227](https://github.com/ai-ecoverse/slicc-kernel/issues/1227)). An older libc keeps the working directory as a string and turns relative paths into absolute ones before they reach the kernel, so it still sees the new directory through relative paths, and its `getcwd` keeps returning the path, since it builds a relative `chdir("..")` from it.
920
920
  - a removal between the check and the lookup is a race, as with any path, and the lookup sees the new directory.
921
921
  - on a `hostfs` folder the inode is the host's, which a host file system may reuse for the new directory (ext4 can; APFS doesn't). There the replacement isn't noticed.
922
922
  - with more than 1023 distinct working directories held at once, the rest are not tracked.
@@ -7598,7 +7598,7 @@ function satisfies(version, range2) {
7598
7598
  }
7599
7599
 
7600
7600
  // src/version.ts
7601
- var KERNEL_VERSION = true ? "1.143.4" : "0.0.0-dev";
7601
+ var KERNEL_VERSION = true ? "1.143.5" : "0.0.0-dev";
7602
7602
  var OS_RELEASE = "6.0.0-slicc";
7603
7603
  function procVersion() {
7604
7604
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -4976,6 +4976,7 @@ var init_wasi_host = __esm({
4976
4976
  startCwd;
4977
4977
  interruptWakes = false;
4978
4978
  strictEpoll = false;
4979
+ cwdFd = false;
4979
4980
  entered = false;
4980
4981
  enteredSignals = 0;
4981
4982
  raisedOnEntry;
@@ -6725,7 +6726,7 @@ var KERNEL_VERSION, OS_RELEASE;
6725
6726
  var init_version = __esm({
6726
6727
  "src/version.ts"() {
6727
6728
  "use strict";
6728
- KERNEL_VERSION = true ? "1.143.4" : "0.0.0-dev";
6729
+ KERNEL_VERSION = true ? "1.143.5" : "0.0.0-dev";
6729
6730
  OS_RELEASE = "6.0.0-slicc";
6730
6731
  }
6731
6732
  });
@@ -17317,7 +17318,7 @@ function posixSignal(sig) {
17317
17318
  function nsToMs(ns) {
17318
17319
  return Math.ceil(Number(ns) / 1e6);
17319
17320
  }
17320
- var FDFLAGSEXT_CLOEXEC, SPAWN_OP_SIZE, SPAWN_OPS, RIGHTS_FD_WRITE, ICANON2, ECHO2, FUTEX_SLICE_MS, EINTR_LIBC, STRICT_EPOLL_LIBC, MAIN_HANDLE, WasixHost;
17321
+ var FDFLAGSEXT_CLOEXEC, SPAWN_OP_SIZE, SPAWN_OPS, RIGHTS_FD_WRITE, ICANON2, ECHO2, FUTEX_SLICE_MS, EINTR_LIBC, STRICT_EPOLL_LIBC, CWD_FD_LIBC, MAIN_HANDLE, WasixHost;
17321
17322
  var init_wasix_host = __esm({
17322
17323
  "src/process/wasi/wasix-host.ts"() {
17323
17324
  "use strict";
@@ -17342,6 +17343,7 @@ var init_wasix_host = __esm({
17342
17343
  FUTEX_SLICE_MS = 50;
17343
17344
  EINTR_LIBC = 22;
17344
17345
  STRICT_EPOLL_LIBC = 29;
17346
+ CWD_FD_LIBC = 41;
17345
17347
  MAIN_HANDLE = 2147483647;
17346
17348
  WasixHost = class _WasixHost {
17347
17349
  process;
@@ -17360,7 +17362,9 @@ var init_wasix_host = __esm({
17360
17362
  driver,
17361
17363
  () => (this.threads?.tid ?? MAIN_TID) !== MAIN_TID
17362
17364
  );
17363
- if (module) host.strictEpoll = (libcVersion(module) ?? 0) >= STRICT_EPOLL_LIBC;
17365
+ const libc = module ? libcVersion(module) ?? 0 : void 0;
17366
+ if (libc !== void 0) host.strictEpoll = libc >= STRICT_EPOLL_LIBC;
17367
+ if (libc !== void 0) host.cwdFd = libc >= CWD_FD_LIBC;
17364
17368
  if (module && !WebAssembly.Module.imports(module).some((i) => i.name === "fd_fdflags_set")) {
17365
17369
  host.fds.implicitCloexec = true;
17366
17370
  host.interruptWakes = (libcVersion(module) ?? 0) < EINTR_LIBC;
@@ -17500,6 +17504,7 @@ var init_wasix_host = __esm({
17500
17504
  mem.view().setUint32(out, host.o.parent?.() ?? host.o.ppid ?? 1, true);
17501
17505
  },
17502
17506
  getcwd: (buf, lenPtr) => {
17507
+ if (host.cwdFd && host.fds.held && !host.fds.held.alive()) return E.NOENT;
17503
17508
  const bytes = new TextEncoder().encode(host.cwd);
17504
17509
  const max = mem.view().getUint32(lenPtr, true);
17505
17510
  mem.view().setUint32(lenPtr, bytes.length, true);