Skip to content

[QNX7.1] std::fs::tests::symlink_hard_link broken on main #129895

Closed
@japaric

Description

@japaric

Ferrocene CI has detected that this test was broken by #127897 . Specifically, by the change in library/std/src/sys/pal/unix/fs.rs, shown below:

diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs
index 7fa147c9754..fc9d7e98883 100644
--- a/library/std/src/sys/pal/unix/fs.rs
+++ b/library/std/src/sys/pal/unix/fs.rs
@@ -1717,7 +1717,7 @@ pub fn link(original: &Path, link: &Path) -> io::Result<()> {
     run_path_with_cstr(original, &|original| {
         run_path_with_cstr(link, &|link| {
             cfg_if::cfg_if! {
-                if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_os = "nto"))] {
+                if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita"))] {
                     // 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.

Test output:

---- fs::tests::symlink_hard_link stdout ----
thread 'fs::tests::symlink_hard_link' panicked at std/src/fs/tests.rs:1473:5:
assertion failed: check!(fs::symlink_metadata(tmpdir.join("hard_link"))).file_type().is_symlink()

Reverting that single line diff fixes the test for the QNX7.1 targets, e.g. arch64-unknown-nto-qnx710 and x86_64-pc-nto-qnx710

@nyurik can the change be reverted or does QNX7.0 need to use link, instead of linkat, here? from looking at libc, it appears that both link and linkat are available on QNX7.0 so reverting the change should at least not cause compilation or linking errors. if the case is the latter, then we should use cfg(target_env = "nto70") in addition to cfg(target_os = "nto").

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-neutrinoOS: QNX Neutrino, a POSIX-compatible real-time operating systemP-lowLow priorityT-libsRelevant to the library team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions