1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge branch 'main' into tail_notify

This commit is contained in:
Jan Scheer 2022-05-17 14:13:20 +02:00
commit 75a6641ced
No known key found for this signature in database
GPG key ID: C62AD4C29E2B9828
39 changed files with 78 additions and 74 deletions

16
Cargo.lock generated
View file

@ -1070,9 +1070,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.125"
version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "libloading"
@ -1104,9 +1104,9 @@ dependencies = [
[[package]]
name = "lscolors"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e9323b3525d4efad2dead1837a105e313253bfdbad1d470994038eededa4d62"
checksum = "88e4434edeec6cd16a7e8e13569af4568a66fcd6d79abd8696db22dd95f920e6"
dependencies = [
"ansi_term",
]
@ -1596,9 +1596,9 @@ dependencies = [
[[package]]
name = "rayon"
version = "1.5.2"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221"
checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d"
dependencies = [
"autocfg",
"crossbeam-deque",
@ -1805,9 +1805,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]]
name = "signal-hook"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d"
checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"
dependencies = [
"libc",
"signal-hook-registry",

View file

@ -16,7 +16,7 @@ path = "src/chmod.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode"] }
[[bin]]

View file

@ -21,7 +21,7 @@ path = "src/cp.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
filetime = "0.2"
libc = "0.2.125"
libc = "0.2.126"
quick-error = "2.0.1"
selinux = { version="0.2", optional=true }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms", "mode"] }

View file

@ -22,7 +22,7 @@ libc = "0.2"
uucore = { version=">=0.0.8", package="uucore", path="../../uucore" }
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
signal-hook = "0.3.9"
signal-hook = "0.3.14"
[[bin]]
name = "dd"

View file

@ -107,7 +107,7 @@ pub fn uu_app<'a>() -> Command<'a> {
fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) {
for (i, arg) in args.iter().enumerate() {
let slice = &arg;
if slice.starts_with('-') && slice.chars().nth(1).map_or(false, |c| c.is_digit(10)) {
if slice.starts_with('-') && slice.chars().nth(1).map_or(false, |c| c.is_ascii_digit()) {
let mut v = args.to_vec();
v.remove(i);
return (v, Some(slice[1..].to_owned()));

View file

@ -20,7 +20,7 @@ pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>
let mut has_num = false;
let mut last_char = 0 as char;
for (n, c) in &mut chars {
if c.is_digit(10) {
if c.is_ascii_digit() {
has_num = true;
num_end = n;
} else {

View file

@ -16,7 +16,7 @@ path = "src/hostid.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]]

View file

@ -16,7 +16,7 @@ path = "src/kill.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["signals"] }
[[bin]]

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/logname.rs"
[dependencies]
libc = "0.2.125"
libc = "0.2.126"
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }

View file

@ -22,7 +22,7 @@ number_prefix = "0.4"
term_grid = "0.1.5"
termsize = "0.1.6"
glob = "0.3.0"
lscolors = { version = "0.9.0", features = ["ansi_term"] }
lscolors = { version = "0.10.0", features = ["ansi_term"] }
uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore", features = ["entries", "fs"] }
once_cell = "1.10.0"
atty = "0.2"

View file

@ -28,7 +28,7 @@ use std::{
cmp::Reverse,
error::Error,
ffi::{OsStr, OsString},
fmt::Display,
fmt::{Display, Write as FmtWrite},
fs::{self, DirEntry, FileType, Metadata, ReadDir},
io::{stdout, BufWriter, ErrorKind, Stdout, Write},
path::{Path, PathBuf},
@ -1826,7 +1826,7 @@ fn display_additional_leading_info(
} else {
"?".to_owned()
};
result.push_str(&format!("{} ", pad_left(&i, padding.inode)));
write!(result, "{} ", pad_left(&i, padding.inode)).unwrap();
}
}
@ -1836,7 +1836,7 @@ fn display_additional_leading_info(
} else {
"?".to_owned()
};
result.push_str(&format!("{} ", pad_left(&s, padding.block_size),));
write!(result, "{} ", pad_left(&s, padding.block_size)).unwrap();
}
Ok(result)
}

View file

@ -16,7 +16,7 @@ path = "src/mkfifo.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]]

View file

@ -17,7 +17,7 @@ path = "src/mknod.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "^0.2.125"
libc = "^0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["mode"] }
[[bin]]

View file

@ -16,7 +16,7 @@ path = "src/nice.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
nix = { version = "0.24.1", default-features = false }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }

View file

@ -16,7 +16,7 @@ path = "src/nohup.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
atty = "0.2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] }

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/nproc.rs"
[dependencies]
libc = "0.2.125"
libc = "0.2.126"
num_cpus = "1.10"
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] }

View file

@ -244,7 +244,7 @@ fn format_string(
p => format!(
"{:<padding$}",
number_with_suffix,
padding = p.abs() as usize
padding = p.unsigned_abs()
),
})
}

View file

@ -29,6 +29,7 @@ mod prn_float;
mod prn_int;
use std::cmp;
use std::fmt::Write;
use crate::byteorder_io::*;
use crate::formatteriteminfo::*;
@ -600,11 +601,13 @@ fn print_bytes(prefix: &str, input_decoder: &MemoryDecoder, output_info: &Output
let mut b = 0;
while b < input_decoder.length() {
output_text.push_str(&format!(
write!(
output_text,
"{:>width$}",
"",
width = f.spacing[b % output_info.byte_size_block]
));
)
.unwrap();
match f.formatter_item_info.formatter {
FormatWriter::IntWriter(func) => {
@ -627,12 +630,14 @@ fn print_bytes(prefix: &str, input_decoder: &MemoryDecoder, output_info: &Output
let missing_spacing = output_info
.print_width_line
.saturating_sub(output_text.chars().count());
output_text.push_str(&format!(
write!(
output_text,
"{:>width$} {}",
"",
format_ascii_dump(input_decoder.get_buffer(0)),
width = missing_spacing
));
)
.unwrap();
}
if first {

View file

@ -244,7 +244,7 @@ fn is_format_size_decimal(
return false;
}
match ch {
Some(d) if d.is_digit(10) => {
Some(d) if d.is_ascii_digit() => {
decimal_size.push(d);
true
}

View file

@ -10,7 +10,7 @@ pub trait CommandLineOpts {
}
/// Implementation for `getopts`
impl<'a> CommandLineOpts for ArgMatches {
impl CommandLineOpts for ArgMatches {
fn inputs(&self) -> Vec<&str> {
self.values_of(options::FILENAME)
.map(|values| values.collect())

View file

@ -16,7 +16,7 @@ path = "src/pathchk.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]]

View file

@ -13,7 +13,7 @@ use std::cmp;
use std::collections::{BTreeSet, HashMap, HashSet};
use std::default::Default;
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::fmt::{Display, Formatter, Write as FmtWrite};
use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use std::num::ParseIntError;
@ -572,7 +572,7 @@ fn format_tex_line(
reference: &str,
) -> String {
let mut output = String::new();
output.push_str(&format!("\\{} ", config.macro_name));
write!(output, "\\{} ", config.macro_name).unwrap();
let all_before = if config.input_ref {
let before = &line[0..word_ref.position];
let before_start_trim_offset =
@ -587,18 +587,18 @@ fn format_tex_line(
let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
output.push_str(&format!(
"{5}{0}{6}{5}{1}{6}{5}{2}{6}{5}{3}{6}{5}{4}{6}",
write!(
output,
"{{{0}}}{{{1}}}{{{2}}}{{{3}}}{{{4}}}",
format_tex_field(&tail),
format_tex_field(&before),
format_tex_field(keyword),
format_tex_field(&after),
format_tex_field(&head),
"{",
"}"
));
)
.unwrap();
if config.auto_ref || config.input_ref {
output.push_str(&format!("{}{}{}", "{", format_tex_field(reference), "}"));
write!(output, "{{{}}}", format_tex_field(reference)).unwrap();
}
output
}
@ -615,7 +615,7 @@ fn format_roff_line(
reference: &str,
) -> String {
let mut output = String::new();
output.push_str(&format!(".{}", config.macro_name));
write!(output, ".{}", config.macro_name).unwrap();
let all_before = if config.input_ref {
let before = &line[0..word_ref.position];
let before_start_trim_offset =
@ -630,16 +630,18 @@ fn format_roff_line(
let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
output.push_str(&format!(
write!(
output,
" \"{}\" \"{}\" \"{}{}\" \"{}\"",
format_roff_field(&tail),
format_roff_field(&before),
format_roff_field(keyword),
format_roff_field(&after),
format_roff_field(&head)
));
)
.unwrap();
if config.auto_ref || config.input_ref {
output.push_str(&format!(" \"{}\"", format_roff_field(reference)));
write!(output, " \"{}\"", format_roff_field(reference)).unwrap();
}
output
}

View file

@ -17,7 +17,7 @@ path = "src/rmdir.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
libc = "0.2.125"
libc = "0.2.126"
[[bin]]
name = "rmdir"

View file

@ -348,9 +348,9 @@ impl GlobalSettings {
];
let mut size_string = input.trim().to_string();
if size_string.ends_with(|c: char| ALLOW_LIST.contains(&c) || c.is_digit(10)) {
if size_string.ends_with(|c: char| ALLOW_LIST.contains(&c) || c.is_ascii_digit()) {
// b 1, K 1024 (default)
if size_string.ends_with(|c: char| c.is_digit(10)) {
if size_string.ends_with(|c: char| c.is_ascii_digit()) {
size_string.push('K');
} else if size_string.ends_with('b') {
size_string.pop();

View file

@ -197,8 +197,8 @@ impl ScanUtil for str {
pub fn group_num(s: &str) -> Cow<str> {
let is_negative = s.starts_with('-');
assert!(is_negative || s.chars().take(1).all(|c| c.is_digit(10)));
assert!(s.chars().skip(1).all(|c| c.is_digit(10)));
assert!(is_negative || s.chars().take(1).all(|c| c.is_ascii_digit()));
assert!(s.chars().skip(1).all(|c| c.is_ascii_digit()));
if s.len() < 4 {
return s.into();
}

View file

@ -62,7 +62,7 @@ struct ProgramOptions {
stderr: BufferType,
}
impl<'a> TryFrom<&ArgMatches> for ProgramOptions {
impl TryFrom<&ArgMatches> for ProgramOptions {
type Error = ProgramOptionsError;
fn try_from(matches: &ArgMatches) -> Result<Self, Self::Error> {

View file

@ -16,7 +16,7 @@ path = "src/sync.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["wide"] }
winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] }

View file

@ -17,7 +17,7 @@ path = "src/tail.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
# notify = { version = "5.0.0-pre.14", features=["macos_kqueue"]}
notify = { git = "https://github.com/notify-rs/notify", features=["macos_kqueue"]}
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["ringbuffer", "lines"] }

View file

@ -19,7 +19,7 @@ pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>
let mut has_num = false;
let mut last_char = 0 as char;
for (n, c) in &mut chars {
if c.is_digit(10) {
if c.is_ascii_digit() {
has_num = true;
num_end = n;
} else {

View file

@ -16,7 +16,7 @@ path = "src/tee.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
retain_mut = "=0.1.7" # ToDO: [2021-01-01; rivy; maint/MinSRV] ~ v0.1.5 uses const generics which aren't stabilized until rust v1.51.0
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["libc"] }

View file

@ -16,7 +16,7 @@ path = "src/test.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[target.'cfg(target_os = "redox")'.dependencies]

View file

@ -16,7 +16,7 @@ path = "src/timeout.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
nix = { version = "0.24.1", default-features = false, features = ["signal"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["process", "signals"] }

View file

@ -50,11 +50,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let mut line = String::new();
match reader.read_line(&mut line) {
Ok(_) => {
let tokens: Vec<String> = line
.trim_end()
.split_whitespace()
.map(|s| s.to_owned())
.collect();
let tokens: Vec<String> = line.split_whitespace().map(|s| s.to_owned()).collect();
if tokens.is_empty() {
break;
}

View file

@ -16,7 +16,7 @@ path = "src/tty.rs"
[dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125"
libc = "0.2.126"
atty = "0.2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] }

View file

@ -15,6 +15,7 @@ use uucore::utmpx::{self, time, Utmpx};
use clap::{crate_version, Arg, Command};
use std::borrow::Cow;
use std::ffi::CStr;
use std::fmt::Write;
use std::os::unix::fs::MetadataExt;
use std::path::PathBuf;
use uucore::{format_usage, InvalidEncodingHandling};
@ -529,24 +530,24 @@ impl Who {
let mut buf = String::with_capacity(64);
let msg = vec![' ', state].into_iter().collect::<String>();
buf.push_str(&format!("{:<8}", user));
write!(buf, "{:<8}", user).unwrap();
if self.include_mesg {
buf.push_str(&msg);
}
buf.push_str(&format!(" {:<12}", line));
write!(buf, " {:<12}", line).unwrap();
// "%b %e %H:%M" (LC_ALL=C)
let time_size = 3 + 2 + 2 + 1 + 2;
buf.push_str(&format!(" {:<1$}", time, time_size));
write!(buf, " {:<1$}", time, time_size).unwrap();
if !self.short_output {
if self.include_idle {
buf.push_str(&format!(" {:<6}", idle));
write!(buf, " {:<6}", idle).unwrap();
}
buf.push_str(&format!(" {:>10}", pid));
write!(buf, " {:>10}", pid).unwrap();
}
buf.push_str(&format!(" {:<8}", comment));
write!(buf, " {:<8}", comment).unwrap();
if self.include_exit {
buf.push_str(&format!(" {:<12}", exit));
write!(buf, " {:<12}", exit).unwrap();
}
println!("{}", buf.trim_end());
}

View file

@ -22,7 +22,7 @@ uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=[
winapi = { version = "0.3", features = ["lmcons"] }
[target.'cfg(unix)'.dependencies]
libc = "0.2.125"
libc = "0.2.126"
[[bin]]
name = "whoami"

View file

@ -31,7 +31,7 @@ time = { version="<= 0.3", optional=true, features = ["formatting", "local-offse
data-encoding = { version="2.1", optional=true }
data-encoding-macro = { version="0.1.12", optional=true }
z85 = { version="3.0.5", optional=true }
libc = { version="0.2.125", optional=true }
libc = { version="0.2.126", optional=true }
once_cell = "1.10.0"
os_display = "0.1.3"

View file

@ -38,7 +38,7 @@ pub fn parse_size(size: &str) -> Result<u64, ParseSizeError> {
}
// Get the numeric part of the size argument. For example, if the
// argument is "123K", then the numeric part is "123".
let numeric_string: String = size.chars().take_while(|c| c.is_digit(10)).collect();
let numeric_string: String = size.chars().take_while(|c| c.is_ascii_digit()).collect();
let number: u64 = if !numeric_string.is_empty() {
match numeric_string.parse() {
Ok(n) => n,

View file

@ -2840,7 +2840,7 @@ fn test_ls_context2() {
let ts = TestScenario::new(util_name!());
for c_flag in ["-Z", "--context"] {
ts.ucmd()
.args(&[c_flag, &"/"])
.args(&[c_flag, "/"])
.succeeds()
.stdout_only(unwrap_or_return!(expected_result(&ts, &[c_flag, "/"])).stdout_str());
}