Skip to content

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

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions