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

wit-parser::decoding::decode should error when given a core module #1673

Closed
rylev opened this issue Jul 15, 2024 · 2 comments · Fixed by #1714
Closed

wit-parser::decoding::decode should error when given a core module #1673

rylev opened this issue Jul 15, 2024 · 2 comments · Fixed by #1714

Comments

@rylev
Copy link
Contributor

rylev commented Jul 15, 2024

wit-parser::decoding::decode requires a WebAssembly component (either as a normal component or as a WIT-package-encoded-as-binary). However, if you pass in a core module, everything "works" (i.e., no error is returned), but you end up with an empty resolve. I imagine the right thing to do here would be to error specifying that a component must be passed.

Let me know if this is the case, and I can submit a fix.

@alexcrichton
Copy link
Member

One use case of passing a core module is that there's these *.o files that come out of wit-bindgen with world information and I wanted to support wasm-tools component wit on these files. I don't believe that's tested in this repository though and I'm not sure if it still works at all. That leads me to:

  • If that doesn't work, then I think it's reasonable to just return an error saying that core modules aren't supported.
  • If that does work, then a core module with zero custom sections that look like component-type* should return an error

@ChristofPetig
Copy link

ChristofPetig commented Aug 5, 2024

I have used wasm-tools component wit on core modules containing the section in the past and it worked fine. Given the wasit2 idea (core modules with WIT interfaces, see WASI issue #595) I would recommend to go for the second choice.

alexcrichton added a commit to alexcrichton/wasm-tools that referenced this issue Aug 9, 2024
Also cause it to return an error if the input is a core wasm module with
zero `component-type` custom sections.

Closes bytecodealliance#1673
github-merge-queue bot pushed a commit that referenced this issue Aug 12, 2024
Also cause it to return an error if the input is a core wasm module with
zero `component-type` custom sections.

Closes #1673
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants