Skip to content

Conversation

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Dec 10, 2025

This commit is a follow-up to #147572 and the issue reported at the end of that PR where the std::fs::hard_link function is broken after that PR landed. The true culprit and bug here is fixed in WebAssembly/wasi-libc#690 but until that's released in a wasi-sdk version it should be reasonable, on WASI, to skip the linkat function.

This commit is a follow-up to 147572 and the issue reported at the end
of that PR where the `std::fs::hard_link` function is broken after that
PR landed. The true culprit and bug here is fixed in
WebAssembly/wasi-libc/690 but until that's released in a wasi-sdk
version it should be reasonable, on WASI, to skip the `linkat`
function.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 10, 2025

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Comment on lines -2080 to +2098
any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_env = "nto70") => {
// VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves
// it implementation-defined whether `link` follows symlinks, so rely on the
// `symlink_hard_link` test in library/std/src/fs/tests.rs to check the behavior.
// Android has `linkat` on newer versions, but we happen to know `link`
// always has the correct behavior, so it's here as well.
any(
// VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead.
// POSIX leaves it implementation-defined whether `link` follows
// symlinks, so rely on the `symlink_hard_link` test in
// library/std/src/fs/tests.rs to check the behavior.
target_os = "vxworks",
target_os = "redox",
target_os = "espidf",
// Android has `linkat` on newer versions, but we happen to know
// `link` always has the correct behavior, so it's here as well.
target_os = "android",
// wasi-sdk-29-and-prior have a buggy `linkat` so use `link` instead
// until wasi-sdk is updated (see WebAssembly/wasi-libc#690)
target_os = "wasi",
// Other misc platforms
target_os = "horizon",
target_os = "vita",
target_env = "nto70",
) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a note for this I took the liberty to reformat the line to be less long and arrange the comments to apply to the platform-in-question too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants