@ai-ecoverse/slicc-kernel 1.144.1 → 1.145.1

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.
@@ -6800,7 +6800,7 @@ var KERNEL_VERSION, OS_RELEASE;
6800
6800
  var init_version = __esm({
6801
6801
  "src/version.ts"() {
6802
6802
  "use strict";
6803
- KERNEL_VERSION = true ? "1.144.1" : "0.0.0-dev";
6803
+ KERNEL_VERSION = true ? "1.145.1" : "0.0.0-dev";
6804
6804
  OS_RELEASE = "6.0.0-slicc";
6805
6805
  }
6806
6806
  });
package/dist/node.js CHANGED
@@ -3305,7 +3305,7 @@ function satisfies(version, range2) {
3305
3305
  }
3306
3306
 
3307
3307
  // src/version.ts
3308
- var KERNEL_VERSION = true ? "1.144.1" : "0.0.0-dev";
3308
+ var KERNEL_VERSION = true ? "1.145.1" : "0.0.0-dev";
3309
3309
  var OS_RELEASE = "6.0.0-slicc";
3310
3310
  function procVersion() {
3311
3311
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -4074,11 +4074,14 @@ function parseCrontab(text, path, system = false) {
4074
4074
  // src/cron/crontab.ts
4075
4075
  var CRONTAB_MAX = 256 * 1024;
4076
4076
  var TAGS_PATH = "/var/spool/cron/tags";
4077
+ var TAGS_VERSION = 1;
4077
4078
  async function readTags(fs) {
4078
4079
  const text = await fs.readFile(TAGS_PATH).catch(() => "");
4079
4080
  try {
4080
4081
  const parsed2 = JSON.parse(text);
4081
- return parsed2 && typeof parsed2 === "object" ? parsed2 : {};
4082
+ if (!parsed2 || typeof parsed2 !== "object") return {};
4083
+ const { v: _, ...tables } = parsed2;
4084
+ return tables;
4082
4085
  } catch {
4083
4086
  return {};
4084
4087
  }
@@ -4144,8 +4147,8 @@ var Crontabs = class {
4144
4147
  const kept = { ...all };
4145
4148
  if (Object.keys(table).length > 0) kept[path] = table;
4146
4149
  else delete kept[path];
4147
- const json5 = JSON.stringify(kept);
4148
- if (json5 === JSON.stringify(all)) return;
4150
+ const json5 = JSON.stringify({ v: TAGS_VERSION, ...kept });
4151
+ if (json5 === await fs.readFile(TAGS_PATH).catch(() => "")) return;
4149
4152
  const owner = owners ? { uid: 0, gid: 0, mode: 384 } : void 0;
4150
4153
  const fresh2 = `${TAGS_PATH}.${crypto.randomUUID()}.new`;
4151
4154
  await fs.writeFile(fresh2, json5, owner);
@@ -26840,6 +26843,14 @@ function foreignImports(bytes) {
26840
26843
  }
26841
26844
  return {};
26842
26845
  }
26846
+ var LIBC_MARK = /^wasix-sysroot \d{4}\.\d+\.\d+-(\d+)/;
26847
+ function libcVersion(module) {
26848
+ for (const section of WebAssembly.Module.customSections(module, "slicc.libc")) {
26849
+ const found = LIBC_MARK.exec(new TextDecoder().decode(section));
26850
+ if (found) return Number(found[1]);
26851
+ }
26852
+ return void 0;
26853
+ }
26843
26854
 
26844
26855
  // src/refused-command.ts
26845
26856
  var REFUSED_PATH = "/usr/lib/slicc/refused";
@@ -27744,6 +27755,14 @@ function cronPath(path) {
27744
27755
  (at) => path === at || path.startsWith(`${at}/`) || at.startsWith(path === "/" ? "/" : `${path}/`)
27745
27756
  );
27746
27757
  }
27758
+ var ETC_HOSTNAME_LIBC = 42;
27759
+ function readsEtcHostname(program) {
27760
+ return program.abi === "wasi" && (libcVersion(program.module) ?? 0) >= ETC_HOSTNAME_LIBC;
27761
+ }
27762
+ function setOrDrop(env, key, value2) {
27763
+ if (value2 === void 0) delete env[key];
27764
+ else env[key] = value2;
27765
+ }
27747
27766
  function baseName2(path) {
27748
27767
  return path.slice(path.lastIndexOf("/") + 1);
27749
27768
  }
@@ -28906,6 +28925,7 @@ var Launcher = class {
28906
28925
  const env = { ...expandDefaults(asked.target.env, seen), ...req.env };
28907
28926
  for (const key of asked.target.unset ?? []) delete env[key];
28908
28927
  delete env[TICKET_ENV];
28928
+ const own = env.HOSTNAME;
28909
28929
  if (asked.target.abi === "wasi") env.HOSTNAME = this.hostname;
28910
28930
  const planned = chosen(asked, env);
28911
28931
  const { target, args } = planned;
@@ -28916,6 +28936,7 @@ var Launcher = class {
28916
28936
  const caller = { pid: req.ppid ?? 0, uid: req.cred.euid, tag: req.tags?.[0] };
28917
28937
  if (this.integrity) await this.checkedSources(planned, caller);
28918
28938
  [program, exeId] = await Promise.all([this.program(target, env, caller), this.exeId(target)]);
28939
+ if (readsEtcHostname(program)) setOrDrop(env, "HOSTNAME", own);
28919
28940
  } catch (err) {
28920
28941
  await req.fds.closeAll();
28921
28942
  throw err;