Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc/wasm: incorrectly checks for require("fs") validity #40446

Open
tharvik opened this issue Jul 28, 2020 · 5 comments
Open

misc/wasm: incorrectly checks for require("fs") validity #40446

tharvik opened this issue Jul 28, 2020 · 5 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@tharvik
Copy link

tharvik commented Jul 28, 2020

When loaded, wasm_exec.js tries to know on which platform it is run. "fs" is loaded if not already available and check if it is empty (when using webpack to provide an empty implementation) or not (when running inside node). The check is wrongly implemented as Object.keys returns an array of key, not a count, thus making that check always true, and unable to use with webpack.

The line in question

if (Object.keys(fs) !== 0) {

Which can be easily fixed by adding a .length after the Object.keys(fs).

@cagedmantis cagedmantis changed the title misc/wasm/wasm_exec.js incorrectly checks for require("fs") validity misc/wasm: incorrectly checks for require("fs") validity Jul 28, 2020
@cagedmantis cagedmantis added this to the Backlog milestone Jul 28, 2020
@agnivade
Copy link
Contributor

That's right. There's a CL at https://go-review.googlesource.com/c/go/+/241119.

@tharvik
Copy link
Author

tharvik commented Jul 29, 2020

Closing as duplicate then, thanks for the pointer.

@tharvik tharvik closed this as completed Jul 29, 2020
@tharvik
Copy link
Author

tharvik commented Jul 29, 2020

Oups, missread that, reopening.

@tharvik tharvik reopened this Jul 29, 2020
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 29, 2020
@cagedmantis
Copy link
Contributor

/cc @neelance @cherrymui

@neelance
Copy link
Member

The CL will land in the next release cycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants