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

net/http: correct use of byte slice in js syscall #26350

Closed
wants to merge 1 commit into from
Closed

net/http: correct use of byte slice in js syscall #26350

wants to merge 1 commit into from

Conversation

johanbrandhorst
Copy link
Member

syscall/js does not allow []byte to be used in direct inputs to
its JavaScript manipulation methods since
bafe466.
Unfortunately, this use of a byte slice was missed, so any
uses of the WASM Roundtripper with a body will panic.
This ensures the byte slice is appropriately converted
before being passed to syscall.

Fixes #26349

@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Jul 12, 2018
@gopherbot
Copy link
Contributor

Message from Gerrit User 13620:

Patch Set 1: Code-Review-2

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 3: New patch set was added with same tree, parent, and commit message as Patch Set 2.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16585:

Patch Set 2:

(1 comment)

Changed to defer the release of the array.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5065:

Patch Set 3:

So apparently we have no test coverage for any of this?

Can we fix that and make this code actually used on the builders?


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16585:

Patch Set 3:

Patch Set 3:

So apparently we have no test coverage for any of this?

Can we fix that and make this code actually used on the builders?

Indeed, there are no tests for this right now. I'd love to write some tests but I've no idea where to start really. Node does not have native support for the Fetch API AFAIK so we can't just run it in that interpreter. Any ideas? Richard?


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 13620:

Patch Set 3: Code-Review+1

(1 comment)

Patch Set 3:

Patch Set 3:

So apparently we have no test coverage for any of this?

Can we fix that and make this code actually used on the builders?

Indeed, there are no tests for this right now. I'd love to write some tests but I've no idea where to start really. Node does not have native support for the Fetch API AFAIK so we can't just run it in that interpreter. Any ideas? Richard?

The package https://www.npmjs.com/package/node-fetch would help with that. I'm using it a lot, it is good. We would need to somehow preinstall it on the builders.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

syscall/js does not allow []byte to be used in direct inputs to
its JavaScript manipulation methods since
bafe466.
Unfortunately, this use of a byte slice was missed, so any
uses of the WASM Roundtripper with a body will panic.
This ensures the byte slice is appropriately converted
before being passed to syscall.

Fixes #26349
@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 5: New patch set was added with same tree, parent, and commit message as Patch Set 4.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16585:

Patch Set 3:

(1 comment)

Patch Set 3: Code-Review+1

(1 comment)

Patch Set 3:

Patch Set 3:

So apparently we have no test coverage for any of this?

Can we fix that and make this code actually used on the builders?

Indeed, there are no tests for this right now. I'd love to write some tests but I've no idea where to start really. Node does not have native support for the Fetch API AFAIK so we can't just run it in that interpreter. Any ideas? Richard?

The package https://www.npmjs.com/package/node-fetch would help with that. I'm using it a lot, it is good. We would need to somehow preinstall it on the builders.

If we can configure the runners to install this package I can start writing some tests for it, assuming the runners will be patched by the time I've written them. Brad, is there something I can do to configure the runners with this package?


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5137:

Patch Set 5:

Thanks Johan for the quick fix! Could we perhaps add a test here to ensure that we never regress?


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5065:

Patch Set 5:

I left a comment at #26051 (comment) on the bug about setting up a browser-based builder.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16585:

Patch Set 5:

Patch Set 5:

I left a comment at #26051 (comment) on the bug about setting up a browser-based builder.

So should we hold off this fix until such a builder is available or should we merge this and add tests as soon as possible? I'd argue that we need to get thisin before the next beta release since I expect wasm users will face this bug pretty quickly.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5137:

Patch Set 5: Run-TryBot+1

Patch Set 5:

Patch Set 5:

I left a comment at #26051 (comment) on the bug about setting up a browser-based builder.

So should we hold off this fix until such a builder is available or should we merge this and add tests as soon as possible? I'd argue that we need to get thisin before the next beta release since I expect wasm users will face this bug pretty quickly.

Johan, roger that. I think in the meantime we can merge this change but I'll open up an issue for when browser-based builders are available and tag this CL as well as Brad's ping.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5976:

Patch Set 5:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=9342bb38


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5137:

Patch Set 5:

Patch Set 5: Run-TryBot+1

Patch Set 5:

Patch Set 5:

I left a comment at #26051 (comment) on the bug about setting up a browser-based builder.

So should we hold off this fix until such a builder is available or should we merge this and add tests as soon as possible? I'd argue that we need to get thisin before the next beta release since I expect wasm users will face this bug pretty quickly.

Johan, roger that. I think in the meantime we can merge this change but I'll open up an issue for when browser-based builders are available and tag this CL as well as Brad's ping.

Filed an issue at #26358 for us to add such tests.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5976:

Patch Set 5: TryBot-Result-1

1 of 19 TryBots failed:
Failed on freebsd-amd64-11_1: https://storage.googleapis.com/go-build-log/9342bb38/freebsd-amd64-11_1_4d44db53.log

Consult https://build.golang.org/ to see whether they are new failures.


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16585:

Patch Set 5:

Patch Set 5: TryBot-Result-1

1 of 19 TryBots failed:
Failed on freebsd-amd64-11_1: https://storage.googleapis.com/go-build-log/9342bb38/freebsd-amd64-11_1_4d44db53.log

Consult https://build.golang.org/ to see whether they are new failures.

Looks like a flaky test failure, could we have a run please?


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 13620:

Patch Set 5: Code-Review+2


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5065:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16585:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Jul 13, 2018
syscall/js does not allow []byte to be used in direct inputs to
its JavaScript manipulation methods since
bafe466.
Unfortunately, this use of a byte slice was missed, so any
uses of the WASM Roundtripper with a body will panic.
This ensures the byte slice is appropriately converted
before being passed to syscall.

Fixes #26349

Change-Id: I83847645d71ce310c1eee3decddbac990fae166b
GitHub-Last-Rev: 3914bda
GitHub-Pull-Request: #26350
Reviewed-on: https://go-review.googlesource.com/123537
Run-TryBot: Emmanuel Odeke <[email protected]>
Reviewed-by: Richard Musiol <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
@gopherbot
Copy link
Contributor

Message from Gerrit User 5065:

Patch Set 5: Code-Review+2

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/123537.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/123537 has been merged.

@gopherbot gopherbot closed this Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants