@volter/browser-wali 0.1.211 → 0.1.212
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/environment.d.ts.map +1 -1
- package/dist/environment.js +2 -2
- package/dist/environment.js.map +1 -1
- package/dist/exec-format.d.ts.map +1 -1
- package/dist/exec-format.js +3 -3
- package/dist/exec-format.js.map +1 -1
- package/dist/filesystem-host-session.d.ts.map +1 -1
- package/dist/filesystem-host-session.js +2 -1
- package/dist/filesystem-host-session.js.map +1 -1
- package/dist/filesystem-remote.d.ts.map +1 -1
- package/dist/filesystem-remote.js +2 -1
- package/dist/filesystem-remote.js.map +1 -1
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +12 -13
- package/dist/filesystem.js.map +1 -1
- package/dist/private-tree.d.ts.map +1 -1
- package/dist/private-tree.js +4 -5
- package/dist/private-tree.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +3 -2
- package/dist/runtime.js.map +1 -1
- package/dist/snapshot-filesystem.d.ts.map +1 -1
- package/dist/snapshot-filesystem.js +2 -1
- package/dist/snapshot-filesystem.js.map +1 -1
- package/dist/symlink.d.ts.map +1 -1
- package/dist/symlink.js +5 -4
- package/dist/symlink.js.map +1 -1
- package/dist/thread-worker.js +5 -4
- package/dist/thread-worker.js.map +1 -1
- package/package.json +1 -1
package/dist/filesystem.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { decodePosixPath, encodePosixPath } from "@volter/browser-runtime/posix-path-bytes.js";
|
|
1
2
|
// File-call rules translated from The Emscripten Authors' WasmFS syscalls.cpp
|
|
2
3
|
// (Copyright 2021, MIT), 862dc0d48acc4134a0088d27ac8f5dd18baba1cd; see ../LICENSE.
|
|
3
4
|
// Storage, shared descriptors and process state remain owned by this kernel.
|
|
@@ -258,12 +259,12 @@ export class WaliFileDescriptorTable {
|
|
|
258
259
|
reportedDroppedEnvironment = true;
|
|
259
260
|
console.warn(`[WALI] environment entries a process cannot receive were dropped: ${dropped.join(", ")}`);
|
|
260
261
|
}
|
|
261
|
-
this.options.filesystem.writeFileSync(path, `${lines.join("\n")}\n`);
|
|
262
|
+
this.options.filesystem.writeFileSync(path, encodePosixPath(`${lines.join("\n")}\n`));
|
|
262
263
|
this.options.filesystem.chmodSync?.(path, 0o600);
|
|
263
264
|
return path;
|
|
264
265
|
}
|
|
265
266
|
copyCString(pointer, value, limit) {
|
|
266
|
-
const encoded =
|
|
267
|
+
const encoded = encodePosixPath(`${value}\0`);
|
|
267
268
|
if (limit < encoded.byteLength)
|
|
268
269
|
return 0;
|
|
269
270
|
this.copyIn(pointer, encoded);
|
|
@@ -444,7 +445,7 @@ export class WaliFileDescriptorTable {
|
|
|
444
445
|
for (let index = pointer; index < end; index += 1) {
|
|
445
446
|
const unit = bytes[index];
|
|
446
447
|
if (unit >= 0x80)
|
|
447
|
-
return
|
|
448
|
+
return decodePosixPath(bytes.slice(pointer, end));
|
|
448
449
|
text += String.fromCharCode(unit);
|
|
449
450
|
}
|
|
450
451
|
return text;
|
|
@@ -523,7 +524,7 @@ export class WaliFileDescriptorTable {
|
|
|
523
524
|
const entry = this.procEntry(path);
|
|
524
525
|
if (entry?.kind !== "file")
|
|
525
526
|
return -3n;
|
|
526
|
-
contents =
|
|
527
|
+
contents = encodePosixPath(entry.text);
|
|
527
528
|
}
|
|
528
529
|
const bytes = contents.slice(position, position + length);
|
|
529
530
|
position += bytes.byteLength;
|
|
@@ -948,7 +949,7 @@ export class WaliFileDescriptorTable {
|
|
|
948
949
|
let written = 0;
|
|
949
950
|
while (directory.position < entries.length) {
|
|
950
951
|
const entry = entries[directory.position];
|
|
951
|
-
const nameBytes =
|
|
952
|
+
const nameBytes = encodePosixPath(entry.name);
|
|
952
953
|
const recordLength = alignTo(19 + nameBytes.byteLength + 1, 8);
|
|
953
954
|
if (recordLength > count - written) {
|
|
954
955
|
if (written === 0)
|
|
@@ -1347,7 +1348,7 @@ export class WaliFileDescriptorTable {
|
|
|
1347
1348
|
throw errno("EINVAL");
|
|
1348
1349
|
if (this.cwd !== "/" && !this.fs().existsSync(this.cwd))
|
|
1349
1350
|
throw errno("ENOENT");
|
|
1350
|
-
const encoded =
|
|
1351
|
+
const encoded = encodePosixPath(`${this.cwd}\0`);
|
|
1351
1352
|
if (encoded.byteLength > size)
|
|
1352
1353
|
throw errno("ERANGE");
|
|
1353
1354
|
this.copyIn(pointer, encoded);
|
|
@@ -1573,7 +1574,7 @@ export class WaliFileDescriptorTable {
|
|
|
1573
1574
|
// itself is missing and makes canonicalization fail.
|
|
1574
1575
|
if (!target)
|
|
1575
1576
|
return this.virtualStat(resolved, false) || waliDeviceStat(resolved) || this.fs().existsSync(resolved) ? -22n : -2n;
|
|
1576
|
-
const encoded =
|
|
1577
|
+
const encoded = encodePosixPath(target).subarray(0, size);
|
|
1577
1578
|
this.copyIn(pointer, encoded);
|
|
1578
1579
|
return BigInt(encoded.byteLength);
|
|
1579
1580
|
}
|
|
@@ -2162,9 +2163,8 @@ export class WaliFileDescriptorTable {
|
|
|
2162
2163
|
if (nodes.some(node => (node.mode & 0o170000) === S_IFIFO))
|
|
2163
2164
|
return decline("a named FIFO requires the shared kernel transport");
|
|
2164
2165
|
const tree = encodePrivateTree(nodes);
|
|
2165
|
-
const
|
|
2166
|
-
const
|
|
2167
|
-
const cwdBytes = encoder.encode(this.cwd);
|
|
2166
|
+
const rootBytes = encodePosixPath(root);
|
|
2167
|
+
const cwdBytes = encodePosixPath(this.cwd);
|
|
2168
2168
|
const size = 4 + 4 + 8 + 4 + rootBytes.byteLength + 4 + cwdBytes.byteLength + tree.byteLength;
|
|
2169
2169
|
if (size > length)
|
|
2170
2170
|
return decline(`what ${root} already holds is larger than the libc's ${length}-byte reply`);
|
|
@@ -2272,7 +2272,7 @@ function checkFilePermission(stat, requested) {
|
|
|
2272
2272
|
}
|
|
2273
2273
|
function checkFileName(path) {
|
|
2274
2274
|
// WASMFS_NAME_MAX is Linux's 255-byte component limit, not a work budget.
|
|
2275
|
-
if (
|
|
2275
|
+
if (encodePosixPath(path.slice(path.lastIndexOf("/") + 1)).byteLength > 255)
|
|
2276
2276
|
throw errno("ENAMETOOLONG");
|
|
2277
2277
|
}
|
|
2278
2278
|
/** preadv's offset: one 64-bit argument, or two 32-bit halves from a libc that splits it (musl's own preadv.c). */
|
|
@@ -2378,7 +2378,7 @@ function syntheticSymlinkStat(target) {
|
|
|
2378
2378
|
isFile: () => false,
|
|
2379
2379
|
isDirectory: () => false,
|
|
2380
2380
|
isSymbolicLink: () => true,
|
|
2381
|
-
size:
|
|
2381
|
+
size: encodePosixPath(target).byteLength,
|
|
2382
2382
|
mode: 0o777,
|
|
2383
2383
|
};
|
|
2384
2384
|
}
|
|
@@ -2417,7 +2417,6 @@ function syntheticTerminalStat() {
|
|
|
2417
2417
|
* and turned into its number, and building an Error (its stack captured) for
|
|
2418
2418
|
* every missing path Python probed was 34 ms of Blender's start (2026-09-27).
|
|
2419
2419
|
*/
|
|
2420
|
-
const strictDecoder = new TextDecoder("utf-8", { fatal: true });
|
|
2421
2420
|
const errnoErrors = new Map();
|
|
2422
2421
|
function errno(errnoName) {
|
|
2423
2422
|
let error = errnoErrors.get(errnoName);
|