@ai-ecoverse/slicc-kernel 1.196.30 → 1.196.32
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 +3 -1
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +87 -20
- package/dist/cloudflare.js.map +3 -3
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +87 -20
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +87 -20
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/package.json +1 -1
package/dist/kernel-worker.js
CHANGED
|
@@ -10034,7 +10034,7 @@ function satisfies(version, range2) {
|
|
|
10034
10034
|
}
|
|
10035
10035
|
|
|
10036
10036
|
// src/version.ts
|
|
10037
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
10037
|
+
var KERNEL_VERSION = true ? "1.196.32" : "0.0.0-dev";
|
|
10038
10038
|
var OS_RELEASE = "6.0.0-slicc";
|
|
10039
10039
|
function procVersion() {
|
|
10040
10040
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -17444,12 +17444,15 @@ var MountFs = class _MountFs {
|
|
|
17444
17444
|
);
|
|
17445
17445
|
}
|
|
17446
17446
|
if (a?.mount !== b?.mount) throw errnoError("EXDEV", `${from} -> ${to}`);
|
|
17447
|
-
if (a) this.writable(a.mount, normalizePath(to));
|
|
17447
|
+
if (a && !options.exclusive) this.writable(a.mount, normalizePath(to));
|
|
17448
17448
|
return copyByBytes(this, source, to, options);
|
|
17449
17449
|
}
|
|
17450
17450
|
async createExclusive(path, owner, redirects = 0) {
|
|
17451
|
+
const real = normalizePath(path);
|
|
17452
|
+
const found = this.at(real);
|
|
17453
|
+
if (found) return this.createMounted(found, real, owner);
|
|
17451
17454
|
const exclusive = this.base.createExclusive?.bind(this.base);
|
|
17452
|
-
if (
|
|
17455
|
+
if (exclusive) {
|
|
17453
17456
|
return this.based(
|
|
17454
17457
|
[path],
|
|
17455
17458
|
redirects,
|
|
@@ -17464,6 +17467,39 @@ var MountFs = class _MountFs {
|
|
|
17464
17467
|
if (there) throw errnoError("EEXIST", path);
|
|
17465
17468
|
await this.writeFile(path, new Uint8Array(0), owner);
|
|
17466
17469
|
}
|
|
17470
|
+
async createMounted(found, real, owner) {
|
|
17471
|
+
const { mount, rel: rel2 } = found;
|
|
17472
|
+
if (rel2 === "/") throw errnoError("EEXIST", real);
|
|
17473
|
+
await mount.conn.call({ op: "getattr", path: rel2 }).then(
|
|
17474
|
+
() => {
|
|
17475
|
+
throw errnoError("EEXIST", real);
|
|
17476
|
+
},
|
|
17477
|
+
(err) => {
|
|
17478
|
+
if (err?.code !== "ENOENT") throw err;
|
|
17479
|
+
}
|
|
17480
|
+
);
|
|
17481
|
+
this.writable(mount, real);
|
|
17482
|
+
if (owner?.fifo) return this.mkfifo(found, real, owner);
|
|
17483
|
+
const made2 = await this.driverOwner(found, real, owner, false);
|
|
17484
|
+
await this.table.commit(real);
|
|
17485
|
+
this.table.forget(mount, real);
|
|
17486
|
+
try {
|
|
17487
|
+
const fh = await mount.conn.call({
|
|
17488
|
+
op: "open",
|
|
17489
|
+
path: rel2,
|
|
17490
|
+
write: true,
|
|
17491
|
+
create: true,
|
|
17492
|
+
exclusive: true,
|
|
17493
|
+
truncate: false,
|
|
17494
|
+
...made2
|
|
17495
|
+
});
|
|
17496
|
+
if (typeof fh !== "number" || !Number.isSafeInteger(fh) || fh < 0)
|
|
17497
|
+
throw errnoError("EIO", real);
|
|
17498
|
+
await mount.conn.call({ op: "release", fh });
|
|
17499
|
+
} finally {
|
|
17500
|
+
this.table.forget(mount, real);
|
|
17501
|
+
}
|
|
17502
|
+
}
|
|
17467
17503
|
async lstat(path, redirects = 0) {
|
|
17468
17504
|
const found = this.at(path);
|
|
17469
17505
|
if (!found) {
|
|
@@ -32298,13 +32334,27 @@ function words2(value2) {
|
|
|
32298
32334
|
}
|
|
32299
32335
|
return [...value2];
|
|
32300
32336
|
}
|
|
32301
|
-
|
|
32302
|
-
|
|
32303
|
-
|
|
32304
|
-
|
|
32305
|
-
|
|
32306
|
-
|
|
32307
|
-
|
|
32337
|
+
var SUDO_ENV_MAX = 4096;
|
|
32338
|
+
var SUDO_ENV_BYTES = 1024 * 1024;
|
|
32339
|
+
function sudoVariables(value2, term) {
|
|
32340
|
+
const input = typeof value2 === "object" && value2 !== null ? value2 : {};
|
|
32341
|
+
const env = /* @__PURE__ */ Object.create(null);
|
|
32342
|
+
let count3 = 0;
|
|
32343
|
+
let budget = SUDO_ENV_BYTES;
|
|
32344
|
+
const fits = (name2, text) => {
|
|
32345
|
+
if (++count3 > SUDO_ENV_MAX || name2.length + text.length + 2 > budget) return false;
|
|
32346
|
+
budget -= storedSize(name2) + storedSize(text) + 2;
|
|
32347
|
+
return budget >= 0;
|
|
32348
|
+
};
|
|
32349
|
+
for (const name2 in input) {
|
|
32350
|
+
if (!Object.hasOwn(input, name2)) continue;
|
|
32351
|
+
const entry = input[name2];
|
|
32352
|
+
if (!fits(name2, typeof entry === "string" ? entry : "")) return void 0;
|
|
32353
|
+
if (typeof entry === "string" && /^[^=\0]+$/.test(name2) && !entry.includes("\0"))
|
|
32354
|
+
env[name2] = entry;
|
|
32355
|
+
}
|
|
32356
|
+
if (term !== void 0 && env.TERM !== term && !fits("TERM", term)) return void 0;
|
|
32357
|
+
return env;
|
|
32308
32358
|
}
|
|
32309
32359
|
var ESCAPES = { " ": "\\t", "\n": "\\n", "\r": "\\r" };
|
|
32310
32360
|
function clipboardLine(text) {
|
|
@@ -34291,12 +34341,17 @@ var WasmProcess = class _WasmProcess {
|
|
|
34291
34341
|
async sudo(req, cancelled) {
|
|
34292
34342
|
const { sudo } = this.options;
|
|
34293
34343
|
if (!sudo) throw new KernelError("ENOSYS");
|
|
34344
|
+
const args = words2(req.args);
|
|
34345
|
+
const term = typeof req.term === "string" ? req.term : void 0;
|
|
34346
|
+
const submitted = sudoVariables(req.env, term);
|
|
34347
|
+
if (submitted === void 0)
|
|
34348
|
+
return { errno: "E2BIG", error: "sudo: the submitted environment is too large" };
|
|
34294
34349
|
const call = {
|
|
34295
34350
|
op: "proc-sudo",
|
|
34296
|
-
args
|
|
34351
|
+
args,
|
|
34297
34352
|
cwd: typeof req.cwd === "string" && req.cwd.startsWith("/") ? req.cwd : "/",
|
|
34298
|
-
...
|
|
34299
|
-
env:
|
|
34353
|
+
...term !== void 0 ? { term } : {},
|
|
34354
|
+
env: submitted
|
|
34300
34355
|
};
|
|
34301
34356
|
const answer2 = await sudo(
|
|
34302
34357
|
call,
|
|
@@ -36899,11 +36954,16 @@ function kernelFsHandlers(fs) {
|
|
|
36899
36954
|
return [{ name: name2, kind: attr2.kind, attr: attr2 }];
|
|
36900
36955
|
}),
|
|
36901
36956
|
async open(path, flags2) {
|
|
36902
|
-
|
|
36903
|
-
|
|
36904
|
-
|
|
36905
|
-
|
|
36906
|
-
|
|
36957
|
+
if (flags2.create && flags2.exclusive) {
|
|
36958
|
+
if (!fs.createExclusive) throw fsError2("ENOTSUP", path);
|
|
36959
|
+
await fs.createExclusive(path);
|
|
36960
|
+
} else {
|
|
36961
|
+
const st = await existing(path);
|
|
36962
|
+
if (st && flags2.exclusive) throw fsError2("EEXIST", path);
|
|
36963
|
+
if (st?.isDirectory && flags2.write) throw fsError2("EISDIR", path);
|
|
36964
|
+
if (!st && !flags2.create) throw fsError2("ENOENT", path);
|
|
36965
|
+
if (!st || flags2.truncate) await fs.writeFile(path, new Uint8Array(0));
|
|
36966
|
+
}
|
|
36907
36967
|
handles.set(++nextFh, { path });
|
|
36908
36968
|
return nextFh;
|
|
36909
36969
|
},
|
|
@@ -37302,11 +37362,14 @@ function hostfsHandlers(current, againMs = RESTORE_AGAIN_MS) {
|
|
|
37302
37362
|
});
|
|
37303
37363
|
async function writable3(client, path, flags2) {
|
|
37304
37364
|
const { ifMatch: _, ...asked } = flags2;
|
|
37305
|
-
const opening2 = () => client.call("open", {
|
|
37365
|
+
const opening2 = () => client.call("open", {
|
|
37366
|
+
path: rel(path),
|
|
37367
|
+
...asked
|
|
37368
|
+
});
|
|
37306
37369
|
try {
|
|
37307
37370
|
return { opened: await opening2(), restore: void 0 };
|
|
37308
37371
|
} catch (err) {
|
|
37309
|
-
if (!flags2.write || codeOf7(err) !== "EACCES") throw err;
|
|
37372
|
+
if (!flags2.write || flags2.exclusive || codeOf7(err) !== "EACCES") throw err;
|
|
37310
37373
|
const was = await client.call("stat", { path: rel(path) });
|
|
37311
37374
|
const mode = was.mode ?? 0;
|
|
37312
37375
|
if (mode & 128) throw err;
|
|
@@ -37332,6 +37395,10 @@ function hostfsHandlers(current, againMs = RESTORE_AGAIN_MS) {
|
|
|
37332
37395
|
const client = current();
|
|
37333
37396
|
const token = client.token;
|
|
37334
37397
|
const { opened: opened2, restore } = await writable3(client, path, flags2);
|
|
37398
|
+
if (flags2.exclusive && (opened2.created === false || opened2.attr && (opened2.attr.kind !== "file" || opened2.attr.size !== 0))) {
|
|
37399
|
+
await client.call("release", { fh: opened2.fh }, true);
|
|
37400
|
+
throw fsError2("EEXIST", path);
|
|
37401
|
+
}
|
|
37335
37402
|
if (flags2.ifMatch !== void 0 && opened2.attr?.etag !== flags2.ifMatch) {
|
|
37336
37403
|
await client.call("release", { fh: opened2.fh }, true);
|
|
37337
37404
|
throw fsError2("ESTALE", `${path} changed on the host while it was being read`);
|