rust/library
Mara Bos ce1020fc55
Rollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichton
Expose correct symlink API on WASI

As described in https://github.com/rust-lang/rust/issues/68574, the currently exposed API for symlinks is, in fact, a thin wrapper around the corresponding syscall, and not suitable for public usage.

The reason is that the 2nd param in the call is expected to be a handle of a "preopened directory" (a WASI concept for exposing dirs), and the only way to retrieve such handle right now is by tinkering with a private `__wasilibc_find_relpath` API, which is an implementation detail and definitely not something we want users to call directly.

Making matters worse, the semantics of this param aren't obvious from its name (`fd`), and easy to misinterpret, resulting in people trying to pass a handle of the target file itself (as in https://github.com/vitiral/path_abs/pull/50), which doesn't work as expected.

I did a [codesearch among open-source repos](https://sourcegraph.com/search?q=std%3A%3Aos%3A%3Awasi%3A%3Afs%3A%3Asymlink&patternType=literal), and the usage above is so far the only usage of this API at all, but we should fix it before more people start using it incorrectly.

While this is technically a breaking API change, I believe it's a justified one, as 1) it's OS-specific and 2) there was strictly no way to correctly use the previous form of the API, and if someone does use it, they're likely doing it wrong like in the example above.

The new API does not lead to the same confusion, as it mirrors `std::os::unix::fs::symlink` and `std::os::windows::fs::symlink_{file,dir}` variants by accepting source/target paths.

Fixes #68574.

r? ``@alexcrichton``
2021-02-05 12:26:00 +01:00
..
alloc Rollup merge of #81727 - m-ou-se:unstabilize-bits, r=Mark-Simulacrum 2021-02-04 21:10:42 +01:00
backtrace@af078ecc0b std: Update the backtrace crate submodule 2020-11-20 11:56:07 -08:00
core Rollup merge of #81727 - m-ou-se:unstabilize-bits, r=Mark-Simulacrum 2021-02-04 21:10:42 +01:00
panic_abort slightly more typed interface to panic implementation 2020-12-21 13:37:59 +01:00
panic_unwind Revert stabilizing integer::BITS. 2021-02-03 22:23:58 +01:00
proc_macro Bump bootstrap compiler to 1.50 beta 2020-12-30 09:27:19 -05:00
profiler_builtins
rtstartup Bump bootstrap compiler to 1.50 beta 2020-12-30 09:27:19 -05:00
rustc-std-workspace-alloc
rustc-std-workspace-core Fix rustc-std-workspace-core documentation 2020-12-20 15:23:21 +08:00
rustc-std-workspace-std
std Rollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichton 2021-02-05 12:26:00 +01:00
stdarch@9c732a56f6 Update stdarch submodule 2020-12-21 00:00:00 +00:00
term Allow/fix non_fmt_panic in tests. 2021-02-03 23:15:45 +01:00
test Allow/fix non_fmt_panic in tests. 2021-02-03 23:15:45 +01:00
unwind Support AArch64 ILP32 in libunwind bindings 2021-01-27 22:47:57 +00:00