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

Rollup of 10 pull requests #83105

Merged
merged 24 commits into from
Mar 14, 2021
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3ed6184
Implement Extend and FromIterator for OsString
lopopolo Feb 14, 2021
2fcb8b5
Optimize FromIterator<OsString> to reuse the first allocation
lopopolo Feb 16, 2021
05ea200
Add impls for iterators of Cow<OsStr>
lopopolo Mar 3, 2021
d6b06b8
std: Fix a bug on the wasm32-wasi target opening files
alexcrichton Mar 5, 2021
45229b0
Rename `rustdoc` to `rustdoc::all`
jyn514 Mar 5, 2021
ce2d95c
Demonstrate best practice for feeding stdin of a child processes
kornelski Mar 9, 2021
2fd2796
add ui testcase for issue 82772
csmoe Mar 5, 2021
77fb6a0
fix: check before index into generated patterns
csmoe Mar 11, 2021
1c9d56e
Update cargo
ehuss Mar 13, 2021
f201746
Add `reverse` search alias for Iterator::rev()
Seppel3210 Mar 13, 2021
bc8093e
Fix panic message of `assert_failed_inner`
Mar 13, 2021
7ecb5d8
Add regression tests
Mar 13, 2021
8fd2f0c
Add documentation about formatting `Duration` values
joshtriplett Jan 28, 2021
8164a74
Document `everybody_loops`
camelid Feb 28, 2021
6caa350
Rollup merge of #81465 - joshtriplett:duration-formatting-documentati…
JohnTitor Mar 14, 2021
67bc866
Rollup merge of #82121 - lopopolo:pathbuf-osstring-extend, r=joshtrip…
JohnTitor Mar 14, 2021
f0ebc10
Rollup merge of #82617 - camelid:everybody_loops-docs, r=jyn514
JohnTitor Mar 14, 2021
0d9a6ed
Rollup merge of #82789 - csmoe:issue-82772, r=estebank
JohnTitor Mar 14, 2021
3361402
Rollup merge of #82798 - jyn514:rustdoc-group, r=Manishearth,Guillaum…
JohnTitor Mar 14, 2021
9ce0820
Rollup merge of #82804 - alexcrichton:fix-wasi, r=pnkfelix
JohnTitor Mar 14, 2021
dda9d05
Rollup merge of #82943 - kornelski:threadstdio, r=joshtriplett
JohnTitor Mar 14, 2021
54546a8
Rollup merge of #83066 - Seppel3210:master, r=joshtriplett
JohnTitor Mar 14, 2021
bc79367
Rollup merge of #83070 - ehuss:update-cargo, r=ehuss
JohnTitor Mar 14, 2021
f8206ac
Rollup merge of #83081 - hyd-dev:assert-message, r=m-ou-se
JohnTitor Mar 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
std: Fix a bug on the wasm32-wasi target opening files
This commit fixes an issue pointed out in #82758 where LTO changed the
behavior of a program. It turns out that LTO was not at fault here, it
simply uncovered an existing bug. The bindings to
`__wasilibc_find_relpath` assumed that the relative portion of the path
returned was always contained within thee input `buf` we passed in. This
isn't actually the case, however, and sometimes the relative portion of
the path may reference a sub-portion of the input string itself.

The fix here is to use the relative path pointer coming out of
`__wasilibc_find_relpath` as the source of truth. The `buf` used for
local storage is discarded in this function and the relative path is
copied out unconditionally. We might be able to get away with some
`Cow`-like business or such to avoid the extra allocation, but for now
this is probably the easiest patch to fix the original issue.
  • Loading branch information
alexcrichton committed Mar 5, 2021
commit d6b06b8a327ff32d083bc0494cc3195d9f8082d2
6 changes: 2 additions & 4 deletions library/std/src/sys/wasi/fs.rs
Original file line number Diff line number Diff line change
@@ -650,13 +650,11 @@ fn open_parent(p: &Path) -> io::Result<(ManuallyDrop<WasiFd>, PathBuf)> {
);
return Err(io::Error::new(io::ErrorKind::Other, msg));
}
let len = CStr::from_ptr(buf.as_ptr().cast()).to_bytes().len();
buf.set_len(len);
buf.shrink_to_fit();
let relative = CStr::from_ptr(relative_path).to_bytes().to_vec();

return Ok((
ManuallyDrop::new(WasiFd::from_raw(fd as u32)),
PathBuf::from(OsString::from_vec(buf)),
PathBuf::from(OsString::from_vec(relative)),
));
}
}