@ai-ecoverse/slicc-kernel 1.62.3 → 1.62.4

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
@@ -386,7 +386,7 @@ The proxy answers `200` with `Content-Type: application/vnd.slicc.raw-fetch`: a
386
386
 
387
387
  ## Filesystem
388
388
 
389
- `/` is the OPFS root. Each process mounts the top-level directories that exist when it starts (plus `/usr` and `/bin`), so files in them are shared by all processes and visible through the OPFS API as soon as the process that wrote them has closed them; `run` resolves only after that. `createKernel` creates `/tmp` and `/home` in OPFS, so they are shared too. Files directly in `/`, and directories created there after a process started, are OPFS as well, the same for Emscripten and WASI programs; only `/dev` and `/proc` live in each process's memory. A program's `mkdir` (WASI `path_create_directory`, Emscripten's `mkdir`) is exclusive, as on Linux: it fails with `EEXIST` when the name exists, and of several processes or threads making one name at once exactly one succeeds, so a directory works as a lock. Unlike Linux, a WASI program's `mkdir` under a missing directory makes the missing parents rather than failing with `ENOENT` (#380); a JS program's `ctx.fs.mkdir` makes parents too. An OPFS or IndexedDB failure that has no POSIX counterpart is `EIO`; its message names the DOM error and the operation (`lookup`, `read`, `write`, `commit` or `sidecar`), and the kernel worker logs the first of each kind to its console. File contents are buffered per open file and written back on close, `fsync` and exit; metadata operations (`mkdir`, `rename`, `rm`, …) go straight to OPFS. The kernel worker is the only writer.
389
+ `/` is the OPFS root. Each process mounts the top-level directories that exist when it starts (plus `/usr` and `/bin`), so files in them are shared by all processes and visible through the OPFS API as soon as the process that wrote them has closed them; `run` resolves only after that. `createKernel` creates `/tmp` and `/home` in OPFS, so they are shared too. Files directly in `/`, and directories created there after a process started, are OPFS as well, the same for Emscripten and WASI programs; only `/dev` and `/proc` live in each process's memory. A program's `mkdir` (WASI `path_create_directory`, Emscripten's `mkdir`) is exclusive, as on Linux: it fails with `EEXIST` when the name exists, and of several processes or threads making one name at once exactly one succeeds, so a directory works as a lock. Under a missing directory it fails with `ENOENT`, as on Linux (`mkdir -p` and `os.makedirs` make the parents in the program); a JS program's `ctx.fs.mkdir` makes parents itself. The kernel makes the system `PNPM_HOME` (`/usr/local/share/pnpm`, or the embedder's) when it starts, since pnpm makes only its `bin` directory there. An OPFS or IndexedDB failure that has no POSIX counterpart is `EIO`; its message names the DOM error and the operation (`lookup`, `read`, `write`, `commit` or `sidecar`), and the kernel worker logs the first of each kind to its console. File contents are buffered per open file and written back on close, `fsync` and exit; metadata operations (`mkdir`, `rename`, `rm`, …) go straight to OPFS. The kernel worker is the only writer.
390
390
 
391
391
  Directories are renamed with `FileSystemHandle.move()` where available, else by copy and delete.
392
392
 
@@ -8112,17 +8112,8 @@ function mkdirOptions(entry, mode = 511) {
8112
8112
  return { recursive: true, owner: { ...owner, parents } };
8113
8113
  }
8114
8114
  async function mkdirExclusive(entry, path, mode) {
8115
- const { fs } = entry;
8116
- const { owner } = mkdirOptions(entry, mode);
8117
- const own = owner ? { owner } : {};
8118
- try {
8119
- await fs.mkdir(path, own);
8120
- } catch (err) {
8121
- if (err?.code !== "ENOENT") throw err;
8122
- const above = owner ? { owner: { ...owner, mode: owner.parents } } : {};
8123
- await fs.mkdir(path.slice(0, path.lastIndexOf("/")) || "/", { recursive: true, ...above });
8124
- await fs.mkdir(path, own);
8125
- }
8115
+ const owner = ownerFor2(entry, mode ?? 511);
8116
+ await entry.fs.mkdir(path, owner ? { owner } : {});
8126
8117
  }
8127
8118
  async function chown(entry, path, req) {
8128
8119
  const cred = entry.cred?.();
@@ -14817,8 +14808,13 @@ var Launcher = class {
14817
14808
  this.fs
14818
14809
  );
14819
14810
  void this.unlinked.sweep(entry.target);
14811
+ if (this.pnpmHome.startsWith(`${entry.target.replace(/\/$/, "")}/`))
14812
+ await this.provisionPnpmHome();
14820
14813
  return entry;
14821
14814
  }
14815
+ async provisionPnpmHome() {
14816
+ await this.base.mkdir(this.pnpmHome, { recursive: true }).catch(() => void 0);
14817
+ }
14822
14818
  mountedBy(spec, cred) {
14823
14819
  if (!this.owners || cred.euid === 0 && cred.egid === 0) return spec;
14824
14820
  const ids = { uid: String(cred.euid), gid: String(cred.egid) };
@@ -14886,6 +14882,7 @@ var Launcher = class {
14886
14882
  }
14887
14883
  async prepare() {
14888
14884
  for (const dir of SHARED_DIRS) await this.base.mkdir(dir, { recursive: true });
14885
+ await this.provisionPnpmHome();
14889
14886
  await this.users.ensure();
14890
14887
  await writeCaFile(this.base, this.ca).catch(() => void 0);
14891
14888
  this.fstab = this.mountFstab();