Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# like e.g. out-of-tree builds ( https://github.com/rust-lang/cargo/issues/2930 ).
# For this reason this file should be avoided as much as possible when there are alternatives.

[target.i586-unknown-redox]
linker = "i586-unknown-redox-gcc"
[target.x86_64-unknown-redox]
linker = "x86_64-unknown-redox-gcc"
[target.aarch64-unknown-linux-gnu]
Expand Down
19 changes: 13 additions & 6 deletions src/uucore/src/lib/features/fsext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ impl FsMeta for StatFs {
not(target_env = "musl"),
not(target_os = "freebsd"),
not(target_os = "netbsd"),
not(target_os = "redox"),
not(target_os = "cygwin"),
any(
target_arch = "s390x",
Expand All @@ -555,8 +554,8 @@ impl FsMeta for StatFs {
target_os = "netbsd",
target_os = "illumos",
target_os = "solaris",
target_os = "redox",
target_os = "cygwin",
all(target_os = "redox", target_pointer_width = "64")
))]
return self.f_bsize.try_into().unwrap();
}
Expand Down Expand Up @@ -648,7 +647,12 @@ impl FsMeta for StatFs {
}

/// The preferred transfer size, which on Linux is `f_bsize`.
#[cfg(any(target_os = "aix", target_os = "linux", target_os = "android"))]
#[cfg(any(
target_os = "aix",
target_os = "linux",
target_os = "android",
target_os = "redox"
))]
#[allow(clippy::unnecessary_cast)]
fn io_size(&self) -> u64 {
self.f_bsize as u64
Expand All @@ -668,7 +672,8 @@ impl FsMeta for StatFs {
target_os = "freebsd",
target_os = "linux",
target_os = "android",
target_os = "netbsd"
target_os = "netbsd",
target_os = "redox"
)))]
fn io_size(&self) -> u64 {
self.f_bsize as u64
Expand Down Expand Up @@ -718,7 +723,8 @@ impl FsMeta for StatFs {
target_os = "aix",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_os = "redox"
))]
#[allow(clippy::unnecessary_cast)]
fn namelen(&self) -> u64 {
Expand All @@ -732,7 +738,8 @@ impl FsMeta for StatFs {
target_os = "linux",
target_os = "android",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_os = "redox"
)))]
fn namelen(&self) -> u64 {
self.f_namemax as u64 // spell-checker:disable-line
Expand Down
7 changes: 3 additions & 4 deletions tests/by-util/test_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,9 @@ fn test_file_is_not_executable() {
let metadata = std::fs::metadata(at.plus("regular_file")).unwrap();
let mut permissions = metadata.permissions();

// The conversion is useless on some platforms and casts from u16 to
// u32 on others
#[allow(clippy::useless_conversion)]
permissions.set_mode(permissions.mode() & !u32::from(libc::S_IXUSR));
// Cast is necessary on some platforms
#[allow(clippy::unnecessary_cast)]
permissions.set_mode(permissions.mode() & !(libc::S_IXUSR as u32));
std::fs::set_permissions(at.plus("regular_file"), permissions).unwrap();
}
ucmd.args(&["!", "-x", "regular_file"]).succeeds();
Expand Down
10 changes: 5 additions & 5 deletions tests/uutests/src/lib/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use core::str;
#[cfg(unix)]
use libc::mode_t;
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "redox")))]
use nix::pty::OpenptyResult;
#[cfg(unix)]
use nix::sys;
Expand Down Expand Up @@ -1957,9 +1957,9 @@ impl UCommand {

let mut captured_stdout = None;
let mut captured_stderr = None;
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "redox")))]
let mut stdin_pty: Option<File> = None;
#[cfg(not(unix))]
#[cfg(not(all(unix, not(target_os = "redox"))))]
let stdin_pty: Option<File> = None;
if self.stderr_to_stdout {
let mut output = CapturedOutput::default();
Expand Down Expand Up @@ -1994,7 +1994,7 @@ impl UCommand {
.stderr(stderr);
}

#[cfg(unix)]
#[cfg(all(unix, not(target_os = "redox")))]
if let Some(simulated_terminal) = &self.terminal_simulation {
let terminal_size = simulated_terminal.size.unwrap_or(libc::winsize {
ws_col: 80,
Expand Down Expand Up @@ -2995,7 +2995,7 @@ pub fn whoami() -> String {
/// - path: The filesystem path to the PTY replica device
/// - controller: The controller file
/// - replica: The replica file
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "redox")))]
pub fn pty_path() -> (String, File, File) {
use nix::pty::openpty;
use nix::unistd::ttyname;
Expand Down
Loading