mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #7423 from sylvestre/rust-2024
bump to Rust edition 2024 & min = 1.85
This commit is contained in:
commit
f038d3e716
310 changed files with 1106 additions and 993 deletions
2
.github/workflows/CICD.yml
vendored
2
.github/workflows/CICD.yml
vendored
|
@ -11,7 +11,7 @@ env:
|
||||||
PROJECT_NAME: coreutils
|
PROJECT_NAME: coreutils
|
||||||
PROJECT_DESC: "Core universal (cross-platform) utilities"
|
PROJECT_DESC: "Core universal (cross-platform) utilities"
|
||||||
PROJECT_AUTH: "uutils"
|
PROJECT_AUTH: "uutils"
|
||||||
RUST_MIN_SRV: "1.82.0"
|
RUST_MIN_SRV: "1.85.0"
|
||||||
# * style job configuration
|
# * style job configuration
|
||||||
STYLE_FAIL_ON_FAULT: true ## (bool) fail the build if a style job contains a fault (error or warning); may be overridden on a per-job basis
|
STYLE_FAIL_ON_FAULT: true ## (bool) fail the build if a style job contains a fault (error or warning); may be overridden on a per-job basis
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ repository = "https://github.com/uutils/coreutils"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
rust-version = "1.82.0"
|
rust-version = "1.85.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
[](https://deps.rs/repo/github/uutils/coreutils)
|
[](https://deps.rs/repo/github/uutils/coreutils)
|
||||||
|
|
||||||
[](https://codecov.io/gh/uutils/coreutils)
|
[](https://codecov.io/gh/uutils/coreutils)
|
||||||

|

|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ the [coreutils docs](https://github.com/uutils/uutils.github.io) repository.
|
||||||
### Rust Version
|
### Rust Version
|
||||||
|
|
||||||
uutils follows Rust's release channels and is tested against stable, beta and
|
uutils follows Rust's release channels and is tested against stable, beta and
|
||||||
nightly. The current Minimum Supported Rust Version (MSRV) is `1.82.0`.
|
nightly. The current Minimum Supported Rust Version (MSRV) is `1.85.0`.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
|
|
2
build.rs
2
build.rs
|
@ -34,7 +34,7 @@ pub fn main() {
|
||||||
match krate.as_ref() {
|
match krate.as_ref() {
|
||||||
"default" | "macos" | "unix" | "windows" | "selinux" | "zip" => continue, // common/standard feature names
|
"default" | "macos" | "unix" | "windows" | "selinux" | "zip" => continue, // common/standard feature names
|
||||||
"nightly" | "test_unimplemented" | "expensive_tests" | "test_risky_names" => {
|
"nightly" | "test_unimplemented" | "expensive_tests" | "test_risky_names" => {
|
||||||
continue
|
continue;
|
||||||
} // crate-local custom features
|
} // crate-local custom features
|
||||||
"uudoc" => continue, // is not a utility
|
"uudoc" => continue, // is not a utility
|
||||||
"test" => continue, // over-ridden with 'uu_test' to avoid collision with rust core crate 'test'
|
"test" => continue, // over-ridden with 'uu_test' to avoid collision with rust core crate 'test'
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "uucore-fuzz"
|
name = "uucore-fuzz"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
publish = false
|
publish = false
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[package.metadata]
|
[package.metadata]
|
||||||
cargo-fuzz = true
|
cargo-fuzz = true
|
||||||
|
|
|
@ -69,7 +69,9 @@ fuzz_target!(|_data: &[u8]| {
|
||||||
// Use C locale to avoid false positives, like in https://github.com/uutils/coreutils/issues/5378,
|
// Use C locale to avoid false positives, like in https://github.com/uutils/coreutils/issues/5378,
|
||||||
// because uutils expr doesn't support localization yet
|
// because uutils expr doesn't support localization yet
|
||||||
// TODO remove once uutils expr supports localization
|
// TODO remove once uutils expr supports localization
|
||||||
env::set_var("LC_COLLATE", "C");
|
unsafe {
|
||||||
|
env::set_var("LC_COLLATE", "C");
|
||||||
|
}
|
||||||
let rust_result = generate_and_run_uumain(&args, uumain, None);
|
let rust_result = generate_and_run_uumain(&args, uumain, None);
|
||||||
|
|
||||||
let gnu_result = match run_gnu_cmd(CMD_PATH, &args[1..], false, None) {
|
let gnu_result = match run_gnu_cmd(CMD_PATH, &args[1..], false, None) {
|
||||||
|
|
|
@ -84,7 +84,9 @@ fuzz_target!(|_data: &[u8]| {
|
||||||
let rust_result = generate_and_run_uumain(&args, uumain, None);
|
let rust_result = generate_and_run_uumain(&args, uumain, None);
|
||||||
|
|
||||||
// TODO remove once uutils printf supports localization
|
// TODO remove once uutils printf supports localization
|
||||||
env::set_var("LC_ALL", "C");
|
unsafe {
|
||||||
|
env::set_var("LC_ALL", "C");
|
||||||
|
}
|
||||||
let gnu_result = match run_gnu_cmd(CMD_PATH, &args[1..], false, None) {
|
let gnu_result = match run_gnu_cmd(CMD_PATH, &args[1..], false, None) {
|
||||||
Ok(result) => result,
|
Ok(result) => result,
|
||||||
Err(error_result) => {
|
Err(error_result) => {
|
||||||
|
|
|
@ -60,7 +60,9 @@ fuzz_target!(|_data: &[u8]| {
|
||||||
let rust_result = generate_and_run_uumain(&args, uumain, Some(&input_lines));
|
let rust_result = generate_and_run_uumain(&args, uumain, Some(&input_lines));
|
||||||
|
|
||||||
// TODO remove once uutils sort supports localization
|
// TODO remove once uutils sort supports localization
|
||||||
env::set_var("LC_ALL", "C");
|
unsafe {
|
||||||
|
env::set_var("LC_ALL", "C");
|
||||||
|
}
|
||||||
let gnu_result = match run_gnu_cmd(CMD_PATH, &args[1..], false, Some(&input_lines)) {
|
let gnu_result = match run_gnu_cmd(CMD_PATH, &args[1..], false, Some(&input_lines)) {
|
||||||
Ok(result) => result,
|
Ok(result) => result,
|
||||||
Err(error_result) => {
|
Err(error_result) => {
|
||||||
|
|
|
@ -23,7 +23,9 @@ fn main() -> io::Result<()> {
|
||||||
|
|
||||||
if tldr_zip.is_none() {
|
if tldr_zip.is_none() {
|
||||||
println!("Warning: No tldr archive found, so the documentation will not include examples.");
|
println!("Warning: No tldr archive found, so the documentation will not include examples.");
|
||||||
println!("To include examples in the documentation, download the tldr archive and put it in the docs/ folder.");
|
println!(
|
||||||
|
"To include examples in the documentation, download the tldr archive and put it in the docs/ folder."
|
||||||
|
);
|
||||||
println!();
|
println!();
|
||||||
println!(" curl https://tldr.sh/assets/tldr.zip -o docs/tldr.zip");
|
println!(" curl https://tldr.sh/assets/tldr.zip -o docs/tldr.zip");
|
||||||
println!();
|
println!();
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/arch"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/arch"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/base32"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/base32"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ use std::io::{self, ErrorKind, Read, Seek, SeekFrom};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::encoding::{
|
use uucore::encoding::{
|
||||||
for_base_common::{BASE32, BASE32HEX, BASE64, BASE64URL, BASE64_NOPAD, HEXUPPER_PERMISSIVE},
|
BASE2LSBF, BASE2MSBF, Format, Z85Wrapper,
|
||||||
Format, Z85Wrapper, BASE2LSBF, BASE2MSBF,
|
for_base_common::{BASE32, BASE32HEX, BASE64, BASE64_NOPAD, BASE64URL, HEXUPPER_PERMISSIVE},
|
||||||
};
|
};
|
||||||
use uucore::encoding::{EncodingWrapper, SupportsFastDecodeAndEncode};
|
use uucore::encoding::{EncodingWrapper, SupportsFastDecodeAndEncode};
|
||||||
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
|
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
|
||||||
|
@ -291,7 +291,7 @@ pub fn get_supports_fast_decode_and_encode(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod fast_encode {
|
pub mod fast_encode {
|
||||||
use crate::base_common::{format_read_error, WRAP_DEFAULT};
|
use crate::base_common::{WRAP_DEFAULT, format_read_error};
|
||||||
use std::{
|
use std::{
|
||||||
collections::VecDeque,
|
collections::VecDeque,
|
||||||
io::{self, ErrorKind, Read, Write},
|
io::{self, ErrorKind, Read, Write},
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/base64"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/base64"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/basename"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/basename"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// spell-checker:ignore (ToDO) fullname
|
// spell-checker:ignore (ToDO) fullname
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use std::path::{is_separator, PathBuf};
|
use std::path::{PathBuf, is_separator};
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{UResult, UUsageError};
|
use uucore::error::{UResult, UUsageError};
|
||||||
use uucore::line_ending::LineEnding;
|
use uucore::line_ending::LineEnding;
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/basenc"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/basenc"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// spell-checker:ignore lsbf msbf
|
// spell-checker:ignore lsbf msbf
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use uu_base32::base_common::{self, Config, BASE_CMD_PARSE_ERROR};
|
use uu_base32::base_common::{self, BASE_CMD_PARSE_ERROR, Config};
|
||||||
use uucore::error::UClapError;
|
use uucore::error::UClapError;
|
||||||
use uucore::{
|
use uucore::{
|
||||||
encoding::Format,
|
encoding::Format,
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/cat"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/cat"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
|
|
||||||
// spell-checker:ignore (ToDO) nonprint nonblank nonprinting ELOOP
|
// spell-checker:ignore (ToDO) nonprint nonblank nonprinting ELOOP
|
||||||
use std::fs::{metadata, File};
|
use std::fs::{File, metadata};
|
||||||
use std::io::{self, BufWriter, IsTerminal, Read, Write};
|
use std::io::{self, BufWriter, IsTerminal, Read, Write};
|
||||||
/// Unix domain socket support
|
/// Unix domain socket support
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
@ -18,7 +18,7 @@ use std::os::unix::net::UnixStream;
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use nix::fcntl::{fcntl, FcntlArg};
|
use nix::fcntl::{FcntlArg, fcntl};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::UResult;
|
use uucore::error::UResult;
|
||||||
|
@ -83,19 +83,11 @@ struct OutputOptions {
|
||||||
|
|
||||||
impl OutputOptions {
|
impl OutputOptions {
|
||||||
fn tab(&self) -> &'static str {
|
fn tab(&self) -> &'static str {
|
||||||
if self.show_tabs {
|
if self.show_tabs { "^I" } else { "\t" }
|
||||||
"^I"
|
|
||||||
} else {
|
|
||||||
"\t"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn end_of_line(&self) -> &'static str {
|
fn end_of_line(&self) -> &'static str {
|
||||||
if self.show_ends {
|
if self.show_ends { "$\n" } else { "\n" }
|
||||||
"$\n"
|
|
||||||
} else {
|
|
||||||
"\n"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// We can write fast if we can simply copy the contents of the file to
|
/// We can write fast if we can simply copy the contents of the file to
|
||||||
|
@ -694,7 +686,7 @@ fn write_end_of_line<W: Write>(
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::io::{stdout, BufWriter};
|
use std::io::{BufWriter, stdout};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_write_nonprint_to_end_new_line() {
|
fn test_write_nonprint_to_end_new_line() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chcon"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chcon"
|
||||||
keywords = ["coreutils", "uutils", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chgrp"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chgrp"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
pub use uucore::entries;
|
pub use uucore::entries;
|
||||||
use uucore::error::{FromIo, UResult, USimpleError};
|
use uucore::error::{FromIo, UResult, USimpleError};
|
||||||
use uucore::perms::{chown_base, options, GidUidOwnerFilter, IfFrom};
|
use uucore::perms::{GidUidOwnerFilter, IfFrom, chown_base, options};
|
||||||
use uucore::{format_usage, help_about, help_usage};
|
use uucore::{format_usage, help_about, help_usage};
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, ArgMatches, Command};
|
use clap::{Arg, ArgAction, ArgMatches, Command};
|
||||||
|
@ -76,7 +76,7 @@ fn parse_gid_and_uid(matches: &ArgMatches) -> UResult<GidUidOwnerFilter> {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
format!("invalid user: '{}'", from_group),
|
format!("invalid user: '{}'", from_group),
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chmod"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chmod"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ use std::fs;
|
||||||
use std::os::unix::fs::{MetadataExt, PermissionsExt};
|
use std::os::unix::fs::{MetadataExt, PermissionsExt};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{set_exit_code, ExitCode, UResult, USimpleError, UUsageError};
|
use uucore::error::{ExitCode, UResult, USimpleError, UUsageError, set_exit_code};
|
||||||
use uucore::fs::display_permissions_unix;
|
use uucore::fs::display_permissions_unix;
|
||||||
use uucore::libc::mode_t;
|
use uucore::libc::mode_t;
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
use uucore::mode;
|
use uucore::mode;
|
||||||
use uucore::perms::{configure_symlink_and_recursion, TraverseSymlinks};
|
use uucore::perms::{TraverseSymlinks, configure_symlink_and_recursion};
|
||||||
use uucore::{format_usage, help_about, help_section, help_usage, show, show_error};
|
use uucore::{format_usage, help_about, help_section, help_usage, show, show_error};
|
||||||
|
|
||||||
const ABOUT: &str = help_about!("chmod.md");
|
const ABOUT: &str = help_about!("chmod.md");
|
||||||
|
@ -107,7 +107,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
format!("cannot stat attributes of {}: {}", fref.quote(), err),
|
format!("cannot stat attributes of {}: {}", fref.quote(), err),
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => None,
|
None => None,
|
||||||
|
@ -298,7 +298,7 @@ impl Chmoder {
|
||||||
format!(
|
format!(
|
||||||
"it is dangerous to operate recursively on {}\nchmod: use --no-preserve-root to override this failsafe",
|
"it is dangerous to operate recursively on {}\nchmod: use --no-preserve-root to override this failsafe",
|
||||||
filename.quote()
|
filename.quote()
|
||||||
)
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if self.recursive {
|
if self.recursive {
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chown"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chown"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
pub use uucore::entries::{self, Group, Locate, Passwd};
|
pub use uucore::entries::{self, Group, Locate, Passwd};
|
||||||
use uucore::perms::{chown_base, options, GidUidOwnerFilter, IfFrom};
|
use uucore::perms::{GidUidOwnerFilter, IfFrom, chown_base, options};
|
||||||
use uucore::{format_usage, help_about, help_usage};
|
use uucore::{format_usage, help_about, help_usage};
|
||||||
|
|
||||||
use uucore::error::{FromIo, UResult, USimpleError};
|
use uucore::error::{FromIo, UResult, USimpleError};
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chroot"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/chroot"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ use std::io::Error;
|
||||||
use std::os::unix::prelude::OsStrExt;
|
use std::os::unix::prelude::OsStrExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process;
|
use std::process;
|
||||||
use uucore::entries::{grp2gid, usr2uid, Locate, Passwd};
|
use uucore::entries::{Locate, Passwd, grp2gid, usr2uid};
|
||||||
use uucore::error::{set_exit_code, UClapError, UResult, UUsageError};
|
use uucore::error::{UClapError, UResult, UUsageError, set_exit_code};
|
||||||
use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
|
use uucore::fs::{MissingHandling, ResolveMode, canonicalize};
|
||||||
use uucore::libc::{self, chroot, setgid, setgroups, setuid};
|
use uucore::libc::{self, chroot, setgid, setgroups, setuid};
|
||||||
use uucore::{format_usage, help_about, help_usage, show};
|
use uucore::{format_usage, help_about, help_usage, show};
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
} else {
|
} else {
|
||||||
ChrootError::CommandFailed(command[0].to_string(), e)
|
ChrootError::CommandFailed(command[0].to_string(), e)
|
||||||
}
|
}
|
||||||
.into())
|
.into());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/cksum"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/cksum"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,17 @@
|
||||||
|
|
||||||
// spell-checker:ignore (ToDO) fname, algo
|
// spell-checker:ignore (ToDO) fname, algo
|
||||||
use clap::builder::ValueParser;
|
use clap::builder::ValueParser;
|
||||||
use clap::{value_parser, Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command, value_parser};
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, stdin, stdout, BufReader, Read, Write};
|
use std::io::{self, BufReader, Read, Write, stdin, stdout};
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::checksum::{
|
use uucore::checksum::{
|
||||||
calculate_blake2b_length, detect_algo, digest_reader, perform_checksum_validation,
|
ALGORITHM_OPTIONS_BLAKE2B, ALGORITHM_OPTIONS_BSD, ALGORITHM_OPTIONS_CRC,
|
||||||
ChecksumError, ChecksumOptions, ChecksumVerbose, ALGORITHM_OPTIONS_BLAKE2B,
|
ALGORITHM_OPTIONS_CRC32B, ALGORITHM_OPTIONS_SYSV, ChecksumError, ChecksumOptions,
|
||||||
ALGORITHM_OPTIONS_BSD, ALGORITHM_OPTIONS_CRC, ALGORITHM_OPTIONS_CRC32B, ALGORITHM_OPTIONS_SYSV,
|
ChecksumVerbose, SUPPORTED_ALGORITHMS, calculate_blake2b_length, detect_algo, digest_reader,
|
||||||
SUPPORTED_ALGORITHMS,
|
perform_checksum_validation,
|
||||||
};
|
};
|
||||||
use uucore::{
|
use uucore::{
|
||||||
encoding,
|
encoding,
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/comm"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/comm"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
// spell-checker:ignore (ToDO) delim mkdelim pairable
|
// spell-checker:ignore (ToDO) delim mkdelim pairable
|
||||||
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::fs::{metadata, File};
|
use std::fs::{File, metadata};
|
||||||
use std::io::{self, stdin, BufRead, BufReader, Read, Stdin};
|
use std::io::{self, BufRead, BufReader, Read, Stdin, stdin};
|
||||||
use uucore::error::{FromIo, UResult, USimpleError};
|
use uucore::error::{FromIo, UResult, USimpleError};
|
||||||
use uucore::fs::paths_refer_to_same_file;
|
use uucore::fs::paths_refer_to_same_file;
|
||||||
use uucore::line_ending::LineEnding;
|
use uucore::line_ending::LineEnding;
|
||||||
|
|
|
@ -13,7 +13,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/cp"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/cp"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ use indicatif::ProgressBar;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::UIoError;
|
use uucore::error::UIoError;
|
||||||
use uucore::fs::{
|
use uucore::fs::{
|
||||||
canonicalize, path_ends_with_terminator, FileInformation, MissingHandling, ResolveMode,
|
FileInformation, MissingHandling, ResolveMode, canonicalize, path_ends_with_terminator,
|
||||||
};
|
};
|
||||||
use uucore::show;
|
use uucore::show;
|
||||||
use uucore::show_error;
|
use uucore::show_error;
|
||||||
|
@ -26,8 +26,8 @@ use uucore::uio_error;
|
||||||
use walkdir::{DirEntry, WalkDir};
|
use walkdir::{DirEntry, WalkDir};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
aligned_ancestors, context_for, copy_attributes, copy_file, copy_link, CopyResult, Error,
|
CopyResult, Error, Options, aligned_ancestors, context_for, copy_attributes, copy_file,
|
||||||
Options,
|
copy_link,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Ensure a Windows path starts with a `\\?`.
|
/// Ensure a Windows path starts with a `\\?`.
|
||||||
|
|
|
@ -20,7 +20,7 @@ use std::path::{Path, PathBuf, StripPrefixError};
|
||||||
#[cfg(all(unix, not(target_os = "android")))]
|
#[cfg(all(unix, not(target_os = "android")))]
|
||||||
use uucore::fsxattr::copy_xattrs;
|
use uucore::fsxattr::copy_xattrs;
|
||||||
|
|
||||||
use clap::{builder::ValueParser, Arg, ArgAction, ArgMatches, Command};
|
use clap::{Arg, ArgAction, ArgMatches, Command, builder::ValueParser};
|
||||||
use filetime::FileTime;
|
use filetime::FileTime;
|
||||||
use indicatif::{ProgressBar, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
@ -29,11 +29,11 @@ use quick_error::ResultExt;
|
||||||
|
|
||||||
use platform::copy_on_write;
|
use platform::copy_on_write;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{set_exit_code, UClapError, UError, UResult, UUsageError};
|
use uucore::error::{UClapError, UError, UResult, UUsageError, set_exit_code};
|
||||||
use uucore::fs::{
|
use uucore::fs::{
|
||||||
are_hardlinks_to_same_file, canonicalize, get_filename, is_symlink_loop, normalize_path,
|
FileInformation, MissingHandling, ResolveMode, are_hardlinks_to_same_file, canonicalize,
|
||||||
path_ends_with_terminator, paths_refer_to_same_file, FileInformation, MissingHandling,
|
get_filename, is_symlink_loop, normalize_path, path_ends_with_terminator,
|
||||||
ResolveMode,
|
paths_refer_to_same_file,
|
||||||
};
|
};
|
||||||
use uucore::{backup_control, update_control};
|
use uucore::{backup_control, update_control};
|
||||||
// These are exposed for projects (e.g. nushell) that want to create an `Options` value, which
|
// These are exposed for projects (e.g. nushell) that want to create an `Options` value, which
|
||||||
|
@ -1498,7 +1498,7 @@ fn file_mode_for_interactive_overwrite(
|
||||||
{
|
{
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
use libc::{mode_t, S_IWUSR};
|
use libc::{S_IWUSR, mode_t};
|
||||||
use std::os::unix::prelude::MetadataExt;
|
use std::os::unix::prelude::MetadataExt;
|
||||||
|
|
||||||
match path.metadata() {
|
match path.metadata() {
|
||||||
|
@ -1631,9 +1631,9 @@ pub(crate) fn copy_attributes(
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
handle_preserve(&attributes.ownership, || -> CopyResult<()> {
|
handle_preserve(&attributes.ownership, || -> CopyResult<()> {
|
||||||
use std::os::unix::prelude::MetadataExt;
|
use std::os::unix::prelude::MetadataExt;
|
||||||
use uucore::perms::wrap_chown;
|
|
||||||
use uucore::perms::Verbosity;
|
use uucore::perms::Verbosity;
|
||||||
use uucore::perms::VerbosityLevel;
|
use uucore::perms::VerbosityLevel;
|
||||||
|
use uucore::perms::wrap_chown;
|
||||||
|
|
||||||
let dest_uid = source_metadata.uid();
|
let dest_uid = source_metadata.uid();
|
||||||
let dest_gid = source_metadata.gid();
|
let dest_gid = source_metadata.gid();
|
||||||
|
@ -2627,7 +2627,7 @@ fn disk_usage_directory(p: &Path) -> io::Result<u64> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use crate::{aligned_ancestors, localize_to_target, Attributes, Preserve};
|
use crate::{Attributes, Preserve, aligned_ancestors, localize_to_target};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -340,7 +340,7 @@ pub(crate) fn copy_on_write(
|
||||||
}
|
}
|
||||||
(ReflinkMode::Auto, SparseMode::Always) => {
|
(ReflinkMode::Auto, SparseMode::Always) => {
|
||||||
copy_debug.sparse_detection = SparseDebug::Zeros; // Default SparseDebug val for
|
copy_debug.sparse_detection = SparseDebug::Zeros; // Default SparseDebug val for
|
||||||
// SparseMode::Always
|
// SparseMode::Always
|
||||||
if source_is_stream {
|
if source_is_stream {
|
||||||
copy_debug.offload = OffloadReflinkDebug::Avoided;
|
copy_debug.offload = OffloadReflinkDebug::Avoided;
|
||||||
copy_stream(source, dest, source_is_fifo).map(|_| ())
|
copy_stream(source, dest, source_is_fifo).map(|_| ())
|
||||||
|
@ -401,7 +401,7 @@ pub(crate) fn copy_on_write(
|
||||||
clone(source, dest, CloneFallback::Error)
|
clone(source, dest, CloneFallback::Error)
|
||||||
}
|
}
|
||||||
(ReflinkMode::Always, _) => {
|
(ReflinkMode::Always, _) => {
|
||||||
return Err("`--reflink=always` can be used only with --sparse=auto".into())
|
return Err("`--reflink=always` can be used only with --sparse=auto".into());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
result.context(context)?;
|
result.context(context)?;
|
||||||
|
@ -524,7 +524,7 @@ fn handle_reflink_auto_sparse_auto(
|
||||||
} else {
|
} else {
|
||||||
copy_method = CopyMethod::SparseCopyWithoutHole;
|
copy_method = CopyMethod::SparseCopyWithoutHole;
|
||||||
} // Since sparse_flag is true, sparse_detection shall be SeekHole for any non virtual
|
} // Since sparse_flag is true, sparse_detection shall be SeekHole for any non virtual
|
||||||
// regular sparse file and the file will be sparsely copied
|
// regular sparse file and the file will be sparsely copied
|
||||||
copy_debug.sparse_detection = SparseDebug::SeekHole;
|
copy_debug.sparse_detection = SparseDebug::SeekHole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ fn handle_reflink_never_sparse_auto(
|
||||||
if sparse_flag {
|
if sparse_flag {
|
||||||
if blocks == 0 && data_flag {
|
if blocks == 0 && data_flag {
|
||||||
copy_method = CopyMethod::FSCopy; // Handles virtual files which have size > 0 but no
|
copy_method = CopyMethod::FSCopy; // Handles virtual files which have size > 0 but no
|
||||||
// disk allocation
|
// disk allocation
|
||||||
} else {
|
} else {
|
||||||
copy_method = CopyMethod::SparseCopyWithoutHole; // Handles regular sparse-files
|
copy_method = CopyMethod::SparseCopyWithoutHole; // Handles regular sparse-files
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ pub(crate) fn copy_on_write(
|
||||||
// support COW).
|
// support COW).
|
||||||
match reflink_mode {
|
match reflink_mode {
|
||||||
ReflinkMode::Always => {
|
ReflinkMode::Always => {
|
||||||
return Err(format!("failed to clone {source:?} from {dest:?}: {error}").into())
|
return Err(format!("failed to clone {source:?} from {dest:?}: {error}").into());
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
copy_debug.reflink = OffloadReflinkDebug::Yes;
|
copy_debug.reflink = OffloadReflinkDebug::Yes;
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/ls"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/ls"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::io::{self, BufReader};
|
use std::io::{self, BufReader};
|
||||||
use std::{
|
use std::{
|
||||||
fs::{remove_file, File},
|
fs::{File, remove_file},
|
||||||
io::{BufRead, BufWriter, Write},
|
io::{BufRead, BufWriter, Write},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
// spell-checker:ignore (regex) diuox
|
// spell-checker:ignore (regex) diuox
|
||||||
|
|
||||||
use uucore::format::{num_format::UnsignedInt, Format, FormatError};
|
use uucore::format::{Format, FormatError, num_format::UnsignedInt};
|
||||||
|
|
||||||
use crate::csplit_error::CsplitError;
|
use crate::csplit_error::CsplitError;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/cut"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/cut"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
// spell-checker:ignore (ToDO) delim sourcefiles
|
// spell-checker:ignore (ToDO) delim sourcefiles
|
||||||
|
|
||||||
use bstr::io::BufReadExt;
|
use bstr::io::BufReadExt;
|
||||||
use clap::{builder::ValueParser, Arg, ArgAction, ArgMatches, Command};
|
use clap::{Arg, ArgAction, ArgMatches, Command, builder::ValueParser};
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, IsTerminal, Read, Write};
|
use std::io::{BufRead, BufReader, BufWriter, IsTerminal, Read, Write, stdin, stdout};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{set_exit_code, FromIo, UResult, USimpleError};
|
use uucore::error::{FromIo, UResult, USimpleError, set_exit_code};
|
||||||
use uucore::line_ending::LineEnding;
|
use uucore::line_ending::LineEnding;
|
||||||
use uucore::os_str_as_bytes;
|
use uucore::os_str_as_bytes;
|
||||||
|
|
||||||
|
@ -355,9 +355,9 @@ fn cut_files(mut filenames: Vec<String>, mode: &Mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
show_if_err!(match mode {
|
show_if_err!(match mode {
|
||||||
Mode::Bytes(ref ranges, ref opts) => cut_bytes(stdin(), ranges, opts),
|
Mode::Bytes(ranges, opts) => cut_bytes(stdin(), ranges, opts),
|
||||||
Mode::Characters(ref ranges, ref opts) => cut_bytes(stdin(), ranges, opts),
|
Mode::Characters(ranges, opts) => cut_bytes(stdin(), ranges, opts),
|
||||||
Mode::Fields(ref ranges, ref opts) => cut_fields(stdin(), ranges, opts),
|
Mode::Fields(ranges, opts) => cut_fields(stdin(), ranges, opts),
|
||||||
});
|
});
|
||||||
|
|
||||||
stdin_read = true;
|
stdin_read = true;
|
||||||
|
@ -370,16 +370,18 @@ fn cut_files(mut filenames: Vec<String>, mode: &Mode) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_if_err!(File::open(path)
|
show_if_err!(
|
||||||
.map_err_context(|| filename.maybe_quote().to_string())
|
File::open(path)
|
||||||
.and_then(|file| {
|
.map_err_context(|| filename.maybe_quote().to_string())
|
||||||
match &mode {
|
.and_then(|file| {
|
||||||
Mode::Bytes(ranges, opts) | Mode::Characters(ranges, opts) => {
|
match &mode {
|
||||||
cut_bytes(file, ranges, opts)
|
Mode::Bytes(ranges, opts) | Mode::Characters(ranges, opts) => {
|
||||||
|
cut_bytes(file, ranges, opts)
|
||||||
|
}
|
||||||
|
Mode::Fields(ranges, opts) => cut_fields(file, ranges, opts),
|
||||||
}
|
}
|
||||||
Mode::Fields(ranges, opts) => cut_fields(file, ranges, opts),
|
})
|
||||||
}
|
);
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/date"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/date"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use chrono::{DateTime, FixedOffset, Local, Offset, TimeDelta, Utc};
|
||||||
use chrono::{Datelike, Timelike};
|
use chrono::{Datelike, Timelike};
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||||
use libc::{clock_settime, timespec, CLOCK_REALTIME};
|
use libc::{CLOCK_REALTIME, clock_settime, timespec};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/dd"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/dd"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ use nix::fcntl::FcntlArg::F_SETFL;
|
||||||
use nix::fcntl::OFlag;
|
use nix::fcntl::OFlag;
|
||||||
use parseargs::Parser;
|
use parseargs::Parser;
|
||||||
use progress::ProgUpdateType;
|
use progress::ProgUpdateType;
|
||||||
use progress::{gen_prog_updater, ProgUpdate, ReadStat, StatusLevel, WriteStat};
|
use progress::{ProgUpdate, ReadStat, StatusLevel, WriteStat, gen_prog_updater};
|
||||||
use uucore::io::OwnedFileDescriptorOrHandle;
|
use uucore::io::OwnedFileDescriptorOrHandle;
|
||||||
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
@ -41,7 +41,7 @@ use std::os::unix::{
|
||||||
use std::os::windows::{fs::MetadataExt, io::AsHandle};
|
use std::os::windows::{fs::MetadataExt, io::AsHandle};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::atomic::AtomicU8;
|
use std::sync::atomic::AtomicU8;
|
||||||
use std::sync::{atomic::Ordering::Relaxed, mpsc, Arc};
|
use std::sync::{Arc, atomic::Ordering::Relaxed, mpsc};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
|
@ -50,12 +50,12 @@ use gcd::Gcd;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use nix::{
|
use nix::{
|
||||||
errno::Errno,
|
errno::Errno,
|
||||||
fcntl::{posix_fadvise, PosixFadviseAdvice},
|
fcntl::{PosixFadviseAdvice, posix_fadvise},
|
||||||
};
|
};
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
#[cfg(unix)]
|
|
||||||
use uucore::error::{set_exit_code, USimpleError};
|
|
||||||
use uucore::error::{FromIo, UResult};
|
use uucore::error::{FromIo, UResult};
|
||||||
|
#[cfg(unix)]
|
||||||
|
use uucore::error::{USimpleError, set_exit_code};
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use uucore::show_if_err;
|
use uucore::show_if_err;
|
||||||
use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
||||||
|
@ -417,11 +417,7 @@ fn make_linux_iflags(iflags: &IFlags) -> Option<libc::c_int> {
|
||||||
flag |= libc::O_SYNC;
|
flag |= libc::O_SYNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if flag == 0 {
|
if flag == 0 { None } else { Some(flag) }
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(flag)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Read for Input<'_> {
|
impl Read for Input<'_> {
|
||||||
|
@ -832,10 +828,9 @@ impl<'a> Output<'a> {
|
||||||
fn discard_cache(&self, offset: libc::off_t, len: libc::off_t) {
|
fn discard_cache(&self, offset: libc::off_t, len: libc::off_t) {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
show_if_err!(self
|
show_if_err!(self.dst.discard_cache(offset, len).map_err_context(|| {
|
||||||
.dst
|
"failed to discard cache for: 'standard output'".to_string()
|
||||||
.discard_cache(offset, len)
|
}));
|
||||||
.map_err_context(|| "failed to discard cache for: 'standard output'".to_string()));
|
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
|
@ -1241,11 +1236,7 @@ fn make_linux_oflags(oflags: &OFlags) -> Option<libc::c_int> {
|
||||||
flag |= libc::O_SYNC;
|
flag |= libc::O_SYNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if flag == 0 {
|
if flag == 0 { None } else { Some(flag) }
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(flag)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read from an input (that is, a source of bytes) into the given buffer.
|
/// Read from an input (that is, a source of bytes) into the given buffer.
|
||||||
|
@ -1441,7 +1432,7 @@ pub fn uu_app() -> Command {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{calc_bsize, Output, Parser};
|
use crate::{Output, Parser, calc_bsize};
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ pub(crate) fn to_magnitude_and_suffix(n: u128, suffix_type: SuffixType) -> Strin
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use crate::numbers::{to_magnitude_and_suffix, SuffixType};
|
use crate::numbers::{SuffixType, to_magnitude_and_suffix};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_to_magnitude_and_suffix_powers_of_1024() {
|
fn test_to_magnitude_and_suffix_powers_of_1024() {
|
||||||
|
|
|
@ -630,8 +630,8 @@ fn conversion_mode(
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use crate::parseargs::{parse_bytes_with_opt_multiplier, Parser};
|
|
||||||
use crate::Num;
|
use crate::Num;
|
||||||
|
use crate::parseargs::{Parser, parse_bytes_with_opt_multiplier};
|
||||||
use std::matches;
|
use std::matches;
|
||||||
const BIG: &str = "9999999999999999999999999999999999999999999999999999999999999";
|
const BIG: &str = "9999999999999999999999999999999999999999999999999999999999999";
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
use crate::StatusLevel;
|
||||||
use crate::conversion_tables::{
|
use crate::conversion_tables::{
|
||||||
ASCII_TO_EBCDIC_UCASE_TO_LCASE, ASCII_TO_IBM, EBCDIC_TO_ASCII_LCASE_TO_UCASE,
|
ASCII_TO_EBCDIC_UCASE_TO_LCASE, ASCII_TO_IBM, EBCDIC_TO_ASCII_LCASE_TO_UCASE,
|
||||||
};
|
};
|
||||||
use crate::parseargs::Parser;
|
use crate::parseargs::Parser;
|
||||||
use crate::StatusLevel;
|
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "linux", target_os = "android")))]
|
#[cfg(not(any(target_os = "linux", target_os = "android")))]
|
||||||
#[allow(clippy::useless_vec)]
|
#[allow(clippy::useless_vec)]
|
||||||
|
@ -341,7 +341,9 @@ fn parse_icf_tokens_elu() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_icf_tokens_remaining() {
|
fn parse_icf_tokens_remaining() {
|
||||||
let args = &["conv=ascii,ucase,block,sparse,swab,sync,noerror,excl,nocreat,notrunc,noerror,fdatasync,fsync"];
|
let args = &[
|
||||||
|
"conv=ascii,ucase,block,sparse,swab,sync,noerror,excl,nocreat,notrunc,noerror,fdatasync,fsync",
|
||||||
|
];
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Parser::new().read(args),
|
Parser::new().read(args),
|
||||||
Ok(Parser {
|
Ok(Parser {
|
||||||
|
|
|
@ -22,7 +22,7 @@ use uucore::{
|
||||||
format::num_format::{FloatVariant, Formatter},
|
format::num_format::{FloatVariant, Formatter},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::numbers::{to_magnitude_and_suffix, SuffixType};
|
use crate::numbers::{SuffixType, to_magnitude_and_suffix};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq)]
|
#[derive(PartialEq, Eq)]
|
||||||
pub(crate) enum ProgUpdateType {
|
pub(crate) enum ProgUpdateType {
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/df"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/df"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use std::{env, fmt};
|
||||||
|
|
||||||
use uucore::{
|
use uucore::{
|
||||||
display::Quotable,
|
display::Quotable,
|
||||||
parse_size::{parse_size_u64, ParseSizeError},
|
parse_size::{ParseSizeError, parse_size_u64},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The first ten powers of 1024.
|
/// The first ten powers of 1024.
|
||||||
|
@ -216,7 +216,7 @@ mod tests {
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use crate::blocks::{to_magnitude_and_suffix, BlockSize, SuffixType};
|
use crate::blocks::{BlockSize, SuffixType, to_magnitude_and_suffix};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_to_magnitude_and_suffix_powers_of_1024() {
|
fn test_to_magnitude_and_suffix_powers_of_1024() {
|
||||||
|
@ -294,8 +294,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_default_block_size() {
|
fn test_default_block_size() {
|
||||||
assert_eq!(BlockSize::Bytes(1024), BlockSize::default());
|
assert_eq!(BlockSize::Bytes(1024), BlockSize::default());
|
||||||
env::set_var("POSIXLY_CORRECT", "1");
|
unsafe { env::set_var("POSIXLY_CORRECT", "1") };
|
||||||
assert_eq!(BlockSize::Bytes(512), BlockSize::default());
|
assert_eq!(BlockSize::Bytes(512), BlockSize::default());
|
||||||
env::remove_var("POSIXLY_CORRECT");
|
unsafe { env::remove_var("POSIXLY_CORRECT") };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
// spell-checker:ignore itotal iused iavail ipcent pcent squashfs
|
// spell-checker:ignore itotal iused iavail ipcent pcent squashfs
|
||||||
use crate::{OPT_INODES, OPT_OUTPUT, OPT_PRINT_TYPE};
|
use crate::{OPT_INODES, OPT_OUTPUT, OPT_PRINT_TYPE};
|
||||||
use clap::{parser::ValueSource, ArgMatches};
|
use clap::{ArgMatches, parser::ValueSource};
|
||||||
|
|
||||||
/// The columns in the output table produced by `df`.
|
/// The columns in the output table produced by `df`.
|
||||||
///
|
///
|
||||||
|
|
|
@ -13,18 +13,18 @@ use clap::builder::ValueParser;
|
||||||
use table::HeaderMode;
|
use table::HeaderMode;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{UError, UResult, USimpleError};
|
use uucore::error::{UError, UResult, USimpleError};
|
||||||
use uucore::fsext::{read_fs_list, MountInfo};
|
use uucore::fsext::{MountInfo, read_fs_list};
|
||||||
use uucore::parse_size::ParseSizeError;
|
use uucore::parse_size::ParseSizeError;
|
||||||
use uucore::{format_usage, help_about, help_section, help_usage, show};
|
use uucore::{format_usage, help_about, help_section, help_usage, show};
|
||||||
|
|
||||||
use clap::{parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
|
use clap::{Arg, ArgAction, ArgMatches, Command, parser::ValueSource};
|
||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::blocks::{read_block_size, BlockSize};
|
use crate::blocks::{BlockSize, read_block_size};
|
||||||
use crate::columns::{Column, ColumnError};
|
use crate::columns::{Column, ColumnError};
|
||||||
use crate::filesystem::Filesystem;
|
use crate::filesystem::Filesystem;
|
||||||
use crate::filesystem::FsError;
|
use crate::filesystem::FsError;
|
||||||
|
@ -749,7 +749,7 @@ mod tests {
|
||||||
|
|
||||||
mod is_included {
|
mod is_included {
|
||||||
|
|
||||||
use crate::{is_included, Options};
|
use crate::{Options, is_included};
|
||||||
use uucore::fsext::MountInfo;
|
use uucore::fsext::MountInfo;
|
||||||
|
|
||||||
/// Instantiate a [`MountInfo`] with the given fields.
|
/// Instantiate a [`MountInfo`] with the given fields.
|
||||||
|
@ -886,7 +886,7 @@ mod tests {
|
||||||
|
|
||||||
mod filter_mount_list {
|
mod filter_mount_list {
|
||||||
|
|
||||||
use crate::{filter_mount_list, Options};
|
use crate::{Options, filter_mount_list};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_empty() {
|
fn test_empty() {
|
||||||
|
|
|
@ -207,7 +207,7 @@ mod tests {
|
||||||
|
|
||||||
use uucore::fsext::MountInfo;
|
use uucore::fsext::MountInfo;
|
||||||
|
|
||||||
use crate::filesystem::{mount_info_from_path, FsError};
|
use crate::filesystem::{FsError, mount_info_from_path};
|
||||||
|
|
||||||
// Create a fake `MountInfo` with the given directory name.
|
// Create a fake `MountInfo` with the given directory name.
|
||||||
fn mount_info(mount_dir: &str) -> MountInfo {
|
fn mount_info(mount_dir: &str) -> MountInfo {
|
||||||
|
@ -312,7 +312,7 @@ mod tests {
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
mod over_mount {
|
mod over_mount {
|
||||||
use crate::filesystem::{is_over_mounted, Filesystem, FsError};
|
use crate::filesystem::{Filesystem, FsError, is_over_mounted};
|
||||||
use uucore::fsext::MountInfo;
|
use uucore::fsext::MountInfo;
|
||||||
|
|
||||||
fn mount_info_with_dev_name(mount_dir: &str, dev_name: Option<&str>) -> MountInfo {
|
fn mount_info_with_dev_name(mount_dir: &str, dev_name: Option<&str>) -> MountInfo {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
//! collection of data rows ([`Row`]), one per filesystem.
|
//! collection of data rows ([`Row`]), one per filesystem.
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
use crate::blocks::{to_magnitude_and_suffix, SuffixType};
|
use crate::blocks::{SuffixType, to_magnitude_and_suffix};
|
||||||
use crate::columns::{Alignment, Column};
|
use crate::columns::{Alignment, Column};
|
||||||
use crate::filesystem::Filesystem;
|
use crate::filesystem::Filesystem;
|
||||||
use crate::{BlockSize, Options};
|
use crate::{BlockSize, Options};
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/ls"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/ls"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
use clap::Command;
|
use clap::Command;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uu_ls::{options, Config, Format};
|
use uu_ls::{Config, Format, options};
|
||||||
use uucore::error::UResult;
|
use uucore::error::UResult;
|
||||||
use uucore::quoting_style::{Quotes, QuotingStyle};
|
use uucore::quoting_style::{Quotes, QuotingStyle};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/dircolors"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/dircolors"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/dirname"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/dirname"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/du"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/du"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
|
|
||||||
use chrono::{DateTime, Local};
|
use chrono::{DateTime, Local};
|
||||||
use clap::{builder::PossibleValue, Arg, ArgAction, ArgMatches, Command};
|
use clap::{Arg, ArgAction, ArgMatches, Command, builder::PossibleValue};
|
||||||
use glob::Pattern;
|
use glob::Pattern;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -24,19 +24,19 @@ use std::sync::mpsc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::{Duration, UNIX_EPOCH};
|
use std::time::{Duration, UNIX_EPOCH};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use uucore::display::{print_verbatim, Quotable};
|
use uucore::display::{Quotable, print_verbatim};
|
||||||
use uucore::error::{set_exit_code, FromIo, UError, UResult, USimpleError};
|
use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code};
|
||||||
use uucore::line_ending::LineEnding;
|
use uucore::line_ending::LineEnding;
|
||||||
use uucore::parse_glob;
|
use uucore::parse_glob;
|
||||||
use uucore::parse_size::{parse_size_u64, ParseSizeError};
|
use uucore::parse_size::{ParseSizeError, parse_size_u64};
|
||||||
use uucore::shortcut_value_parser::ShortcutValueParser;
|
use uucore::shortcut_value_parser::ShortcutValueParser;
|
||||||
use uucore::{format_usage, help_about, help_section, help_usage, show, show_error, show_warning};
|
use uucore::{format_usage, help_about, help_section, help_usage, show, show_error, show_warning};
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use windows_sys::Win32::Foundation::HANDLE;
|
use windows_sys::Win32::Foundation::HANDLE;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use windows_sys::Win32::Storage::FileSystem::{
|
use windows_sys::Win32::Storage::FileSystem::{
|
||||||
FileIdInfo, FileStandardInfo, GetFileInformationByHandleEx, FILE_ID_128, FILE_ID_INFO,
|
FILE_ID_128, FILE_ID_INFO, FILE_STANDARD_INFO, FileIdInfo, FileStandardInfo,
|
||||||
FILE_STANDARD_INFO,
|
GetFileInformationByHandleEx,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod options {
|
mod options {
|
||||||
|
@ -593,7 +593,7 @@ fn read_files_from(file_name: &str) -> Result<Vec<PathBuf>, std::io::Error> {
|
||||||
return Err(std::io::Error::new(
|
return Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::Other,
|
std::io::ErrorKind::Other,
|
||||||
format!("cannot open '{file_name}' for reading: No such file or directory"),
|
format!("cannot open '{file_name}' for reading: No such file or directory"),
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
Err(e) => return Err(e),
|
Err(e) => return Err(e),
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/echo"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/echo"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use std::env;
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::io::{self, StdoutLock, Write};
|
use std::io::{self, StdoutLock, Write};
|
||||||
use uucore::error::{UResult, USimpleError};
|
use uucore::error::{UResult, USimpleError};
|
||||||
use uucore::format::{parse_escape_only, EscapedChar, FormatChar, OctalParsing};
|
use uucore::format::{EscapedChar, FormatChar, OctalParsing, parse_escape_only};
|
||||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||||
|
|
||||||
const ABOUT: &str = help_about!("echo.md");
|
const ABOUT: &str = help_about!("echo.md");
|
||||||
|
|
2
src/uu/env/Cargo.toml
vendored
2
src/uu/env/Cargo.toml
vendored
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/env"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/env"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
25
src/uu/env/src/env.rs
vendored
25
src/uu/env/src/env.rs
vendored
|
@ -13,14 +13,14 @@ pub mod string_parser;
|
||||||
pub mod variable_parser;
|
pub mod variable_parser;
|
||||||
|
|
||||||
use clap::builder::ValueParser;
|
use clap::builder::ValueParser;
|
||||||
use clap::{crate_name, Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command, crate_name};
|
||||||
use ini::Ini;
|
use ini::Ini;
|
||||||
use native_int_str::{
|
use native_int_str::{
|
||||||
from_native_int_representation_owned, Convert, NCvt, NativeIntStr, NativeIntString, NativeStr,
|
Convert, NCvt, NativeIntStr, NativeIntString, NativeStr, from_native_int_representation_owned,
|
||||||
};
|
};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use nix::sys::signal::{
|
use nix::sys::signal::{
|
||||||
raise, sigaction, signal, SaFlags, SigAction, SigHandler, SigHandler::SigIgn, SigSet, Signal,
|
SaFlags, SigAction, SigHandler, SigHandler::SigIgn, SigSet, Signal, raise, sigaction, signal,
|
||||||
};
|
};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -163,7 +163,9 @@ fn load_config_file(opts: &mut Options) -> UResult<()> {
|
||||||
for (_, prop) in &conf {
|
for (_, prop) in &conf {
|
||||||
// ignore all INI section lines (treat them as comments)
|
// ignore all INI section lines (treat them as comments)
|
||||||
for (key, value) in prop {
|
for (key, value) in prop {
|
||||||
env::set_var(key, value);
|
unsafe {
|
||||||
|
env::set_var(key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,7 +561,9 @@ fn apply_removal_of_all_env_vars(opts: &Options<'_>) {
|
||||||
// remove all env vars if told to ignore presets
|
// remove all env vars if told to ignore presets
|
||||||
if opts.ignore_env {
|
if opts.ignore_env {
|
||||||
for (ref name, _) in env::vars_os() {
|
for (ref name, _) in env::vars_os() {
|
||||||
env::remove_var(name);
|
unsafe {
|
||||||
|
env::remove_var(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -634,8 +638,9 @@ fn apply_unset_env_vars(opts: &Options<'_>) -> Result<(), Box<dyn UError>> {
|
||||||
format!("cannot unset {}: Invalid argument", name.quote()),
|
format!("cannot unset {}: Invalid argument", name.quote()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
unsafe {
|
||||||
env::remove_var(name);
|
env::remove_var(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -692,7 +697,9 @@ fn apply_specified_env_vars(opts: &Options<'_>) {
|
||||||
show_warning!("no name specified for value {}", val.quote());
|
show_warning!("no name specified for value {}", val.quote());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
env::set_var(name, val);
|
unsafe {
|
||||||
|
env::set_var(name, val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,7 +743,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_split_string_environment_vars_test() {
|
fn test_split_string_environment_vars_test() {
|
||||||
std::env::set_var("FOO", "BAR");
|
unsafe { std::env::set_var("FOO", "BAR") };
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NCvt::convert(vec!["FOO=bar", "sh", "-c", "echo xBARx =$FOO="]),
|
NCvt::convert(vec!["FOO=bar", "sh", "-c", "echo xBARx =$FOO="]),
|
||||||
parse_args_from_str(&NCvt::convert(r#"FOO=bar sh -c "echo x${FOO}x =\$FOO=""#))
|
parse_args_from_str(&NCvt::convert(r#"FOO=bar sh -c "echo x${FOO}x =\$FOO=""#))
|
||||||
|
|
16
src/uu/env/src/native_int_str.rs
vendored
16
src/uu/env/src/native_int_str.rs
vendored
|
@ -19,10 +19,10 @@ use std::os::unix::ffi::{OsStrExt, OsStringExt};
|
||||||
use std::os::windows::prelude::*;
|
use std::os::windows::prelude::*;
|
||||||
use std::{borrow::Cow, ffi::OsStr};
|
use std::{borrow::Cow, ffi::OsStr};
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
use u16 as NativeIntCharU;
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
use u8 as NativeIntCharU;
|
use u8 as NativeIntCharU;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
use u16 as NativeIntCharU;
|
||||||
|
|
||||||
pub type NativeCharInt = NativeIntCharU;
|
pub type NativeCharInt = NativeIntCharU;
|
||||||
pub type NativeIntStr = [NativeCharInt];
|
pub type NativeIntStr = [NativeCharInt];
|
||||||
|
@ -178,22 +178,14 @@ pub fn get_single_native_int_value(c: &char) -> Option<NativeCharInt> {
|
||||||
{
|
{
|
||||||
let mut buf = [0u16, 0];
|
let mut buf = [0u16, 0];
|
||||||
let s = c.encode_utf16(&mut buf);
|
let s = c.encode_utf16(&mut buf);
|
||||||
if s.len() == 1 {
|
if s.len() == 1 { Some(buf[0]) } else { None }
|
||||||
Some(buf[0])
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
{
|
{
|
||||||
let mut buf = [0u8, 0, 0, 0];
|
let mut buf = [0u8, 0, 0, 0];
|
||||||
let s = c.encode_utf8(&mut buf);
|
let s = c.encode_utf8(&mut buf);
|
||||||
if s.len() == 1 {
|
if s.len() == 1 { Some(buf[0]) } else { None }
|
||||||
Some(buf[0])
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
src/uu/env/src/split_iterator.rs
vendored
6
src/uu/env/src/split_iterator.rs
vendored
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use crate::native_int_str::from_native_int_representation;
|
|
||||||
use crate::native_int_str::NativeCharInt;
|
use crate::native_int_str::NativeCharInt;
|
||||||
use crate::native_int_str::NativeIntStr;
|
use crate::native_int_str::NativeIntStr;
|
||||||
use crate::native_int_str::NativeIntString;
|
use crate::native_int_str::NativeIntString;
|
||||||
|
use crate::native_int_str::from_native_int_representation;
|
||||||
use crate::parse_error::ParseError;
|
use crate::parse_error::ParseError;
|
||||||
use crate::string_expander::StringExpander;
|
use crate::string_expander::StringExpander;
|
||||||
use crate::string_parser::StringParser;
|
use crate::string_parser::StringParser;
|
||||||
|
@ -256,7 +256,7 @@ impl<'a> SplitIterator<'a> {
|
||||||
return Err(ParseError::MissingClosingQuote {
|
return Err(ParseError::MissingClosingQuote {
|
||||||
pos: self.get_parser().get_peek_position(),
|
pos: self.get_parser().get_peek_position(),
|
||||||
c: '\'',
|
c: '\'',
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
Some(SINGLE_QUOTES) => {
|
Some(SINGLE_QUOTES) => {
|
||||||
self.skip_one()?;
|
self.skip_one()?;
|
||||||
|
@ -306,7 +306,7 @@ impl<'a> SplitIterator<'a> {
|
||||||
return Err(ParseError::MissingClosingQuote {
|
return Err(ParseError::MissingClosingQuote {
|
||||||
pos: self.get_parser().get_peek_position(),
|
pos: self.get_parser().get_peek_position(),
|
||||||
c: '"',
|
c: '"',
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
Some(DOLLAR) => {
|
Some(DOLLAR) => {
|
||||||
self.substitute_variable()?;
|
self.substitute_variable()?;
|
||||||
|
|
2
src/uu/env/src/string_expander.rs
vendored
2
src/uu/env/src/string_expander.rs
vendored
|
@ -10,7 +10,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
native_int_str::{to_native_int_representation, NativeCharInt, NativeIntStr},
|
native_int_str::{NativeCharInt, NativeIntStr, to_native_int_representation},
|
||||||
string_parser::{Chunk, Error, StringParser},
|
string_parser::{Chunk, Error, StringParser},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
4
src/uu/env/src/string_parser.rs
vendored
4
src/uu/env/src/string_parser.rs
vendored
|
@ -9,8 +9,8 @@
|
||||||
use std::{borrow::Cow, ffi::OsStr};
|
use std::{borrow::Cow, ffi::OsStr};
|
||||||
|
|
||||||
use crate::native_int_str::{
|
use crate::native_int_str::{
|
||||||
from_native_int_representation, get_char_from_native_int, get_single_native_int_value,
|
NativeCharInt, NativeIntStr, from_native_int_representation, get_char_from_native_int,
|
||||||
NativeCharInt, NativeIntStr,
|
get_single_native_int_value,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
|
|
36
src/uu/env/src/variable_parser.rs
vendored
36
src/uu/env/src/variable_parser.rs
vendored
|
@ -21,7 +21,10 @@ impl<'a> VariableParser<'a, '_> {
|
||||||
if c.is_ascii_digit() {
|
if c.is_ascii_digit() {
|
||||||
return Err(ParseError::ParsingOfVariableNameFailed {
|
return Err(ParseError::ParsingOfVariableNameFailed {
|
||||||
pos: self.parser.get_peek_position(),
|
pos: self.parser.get_peek_position(),
|
||||||
msg: format!("Unexpected character: '{c}', expected variable name must not start with 0..9") });
|
msg: format!(
|
||||||
|
"Unexpected character: '{c}', expected variable name must not start with 0..9"
|
||||||
|
),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -44,8 +47,10 @@ impl<'a> VariableParser<'a, '_> {
|
||||||
match self.get_current_char() {
|
match self.get_current_char() {
|
||||||
None => {
|
None => {
|
||||||
return Err(ParseError::ParsingOfVariableNameFailed {
|
return Err(ParseError::ParsingOfVariableNameFailed {
|
||||||
pos: self.parser.get_peek_position(), msg: "Missing closing brace".into() })
|
pos: self.parser.get_peek_position(),
|
||||||
},
|
msg: "Missing closing brace".into(),
|
||||||
|
});
|
||||||
|
}
|
||||||
Some(c) if !c.is_ascii() || c.is_ascii_alphanumeric() || c == '_' => {
|
Some(c) if !c.is_ascii() || c.is_ascii_alphanumeric() || c == '_' => {
|
||||||
self.skip_one()?;
|
self.skip_one()?;
|
||||||
}
|
}
|
||||||
|
@ -56,32 +61,35 @@ impl<'a> VariableParser<'a, '_> {
|
||||||
None => {
|
None => {
|
||||||
return Err(ParseError::ParsingOfVariableNameFailed {
|
return Err(ParseError::ParsingOfVariableNameFailed {
|
||||||
pos: self.parser.get_peek_position(),
|
pos: self.parser.get_peek_position(),
|
||||||
msg: "Missing closing brace after default value".into() })
|
msg: "Missing closing brace after default value".into(),
|
||||||
},
|
});
|
||||||
|
}
|
||||||
Some('}') => {
|
Some('}') => {
|
||||||
default_end = Some(self.parser.get_peek_position());
|
default_end = Some(self.parser.get_peek_position());
|
||||||
self.skip_one()?;
|
self.skip_one()?;
|
||||||
break
|
break;
|
||||||
},
|
}
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
self.skip_one()?;
|
self.skip_one()?;
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
Some('}') => {
|
Some('}') => {
|
||||||
varname_end = self.parser.get_peek_position();
|
varname_end = self.parser.get_peek_position();
|
||||||
default_end = None;
|
default_end = None;
|
||||||
self.skip_one()?;
|
self.skip_one()?;
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
Some(c) => {
|
Some(c) => {
|
||||||
return Err(ParseError::ParsingOfVariableNameFailed {
|
return Err(ParseError::ParsingOfVariableNameFailed {
|
||||||
pos: self.parser.get_peek_position(),
|
pos: self.parser.get_peek_position(),
|
||||||
msg: format!("Unexpected character: '{c}', expected a closing brace ('}}') or colon (':')")
|
msg: format!(
|
||||||
})
|
"Unexpected character: '{c}', expected a closing brace ('}}') or colon (':')"
|
||||||
},
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +152,7 @@ impl<'a> VariableParser<'a, '_> {
|
||||||
return Err(ParseError::ParsingOfVariableNameFailed {
|
return Err(ParseError::ParsingOfVariableNameFailed {
|
||||||
pos: self.parser.get_peek_position(),
|
pos: self.parser.get_peek_position(),
|
||||||
msg: "missing variable name".into(),
|
msg: "missing variable name".into(),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
Some('{') => {
|
Some('{') => {
|
||||||
self.skip_one()?;
|
self.skip_one()?;
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/expand"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/expand"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@ use std::error::Error;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
|
use std::io::{BufRead, BufReader, BufWriter, Read, Write, stdin, stdout};
|
||||||
use std::num::IntErrorKind;
|
use std::num::IntErrorKind;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::str::from_utf8;
|
use std::str::from_utf8;
|
||||||
use unicode_width::UnicodeWidthChar;
|
use unicode_width::UnicodeWidthChar;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{set_exit_code, FromIo, UError, UResult};
|
use uucore::error::{FromIo, UError, UResult, set_exit_code};
|
||||||
use uucore::{format_usage, help_about, help_usage, show_error};
|
use uucore::{format_usage, help_about, help_usage, show_error};
|
||||||
|
|
||||||
const ABOUT: &str = help_about!("expand.md");
|
const ABOUT: &str = help_about!("expand.md");
|
||||||
|
@ -496,8 +496,8 @@ fn expand(options: &Options) -> UResult<()> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::is_digit_or_comma;
|
use crate::is_digit_or_comma;
|
||||||
|
|
||||||
use super::next_tabstop;
|
|
||||||
use super::RemainingMode;
|
use super::RemainingMode;
|
||||||
|
use super::next_tabstop;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_next_tabstop_remaining_mode_none() {
|
fn test_next_tabstop_remaining_mode_none() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/expr"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/expr"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use syntax_tree::{is_truthy, AstNode};
|
use syntax_tree::{AstNode, is_truthy};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use uucore::{
|
use uucore::{
|
||||||
display::Quotable,
|
display::Quotable,
|
||||||
|
|
|
@ -87,11 +87,7 @@ impl RelationOp {
|
||||||
Self::Geq => a >= b,
|
Self::Geq => a >= b,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if b {
|
if b { Ok(1.into()) } else { Ok(0.into()) }
|
||||||
Ok(1.into())
|
|
||||||
} else {
|
|
||||||
Ok(0.into())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,8 +693,8 @@ mod test {
|
||||||
use crate::ExprError::InvalidBracketContent;
|
use crate::ExprError::InvalidBracketContent;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
check_posix_regex_errors, get_next_id, AstNode, AstNodeInner, BinOp, NumericOp, RelationOp,
|
AstNode, AstNodeInner, BinOp, NumericOp, RelationOp, StringOp, check_posix_regex_errors,
|
||||||
StringOp,
|
get_next_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl PartialEq for AstNode {
|
impl PartialEq for AstNode {
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
use std::io::{self, stdin, stdout, Write};
|
use std::io::{self, Write, stdin, stdout};
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use num_bigint::BigUint;
|
use num_bigint::BigUint;
|
||||||
use num_traits::FromPrimitive;
|
use num_traits::FromPrimitive;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{set_exit_code, FromIo, UResult, USimpleError};
|
use uucore::error::{FromIo, UResult, USimpleError, set_exit_code};
|
||||||
use uucore::{format_usage, help_about, help_usage, show_error, show_warning};
|
use uucore::{format_usage, help_about, help_usage, show_error, show_warning};
|
||||||
|
|
||||||
const ABOUT: &str = help_about!("factor.md");
|
const ABOUT: &str = help_about!("factor.md");
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/false"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/false"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use std::{ffi::OsString, io::Write};
|
use std::{ffi::OsString, io::Write};
|
||||||
use uucore::error::{set_exit_code, UResult};
|
use uucore::error::{UResult, set_exit_code};
|
||||||
use uucore::help_about;
|
use uucore::help_about;
|
||||||
|
|
||||||
const ABOUT: &str = help_about!("false.md");
|
const ABOUT: &str = help_about!("false.md");
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/fmt"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/fmt"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, ArgMatches, Command};
|
use clap::{Arg, ArgAction, ArgMatches, Command};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Stdout, Write};
|
use std::io::{BufReader, BufWriter, Read, Stdout, Write, stdin, stdout};
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
|
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
|
||||||
use uucore::{format_usage, help_about, help_usage};
|
use uucore::{format_usage, help_about, help_usage};
|
||||||
|
@ -124,7 +124,10 @@ impl FmtOptions {
|
||||||
}
|
}
|
||||||
(None, None) => (DEFAULT_WIDTH, DEFAULT_GOAL),
|
(None, None) => (DEFAULT_WIDTH, DEFAULT_GOAL),
|
||||||
};
|
};
|
||||||
debug_assert!(width >= goal, "GOAL {goal} should not be greater than WIDTH {width} when given {width_opt:?} and {goal_opt:?}.");
|
debug_assert!(
|
||||||
|
width >= goal,
|
||||||
|
"GOAL {goal} should not be greater than WIDTH {width} when given {width_opt:?} and {goal_opt:?}."
|
||||||
|
);
|
||||||
|
|
||||||
if width > MAX_WIDTH {
|
if width > MAX_WIDTH {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
use std::io::{BufWriter, Stdout, Write};
|
use std::io::{BufWriter, Stdout, Write};
|
||||||
use std::{cmp, mem};
|
use std::{cmp, mem};
|
||||||
|
|
||||||
use crate::parasplit::{ParaWords, Paragraph, WordInfo};
|
|
||||||
use crate::FmtOptions;
|
use crate::FmtOptions;
|
||||||
|
use crate::parasplit::{ParaWords, Paragraph, WordInfo};
|
||||||
|
|
||||||
struct BreakArgs<'a> {
|
struct BreakArgs<'a> {
|
||||||
opts: &'a FmtOptions,
|
opts: &'a FmtOptions,
|
||||||
|
@ -465,11 +465,7 @@ fn restart_active_breaks<'a>(
|
||||||
// Number of spaces to add before a word, based on mode, newline, sentence start.
|
// Number of spaces to add before a word, based on mode, newline, sentence start.
|
||||||
fn compute_slen(uniform: bool, newline: bool, start: bool, punct: bool) -> usize {
|
fn compute_slen(uniform: bool, newline: bool, start: bool, punct: bool) -> usize {
|
||||||
if uniform || newline {
|
if uniform || newline {
|
||||||
if start || (newline && punct) {
|
if start || (newline && punct) { 2 } else { 1 }
|
||||||
2
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/fold"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/fold"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{stdin, BufRead, BufReader, Read};
|
use std::io::{BufRead, BufReader, Read, stdin};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{FromIo, UResult, USimpleError};
|
use uucore::error::{FromIo, UResult, USimpleError};
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/groups"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/groups"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use uucore::{
|
use uucore::{
|
||||||
display::Quotable,
|
display::Quotable,
|
||||||
entries::{get_groups_gnu, gid2grp, Locate, Passwd},
|
entries::{Locate, Passwd, get_groups_gnu, gid2grp},
|
||||||
error::{UError, UResult},
|
error::{UError, UResult},
|
||||||
format_usage, help_about, help_usage, show,
|
format_usage, help_about, help_usage, show,
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/hashsum"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/hashsum"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -5,26 +5,26 @@
|
||||||
|
|
||||||
// spell-checker:ignore (ToDO) algo, algoname, regexes, nread, nonames
|
// spell-checker:ignore (ToDO) algo, algoname, regexes, nread, nonames
|
||||||
|
|
||||||
|
use clap::ArgAction;
|
||||||
use clap::builder::ValueParser;
|
use clap::builder::ValueParser;
|
||||||
use clap::value_parser;
|
use clap::value_parser;
|
||||||
use clap::ArgAction;
|
|
||||||
use clap::{Arg, ArgMatches, Command};
|
use clap::{Arg, ArgMatches, Command};
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{stdin, BufReader, Read};
|
use std::io::{BufReader, Read, stdin};
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use uucore::checksum::ChecksumError;
|
||||||
|
use uucore::checksum::ChecksumOptions;
|
||||||
|
use uucore::checksum::ChecksumVerbose;
|
||||||
|
use uucore::checksum::HashAlgorithm;
|
||||||
use uucore::checksum::calculate_blake2b_length;
|
use uucore::checksum::calculate_blake2b_length;
|
||||||
use uucore::checksum::create_sha3;
|
use uucore::checksum::create_sha3;
|
||||||
use uucore::checksum::detect_algo;
|
use uucore::checksum::detect_algo;
|
||||||
use uucore::checksum::digest_reader;
|
use uucore::checksum::digest_reader;
|
||||||
use uucore::checksum::escape_filename;
|
use uucore::checksum::escape_filename;
|
||||||
use uucore::checksum::perform_checksum_validation;
|
use uucore::checksum::perform_checksum_validation;
|
||||||
use uucore::checksum::ChecksumError;
|
|
||||||
use uucore::checksum::ChecksumOptions;
|
|
||||||
use uucore::checksum::ChecksumVerbose;
|
|
||||||
use uucore::checksum::HashAlgorithm;
|
|
||||||
use uucore::error::{FromIo, UResult};
|
use uucore::error::{FromIo, UResult};
|
||||||
use uucore::sum::{Digest, Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256};
|
use uucore::sum::{Digest, Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256};
|
||||||
use uucore::{format_usage, help_about, help_usage};
|
use uucore::{format_usage, help_about, help_usage};
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/head"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/head"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
|
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use uucore::parse_size::{parse_size_u64, ParseSizeError};
|
use uucore::parse_size::{ParseSizeError, parse_size_u64};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Debug)]
|
#[derive(PartialEq, Eq, Debug)]
|
||||||
pub enum ParseError {
|
pub enum ParseError {
|
||||||
|
@ -14,7 +14,7 @@ pub enum ParseError {
|
||||||
|
|
||||||
/// Parses obsolete syntax
|
/// Parses obsolete syntax
|
||||||
/// head -NUM\[kmzv\] // spell-checker:disable-line
|
/// head -NUM\[kmzv\] // spell-checker:disable-line
|
||||||
pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
|
pub fn parse_obsolete(src: &str) -> Option<Result<Vec<OsString>, ParseError>> {
|
||||||
let mut chars = src.char_indices();
|
let mut chars = src.char_indices();
|
||||||
if let Some((_, '-')) = chars.next() {
|
if let Some((_, '-')) = chars.next() {
|
||||||
let mut num_end = 0usize;
|
let mut num_end = 0usize;
|
||||||
|
@ -44,7 +44,7 @@ fn process_num_block(
|
||||||
src: &str,
|
src: &str,
|
||||||
last_char: char,
|
last_char: char,
|
||||||
chars: &mut std::str::CharIndices,
|
chars: &mut std::str::CharIndices,
|
||||||
) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
|
) -> Option<Result<Vec<OsString>, ParseError>> {
|
||||||
match src.parse::<usize>() {
|
match src.parse::<usize>() {
|
||||||
Ok(num) => {
|
Ok(num) => {
|
||||||
let mut quiet = false;
|
let mut quiet = false;
|
||||||
|
@ -99,7 +99,7 @@ fn process_num_block(
|
||||||
options.push(OsString::from("-n"));
|
options.push(OsString::from("-n"));
|
||||||
options.push(OsString::from(format!("{num}")));
|
options.push(OsString::from(format!("{num}")));
|
||||||
}
|
}
|
||||||
Some(Ok(options.into_iter()))
|
Some(Ok(options))
|
||||||
}
|
}
|
||||||
Err(_) => Some(Err(ParseError::Overflow)),
|
Err(_) => Some(Err(ParseError::Overflow)),
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,10 @@ mod tests {
|
||||||
let r = parse_obsolete(src);
|
let r = parse_obsolete(src);
|
||||||
match r {
|
match r {
|
||||||
Some(s) => match s {
|
Some(s) => match s {
|
||||||
Ok(v) => Some(Ok(v.map(|s| s.to_str().unwrap().to_owned()).collect())),
|
Ok(v) => Some(Ok(v
|
||||||
|
.into_iter()
|
||||||
|
.map(|s| s.to_str().unwrap().to_owned())
|
||||||
|
.collect())),
|
||||||
Err(e) => Some(Err(e)),
|
Err(e) => Some(Err(e)),
|
||||||
},
|
},
|
||||||
None => None,
|
None => None,
|
||||||
|
|
|
@ -362,7 +362,7 @@ mod tests {
|
||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
|
|
||||||
use crate::take::{
|
use crate::take::{
|
||||||
copy_all_but_n_bytes, copy_all_but_n_lines, take_lines, TakeAllBuffer, TakeAllLinesBuffer,
|
TakeAllBuffer, TakeAllLinesBuffer, copy_all_but_n_bytes, copy_all_but_n_lines, take_lines,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/hostid"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/hostid"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ const USAGE: &str = help_usage!("hostid.md");
|
||||||
const ABOUT: &str = help_about!("hostid.md");
|
const ABOUT: &str = help_about!("hostid.md");
|
||||||
|
|
||||||
// currently rust libc interface doesn't include gethostid
|
// currently rust libc interface doesn't include gethostid
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
pub fn gethostid() -> c_long;
|
pub fn gethostid() -> c_long;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/hostname"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/hostname"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ static OPT_HOST: &str = "host";
|
||||||
mod wsa {
|
mod wsa {
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
use windows_sys::Win32::Networking::WinSock::{WSACleanup, WSAStartup, WSADATA};
|
use windows_sys::Win32::Networking::WinSock::{WSACleanup, WSADATA, WSAStartup};
|
||||||
|
|
||||||
pub(super) struct WsaHandle(());
|
pub(super) struct WsaHandle(());
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/id"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/id"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ use std::ffi::CStr;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::entries::{self, Group, Locate, Passwd};
|
use uucore::entries::{self, Group, Locate, Passwd};
|
||||||
use uucore::error::UResult;
|
use uucore::error::UResult;
|
||||||
use uucore::error::{set_exit_code, USimpleError};
|
use uucore::error::{USimpleError, set_exit_code};
|
||||||
pub use uucore::libc;
|
pub use uucore::libc;
|
||||||
use uucore::libc::{getlogin, uid_t};
|
use uucore::libc::{getlogin, uid_t};
|
||||||
use uucore::line_ending::LineEnding;
|
use uucore::line_ending::LineEnding;
|
||||||
|
@ -660,7 +660,7 @@ mod audit {
|
||||||
}
|
}
|
||||||
pub type c_auditinfo_addr_t = c_auditinfo_addr;
|
pub type c_auditinfo_addr_t = c_auditinfo_addr;
|
||||||
|
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
pub fn getaudit(auditinfo_addr: *mut c_auditinfo_addr_t) -> c_int;
|
pub fn getaudit(auditinfo_addr: *mut c_auditinfo_addr_t) -> c_int;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ homepage = "https://github.com/uutils/coreutils"
|
||||||
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/install"
|
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/install"
|
||||||
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
readme.workspace = true
|
readme.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@ mod mode;
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, ArgMatches, Command};
|
use clap::{Arg, ArgAction, ArgMatches, Command};
|
||||||
use file_diff::diff;
|
use file_diff::diff;
|
||||||
use filetime::{set_file_times, FileTime};
|
use filetime::{FileTime, set_file_times};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::fs::{self, metadata};
|
use std::fs::{self, metadata};
|
||||||
use std::path::{Path, PathBuf, MAIN_SEPARATOR};
|
use std::path::{MAIN_SEPARATOR, Path, PathBuf};
|
||||||
use std::process;
|
use std::process;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use uucore::backup_control::{self, BackupMode};
|
use uucore::backup_control::{self, BackupMode};
|
||||||
|
@ -23,7 +23,7 @@ use uucore::entries::{grp2gid, usr2uid};
|
||||||
use uucore::error::{FromIo, UError, UResult, UUsageError};
|
use uucore::error::{FromIo, UError, UResult, UUsageError};
|
||||||
use uucore::fs::dir_strip_dot_for_creation;
|
use uucore::fs::dir_strip_dot_for_creation;
|
||||||
use uucore::mode::get_umask;
|
use uucore::mode::get_umask;
|
||||||
use uucore::perms::{wrap_chown, Verbosity, VerbosityLevel};
|
use uucore::perms::{Verbosity, VerbosityLevel, wrap_chown};
|
||||||
use uucore::process::{getegid, geteuid};
|
use uucore::process::{getegid, geteuid};
|
||||||
use uucore::{format_usage, help_about, help_usage, show, show_error, show_if_err};
|
use uucore::{format_usage, help_about, help_usage, show, show_error, show_if_err};
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue