[Pkg-javascript-devel] Bug#1076388: node-xterm: Unable to build package node-xterm in Debian Trixie i386 due to LinkError in WebAssembly.Instance()

Jérémy Lal kapouer at melix.org
Tue Jul 16 09:25:54 BST 2024


Source: node-xterm
Version: 5.3.0-2
Followup-For: Bug #1076388
Control: reassign -1 inwasm

This is an issue with inwasm, I think.

Reassigning.

Meanwhile, node-xterm can use attached patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.9.8-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
Description: workaround inwasm #1076425 by setting sane-ish values for maximum
Author: J?r?my Lal <kapouer at melix.org>
Last-Update: 2024-07-16
Forwarded: not-needed
--- a/xterm-wasm-parts/src/base64/Base64Decoder.wasm.ts
+++ b/xterm-wasm-parts/src/base64/Base64Decoder.wasm.ts
@@ -29,7 +29,7 @@
   mode: OutputMode.SYNC,
   srctype: 'Clang-C',
   imports: {
-    env: { memory: new WebAssembly.Memory({ initial: 1 }) }
+    env: { memory: new WebAssembly.Memory({ initial: 1, maximum: 8 }) }
   },
   exports: {
     dec: () => 0,
@@ -123,7 +123,7 @@
   mode: OutputMode.SYNC,
   srctype: 'Clang-C',
   imports: {
-    env: { memory: new WebAssembly.Memory({ initial: 1 }) }
+    env: { memory: new WebAssembly.Memory({ initial: 1, maximum: 8 }) }
   },
   exports: {
     dec: () => 0,
@@ -339,7 +339,7 @@
     let m = this._m32;
     const bytes = (Math.ceil(size / 3) + P32.STATE_DATA) * 4;
     if (!this._inst) {
-      this._mem = new WebAssembly.Memory({ initial: Math.ceil(bytes / 65536) });
+      this._mem = new WebAssembly.Memory({ initial: Math.ceil(bytes / 65536), maximum: 8 * Math.ceil(bytes / 65536) });
       this._inst = wasmDecode({ env: { memory: this._mem } });
       m = new Uint32Array(this._mem.buffer, 0);
       m.set(D, P32.D0);
--- a/xterm-wasm-parts/src/base64/Base64Encoder.wasm.ts
+++ b/xterm-wasm-parts/src/base64/Base64Encoder.wasm.ts
@@ -15,7 +15,7 @@
   mode: OutputMode.SYNC,
   srctype: 'Clang-C',
   imports: {
-    env: { memory: new WebAssembly.Memory({ initial: 1 }) }
+    env: { memory: new WebAssembly.Memory({ initial: 1, maximum: 8 }) }
   },
   exports: {
     enc: (src: number, length: number) => 0
@@ -91,7 +91,7 @@
   mode: OutputMode.SYNC,
   srctype: 'Clang-C',
   imports: {
-    env: { memory: new WebAssembly.Memory({ initial: 1 }) }
+    env: { memory: new WebAssembly.Memory({ initial: 1, maximum: 8 }) }
   },
   exports: {
     enc: (src: number, length: number) => 0
@@ -214,7 +214,7 @@
   public encode(d: Uint8Array): Uint8Array {
     const bytes = Math.ceil(d.length * 1.4) + P8.DST_P;
     if (!this._inst) {
-      this._mem = new WebAssembly.Memory({ initial: Math.ceil(bytes / 65536) });
+      this._mem = new WebAssembly.Memory({ initial: Math.ceil(bytes / 65536), maximum: 8 * Math.ceil(bytes / 65536) });
       (new Uint16Array(this._mem.buffer)).set(LUT, P8.LUT_P/2);
       this._inst = wasmEncode({ env: { memory: this._mem }});
     } else if (this._mem.buffer.byteLength < bytes) {


More information about the Pkg-javascript-devel mailing list