Skip to content

uucore: perms imports safe_traversal unconditionally, breaking aix/hurd/redox builds #14537

Open

Description

@sylvestre

Summary

uucore's perms feature enables safe-traversal, and perms.rs imports it unconditionally:

// src/uucore/src/lib/features/perms.rs:32
use crate::features::safe_traversal::{DirFd, SymlinkBehavior};

But the module itself is compiled only for a subset of unix:

// src/uucore/src/lib/features.rs:88-93  (and lib.rs:106-111)
#[cfg(all(
    feature = "safe-traversal",
    unix,
    not(any(target_os = "aix", target_os = "hurd", target_os = "redox"))
))]
pub mod safe_traversal;

So on aix, hurd and redox, any crate that enables uucore/perms fails to build:

error[E0432]: unresolved import `crate::features::safe_traversal`
  --> src/uucore/src/lib/features/perms.rs:32:22
   |
32 | use crate::features::safe_traversal::{DirFd, SymlinkBehavior};
   |                      ^^^^^^^^^^^^^^ could not find `safe_traversal` in `features`

chmod, chown, chgrp, chcon, runcon, cp, mv and install all enable perms.

Why it matters for Redox specifically

feat_os_unix_redox includes chmod (Cargo.toml:371-377), and uu_chmod enables uucore/perms. So the documented Redox feature set does not build.

Why it has gone unnoticed

The Redox CI job is commented out:

# .github/workflows/CICD.yml:388
# - { os: ubuntu-latest, target: x86_64-unknown-redox, features: feat_os_unix_redox, use-cross: redoxer, skip-tests: true, check-only: true }

Reproducing without a Redox toolchain

Add target_os = "linux" to the exclusion list in both features.rs and lib.rs, then cargo build -p uu_chmod. The same E0432 appears.

Suggested fix

Either gate the perms.rs import and its uses on the same cfg as the module and provide a fallback for those targets, or widen safe_traversal to compile on them. Re-enabling the Redox check-only job afterwards would stop it regressing.

Activity

  1. xtqqczze commented on Sep 15, 2026

    @xtqqczze
    Collaborator

    @sylvestre I have this fixed locally, but I think there are some dependencies that require merging first.

  2. xtqqczze commented on Sep 15, 2026

    @xtqqczze
    Collaborator

    @sylvestre Sorry, but the issue appears to be based on a misunderstanding: perms.rs does not import safe_traversal unconditionally.

    I think your LLM may have gotten confused here. There is, however, a real issue in chmod at least.

  3. xtqqczze commented on Sep 15, 2026

    @xtqqczze
    Collaborator

    chmod succeeds on Redox:

    $ git rev-parse HEAD
    4f11d2b173f9d4098965596d55aef0896e83ecc6
    $ RUSTC_BOOTSTRAP=1 cargo clippy -q -Zbuild-std -p uu_chmod --all-features --all-targets --target x86_64-unknown-redox

    chmod fails on AIX and Hurd. These failures are addressed by #14585.

    install fails on AIX, Hurd, and Redox. These failures are addressed by #14586.

    Gating of safe_traversal is addressed by #14588.

  4. abendrothj commented on Oct 1, 2026

    @abendrothj
    Contributor

    A separate Redox build break, unrelated to the perms import above: since #14623, create_link_std in src/uucore/src/lib/features/fs.rs, which is compiled for Windows and Redox, calls rustix::fs::symlinkat in its non-Windows branch, but rustix does not provide symlinkat on Redox. cargo check -p uucore --features fs --target x86_64-unknown-redox fails with "cannot find function symlinkat in module rustix::fs" (fs.rs:1202 at cacdd8d). std::os::unix::fs::symlink would work in that branch.

  5. xtqqczze commented on Oct 1, 2026

    @xtqqczze
    Collaborator

    A separate Redox build break, unrelated to the perms import above: since #14623, create_link_std in src/uucore/src/lib/features/fs.rs, which is compiled for Windows and Redox, calls rustix::fs::symlinkat in its non-Windows branch, but rustix does not provide symlinkat on Redox. cargo check -p uucore --features fs --target x86_64-unknown-redox fails with "cannot find function symlinkat in module rustix::fs" (fs.rs:1202 at cacdd8d). std::os::unix::fs::symlink would work in that branch.

    Tracked by #14704.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions