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

Do not silently truncate offsets for read_at/write_at on emscripten #50634

Merged
merged 1 commit into from
May 13, 2018

Conversation

tbu-
Copy link
Contributor

@tbu- tbu- commented May 10, 2018

Generate an IO error if the offset is out of bounds for the system call.

@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 10, 2018
@kennytm
Copy link
Member

kennytm commented May 11, 2018

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 11, 2018

📌 Commit d71625b has been approved by kennytm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 11, 2018
alexcrichton added a commit to alexcrichton/rust that referenced this pull request May 11, 2018
…nnytm

Do not silently truncate offsets for `read_at`/`write_at` on emscripten

Generate an IO error if the offset is out of bounds for the system call.
@alexcrichton
Copy link
Member

@bors: r-

This caused a rollup failure. I've attempted to fix it in the rollup so it's not necessary to update this PR if the rollup lands.

Also a friendly reminder to please test PRs, it looks like this was not tested on the target platform of the PR before being submitted.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 11, 2018
@kennytm
Copy link
Member

kennytm commented May 11, 2018

Oops, missing import.

[01:06:05] error[E0599]: no method named `try_into` found for type `i64` in the current scope
[01:06:05]   --> libstd/sys/unix/fd.rs:80:35
[01:06:05]    |
[01:06:05] 80 |             if let Ok(o) = offset.try_into() {
[01:06:05]    |                                   ^^^^^^^^
[01:06:05]    |
[01:06:05]    = help: items from traits can only be used if the trait is in scope
[01:06:05]    = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
[01:06:05]            candidate #1: `use core::convert::TryInto;`
[01:06:05] 
[01:06:05] error[E0599]: no method named `try_into` found for type `i64` in the current scope
[01:06:05]    --> libstd/sys/unix/fd.rs:127:35
[01:06:05]     |
[01:06:05] 127 |             if let Ok(o) = offset.try_into() {
[01:06:05]     |                                   ^^^^^^^^
[01:06:05]     |
[01:06:05]     = help: items from traits can only be used if the trait is in scope
[01:06:05]     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
[01:06:05]             candidate #1: `use core::convert::TryInto;`
[01:06:05] 
[01:06:05] error: aborting due to 2 previous errors

@alexcrichton
Copy link
Member

I've decided to close the rollup, so this PR will need to be fixed

@alexcrichton
Copy link
Member

(please be sure to test it to make sure the import suggestions work)

Generate an IO error if the offset is out of bounds for the system call.
@tbu- tbu- force-pushed the pr_preadwrite_emscripten branch from d71625b to 4ce2426 Compare May 12, 2018 00:31
@tbu-
Copy link
Contributor Author

tbu- commented May 12, 2018

Where do I find documentation for building the standard library for emscripten?

@kennytm
Copy link
Member

kennytm commented May 12, 2018

@tbu- First, you enable emscripten in your config.toml with

[rust]
codegen-backends = ["llvm", "emscripten"]

then, to build, you run

./x.py build --stage 1 src/libstd --target asmjs-unknown-emscripten

However, I believe you could quickly check for syntax error just using x.py check in stage 0:

./x.py check src/libstd --target asmjs-unknown-emscripten

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 12, 2018
@tbu-
Copy link
Contributor Author

tbu- commented May 12, 2018

Re S-waiting-on-review: The test compilation on my side hasn't finished yet.

@tbu-
Copy link
Contributor Author

tbu- commented May 12, 2018

Oh nvm, now it has.

EDIT: Thanks for the instructions on how to build!

@kennytm
Copy link
Member

kennytm commented May 12, 2018

@bors r+

@bors
Copy link
Contributor

bors commented May 12, 2018

📌 Commit 4ce2426 has been approved by kennytm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 12, 2018
kennytm added a commit to kennytm/rust that referenced this pull request May 12, 2018
…nnytm

Do not silently truncate offsets for `read_at`/`write_at` on emscripten

Generate an IO error if the offset is out of bounds for the system call.
bors added a commit that referenced this pull request May 12, 2018
Rollup of 13 pull requests

Successful merges:

 - #50544 (Cleanup some dependencies)
 - #50545 (Made some functions in time module const)
 - #50550 (use fmt::Result where applicable)
 - #50558 (Remove all reference to DepGraph::work_products)
 - #50602 (Update canonicalize docs)
 - #50607 (Allocate Symbol strings from an arena)
 - #50613 (Migrate the toolstate update bot to rust-highfive)
 - #50624 (fs::write: Add example writing a &str)
 - #50634 (Do not silently truncate offsets for `read_at`/`write_at` on emscripten)
 - #50644 (AppVeyor: Read back trace from crash dump on failure.)
 - #50661 (Ignore non .rs files for tidy libcoretest)
 - #50663 (rustc: Allow an edition's feature on that edition)
 - #50667 (rustc: Only suggest deleting `extern crate` if it works)

Failed merges:
kennytm added a commit to kennytm/rust that referenced this pull request May 13, 2018
…nnytm

Do not silently truncate offsets for `read_at`/`write_at` on emscripten

Generate an IO error if the offset is out of bounds for the system call.
bors added a commit that referenced this pull request May 13, 2018
Rollup of 8 pull requests

Successful merges:

 - #50624 (fs::write: Add example writing a &str)
 - #50634 (Do not silently truncate offsets for `read_at`/`write_at` on emscripten)
 - #50644 (AppVeyor: Read back trace from crash dump on failure.)
 - #50661 (Ignore non .rs files for tidy libcoretest)
 - #50663 (rustc: Allow an edition's feature on that edition)
 - #50667 (rustc: Only suggest deleting `extern crate` if it works)
 - #50670 (rustc: Include semicolon when removing `extern crate`)
 - #50678 (Update openbsd targets)

Failed merges:
@bors bors merged commit 4ce2426 into rust-lang:master May 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants