@ai-ecoverse/slicc-kernel 1.178.3 → 1.179.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.
@@ -5572,13 +5572,6 @@ async function linkable(g, from, to, follow2) {
5572
5572
  }
5573
5573
  await inParent(g, "link", to);
5574
5574
  }
5575
- async function ownerOnly(g, op, path, follow2) {
5576
- const walked = await need(g, op, path, 0, { follow: follow2 });
5577
- const perm = walked.perm;
5578
- if (!perm || g.cred.euid === 0 || perm.uid === g.cred.euid) return walked;
5579
- if (await present(g.fs, walked.path, false)) deny(g, op, path, "EPERM");
5580
- return walked;
5581
- }
5582
5575
  async function chmodMode(g, path, mode) {
5583
5576
  const walked = await need(g, "chmod", path, 0, { follow: true });
5584
5577
  const perm = walked.perm;
@@ -5600,17 +5593,26 @@ function heldChmodMode(g, path, st, mode) {
5600
5593
  function heldRetimable(g, path, st, now) {
5601
5594
  const perm = permOf(st);
5602
5595
  if (g.cred.euid === 0 || perm.uid === g.cred.euid) return;
5603
- if (!now) deny(g, "futimens", path, "EPERM");
5604
- else if (!permits(g.cred, perm, W_OK, false)) deny(g, "futimens", path);
5596
+ if (now || st.fat) {
5597
+ if (!permits(g.cred, perm, W_OK, false)) deny(g, "futimens", path);
5598
+ return;
5599
+ }
5600
+ deny(g, "futimens", path, "EPERM");
5605
5601
  }
5606
5602
  async function retimable(g, op, path, now = false) {
5607
5603
  const follow2 = op !== "lutimes";
5608
- if (!now) return void await ownerOnly(g, op, path, follow2);
5609
5604
  const walked = await need(g, op, path, 0, { follow: follow2 });
5610
5605
  const perm = walked.perm;
5611
5606
  if (!perm || g.cred.euid === 0 || perm.uid === g.cred.euid) return;
5612
- if (permits(g.cred, perm, W_OK, false)) return;
5613
- if (await present(g.fs, walked.path, false)) deny(g, op, path);
5607
+ const look = follow2 ? g.fs.stat : g.fs.lstat;
5608
+ const st = await look.call(g.fs, walked.path).catch(() => void 0);
5609
+ if (now || st?.fat) {
5610
+ if (!permits(g.cred, perm, W_OK, false) && await present(g.fs, walked.path, false)) {
5611
+ deny(g, op, path);
5612
+ }
5613
+ return;
5614
+ }
5615
+ if (await present(g.fs, walked.path, false)) deny(g, op, path, "EPERM");
5614
5616
  }
5615
5617
  async function fileWritable(g, op, path) {
5616
5618
  await need(g, op, path, W_OK, { directory: false });
@@ -8128,7 +8130,7 @@ var UserDb = class {
8128
8130
  };
8129
8131
 
8130
8132
  // src/client/protocol.ts
8131
- var PROTOCOL = [1, 13];
8133
+ var PROTOCOL = [1, 14];
8132
8134
  var FS_METHODS = [
8133
8135
  "readFile",
8134
8136
  "writeFile",
@@ -8777,7 +8779,7 @@ function satisfies(version, range2) {
8777
8779
  }
8778
8780
 
8779
8781
  // src/version.ts
8780
- var KERNEL_VERSION = true ? "1.178.3" : "0.0.0-dev";
8782
+ var KERNEL_VERSION = true ? "1.179.0" : "0.0.0-dev";
8781
8783
  var OS_RELEASE = "6.0.0-slicc";
8782
8784
  function procVersion() {
8783
8785
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -33712,6 +33714,11 @@ function usersMode(mode = "off") {
33712
33714
  function tagOption(tag) {
33713
33715
  if (tag !== void 0 && typeof tag !== "string") throw new TypeError("a tag must be a string");
33714
33716
  }
33717
+ function cwdMissingOption(value2) {
33718
+ if (value2 === void 0 || value2 === "create") return "create";
33719
+ if (value2 === "error") return "error";
33720
+ throw new TypeError("cwdMissing must be 'create' or 'error'");
33721
+ }
33715
33722
  function withTag(tags, tag) {
33716
33723
  if (tag === void 0 || tags?.includes(tag)) return tags;
33717
33724
  return [...tags ?? [], tag];
@@ -36590,7 +36597,7 @@ var Launcher = class {
36590
36597
  const kept = keepingOpen(fs, nodes, (path) => this.changes.publish(path));
36591
36598
  return this.swaps.wrap(unlinked.wrap(kept));
36592
36599
  }
36593
- async starting(argv, dir, account, tags, base) {
36600
+ async starting(argv, dir, account, tags, base, missing6 = "create") {
36594
36601
  const tag = tags?.[0];
36595
36602
  await this.swaps.settled();
36596
36603
  this.resetCatalogs();
@@ -36599,8 +36606,13 @@ var Launcher = class {
36599
36606
  const cwd = await physicalPathAsync(this.base, start2.startsWith("/") ? start2 : `/${start2}`);
36600
36607
  await this.enterable(this.execGuard(credOf(account), 0, tag), cwd);
36601
36608
  const file = await this.execFile(argv[0] ?? "", cwd, this.execGuard(credOf(account), 0, tag));
36602
- if (!await this.base.exists(cwd))
36609
+ if (!await this.base.exists(cwd)) {
36610
+ if (missing6 === "error")
36611
+ throw Object.assign(new Error(`cannot change to ${cwd}: No such file or directory`), {
36612
+ code: "ENOENT"
36613
+ });
36603
36614
  await this.stackFor(tags, base).fs.mkdir(cwd, { recursive: true });
36615
+ }
36604
36616
  const plan = async () => {
36605
36617
  const found = await this.plan(file, argv, cwd, scope);
36606
36618
  await this.mayExec(credOf(account), { file, cwd, pid: 0, tag }, found);
@@ -36611,6 +36623,7 @@ var Launcher = class {
36611
36623
  }
36612
36624
  async openTerminal(argv, options) {
36613
36625
  const tagged = tagsOption(options);
36626
+ const missing6 = cwdMissingOption(options.cwdMissing);
36614
36627
  const { tags } = tagged;
36615
36628
  const { account, tty: ttyGroup } = await this.terminalAccount(options.user);
36616
36629
  const { cwd, file, planned } = await this.starting(
@@ -36618,7 +36631,8 @@ var Launcher = class {
36618
36631
  options.cwd,
36619
36632
  account,
36620
36633
  tags,
36621
- tagged.tagBase
36634
+ tagged.tagBase,
36635
+ missing6
36622
36636
  );
36623
36637
  if (!planned) throw new Error(`${file}: command not found`);
36624
36638
  let leader = 0;
@@ -36670,6 +36684,7 @@ var Launcher = class {
36670
36684
  }
36671
36685
  async run(argv, options = {}) {
36672
36686
  const tagged = tagsOption(options);
36687
+ const missing6 = cwdMissingOption(options.cwdMissing);
36673
36688
  const { tags } = tagged;
36674
36689
  const account = await this.account(options.user);
36675
36690
  const { cwd, file, planned } = await this.starting(
@@ -36677,7 +36692,8 @@ var Launcher = class {
36677
36692
  options.cwd,
36678
36693
  account,
36679
36694
  tags,
36680
- tagged.tagBase
36695
+ tagged.tagBase,
36696
+ missing6
36681
36697
  );
36682
36698
  const env = this.environment(cwd, options.env, account, options.login);
36683
36699
  const out = [];