#1010408 ftbfs: Error: Failed to find "global.fs = fs;" in Go JS shim code

#1010408#5
Date:
2022-04-30 20:36:58 UTC
From:
To:
Hi,

your package FTBFS, however a trivial upstream update fixes it (took me a minute to rebuild it).

Jérémy.

#1010408#10
Date:
2022-06-04 06:18:50 UTC
From:
To:
Hi Jérémy,

Thank you for your report!
past)
minute to rebuild it).

I'd like to provide a bit more context:

esbuild v0.14.25 started FTBFS when golang-1.18 became the default in
Debian on about 2022-03-22.
The actual FTBFS error looks something like this:

=====
   debian/rules execute_after_dh_auto_build-arch
make[1]: Entering directory '/<<PKGBUILDDIR>>'
ln -s _build/bin/esbuild .
# Generate npm/esbuild/*
node scripts/esbuild.js ./esbuild --neutral
# Generate npm/esbuild-wasm/*
GOPATH=/<<PKGBUILDDIR>>/_build GOCACHE=/<<PKGBUILDDIR>>/_build/go-build \
    node scripts/esbuild.js ./esbuild --wasm
/<<PKGBUILDDIR>>/scripts/esbuild.js:110
    if (wasm_exec_js.indexOf(toReplace) === -1) throw new Error(`Failed to
find ${JSON.stringify(toReplace)} in Go JS shim code`);
                                                      ^

Error: Failed to find "global.fs = fs;" in Go JS shim code
    at replace (/<<PKGBUILDDIR>>/scripts/esbuild.js:110:55)
    at Object.exports.buildWasmLib
(/<<PKGBUILDDIR>>/scripts/esbuild.js:113:3)
    at Object.<anonymous> (/<<PKGBUILDDIR>>/scripts/esbuild.js:366:52)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js
(node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain]
(node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
make[1]: *** [debian/rules:25: execute_after_dh_auto_build-arch] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:17: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit
status 2
=====

This was apparently fixed in the upstream commit

   -
https://github.com/evanw/esbuild/commit/517f77fa11da2287b4f63680cee9544be1f88c76

which was released upstream as v0.14.28 on 2022-03-25.

#1010408#15
Date:
2022-06-04 06:18:50 UTC
From:
To:
Hi Jérémy,

Thank you for your report!
past)
minute to rebuild it).

I'd like to provide a bit more context:

esbuild v0.14.25 started FTBFS when golang-1.18 became the default in
Debian on about 2022-03-22.
The actual FTBFS error looks something like this:

=====
   debian/rules execute_after_dh_auto_build-arch
make[1]: Entering directory '/<<PKGBUILDDIR>>'
ln -s _build/bin/esbuild .
# Generate npm/esbuild/*
node scripts/esbuild.js ./esbuild --neutral
# Generate npm/esbuild-wasm/*
GOPATH=/<<PKGBUILDDIR>>/_build GOCACHE=/<<PKGBUILDDIR>>/_build/go-build \
    node scripts/esbuild.js ./esbuild --wasm
/<<PKGBUILDDIR>>/scripts/esbuild.js:110
    if (wasm_exec_js.indexOf(toReplace) === -1) throw new Error(`Failed to
find ${JSON.stringify(toReplace)} in Go JS shim code`);
                                                      ^

Error: Failed to find "global.fs = fs;" in Go JS shim code
    at replace (/<<PKGBUILDDIR>>/scripts/esbuild.js:110:55)
    at Object.exports.buildWasmLib
(/<<PKGBUILDDIR>>/scripts/esbuild.js:113:3)
    at Object.<anonymous> (/<<PKGBUILDDIR>>/scripts/esbuild.js:366:52)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js
(node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain]
(node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
make[1]: *** [debian/rules:25: execute_after_dh_auto_build-arch] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:17: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit
status 2
=====

This was apparently fixed in the upstream commit

   -
https://github.com/evanw/esbuild/commit/517f77fa11da2287b4f63680cee9544be1f88c76

which was released upstream as v0.14.28 on 2022-03-25.

#1010408#20
Date:
2022-06-04 07:03:51 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
golang-github-evanw-esbuild, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1010408@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Anthony Fok <foka@debian.org> (supplier of updated golang-github-evanw-esbuild package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sat, 04 Jun 2022 00:32:24 -0600
Source: golang-github-evanw-esbuild
Architecture: source
Version: 0.14.36-1
Distribution: unstable
Urgency: medium
Maintainer: Debian Go Packaging Team <team+pkg-go@tracker.debian.org>
Changed-By: Anthony Fok <foka@debian.org>
Closes: 1010408
Changes:
 golang-github-evanw-esbuild (0.14.36-1) unstable; urgency=medium
 .
   * New upstream version 0.14.36 (Closes: #1010408)
   * Switch from Built-Using to Static-Built-Using in debian/control
   * Update esbuild(1) man page to 0.14.36
Checksums-Sha1:
 fb15ef22c0483a71cf1faf2e086eda7dd6bc519c 2510 golang-github-evanw-esbuild_0.14.36-1.dsc
 d923f762948e9f486ebc69e63a3401e149fd232a 1599445 golang-github-evanw-esbuild_0.14.36.orig.tar.gz
 a59bd02538f3c0d9a81e5ad30faf4dd506e2feb5 7888 golang-github-evanw-esbuild_0.14.36-1.debian.tar.xz
 4a52d1e61b803d7a253be7d794d145ac4e0bcf69 11830 golang-github-evanw-esbuild_0.14.36-1_amd64.buildinfo
Checksums-Sha256:
 75806971abdd62aad7db58748dffa94f637dc15668e545fd1375308f911d0f95 2510 golang-github-evanw-esbuild_0.14.36-1.dsc
 77391e246289755537ce4b5412bb4da80671c884d8cb52d2380a6d8b8f8117a5 1599445 golang-github-evanw-esbuild_0.14.36.orig.tar.gz
 371d2ae3be8d1f6a3bc294b59d4f8df9e390946755d2163367b17c8f4c3a3a4d 7888 golang-github-evanw-esbuild_0.14.36-1.debian.tar.xz
 1c6faec60a4ce646c9e41b044ddf73887f5e95bcf53cb8d21ee4cf0d29981d32 11830 golang-github-evanw-esbuild_0.14.36-1_amd64.buildinfo
Files:
 d7e4a5544a78b1d29e7490b4deb6eeda 2510 golang optional golang-github-evanw-esbuild_0.14.36-1.dsc
 5700b71490a821e29282c5ff4eb60904 1599445 golang optional golang-github-evanw-esbuild_0.14.36.orig.tar.gz
 78cec595ce69568895b89dbbc4b65635 7888 golang optional golang-github-evanw-esbuild_0.14.36-1.debian.tar.xz
 ef5c767398c6a3935be436828c844f08 11830 golang optional golang-github-evanw-esbuild_0.14.36-1_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJEBAEBCAAuFiEEFCQhsZrUqVmW+VBy6iUAtBLFms8FAmKa/ZgQHGZva2FAZGVi
aWFuLm9yZwAKCRDqJQC0EsWaz2JTD/4z7uPsUZfP3A7dSrRVyvsgQYH8jUcn2Exq
GVGl3RIH+CmIFSyLEVwlDWj+b/iyQWwGEepLMwrHii5FIoczS+EXbePgXS06ya1v
6D2PDSnnbqZs7WZIA/sttkysBANeoZw9tR7d5Wt9PWfCHp8OpXeqErt+nlJ+ekt3
7uljoz2nfuS5KEuVkPSR7kx5Cv2h52vB/bYnr3NdoqmNyawvKakMLajx3kel4Nu+
o3eCj9PkRXSwgZmpmiUWLTbQGd1GlhoLpqE5X1r1wtTmcuFiQevKAPx9YTwLwfjo
jqzc580Y0qaVoO3iL6wlVjfkDZBR/bvDVN7hVk3vvqbma9ubyS4UgrhNHMsYUjaF
2cPFzmSq7EsNVsxZqtkOwARgyjzbtnfWwWLakjC12rpC4a+nQeKiuvXGi33IqEo1
L57EQEK3gGQFCKoqn/0uBw+FkXbYFOUZU9Gff6ecBPoQKFE0iqoSQ0l/Ts8K5/Rn
bhmiHaG0xPgsrpxRcx8dUpgvYp9x2VHS0tXDTBUrqek/1GZ0PZ0UpmF3GQqsgJTx
juEmbe2R+gBsuMHvhVGBKV5CrcnR9oeJjty5EH33ETVf+0LMGdqxTxa01Khlakme
BkklPKiqb2QzB5hZO9HL6OS6lioBoDI3AcpoGal8WtHi7+y7PVgssQFkHtZxjHJV
v4XAdKN63A==
=1M6+
-----END PGP SIGNATURE-----