@ai-ecoverse/slicc-kernel 1.103.1 → 1.103.2

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
@@ -11190,7 +11190,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
11190
11190
  var EARLY_WHOLE_FILE = 64 * 1024;
11191
11191
 
11192
11192
  // src/version.ts
11193
- var KERNEL_VERSION = true ? "1.103.1" : "0.0.0-dev";
11193
+ var KERNEL_VERSION = true ? "1.103.2" : "0.0.0-dev";
11194
11194
  var OS_RELEASE = "6.0.0-slicc";
11195
11195
  function procVersion() {
11196
11196
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -14274,6 +14274,7 @@ async function runChild(req, deps) {
14274
14274
  ...req.argv0 !== void 0 ? { argv0: req.argv0 } : {},
14275
14275
  env: req.env,
14276
14276
  cwd: req.cwd,
14277
+ ...req.chdir ? { chdir: req.chdir } : {},
14277
14278
  ...req.pgid !== void 0 ? { pgid: req.pgid } : {},
14278
14279
  ...req.session ? { session: req.session } : {}
14279
14280
  },
@@ -15756,13 +15757,23 @@ var WasmProcess = class {
15756
15757
  return "deliver";
15757
15758
  }
15758
15759
  async spawn(req) {
15759
- const { file, argv, argv0, env, cwd, stdio, inherit: inherit2, exec, pgid, session, deathSignal } = req;
15760
+ const { file, argv, argv0, env, cwd, chdir, stdio, inherit: inherit2, exec, pgid, session, deathSignal } = req;
15760
15761
  if (deathSignal !== void 0 && (exec || !isSignal(deathSignal))) {
15761
15762
  throw new KernelError("EINVAL");
15762
15763
  }
15763
15764
  const group = { ...pgid !== void 0 ? { pgid } : {}, ...session ? { session } : {} };
15764
15765
  const named = argv0 !== void 0 ? { argv0 } : {};
15765
- const spawned = { file, argv, ...named, env, cwd, ...group, ...exec ? { exec } : {} };
15766
+ const moved2 = chdir ? { chdir } : {};
15767
+ const spawned = {
15768
+ file,
15769
+ argv,
15770
+ ...named,
15771
+ env,
15772
+ cwd,
15773
+ ...moved2,
15774
+ ...group,
15775
+ ...exec ? { exec } : {}
15776
+ };
15766
15777
  const pid = await this.children.spawn(spawned, stdio, inherit2);
15767
15778
  if (deathSignal !== void 0) this.onDeath(pgid === 0 || session ? -pid : pid, deathSignal);
15768
15779
  if (!exec) return pid;
@@ -21281,6 +21292,13 @@ var Launcher = class {
21281
21292
  await fds.closeAll();
21282
21293
  throw new SpawnError(await this.unrunnable(file, req.cwd, scope));
21283
21294
  }
21295
+ async enterable(g, cwd) {
21296
+ if (!g) return;
21297
+ const denied2 = new Error(`cannot change to ${cwd}: Permission denied`);
21298
+ await need(g, "chdir", cwd, X_OK, { directory: true }).catch((err) => {
21299
+ throw err.code === "EACCES" ? Object.assign(denied2, { code: "EACCES" }) : err;
21300
+ });
21301
+ }
21284
21302
  execGuard(cred, pid, tag) {
21285
21303
  const { dac } = this;
21286
21304
  return dac && { fs: this.fs, cred, pid, dac, tag, links: this.links.get(pid) };
@@ -21897,6 +21915,13 @@ var Launcher = class {
21897
21915
  throw new SpawnError(group);
21898
21916
  }
21899
21917
  const cred = grant ? grant.cred : this.credOf(ppid);
21918
+ if (req.chdir && !grant) {
21919
+ const g = this.execGuard(cred, ppid);
21920
+ await this.enterable(g, req.cwd).catch(async (err) => {
21921
+ await fds.closeAll();
21922
+ throw err.code === "EACCES" ? new SpawnError("EACCES") : err;
21923
+ });
21924
+ }
21900
21925
  const scope = grant ? "" : await this.scopeOf(cred.euid);
21901
21926
  const file = booked === void 0 ? req.file : await this.ticketFile(req, fds);
21902
21927
  const planned = await this.checkedPlan({ ...req, file }, { ppid, cred, scope }, fds);
@@ -22493,6 +22518,7 @@ var Launcher = class {
22493
22518
  const scope = account.uid === 0 ? "" : pnpmHomeOf(account, this.pnpmHome);
22494
22519
  const start2 = dir ?? "/";
22495
22520
  const cwd = await physicalPathAsync(this.base, start2.startsWith("/") ? start2 : `/${start2}`);
22521
+ await this.enterable(this.execGuard(credOf(account), 0, tag), cwd);
22496
22522
  const file = await this.execFile(argv[0] ?? "", cwd, this.execGuard(credOf(account), 0, tag));
22497
22523
  if (!await this.base.exists(cwd)) await this.stackFor(tag).fs.mkdir(cwd, { recursive: true });
22498
22524
  const planned = await this.plan(file, argv, cwd, scope);