From cf7b90bbe7cb87099499876622f413a65a699038 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Tue, 28 Feb 2023 17:45:14 +0000 Subject: [PATCH 001/253] dd: use an alarm thread instead of elapsed() calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quick benchmark on FreeBSD 13.1-RELEASE: Summary './dd-thread-alarm if=/dev/zero of=/dev/null count=4000000 status=progress' ran 1.17 ± 0.17 times faster than './dd-baseline if=/dev/zero of=/dev/null count=4000000 status=progress' --- src/uu/dd/src/dd.rs | 47 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index eaf89ca55..2baa12106 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -65,6 +65,46 @@ struct Settings { status: Option, } +use std::thread::sleep; +use std::time::Duration; + +use std::sync::{ + atomic::{AtomicBool, Ordering::Relaxed}, + Arc, +}; + +#[derive(Debug, Clone)] +pub struct Alarm { + interval: Duration, + trigger: Arc, +} + +impl Alarm { + pub fn with_interval(interval: Duration) -> Alarm { + let trigger = Arc::new(AtomicBool::default()); + + let weak_trigger = Arc::downgrade(&trigger); + std::thread::spawn(move || loop { + sleep(interval); + if let Some(trigger) = weak_trigger.upgrade() { + trigger.store(true, Relaxed); + } else { + break; + } + }); + + Alarm { interval, trigger } + } + + pub fn is_triggered(&self) -> bool { + self.trigger.swap(false, Relaxed) + } + + pub fn get_interval(&self) -> Duration { + self.interval + } +} + /// A number in blocks or bytes /// /// Some values (seek, skip, iseek, oseek) can have values either in blocks or in bytes. @@ -628,7 +668,6 @@ fn dd_copy(mut i: Input, mut o: Output) -> std::io::Result<()> { // information. let (prog_tx, rx) = mpsc::channel(); let output_thread = thread::spawn(gen_prog_updater(rx, i.settings.status)); - let mut progress_as_secs = 0; // Optimization: if no blocks are to be written, then don't // bother allocating any buffers. @@ -639,6 +678,7 @@ fn dd_copy(mut i: Input, mut o: Output) -> std::io::Result<()> { // Create a common buffer with a capacity of the block size. // This is the max size needed. let mut buf = vec![BUF_INIT_BYTE; bsize]; + let alarm = Alarm::with_interval(Duration::from_secs(1)); // The main read/write loop. // @@ -667,9 +707,8 @@ fn dd_copy(mut i: Input, mut o: Output) -> std::io::Result<()> { // error. rstat += rstat_update; wstat += wstat_update; - let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), false); - if prog_update.duration.as_secs() >= progress_as_secs { - progress_as_secs = prog_update.duration.as_secs() + 1; + if alarm.is_triggered() { + let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), false); prog_tx.send(prog_update).unwrap_or(()); } } From 52c93a4d107a6252c4cfe85c572075cacc493272 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Wed, 1 Mar 2023 13:56:18 +0000 Subject: [PATCH 002/253] dd: Simplify loop of progress Alarm thread --- src/uu/dd/src/dd.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index 2baa12106..15c7e8ed4 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -80,20 +80,18 @@ pub struct Alarm { } impl Alarm { - pub fn with_interval(interval: Duration) -> Alarm { + pub fn with_interval(interval: Duration) -> Self { let trigger = Arc::new(AtomicBool::default()); let weak_trigger = Arc::downgrade(&trigger); - std::thread::spawn(move || loop { - sleep(interval); - if let Some(trigger) = weak_trigger.upgrade() { + std::thread::spawn(move || { + while let Some(trigger) = weak_trigger.upgrade() { + sleep(interval); trigger.store(true, Relaxed); - } else { - break; } }); - Alarm { interval, trigger } + Self { interval, trigger } } pub fn is_triggered(&self) -> bool { From 08e8b40e451b17c404c8795ae431636a3a48bca8 Mon Sep 17 00:00:00 2001 From: Joining7943 <111500881+Joining7943@users.noreply.github.com> Date: Thu, 20 Apr 2023 21:08:12 +0200 Subject: [PATCH 003/253] tail: Refactor paths::Input::from method, Settings::inputs now use Vec instead of VecDeque --- src/uu/tail/src/args.rs | 26 ++++++++++---------------- src/uu/tail/src/follow/watch.rs | 3 +-- src/uu/tail/src/paths.rs | 11 ++++++----- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index 55014e029..eff332230 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -12,7 +12,6 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; use fundu::DurationParser; use is_terminal::IsTerminal; use same_file::Handle; -use std::collections::VecDeque; use std::ffi::OsString; use std::time::Duration; use uucore::error::{UResult, USimpleError, UUsageError}; @@ -141,7 +140,8 @@ pub struct Settings { pub use_polling: bool, pub verbose: bool, pub presume_input_pipe: bool, - pub inputs: VecDeque, + /// `FILE(s)` positional arguments + pub inputs: Vec, } impl Default for Settings { @@ -173,11 +173,11 @@ impl Settings { } settings.mode = FilterMode::from_obsolete_args(args); let input = if let Some(name) = name { - Input::from(&name) + Input::from(name) } else { Input::default() }; - settings.inputs.push_back(input); + settings.inputs.push(input); settings } @@ -282,19 +282,13 @@ impl Settings { } } - let mut inputs: VecDeque = matches - .get_many::(options::ARG_FILES) - .map(|v| v.map(|string| Input::from(&string)).collect()) - .unwrap_or_default(); + settings.inputs = matches + .get_raw(options::ARG_FILES) + .map(|v| v.map(Input::from).collect()) + .unwrap_or_else(|| vec![Input::default()]); - // apply default and add '-' to inputs if none is present - if inputs.is_empty() { - inputs.push_front(Input::default()); - } - - settings.verbose = inputs.len() > 1 && !matches.get_flag(options::verbosity::QUIET); - - settings.inputs = inputs; + settings.verbose = + settings.inputs.len() > 1 && !matches.get_flag(options::verbosity::QUIET); Ok(settings) } diff --git a/src/uu/tail/src/follow/watch.rs b/src/uu/tail/src/follow/watch.rs index 2c3cf10b8..966f39120 100644 --- a/src/uu/tail/src/follow/watch.rs +++ b/src/uu/tail/src/follow/watch.rs @@ -10,7 +10,6 @@ use crate::follow::files::{FileHandling, PathData}; use crate::paths::{Input, InputKind, MetadataExtTail, PathExtTail}; use crate::{platform, text}; use notify::{RecommendedWatcher, RecursiveMode, Watcher, WatcherKind}; -use std::collections::VecDeque; use std::io::BufRead; use std::path::{Path, PathBuf}; use std::sync::mpsc::{self, channel, Receiver}; @@ -270,7 +269,7 @@ impl Observer { self.follow_name() && self.retry } - fn init_files(&mut self, inputs: &VecDeque) -> UResult<()> { + fn init_files(&mut self, inputs: &Vec) -> UResult<()> { if let Some(watcher_rx) = &mut self.watcher_rx { for input in inputs { match input.kind() { diff --git a/src/uu/tail/src/paths.rs b/src/uu/tail/src/paths.rs index 4badd6866..d813ea942 100644 --- a/src/uu/tail/src/paths.rs +++ b/src/uu/tail/src/paths.rs @@ -27,20 +27,21 @@ pub struct Input { } impl Input { - pub fn from>(string: &T) -> Self { - let kind = if string.as_ref() == Path::new(text::DASH) { + pub fn from>(string: T) -> Self { + let string = string.as_ref(); + let kind = if string == OsStr::new(text::DASH) { InputKind::Stdin } else { - InputKind::File(PathBuf::from(string.as_ref())) + InputKind::File(PathBuf::from(string)) }; let display_name = match kind { - InputKind::File(_) => string.as_ref().to_string_lossy().to_string(), + InputKind::File(_) => string.to_string_lossy().to_string(), InputKind::Stdin => { if cfg!(unix) { text::STDIN_HEADER.to_string() } else { - string.as_ref().to_string_lossy().to_string() + string.to_string_lossy().to_string() } } }; From ae60045f3f0cf35c4f893c02f22d3c93b396b37f Mon Sep 17 00:00:00 2001 From: Joining7943 <111500881+Joining7943@users.noreply.github.com> Date: Thu, 20 Apr 2023 21:12:24 +0200 Subject: [PATCH 004/253] tail: Fix printed header for stdin should be the same on all platforms --- src/uu/tail/src/paths.rs | 43 ++++++++++++++++++++++++++------------ tests/by-util/test_tail.rs | 6 +----- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/uu/tail/src/paths.rs b/src/uu/tail/src/paths.rs index d813ea942..cce3270a8 100644 --- a/src/uu/tail/src/paths.rs +++ b/src/uu/tail/src/paths.rs @@ -10,7 +10,10 @@ use std::ffi::OsStr; use std::fs::{File, Metadata}; use std::io::{Seek, SeekFrom}; #[cfg(unix)] -use std::os::unix::fs::{FileTypeExt, MetadataExt}; +use std::os::unix::{ + fs::{FileTypeExt, MetadataExt}, + prelude::OsStrExt, +}; use std::path::{Path, PathBuf}; use uucore::error::UResult; @@ -20,6 +23,30 @@ pub enum InputKind { Stdin, } +#[cfg(unix)] +impl From<&OsStr> for InputKind { + fn from(value: &OsStr) -> Self { + const DASH: [u8; 1] = [b'-']; + + if value.as_bytes() == DASH { + Self::Stdin + } else { + Self::File(PathBuf::from(value)) + } + } +} + +#[cfg(not(unix))] +impl From<&OsStr> for InputKind { + fn from(value: &OsStr) -> Self { + if value == OsStr::new(text::DASH) { + Self::Stdin + } else { + Self::File(PathBuf::from(value)) + } + } +} + #[derive(Debug, Clone)] pub struct Input { kind: InputKind, @@ -29,21 +56,11 @@ pub struct Input { impl Input { pub fn from>(string: T) -> Self { let string = string.as_ref(); - let kind = if string == OsStr::new(text::DASH) { - InputKind::Stdin - } else { - InputKind::File(PathBuf::from(string)) - }; + let kind = string.into(); let display_name = match kind { InputKind::File(_) => string.to_string_lossy().to_string(), - InputKind::Stdin => { - if cfg!(unix) { - text::STDIN_HEADER.to_string() - } else { - string.to_string_lossy().to_string() - } - } + InputKind::Stdin => text::STDIN_HEADER.to_string(), }; Self { kind, display_name } diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index f3e55e434..2391a5f7a 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -145,12 +145,8 @@ fn test_stdin_redirect_offset() { } #[test] -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] // FIXME: for currently not working platforms +#[cfg(all(not(target_vendor = "apple")))] // FIXME: for currently not working platforms fn test_stdin_redirect_offset2() { - // FIXME: windows: Failed because of difference in printed header. See below. - // actual : ==> - <== - // expected: ==> standard input <== - // like test_stdin_redirect_offset but with multiple files let ts = TestScenario::new(util_name!()); From 546631c8e77bb6256d6b211306ed71b5bbf0e16f Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Wed, 3 May 2023 16:30:53 +0000 Subject: [PATCH 005/253] dd: Tidy includes --- src/uu/dd/src/dd.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index 15c7e8ed4..541c85ff9 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -33,9 +33,12 @@ use std::os::unix::fs::FileTypeExt; #[cfg(any(target_os = "linux", target_os = "android"))] use std::os::unix::fs::OpenOptionsExt; use std::path::Path; -use std::sync::mpsc; +use std::sync::{ + atomic::{AtomicBool, Ordering::Relaxed}, + mpsc, Arc, +}; use std::thread; -use std::time; +use std::time::{Duration, Instant}; use clap::{crate_version, Arg, Command}; use gcd::Gcd; @@ -65,14 +68,6 @@ struct Settings { status: Option, } -use std::thread::sleep; -use std::time::Duration; - -use std::sync::{ - atomic::{AtomicBool, Ordering::Relaxed}, - Arc, -}; - #[derive(Debug, Clone)] pub struct Alarm { interval: Duration, @@ -84,9 +79,9 @@ impl Alarm { let trigger = Arc::new(AtomicBool::default()); let weak_trigger = Arc::downgrade(&trigger); - std::thread::spawn(move || { + thread::spawn(move || { while let Some(trigger) = weak_trigger.upgrade() { - sleep(interval); + thread::sleep(interval); trigger.store(true, Relaxed); } }); @@ -646,7 +641,7 @@ fn dd_copy(mut i: Input, mut o: Output) -> std::io::Result<()> { // of its report includes the throughput in bytes per second, // which requires knowing how long the process has been // running. - let start = time::Instant::now(); + let start = Instant::now(); // A good buffer size for reading. // @@ -718,7 +713,7 @@ fn finalize( output: &mut Output, rstat: ReadStat, wstat: WriteStat, - start: time::Instant, + start: Instant, prog_tx: &mpsc::Sender, output_thread: thread::JoinHandle, ) -> std::io::Result<()> { From 01a8623d216599449f6c895996e6ba64c12fbd89 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Wed, 3 May 2023 16:31:14 +0000 Subject: [PATCH 006/253] dd: Add documentation to Alarm struct --- src/uu/dd/src/dd.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index 541c85ff9..41b7eb773 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -68,6 +68,15 @@ struct Settings { status: Option, } +/// A timer which triggers on a given interval +/// +/// After being constructed with [`Alarm::with_interval`], [`Alarm::is_triggered`] +/// will return true once per the given [`Duration`]. +/// +/// Can be cloned, but the trigger status is shared across all instances so only +/// the first caller each interval will yield true. +/// +/// When all instances are dropped the background thread will exit on the next interval. #[derive(Debug, Clone)] pub struct Alarm { interval: Duration, @@ -671,6 +680,11 @@ fn dd_copy(mut i: Input, mut o: Output) -> std::io::Result<()> { // Create a common buffer with a capacity of the block size. // This is the max size needed. let mut buf = vec![BUF_INIT_BYTE; bsize]; + + // Spawn a timer thread to provide a scheduled signal indicating when we + // should send an update of our progress to the reporting thread. + // + // This avoids the need to query the OS monotonic clock for every block. let alarm = Alarm::with_interval(Duration::from_secs(1)); // The main read/write loop. From 6c98b23e80d73f051de94d3f85129af94c96a2e3 Mon Sep 17 00:00:00 2001 From: Ideflop <94184575+Ideflop@users.noreply.github.com> Date: Mon, 29 May 2023 14:36:18 +0200 Subject: [PATCH 007/253] more: implement arguments -n/--lines and --number --- src/uu/more/src/more.rs | 73 ++++++++++++++++++++++++++------------ tests/by-util/test_more.rs | 14 ++++++++ 2 files changed, 64 insertions(+), 23 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 996a1dc61..9be9b5576 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -14,10 +14,10 @@ use std::{ time::Duration, }; -use clap::{crate_version, Arg, ArgAction, ArgMatches, Command}; +use clap::{crate_version, value_parser, Arg, ArgAction, ArgMatches, Command}; use crossterm::event::KeyEventKind; use crossterm::{ - cursor::MoveTo, + cursor::{MoveTo, MoveUp}, event::{self, Event, KeyCode, KeyEvent, KeyModifiers}, execute, queue, style::Attribute, @@ -53,16 +53,28 @@ pub mod options { const MULTI_FILE_TOP_PROMPT: &str = "::::::::::::::\n{}\n::::::::::::::\n"; struct Options { - silent: bool, clean_print: bool, + lines: Option, print_over: bool, + silent: bool, squeeze: bool, } impl Options { fn from(matches: &ArgMatches) -> Self { + let lines = match ( + matches.get_one::(options::LINES).copied(), + matches.get_one::(options::NUMBER).copied(), + ) { + // We add 1 to the number of lines to display because the last line + // is used for the banner + (Some(number), _) if number > 0 => Some(number + 1), + (None, Some(number)) if number > 0 => Some(number + 1), + (_, _) => None, + }; Self { clean_print: matches.get_flag(options::CLEAN_PRINT), + lines, print_over: matches.get_flag(options::PRINT_OVER), silent: matches.get_flag(options::SILENT), squeeze: matches.get_flag(options::SQUEEZE), @@ -167,6 +179,23 @@ pub fn uu_app() -> Command { .help("Squeeze multiple blank lines into one") .action(ArgAction::SetTrue), ) + .arg( + Arg::new(options::LINES) + .short('n') + .long(options::LINES) + .value_name("number") + .num_args(1) + .value_parser(value_parser!(u16).range(0..)) + .help("The number of lines per screen full"), + ) + .arg( + Arg::new(options::NUMBER) + .long(options::NUMBER) + .required(false) + .num_args(1) + .value_parser(value_parser!(u16).range(0..)) + .help("Same as --lines"), + ) // The commented arguments below are unimplemented: /* .arg( @@ -187,22 +216,6 @@ pub fn uu_app() -> Command { .long(options::PLAIN) .help("Suppress underlining and bold"), ) - .arg( - Arg::new(options::LINES) - .short('n') - .long(options::LINES) - .value_name("number") - .takes_value(true) - .help("The number of lines per screen full"), - ) - .arg( - Arg::new(options::NUMBER) - .allow_hyphen_values(true) - .long(options::NUMBER) - .required(false) - .takes_value(true) - .help("Same as --lines"), - ) .arg( Arg::new(options::FROM_LINE) .short('F') @@ -263,7 +276,11 @@ fn more( next_file: Option<&str>, options: &Options, ) -> UResult<()> { - let (cols, rows) = terminal::size().unwrap(); + let (cols, mut rows) = terminal::size().unwrap(); + if let Some(number) = options.lines { + rows = number; + } + let lines = break_buff(buff, usize::from(cols)); let mut pager = Pager::new(rows, lines, next_file, options); @@ -327,6 +344,7 @@ fn more( .. }) => { pager.page_up(); + paging_add_back_message(options, stdout); } Event::Key(KeyEvent { code: KeyCode::Char('j'), @@ -347,7 +365,7 @@ fn more( pager.prev_line(); } Event::Resize(col, row) => { - pager.page_resize(col, row); + pager.page_resize(col, row, options.lines); } Event::Key(KeyEvent { code: KeyCode::Char(k), @@ -447,8 +465,10 @@ impl<'a> Pager<'a> { } // TODO: Deal with column size changes. - fn page_resize(&mut self, _: u16, row: u16) { - self.content_rows = row.saturating_sub(1); + fn page_resize(&mut self, _: u16, row: u16, option_line: Option) { + if option_line.is_none() { + self.content_rows = row.saturating_sub(1); + }; } fn draw(&mut self, stdout: &mut std::io::Stdout, wrong_key: Option) { @@ -536,6 +556,13 @@ impl<'a> Pager<'a> { } } +fn paging_add_back_message(options: &Options, stdout: &mut std::io::Stdout) { + if options.lines.is_some() { + execute!(stdout, MoveUp(1)).unwrap(); + stdout.write_all("\n\r...back 1 page\n".as_bytes()).unwrap(); + } +} + // Break the lines on the cols of the terminal fn break_buff(buff: &str, cols: usize) -> Vec { let mut lines = Vec::with_capacity(buff.lines().count()); diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index 43f405d9a..95a4818b5 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -20,6 +20,20 @@ fn test_valid_arg() { new_ucmd!().arg("-s").succeeds(); new_ucmd!().arg("--squeeze").succeeds(); + + new_ucmd!().arg("-n").arg("10").succeeds(); + new_ucmd!().arg("--lines").arg("0").succeeds(); + new_ucmd!().arg("--number").arg("0").succeeds(); + } +} + +#[test] +fn test_invalid_arg() { + if std::io::stdout().is_terminal() { + new_ucmd!().arg("--invalid").fails(); + + new_ucmd!().arg("--lines").arg("-10").fails(); + new_ucmd!().arg("--number").arg("-10").fails(); } } From f2006a9a6b95c1ca327421a67c659435c3a91130 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 22 May 2023 23:03:54 +0200 Subject: [PATCH 008/253] cp: add support of cp --debug --- src/uu/cp/src/cp.rs | 85 ++++++++++- src/uu/cp/src/platform/linux.rs | 41 ++++- src/uu/cp/src/platform/macos.rs | 12 +- src/uu/cp/src/platform/other.rs | 12 +- tests/by-util/test_cp.rs | 257 ++++++++++++++++++++++++++++++++ 5 files changed, 391 insertions(+), 16 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index f7069f04f..a1cbd4aec 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -229,10 +229,79 @@ pub struct Options { backup_suffix: String, target_dir: Option, update: UpdateMode, + debug: bool, verbose: bool, progress_bar: bool, } +/// Enum representing various debug states of the offload and reflink actions. +#[derive(Debug)] +#[allow(dead_code)] // All of them are used on Linux +enum OffloadReflinkDebug { + Unknown, + No, + Yes, + Avoided, + Unsupported, +} + +/// Enum representing various debug states of the sparse detection. +#[derive(Debug)] +#[allow(dead_code)] // silent for now until we use them +enum SparseDebug { + Unknown, + No, + Zeros, + SeekHole, + SeekHoleZeros, + Unsupported, +} + +/// Struct that contains the debug state for each action in a file copy operation. +#[derive(Debug)] +struct CopyDebug { + offload: OffloadReflinkDebug, + reflink: OffloadReflinkDebug, + sparse_detection: SparseDebug, +} + +impl OffloadReflinkDebug { + fn to_string(&self) -> &'static str { + match self { + Self::No => "no", + Self::Yes => "yes", + Self::Avoided => "avoided", + Self::Unsupported => "unsupported", + Self::Unknown => "unknown", + } + } +} + +impl SparseDebug { + fn to_string(&self) -> &'static str { + match self { + Self::No => "no", + Self::Zeros => "zeros", + Self::SeekHole => "SEEK_HOLE", + Self::SeekHoleZeros => "SEEK_HOLE + zeros", + Self::Unsupported => "unsupported", + Self::Unknown => "unknown", + } + } +} + +/// This function prints the debug information of a file copy operation if +/// no hard link or symbolic link is required, and data copy is required. +/// It prints the debug information of the offload, reflink, and sparse detection actions. +fn show_debug(copy_debug: &CopyDebug) { + println!( + "copy offload: {}, reflink: {}, sparse detection: {}", + copy_debug.offload.to_string(), + copy_debug.reflink.to_string(), + copy_debug.sparse_detection.to_string(), + ); +} + const ABOUT: &str = help_about!("cp.md"); const USAGE: &str = help_usage!("cp.md"); const AFTER_HELP: &str = help_section!("after help", "cp.md"); @@ -269,6 +338,7 @@ mod options { pub const STRIP_TRAILING_SLASHES: &str = "strip-trailing-slashes"; pub const SYMBOLIC_LINK: &str = "symbolic-link"; pub const TARGET_DIRECTORY: &str = "target-directory"; + pub const DEBUG: &str = "debug"; pub const VERBOSE: &str = "verbose"; } @@ -361,6 +431,12 @@ pub fn uu_app() -> Command { .help("remove any trailing slashes from each SOURCE argument") .action(ArgAction::SetTrue), ) + .arg( + Arg::new(options::DEBUG) + .long(options::DEBUG) + .help("explain how a file is copied. Implies -v") + .action(ArgAction::SetTrue), + ) .arg( Arg::new(options::VERBOSE) .short('v') @@ -831,7 +907,8 @@ impl Options { one_file_system: matches.get_flag(options::ONE_FILE_SYSTEM), parents: matches.get_flag(options::PARENTS), update: update_mode, - verbose: matches.get_flag(options::VERBOSE), + debug: matches.get_flag(options::DEBUG), + verbose: matches.get_flag(options::VERBOSE) || matches.get_flag(options::DEBUG), strip_trailing_slashes: matches.get_flag(options::STRIP_TRAILING_SLASHES), reflink_mode: { if let Some(reflink) = matches.get_one::(options::REFLINK) { @@ -1745,7 +1822,7 @@ fn copy_helper( } else if source_is_symlink { copy_link(source, dest, symlinked_files)?; } else { - copy_on_write( + let copy_debug = copy_on_write( source, dest, options.reflink_mode, @@ -1754,6 +1831,10 @@ fn copy_helper( #[cfg(any(target_os = "linux", target_os = "android", target_os = "macos"))] source_is_fifo, )?; + + if !options.attributes_only && options.debug { + show_debug(©_debug); + } } Ok(()) diff --git a/src/uu/cp/src/platform/linux.rs b/src/uu/cp/src/platform/linux.rs index 7d97813dd..18f2520a2 100644 --- a/src/uu/cp/src/platform/linux.rs +++ b/src/uu/cp/src/platform/linux.rs @@ -13,7 +13,7 @@ use quick_error::ResultExt; use uucore::mode::get_umask; -use crate::{CopyResult, ReflinkMode, SparseMode}; +use crate::{CopyDebug, CopyResult, OffloadReflinkDebug, ReflinkMode, SparseDebug, SparseMode}; // From /usr/include/linux/fs.h: // #define FICLONE _IOW(0x94, 9, int) @@ -145,24 +145,51 @@ pub(crate) fn copy_on_write( sparse_mode: SparseMode, context: &str, source_is_fifo: bool, -) -> CopyResult<()> { +) -> CopyResult { + let mut copy_debug = CopyDebug { + offload: OffloadReflinkDebug::Unknown, + reflink: OffloadReflinkDebug::Unsupported, + sparse_detection: SparseDebug::No, + }; + let result = match (reflink_mode, sparse_mode) { - (ReflinkMode::Never, SparseMode::Always) => sparse_copy(source, dest), - (ReflinkMode::Never, _) => std::fs::copy(source, dest).map(|_| ()), - (ReflinkMode::Auto, SparseMode::Always) => sparse_copy(source, dest), + (ReflinkMode::Never, SparseMode::Always) => { + copy_debug.sparse_detection = SparseDebug::Zeros; + copy_debug.offload = OffloadReflinkDebug::Avoided; + copy_debug.reflink = OffloadReflinkDebug::No; + sparse_copy(source, dest) + } + (ReflinkMode::Never, _) => { + copy_debug.sparse_detection = SparseDebug::No; + copy_debug.reflink = OffloadReflinkDebug::No; + std::fs::copy(source, dest).map(|_| ()) + } + (ReflinkMode::Auto, SparseMode::Always) => { + copy_debug.offload = OffloadReflinkDebug::Avoided; + copy_debug.sparse_detection = SparseDebug::Zeros; + copy_debug.reflink = OffloadReflinkDebug::Unsupported; + sparse_copy(source, dest) + } (ReflinkMode::Auto, _) => { + copy_debug.sparse_detection = SparseDebug::No; + copy_debug.reflink = OffloadReflinkDebug::Unsupported; if source_is_fifo { copy_fifo_contents(source, dest).map(|_| ()) } else { clone(source, dest, CloneFallback::FSCopy) } } - (ReflinkMode::Always, SparseMode::Auto) => clone(source, dest, CloneFallback::Error), + (ReflinkMode::Always, SparseMode::Auto) => { + copy_debug.sparse_detection = SparseDebug::No; + copy_debug.reflink = OffloadReflinkDebug::Yes; + + clone(source, dest, CloneFallback::Error) + } (ReflinkMode::Always, _) => { return Err("`--reflink=always` can be used only with --sparse=auto".into()) } }; result.context(context)?; - Ok(()) + Ok(copy_debug) } diff --git a/src/uu/cp/src/platform/macos.rs b/src/uu/cp/src/platform/macos.rs index 4407e0edf..b173aa959 100644 --- a/src/uu/cp/src/platform/macos.rs +++ b/src/uu/cp/src/platform/macos.rs @@ -11,7 +11,7 @@ use std::path::Path; use quick_error::ResultExt; -use crate::{CopyResult, ReflinkMode, SparseMode}; +use crate::{CopyDebug, CopyResult, OffloadReflinkDebug, ReflinkMode, SparseDebug, SparseMode}; /// Copies `source` to `dest` using copy-on-write if possible. /// @@ -24,10 +24,15 @@ pub(crate) fn copy_on_write( sparse_mode: SparseMode, context: &str, source_is_fifo: bool, -) -> CopyResult<()> { +) -> CopyResult { if sparse_mode != SparseMode::Auto { return Err("--sparse is only supported on linux".to_string().into()); } + let mut copy_debug = CopyDebug { + offload: OffloadReflinkDebug::Unknown, + reflink: OffloadReflinkDebug::Unsupported, + sparse_detection: SparseDebug::Unsupported, + }; // Extract paths in a form suitable to be passed to a syscall. // The unwrap() is safe because they come from the command-line and so contain non nul @@ -72,6 +77,7 @@ pub(crate) fn copy_on_write( return Err(format!("failed to clone {source:?} from {dest:?}: {error}").into()) } _ => { + copy_debug.reflink = OffloadReflinkDebug::Yes; if source_is_fifo { let mut src_file = File::open(source)?; let mut dst_file = File::create(dest)?; @@ -83,5 +89,5 @@ pub(crate) fn copy_on_write( }; } - Ok(()) + Ok(copy_debug) } diff --git a/src/uu/cp/src/platform/other.rs b/src/uu/cp/src/platform/other.rs index b70da2f23..f5882f75e 100644 --- a/src/uu/cp/src/platform/other.rs +++ b/src/uu/cp/src/platform/other.rs @@ -8,7 +8,7 @@ use std::path::Path; use quick_error::ResultExt; -use crate::{CopyResult, ReflinkMode, SparseMode}; +use crate::{CopyDebug, CopyResult, OffloadReflinkDebug, ReflinkMode, SparseDebug, SparseMode}; /// Copies `source` to `dest` for systems without copy-on-write pub(crate) fn copy_on_write( @@ -17,7 +17,7 @@ pub(crate) fn copy_on_write( reflink_mode: ReflinkMode, sparse_mode: SparseMode, context: &str, -) -> CopyResult<()> { +) -> CopyResult { if reflink_mode != ReflinkMode::Never { return Err("--reflink is only supported on linux and macOS" .to_string() @@ -26,8 +26,12 @@ pub(crate) fn copy_on_write( if sparse_mode != SparseMode::Auto { return Err("--sparse is only supported on linux".to_string().into()); } - + let copy_debug = CopyDebug { + offload: OffloadReflinkDebug::Unsupported, + reflink: OffloadReflinkDebug::Unsupported, + sparse_detection: SparseDebug::Unsupported, + }; fs::copy(source, dest).context(context)?; - Ok(()) + Ok(copy_debug) } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index ef35f6c2d..1feeb0ede 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -2909,3 +2909,260 @@ fn test_cp_archive_on_directory_ending_dot() { ucmd.args(&["-a", "dir1/.", "dir2"]).succeeds(); assert!(at.file_exists("dir2/file")); } + +#[test] +fn test_cp_debug_default() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + at.touch("a"); + let result = ts.ucmd().arg("--debug").arg("a").arg("b").succeeds(); + + let stdout_str = result.stdout_str(); + #[cfg(target_os = "macos")] + if !stdout_str + .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } + #[cfg(target_os = "linux")] + if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } + + #[cfg(windows)] + if !stdout_str + .contains("copy offload: unsupported, reflink: unsupported, sparse detection: unsupported") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } +} + +#[test] +fn test_cp_debug_multiple_default() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + let dir = "dir"; + at.touch("a"); + at.touch("b"); + at.mkdir(dir); + let result = ts + .ucmd() + .arg("--debug") + .arg("a") + .arg("b") + .arg(dir) + .succeeds(); + + let stdout_str = result.stdout_str(); + + #[cfg(target_os = "macos")] + { + if !stdout_str + .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } + + // two files, two occurrences + assert_eq!( + result + .stdout_str() + .matches( + "copy offload: unknown, reflink: unsupported, sparse detection: unsupported" + ) + .count(), + 2 + ); + } + + #[cfg(target_os = "linux")] + { + if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } + + // two files, two occurrences + assert_eq!( + result + .stdout_str() + .matches("copy offload: unknown, reflink: unsupported, sparse detection: no") + .count(), + 2 + ); + } + + #[cfg(target_os = "windows")] + { + if !stdout_str.contains( + "copy offload: unsupported, reflink: unsupported, sparse detection: unsupported", + ) { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } + + // two files, two occurrences + assert_eq!( + result + .stdout_str() + .matches("copy offload: unsupported, reflink: unsupported, sparse detection: unsupported") + .count(), + 2 + ); + } +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_debug_sparse_reflink() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + at.touch("a"); + let result = ts + .ucmd() + .arg("--debug") + .arg("--sparse=always") + .arg("--reflink=never") + .arg("a") + .arg("b") + .succeeds(); + + let stdout_str = result.stdout_str(); + if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: zeros") { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_debug_sparse_always() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + at.touch("a"); + let result = ts + .ucmd() + .arg("--debug") + .arg("--sparse=always") + .arg("a") + .arg("b") + .succeeds(); + let stdout_str = result.stdout_str(); + if !stdout_str.contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_debug_sparse_never() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + at.touch("a"); + let result = ts + .ucmd() + .arg("--debug") + .arg("--sparse=never") + .arg("a") + .arg("b") + .succeeds(); + let stdout_str = result.stdout_str(); + if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } +} + +#[test] +fn test_cp_debug_sparse_auto() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + at.touch("a"); + let result = ts + .ucmd() + .arg("--debug") + .arg("--sparse=auto") + .arg("a") + .arg("b") + .succeeds(); + let stdout_str = result.stdout_str(); + + #[cfg(target_os = "macos")] + if !stdout_str + .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } + + #[cfg(target_os = "linux")] + if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } +} + +#[test] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "macos"))] +fn test_cp_debug_reflink_auto() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + at.touch("a"); + let result = ts + .ucmd() + .arg("--debug") + .arg("--reflink=auto") + .arg("a") + .arg("b") + .succeeds(); + + #[cfg(target_os = "linux")] + { + let stdout_str = result.stdout_str(); + if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } + } + + #[cfg(target_os = "macos")] + { + let stdout_str = result.stdout_str(); + if !stdout_str + .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } + } +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_debug_sparse_always_reflink_auto() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + at.touch("a"); + let result = ts + .ucmd() + .arg("--debug") + .arg("--sparse=always") + .arg("--reflink=auto") + .arg("a") + .arg("b") + .succeeds(); + let stdout_str = result.stdout_str(); + if !stdout_str.contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros") + { + println!("Failure: stdout was \n{stdout_str}"); + assert!(false); + } +} From 2b3594a5f536496035215bf2bf7fee46d06c9452 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 29 May 2023 19:13:33 -0700 Subject: [PATCH 009/253] core: add octal and hex size parse support --- src/uucore/src/lib/parser/parse_size.rs | 126 ++++++++++++++++++++---- 1 file changed, 106 insertions(+), 20 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 60209d849..70b94fbcc 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -25,6 +25,12 @@ pub struct Parser<'parser> { pub default_unit: Option<&'parser str>, } +enum NumberSystem { + Decimal, + Octal, + Hexadecimal, +} + impl<'parser> Parser<'parser> { pub fn with_allow_list(&mut self, allow_list: &'parser [&str]) -> &mut Self { self.allow_list = Some(allow_list); @@ -62,32 +68,42 @@ impl<'parser> Parser<'parser> { /// assert_eq!(Ok(123), parse_size("123")); /// assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000 /// assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024 + /// assert_eq!(Ok(44251 * 1024), parse_size("0xACDBK")); /// ``` pub fn parse(&self, size: &str) -> Result { if size.is_empty() { return Err(ParseSizeError::parse_failure(size)); } - // 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_ascii_digit()).collect(); - let number: u64 = if numeric_string.is_empty() { - 1 - } else { - match numeric_string.parse() { - Ok(n) => n, - Err(_) => return Err(ParseSizeError::parse_failure(size)), + + let number_system: NumberSystem = self.determine_number_system(size); + + // Split the size argument into numeric and unit parts + // For example, if the argument is "123K", the numeric part is "123", and + // the unit is "K" + let (numeric_string, unit) = match number_system { + NumberSystem::Hexadecimal => { + let numeric_string: String = size + .chars() + .take(2) + .chain(size.chars().skip(2).take_while(|c| c.is_ascii_hexdigit())) + .collect(); + let unit: String = size.chars().skip(numeric_string.len()).collect(); + + (numeric_string, unit) + } + _ => { + let mut unit: String = size + .chars() + .rev() + .take_while(|c| c.is_alphabetic()) + .collect(); + unit = unit.chars().rev().collect(); + let numeric_string = size.chars().take(size.len() - unit.len()).collect(); + + (numeric_string, unit) } }; - - // Get the alphabetic units part of the size argument and compute - // the factor it represents. For example, if the argument is "123K", - // then the unit part is "K" and the factor is 1024. This may be the - // empty string, in which case, the factor is 1. - // - // The lowercase "b" (used by `od`, `head`, `tail`, etc.) means - // "block" and the Posix block size is 512. The uppercase "B" - // means "byte". - let mut unit: &str = &size[numeric_string.len()..]; + let mut unit: &str = unit.as_str(); if let Some(default_unit) = self.default_unit { // Check if `unit` is empty then assigns `default_unit` to `unit` @@ -115,6 +131,12 @@ impl<'parser> Parser<'parser> { } } + // Compute the factor the unit represents. + // empty string means the factor is 1. + // + // The lowercase "b" (used by `od`, `head`, `tail`, etc.) means + // "block" and the Posix block size is 512. The uppercase "B" + // means "byte". let (base, exponent): (u128, u32) = match unit { "" => (1, 0), "B" if self.capital_b_bytes => (1, 0), @@ -142,10 +164,60 @@ impl<'parser> Parser<'parser> { Ok(n) => n, Err(_) => return Err(ParseSizeError::size_too_big(size)), }; + + // parse string into u64 + let number: u64 = match number_system { + NumberSystem::Decimal => { + if numeric_string.is_empty() { + 1 + } else { + match numeric_string.parse() { + Ok(n) => n, + Err(_) => return Err(ParseSizeError::parse_failure(size)), + } + } + } + NumberSystem::Octal => { + let trimmed_string = numeric_string.trim_start_matches("0"); + match u64::from_str_radix(trimmed_string, 8) { + Ok(res) => res, + Err(_) => return Err(ParseSizeError::parse_failure(size)), + } + } + NumberSystem::Hexadecimal => { + let trimmed_string = numeric_string.trim_start_matches("0x"); + match u64::from_str_radix(trimmed_string, 16) { + Ok(res) => res, + Err(_) => return Err(ParseSizeError::parse_failure(size)), + } + } + }; + number .checked_mul(factor) .ok_or_else(|| ParseSizeError::size_too_big(size)) } + + fn determine_number_system(&self, size: &str) -> NumberSystem { + if size.len() <= 1 { + return NumberSystem::Decimal; + } + + if size.starts_with("0x") { + return NumberSystem::Hexadecimal; + } + + let num_digits: usize = size + .chars() + .take_while(|c| c.is_ascii_digit()) + .collect::() + .len(); + if size.starts_with("0") && num_digits > 1 { + return NumberSystem::Octal; + } + + NumberSystem::Decimal + } } /// Parse a size string into a number of bytes. @@ -336,7 +408,7 @@ mod tests { #[test] fn invalid_suffix() { - let test_strings = ["328hdsf3290", "5mib", "1e2", "1H", "1.2"]; + let test_strings = ["5mib", "1eb", "1H"]; for &test_string in &test_strings { assert_eq!( parse_size(test_string).unwrap_err(), @@ -450,4 +522,18 @@ mod tests { assert!(parser.parse("1B").is_err()); assert!(parser.parse("B").is_err()); } + + #[test] + fn parse_octal_size() { + assert_eq!(Ok(63), parse_size("077")); + assert_eq!(Ok(528), parse_size("01020")); + assert_eq!(Ok(668 * 1024), parse_size("01234K")); + } + + #[test] + fn parse_hex_size() { + assert_eq!(Ok(10), parse_size("0xA")); + assert_eq!(Ok(94722), parse_size("0x17202")); + assert_eq!(Ok(44251 * 1024), parse_size("0xACDBK")); + } } From f8a46196ef42bc404040173ad9bc93ae25d15ac4 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 29 May 2023 20:10:16 -0700 Subject: [PATCH 010/253] shred: add support for hex and octal size --- src/uu/shred/src/shred.rs | 42 ++++++++++--------------------------- tests/by-util/test_shred.rs | 11 ++++++++++ 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 89f857b19..1ceffe995 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -19,6 +19,7 @@ use std::os::unix::prelude::PermissionsExt; use std::path::{Path, PathBuf}; use uucore::display::Quotable; use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; +use uucore::parse_size::parse_size; use uucore::{format_usage, help_about, help_section, help_usage, show, show_error, show_if_err}; const ABOUT: &str = help_about!("shred.md"); @@ -318,38 +319,17 @@ pub fn uu_app() -> Command { ) } -// TODO: Add support for all postfixes here up to and including EiB -// http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size fn get_size(size_str_opt: Option) -> Option { - size_str_opt.as_ref()?; - - let mut size_str = size_str_opt.as_ref().unwrap().clone(); - // Immutably look at last character of size string - let unit = match size_str.chars().last().unwrap() { - 'K' => { - size_str.pop(); - 1024u64 - } - 'M' => { - size_str.pop(); - (1024 * 1024) as u64 - } - 'G' => { - size_str.pop(); - (1024 * 1024 * 1024) as u64 - } - _ => 1u64, - }; - - let coefficient = match size_str.parse::() { - Ok(u) => u, - Err(_) => { - show_error!("{}: Invalid file size", size_str_opt.unwrap().maybe_quote()); - std::process::exit(1); - } - }; - - Some(coefficient * unit) + match size_str_opt { + Some(size) => match parse_size(size.as_str()) { + Ok(res) => Some(res), + Err(_) => { + show_error!("invalid file size: {}", size.quote()); + std::process::exit(1) + } + }, + None => None, + } } fn pass_name(pass_type: &PassType) -> String { diff --git a/tests/by-util/test_shred.rs b/tests/by-util/test_shred.rs index 58db09cbd..a34345aee 100644 --- a/tests/by-util/test_shred.rs +++ b/tests/by-util/test_shred.rs @@ -51,3 +51,14 @@ fn test_shred_force() { // file_a was deleted. assert!(!at.file_exists(file)); } + +#[test] +fn test_hex() { + let (at, mut ucmd) = at_and_ucmd!(); + + let file = "test_hex"; + + at.touch(file); + + ucmd.arg("--size=0x10").arg(file).succeeds(); +} From 6233ad6dd7e9a0fa4552cec788265a75dac5fecf Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 29 May 2023 20:59:21 -0700 Subject: [PATCH 011/253] core: fix clippy warning for size parser --- src/uucore/src/lib/parser/parse_size.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 70b94fbcc..be642ef8b 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -178,7 +178,7 @@ impl<'parser> Parser<'parser> { } } NumberSystem::Octal => { - let trimmed_string = numeric_string.trim_start_matches("0"); + let trimmed_string = numeric_string.trim_start_matches('0'); match u64::from_str_radix(trimmed_string, 8) { Ok(res) => res, Err(_) => return Err(ParseSizeError::parse_failure(size)), @@ -212,7 +212,7 @@ impl<'parser> Parser<'parser> { .take_while(|c| c.is_ascii_digit()) .collect::() .len(); - if size.starts_with("0") && num_digits > 1 { + if size.starts_with('0') && num_digits > 1 { return NumberSystem::Octal; } From f1c943ed31d9d44cc1316f05042ec9f0505edec7 Mon Sep 17 00:00:00 2001 From: Ideflop <94184575+Ideflop@users.noreply.github.com> Date: Tue, 30 May 2023 09:03:00 +0200 Subject: [PATCH 012/253] more: error handling for write_all in function paging_add_back_message --- src/uu/more/src/more.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 9be9b5576..a43489566 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -344,7 +344,7 @@ fn more( .. }) => { pager.page_up(); - paging_add_back_message(options, stdout); + paging_add_back_message(options, stdout)?; } Event::Key(KeyEvent { code: KeyCode::Char('j'), @@ -556,11 +556,12 @@ impl<'a> Pager<'a> { } } -fn paging_add_back_message(options: &Options, stdout: &mut std::io::Stdout) { +fn paging_add_back_message(options: &Options, stdout: &mut std::io::Stdout) -> UResult<()> { if options.lines.is_some() { - execute!(stdout, MoveUp(1)).unwrap(); - stdout.write_all("\n\r...back 1 page\n".as_bytes()).unwrap(); + execute!(stdout, MoveUp(1))?; + stdout.write_all("\n\r...back 1 page\n".as_bytes())?; } + Ok(()) } // Break the lines on the cols of the terminal From af528ba84e91a36005e2d6f4c82e92107a4937b5 Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 00:26:17 -0700 Subject: [PATCH 013/253] core: refactor num and unit split --- src/uucore/src/lib/parser/parse_size.rs | 31 +++++++------------------ 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index be642ef8b..716cf8d79 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -80,30 +80,15 @@ impl<'parser> Parser<'parser> { // Split the size argument into numeric and unit parts // For example, if the argument is "123K", the numeric part is "123", and // the unit is "K" - let (numeric_string, unit) = match number_system { - NumberSystem::Hexadecimal => { - let numeric_string: String = size - .chars() - .take(2) - .chain(size.chars().skip(2).take_while(|c| c.is_ascii_hexdigit())) - .collect(); - let unit: String = size.chars().skip(numeric_string.len()).collect(); - - (numeric_string, unit) - } - _ => { - let mut unit: String = size - .chars() - .rev() - .take_while(|c| c.is_alphabetic()) - .collect(); - unit = unit.chars().rev().collect(); - let numeric_string = size.chars().take(size.len() - unit.len()).collect(); - - (numeric_string, unit) - } + let numeric_string: String = match number_system { + NumberSystem::Hexadecimal => size + .chars() + .take(2) + .chain(size.chars().skip(2).take_while(|c| c.is_ascii_hexdigit())) + .collect(), + _ => size.chars().take_while(|c| c.is_ascii_digit()).collect(), }; - let mut unit: &str = unit.as_str(); + let mut unit: &str = &size[numeric_string.len()..]; if let Some(default_unit) = self.default_unit { // Check if `unit` is empty then assigns `default_unit` to `unit` From aed8a5759a42ffe6b7f94dc8d6750e18c623df65 Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 00:27:09 -0700 Subject: [PATCH 014/253] core: size parser treat 000 as decimal --- src/uucore/src/lib/parser/parse_size.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 716cf8d79..af4cf990d 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -197,7 +197,8 @@ impl<'parser> Parser<'parser> { .take_while(|c| c.is_ascii_digit()) .collect::() .len(); - if size.starts_with('0') && num_digits > 1 { + let all_zeros = size.chars().all(|c| c == '0'); + if size.starts_with('0') && num_digits > 1 && !all_zeros { return NumberSystem::Octal; } From 81871d54a2bc3b765d5c3bee219b3d7725e2d362 Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 00:33:14 -0700 Subject: [PATCH 015/253] core: refactor parse_number in size parser --- src/uucore/src/lib/parser/parse_size.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index af4cf990d..c6a02dfae 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -156,25 +156,16 @@ impl<'parser> Parser<'parser> { if numeric_string.is_empty() { 1 } else { - match numeric_string.parse() { - Ok(n) => n, - Err(_) => return Err(ParseSizeError::parse_failure(size)), - } + self.parse_number(&numeric_string, 10, size)? } } NumberSystem::Octal => { let trimmed_string = numeric_string.trim_start_matches('0'); - match u64::from_str_radix(trimmed_string, 8) { - Ok(res) => res, - Err(_) => return Err(ParseSizeError::parse_failure(size)), - } + self.parse_number(trimmed_string, 8, size)? } NumberSystem::Hexadecimal => { let trimmed_string = numeric_string.trim_start_matches("0x"); - match u64::from_str_radix(trimmed_string, 16) { - Ok(res) => res, - Err(_) => return Err(ParseSizeError::parse_failure(size)), - } + self.parse_number(trimmed_string, 16, size)? } }; @@ -204,6 +195,16 @@ impl<'parser> Parser<'parser> { NumberSystem::Decimal } + + fn parse_number( + &self, + numeric_string: &str, + radix: u32, + original_size: &str, + ) -> Result { + u64::from_str_radix(numeric_string, radix) + .map_err(|_| ParseSizeError::ParseFailure(original_size.to_string())) + } } /// Parse a size string into a number of bytes. From 6278c6f2d6bcd923c2ce294b13b822853a529030 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 29 May 2023 19:13:33 -0700 Subject: [PATCH 016/253] core: add octal and hex size parse support --- src/uucore/src/lib/parser/parse_size.rs | 126 ++++++++++++++++++++---- 1 file changed, 106 insertions(+), 20 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 60209d849..70b94fbcc 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -25,6 +25,12 @@ pub struct Parser<'parser> { pub default_unit: Option<&'parser str>, } +enum NumberSystem { + Decimal, + Octal, + Hexadecimal, +} + impl<'parser> Parser<'parser> { pub fn with_allow_list(&mut self, allow_list: &'parser [&str]) -> &mut Self { self.allow_list = Some(allow_list); @@ -62,32 +68,42 @@ impl<'parser> Parser<'parser> { /// assert_eq!(Ok(123), parse_size("123")); /// assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000 /// assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024 + /// assert_eq!(Ok(44251 * 1024), parse_size("0xACDBK")); /// ``` pub fn parse(&self, size: &str) -> Result { if size.is_empty() { return Err(ParseSizeError::parse_failure(size)); } - // 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_ascii_digit()).collect(); - let number: u64 = if numeric_string.is_empty() { - 1 - } else { - match numeric_string.parse() { - Ok(n) => n, - Err(_) => return Err(ParseSizeError::parse_failure(size)), + + let number_system: NumberSystem = self.determine_number_system(size); + + // Split the size argument into numeric and unit parts + // For example, if the argument is "123K", the numeric part is "123", and + // the unit is "K" + let (numeric_string, unit) = match number_system { + NumberSystem::Hexadecimal => { + let numeric_string: String = size + .chars() + .take(2) + .chain(size.chars().skip(2).take_while(|c| c.is_ascii_hexdigit())) + .collect(); + let unit: String = size.chars().skip(numeric_string.len()).collect(); + + (numeric_string, unit) + } + _ => { + let mut unit: String = size + .chars() + .rev() + .take_while(|c| c.is_alphabetic()) + .collect(); + unit = unit.chars().rev().collect(); + let numeric_string = size.chars().take(size.len() - unit.len()).collect(); + + (numeric_string, unit) } }; - - // Get the alphabetic units part of the size argument and compute - // the factor it represents. For example, if the argument is "123K", - // then the unit part is "K" and the factor is 1024. This may be the - // empty string, in which case, the factor is 1. - // - // The lowercase "b" (used by `od`, `head`, `tail`, etc.) means - // "block" and the Posix block size is 512. The uppercase "B" - // means "byte". - let mut unit: &str = &size[numeric_string.len()..]; + let mut unit: &str = unit.as_str(); if let Some(default_unit) = self.default_unit { // Check if `unit` is empty then assigns `default_unit` to `unit` @@ -115,6 +131,12 @@ impl<'parser> Parser<'parser> { } } + // Compute the factor the unit represents. + // empty string means the factor is 1. + // + // The lowercase "b" (used by `od`, `head`, `tail`, etc.) means + // "block" and the Posix block size is 512. The uppercase "B" + // means "byte". let (base, exponent): (u128, u32) = match unit { "" => (1, 0), "B" if self.capital_b_bytes => (1, 0), @@ -142,10 +164,60 @@ impl<'parser> Parser<'parser> { Ok(n) => n, Err(_) => return Err(ParseSizeError::size_too_big(size)), }; + + // parse string into u64 + let number: u64 = match number_system { + NumberSystem::Decimal => { + if numeric_string.is_empty() { + 1 + } else { + match numeric_string.parse() { + Ok(n) => n, + Err(_) => return Err(ParseSizeError::parse_failure(size)), + } + } + } + NumberSystem::Octal => { + let trimmed_string = numeric_string.trim_start_matches("0"); + match u64::from_str_radix(trimmed_string, 8) { + Ok(res) => res, + Err(_) => return Err(ParseSizeError::parse_failure(size)), + } + } + NumberSystem::Hexadecimal => { + let trimmed_string = numeric_string.trim_start_matches("0x"); + match u64::from_str_radix(trimmed_string, 16) { + Ok(res) => res, + Err(_) => return Err(ParseSizeError::parse_failure(size)), + } + } + }; + number .checked_mul(factor) .ok_or_else(|| ParseSizeError::size_too_big(size)) } + + fn determine_number_system(&self, size: &str) -> NumberSystem { + if size.len() <= 1 { + return NumberSystem::Decimal; + } + + if size.starts_with("0x") { + return NumberSystem::Hexadecimal; + } + + let num_digits: usize = size + .chars() + .take_while(|c| c.is_ascii_digit()) + .collect::() + .len(); + if size.starts_with("0") && num_digits > 1 { + return NumberSystem::Octal; + } + + NumberSystem::Decimal + } } /// Parse a size string into a number of bytes. @@ -336,7 +408,7 @@ mod tests { #[test] fn invalid_suffix() { - let test_strings = ["328hdsf3290", "5mib", "1e2", "1H", "1.2"]; + let test_strings = ["5mib", "1eb", "1H"]; for &test_string in &test_strings { assert_eq!( parse_size(test_string).unwrap_err(), @@ -450,4 +522,18 @@ mod tests { assert!(parser.parse("1B").is_err()); assert!(parser.parse("B").is_err()); } + + #[test] + fn parse_octal_size() { + assert_eq!(Ok(63), parse_size("077")); + assert_eq!(Ok(528), parse_size("01020")); + assert_eq!(Ok(668 * 1024), parse_size("01234K")); + } + + #[test] + fn parse_hex_size() { + assert_eq!(Ok(10), parse_size("0xA")); + assert_eq!(Ok(94722), parse_size("0x17202")); + assert_eq!(Ok(44251 * 1024), parse_size("0xACDBK")); + } } From 3ca003846dc2d272d56a27043cf73c9b5dc6b427 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 29 May 2023 20:10:16 -0700 Subject: [PATCH 017/253] shred: add support for hex and octal size --- src/uu/shred/src/shred.rs | 42 ++++++++++--------------------------- tests/by-util/test_shred.rs | 11 ++++++++++ 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 89f857b19..1ceffe995 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -19,6 +19,7 @@ use std::os::unix::prelude::PermissionsExt; use std::path::{Path, PathBuf}; use uucore::display::Quotable; use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; +use uucore::parse_size::parse_size; use uucore::{format_usage, help_about, help_section, help_usage, show, show_error, show_if_err}; const ABOUT: &str = help_about!("shred.md"); @@ -318,38 +319,17 @@ pub fn uu_app() -> Command { ) } -// TODO: Add support for all postfixes here up to and including EiB -// http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size fn get_size(size_str_opt: Option) -> Option { - size_str_opt.as_ref()?; - - let mut size_str = size_str_opt.as_ref().unwrap().clone(); - // Immutably look at last character of size string - let unit = match size_str.chars().last().unwrap() { - 'K' => { - size_str.pop(); - 1024u64 - } - 'M' => { - size_str.pop(); - (1024 * 1024) as u64 - } - 'G' => { - size_str.pop(); - (1024 * 1024 * 1024) as u64 - } - _ => 1u64, - }; - - let coefficient = match size_str.parse::() { - Ok(u) => u, - Err(_) => { - show_error!("{}: Invalid file size", size_str_opt.unwrap().maybe_quote()); - std::process::exit(1); - } - }; - - Some(coefficient * unit) + match size_str_opt { + Some(size) => match parse_size(size.as_str()) { + Ok(res) => Some(res), + Err(_) => { + show_error!("invalid file size: {}", size.quote()); + std::process::exit(1) + } + }, + None => None, + } } fn pass_name(pass_type: &PassType) -> String { diff --git a/tests/by-util/test_shred.rs b/tests/by-util/test_shred.rs index 58db09cbd..a34345aee 100644 --- a/tests/by-util/test_shred.rs +++ b/tests/by-util/test_shred.rs @@ -51,3 +51,14 @@ fn test_shred_force() { // file_a was deleted. assert!(!at.file_exists(file)); } + +#[test] +fn test_hex() { + let (at, mut ucmd) = at_and_ucmd!(); + + let file = "test_hex"; + + at.touch(file); + + ucmd.arg("--size=0x10").arg(file).succeeds(); +} From 6cadffc8f1879ba1174d30d10cadc9ac273498a3 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 29 May 2023 20:59:21 -0700 Subject: [PATCH 018/253] core: fix clippy warning for size parser --- src/uucore/src/lib/parser/parse_size.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 70b94fbcc..be642ef8b 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -178,7 +178,7 @@ impl<'parser> Parser<'parser> { } } NumberSystem::Octal => { - let trimmed_string = numeric_string.trim_start_matches("0"); + let trimmed_string = numeric_string.trim_start_matches('0'); match u64::from_str_radix(trimmed_string, 8) { Ok(res) => res, Err(_) => return Err(ParseSizeError::parse_failure(size)), @@ -212,7 +212,7 @@ impl<'parser> Parser<'parser> { .take_while(|c| c.is_ascii_digit()) .collect::() .len(); - if size.starts_with("0") && num_digits > 1 { + if size.starts_with('0') && num_digits > 1 { return NumberSystem::Octal; } From 8ef926c6e863c0b274df9c33b326d45e7e24b10e Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 00:26:17 -0700 Subject: [PATCH 019/253] core: refactor num and unit split --- src/uucore/src/lib/parser/parse_size.rs | 31 +++++++------------------ 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index be642ef8b..716cf8d79 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -80,30 +80,15 @@ impl<'parser> Parser<'parser> { // Split the size argument into numeric and unit parts // For example, if the argument is "123K", the numeric part is "123", and // the unit is "K" - let (numeric_string, unit) = match number_system { - NumberSystem::Hexadecimal => { - let numeric_string: String = size - .chars() - .take(2) - .chain(size.chars().skip(2).take_while(|c| c.is_ascii_hexdigit())) - .collect(); - let unit: String = size.chars().skip(numeric_string.len()).collect(); - - (numeric_string, unit) - } - _ => { - let mut unit: String = size - .chars() - .rev() - .take_while(|c| c.is_alphabetic()) - .collect(); - unit = unit.chars().rev().collect(); - let numeric_string = size.chars().take(size.len() - unit.len()).collect(); - - (numeric_string, unit) - } + let numeric_string: String = match number_system { + NumberSystem::Hexadecimal => size + .chars() + .take(2) + .chain(size.chars().skip(2).take_while(|c| c.is_ascii_hexdigit())) + .collect(), + _ => size.chars().take_while(|c| c.is_ascii_digit()).collect(), }; - let mut unit: &str = unit.as_str(); + let mut unit: &str = &size[numeric_string.len()..]; if let Some(default_unit) = self.default_unit { // Check if `unit` is empty then assigns `default_unit` to `unit` From 0465553f6ebd36cebf4d0d71a476b957cb2b29fc Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 00:27:09 -0700 Subject: [PATCH 020/253] core: size parser treat 000 as decimal --- src/uucore/src/lib/parser/parse_size.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 716cf8d79..af4cf990d 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -197,7 +197,8 @@ impl<'parser> Parser<'parser> { .take_while(|c| c.is_ascii_digit()) .collect::() .len(); - if size.starts_with('0') && num_digits > 1 { + let all_zeros = size.chars().all(|c| c == '0'); + if size.starts_with('0') && num_digits > 1 && !all_zeros { return NumberSystem::Octal; } From a3979201836e97cea203eee0f328d89ff75d8a7b Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 00:33:14 -0700 Subject: [PATCH 021/253] core: refactor parse_number in size parser --- src/uucore/src/lib/parser/parse_size.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index af4cf990d..c6a02dfae 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -156,25 +156,16 @@ impl<'parser> Parser<'parser> { if numeric_string.is_empty() { 1 } else { - match numeric_string.parse() { - Ok(n) => n, - Err(_) => return Err(ParseSizeError::parse_failure(size)), - } + self.parse_number(&numeric_string, 10, size)? } } NumberSystem::Octal => { let trimmed_string = numeric_string.trim_start_matches('0'); - match u64::from_str_radix(trimmed_string, 8) { - Ok(res) => res, - Err(_) => return Err(ParseSizeError::parse_failure(size)), - } + self.parse_number(trimmed_string, 8, size)? } NumberSystem::Hexadecimal => { let trimmed_string = numeric_string.trim_start_matches("0x"); - match u64::from_str_radix(trimmed_string, 16) { - Ok(res) => res, - Err(_) => return Err(ParseSizeError::parse_failure(size)), - } + self.parse_number(trimmed_string, 16, size)? } }; @@ -204,6 +195,16 @@ impl<'parser> Parser<'parser> { NumberSystem::Decimal } + + fn parse_number( + &self, + numeric_string: &str, + radix: u32, + original_size: &str, + ) -> Result { + u64::from_str_radix(numeric_string, radix) + .map_err(|_| ParseSizeError::ParseFailure(original_size.to_string())) + } } /// Parse a size string into a number of bytes. From 58bf9989199c0713ed6d4e385a594f0424e100cc Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 30 May 2023 15:49:53 +0200 Subject: [PATCH 022/253] Ignore some words --- src/uucore/src/lib/parser/parse_size.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index c6a02dfae..2ea84e389 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -3,7 +3,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// spell-checker:ignore (ToDO) hdsf ghead gtail +// spell-checker:ignore (ToDO) hdsf ghead gtail ACDBK hexdigit use std::error::Error; use std::fmt; From f10faf21bc328fb5704cdb0361c5084e20e84d7a Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 11:26:39 -0700 Subject: [PATCH 023/253] head: interpret size as decimal --- src/uu/head/src/parse.rs | 8 +++++++- tests/by-util/test_head.rs | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index b24b6591e..56c359a0c 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -114,7 +114,13 @@ pub fn parse_num(src: &str) -> Result<(u64, bool), ParseSizeError> { return Err(ParseSizeError::ParseFailure(src.to_string())); } - parse_size(size_string).map(|n| (n, all_but_last)) + // remove leading zeros so that size is interpreted as decimal, not octal + let trimmed_string = size_string.trim_start_matches('0'); + if trimmed_string.is_empty() { + Ok((0, all_but_last)) + } else { + parse_size(trimmed_string).map(|n| (n, all_but_last)) + } } #[cfg(test)] diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 571bfb3a8..0e1eafc86 100644 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -189,6 +189,15 @@ fn test_no_such_file_or_directory() { .stderr_contains("cannot open 'no_such_file.toml' for reading: No such file or directory"); } +#[test] +fn test_lines_leading_zeros() { + new_ucmd!() + .arg("--lines=010") + .pipe_in("\n\n\n\n\n\n\n\n\n\n\n\n") + .succeeds() + .stdout_is("\n\n\n\n\n\n\n\n\n\n"); +} + /// Test that each non-existent files gets its own error message printed. #[test] fn test_multiple_nonexistent_files() { From b93bae2964ce52ad24dbd16ee110593096efb944 Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 13:34:00 -0700 Subject: [PATCH 024/253] tail: fix parsing logic and add quote --- src/uu/tail/src/args.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index 5fb5ef2b3..955a9d8f6 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -80,7 +80,7 @@ impl FilterMode { Err(e) => { return Err(USimpleError::new( 1, - format!("invalid number of bytes: {e}"), + format!("invalid number of bytes: '{e}'"), )) } } @@ -415,16 +415,17 @@ fn parse_num(src: &str) -> Result { starting_with = true; } } - } else { - return Err(ParseSizeError::ParseFailure(src.to_string())); } - parse_size(size_string).map(|n| match (n, starting_with) { - (0, true) => Signum::PlusZero, - (0, false) => Signum::MinusZero, - (n, true) => Signum::Positive(n), - (n, false) => Signum::Negative(n), - }) + match parse_size(size_string) { + Ok(n) => match (n, starting_with) { + (0, true) => Ok(Signum::PlusZero), + (0, false) => Ok(Signum::MinusZero), + (n, true) => Ok(Signum::Positive(n)), + (n, false) => Ok(Signum::Negative(n)), + }, + Err(_) => Err(ParseSizeError::ParseFailure(size_string.to_string())), + } } pub fn parse_args(args: impl uucore::Args) -> UResult { From f10059db026cdda3def757ee6a430b122e59bd83 Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 13:40:41 -0700 Subject: [PATCH 025/253] shred: refactor get_size --- src/uu/shred/src/shred.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 1ceffe995..47c3ff6ec 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -320,16 +320,16 @@ pub fn uu_app() -> Command { } fn get_size(size_str_opt: Option) -> Option { - match size_str_opt { - Some(size) => match parse_size(size.as_str()) { - Ok(res) => Some(res), - Err(_) => { + size_str_opt + .as_ref() + .and_then(|size| parse_size(size.as_str()).ok()) + .or_else(|| { + if let Some(size) = size_str_opt { show_error!("invalid file size: {}", size.quote()); - std::process::exit(1) + std::process::exit(1); } - }, - None => None, - } + None + }) } fn pass_name(pass_type: &PassType) -> String { From 4b09b917cd3e4687da28fb91b6d3d3eef0ffea54 Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 30 May 2023 15:08:22 -0700 Subject: [PATCH 026/253] shred: use exact if size is given --- src/uu/shred/src/shred.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 47c3ff6ec..5ec1d1213 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -239,7 +239,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { .get_one::(options::SIZE) .map(|s| s.to_string()); let size = get_size(size_arg); - let exact = matches.get_flag(options::EXACT) && size.is_none(); // if -s is given, ignore -x + let exact = matches.get_flag(options::EXACT) || size.is_some(); let zero = matches.get_flag(options::ZERO); let verbose = matches.get_flag(options::VERBOSE); From 77e183955b73951047db10ac37d2747b428863c9 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 31 May 2023 20:09:26 +0200 Subject: [PATCH 027/253] head: use OsStringExt::from_vec instead of std::from_utf8_unchecked This no longer triggers the `invalid_from_utf8_unchecked` lint. It is also a bit cleaner and no longer requires `unsafe` because OsString is not guaranteed to be valid UTF-8. --- src/uu/head/src/head.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 2ccf20904..a336c91d4 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -622,12 +622,10 @@ mod tests { #[test] #[cfg(target_os = "linux")] fn test_arg_iterate_bad_encoding() { - #[allow(clippy::invalid_utf8_in_unchecked)] - let invalid = unsafe { std::str::from_utf8_unchecked(b"\x80\x81") }; + use std::os::unix::ffi::OsStringExt; + let invalid = OsString::from_vec(vec![b'\x80', b'\x81']); // this arises from a conversion from OsString to &str - assert!( - arg_iterate(vec![OsString::from("head"), OsString::from(invalid)].into_iter()).is_err() - ); + assert!(arg_iterate(vec![OsString::from("head"), invalid].into_iter()).is_err()); } #[test] fn read_early_exit() { From 7a706d37197d6dadfc4fda56f436bfad2ca686d8 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 30 May 2023 16:41:48 +0200 Subject: [PATCH 028/253] deny.toml: remove io-lifetimes from skip list --- deny.toml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/deny.toml b/deny.toml index c4d83c513..14470b9b0 100644 --- a/deny.toml +++ b/deny.toml @@ -61,13 +61,10 @@ highlight = "all" skip = [ # is-terminal { name = "hermit-abi", version = "0.3.1" }, - # is-terminal + # procfs { name = "rustix", version = "0.36.14" }, - # is-terminal (via rustix) - { name = "io-lifetimes", version = "1.0.5" }, - # is-terminal - { name = "linux-raw-sys", version = "0.1.4" }, - # is-terminal + { name = "linux-raw-sys", version = "0.1.4" }, + # various crates { name = "windows-sys", version = "0.45.0" }, { name = "windows-targets", version = "0.42.2" }, { name = "windows_aarch64_gnullvm", version = "0.42.2" }, @@ -77,7 +74,6 @@ skip = [ { name = "windows_x86_64_gnu", version = "0.42.2" }, { name = "windows_x86_64_gnullvm", version = "0.42.2" }, { name = "windows_x86_64_msvc", version = "0.42.2" }, - # tempfile { name = "redox_syscall", version = "0.3.5" }, # cpp_macros From 0b4a91744d73daea683a1385d160f281b361e242 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 30 May 2023 16:47:40 +0200 Subject: [PATCH 029/253] Bump io-lifetimes from 1.0.5 to 1.0.11 --- Cargo.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d7a1f5b9b..c38199dca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1226,12 +1226,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.5" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ + "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] From 7a449feaa0a414f5cac208fcbe552f4b3e87f879 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 1 Jun 2023 10:43:09 +0200 Subject: [PATCH 030/253] Bump fundu from 0.5.1 to 1.0.0 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c38199dca..b657c84fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -957,9 +957,9 @@ dependencies = [ [[package]] name = "fundu" -version = "0.5.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a37cfff04a32112c22c5497b20b0b09100fca406e76afd47b2ba5ab33d7a851" +checksum = "47af3b646bdd738395be2db903fc11a5923b5e206016b8d4ad6db890bcae9bd5" [[package]] name = "futures" diff --git a/Cargo.toml b/Cargo.toml index ebd9a4bf4..409b03159 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -282,7 +282,7 @@ filetime = "0.2" fnv = "1.0.7" fs_extra = "1.3.0" fts-sys = "0.2" -fundu = "0.5.1" +fundu = "1.0.0" gcd = "2.3" glob = "0.3.1" half = "2.2" From ccee02f0257b44ab376c8fb5a3377099ca713b20 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 1 Jun 2023 10:57:54 +0200 Subject: [PATCH 031/253] sleep: fix compile error due to fundu update --- src/uu/sleep/src/sleep.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index 009986095..8acb7724f 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -14,7 +14,7 @@ use uucore::{ }; use clap::{crate_version, Arg, ArgAction, Command}; -use fundu::{self, DurationParser, ParseError}; +use fundu::{self, DurationParser, ParseError, SaturatingInto}; static ABOUT: &str = help_about!("sleep.md"); const USAGE: &str = help_usage!("sleep.md"); @@ -63,7 +63,7 @@ pub fn uu_app() -> Command { fn sleep(args: &[&str]) -> UResult<()> { let mut arg_error = false; - use fundu::TimeUnit::*; + use fundu::TimeUnit::{Day, Hour, Minute, Second}; let parser = DurationParser::with_time_units(&[Second, Minute, Hour, Day]); let sleep_dur = args @@ -91,7 +91,9 @@ fn sleep(args: &[&str]) -> UResult<()> { None } }) - .fold(Duration::ZERO, |acc, n| acc.saturating_add(n)); + .fold(Duration::ZERO, |acc, n| { + acc.saturating_add(SaturatingInto::::saturating_into(n)) + }); if arg_error { return Err(UUsageError::new(1, "")); From b6c02c1a236d83d6f538d045eb02e6ce3eddf8eb Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 1 Jun 2023 15:30:43 +0200 Subject: [PATCH 032/253] tail: fix compile error due to fundu update --- src/uu/tail/src/args.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index 5fb5ef2b3..c054017c2 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -9,7 +9,7 @@ use crate::paths::Input; use crate::{parse, platform, Quotable}; use clap::crate_version; use clap::{Arg, ArgAction, ArgMatches, Command}; -use fundu::DurationParser; +use fundu::{DurationParser, SaturatingInto}; use is_terminal::IsTerminal; use same_file::Handle; use std::collections::VecDeque; @@ -235,12 +235,15 @@ impl Settings { // `DURATION::MAX` or `infinity` was given // * not applied here but it supports customizable time units and provides better error // messages - settings.sleep_sec = - DurationParser::without_time_units() - .parse(source) - .map_err(|_| { - UUsageError::new(1, format!("invalid number of seconds: '{source}'")) - })?; + settings.sleep_sec = match DurationParser::without_time_units().parse(source) { + Ok(duration) => SaturatingInto::::saturating_into(duration), + Err(_) => { + return Err(UUsageError::new( + 1, + format!("invalid number of seconds: '{source}'"), + )) + } + } } if let Some(s) = matches.get_one::(options::MAX_UNCHANGED_STATS) { From 4eb1e847e984f6293e0d919109a1f5cdd16b2f7a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 31 May 2023 23:53:21 +0200 Subject: [PATCH 033/253] cp --no-clobber should fail --- src/uu/cp/src/cp.rs | 15 ++++++--------- tests/by-util/test_cp.rs | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 513fb8380..e9fb56ef3 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1102,23 +1102,21 @@ fn preserve_hardlinks( } /// When handling errors, we don't always want to show them to the user. This function handles that. -/// If the error is printed, returns true, false otherwise. -fn show_error_if_needed(error: &Error) -> bool { +fn show_error_if_needed(error: &Error) { match error { // When using --no-clobber, we don't want to show // an error message - Error::NotAllFilesCopied => (), + Error::NotAllFilesCopied => { + // Need to return an error code + } Error::Skipped => { // touch a b && echo "n"|cp -i a b && echo $? // should return an error from GNU 9.2 - return true; } _ => { show_error!("{}", error); - return true; } } - false } /// Copy all `sources` to `target`. Returns an @@ -1175,9 +1173,8 @@ fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResu options, &mut symlinked_files, ) { - if show_error_if_needed(&error) { - non_fatal_errors = true; - } + show_error_if_needed(&error); + non_fatal_errors = true; } } seen_sources.insert(source); diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 1feeb0ede..690aa8b4e 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -487,7 +487,7 @@ fn test_cp_arg_no_clobber() { ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .arg("--no-clobber") - .succeeds(); + .fails(); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "How are you?\n"); } @@ -498,7 +498,7 @@ fn test_cp_arg_no_clobber_inferred_arg() { ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .arg("--no-clob") - .succeeds(); + .fails(); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "How are you?\n"); } @@ -525,7 +525,7 @@ fn test_cp_arg_no_clobber_twice() { .arg("--no-clobber") .arg("source.txt") .arg("dest.txt") - .succeeds(); + .fails(); assert_eq!(at.read("source.txt"), "some-content"); // Should be empty as the "no-clobber" should keep From 20ce7accf250b07a4e0fe2f1bfe29f6363581cd6 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Jun 2023 00:23:34 +0200 Subject: [PATCH 034/253] cp: -i prompts in the right place Should fix tests/cp/cp-i.sh --- src/uu/cp/src/cp.rs | 25 ++++++++++++++++++------- tests/by-util/test_cp.rs | 26 +++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index e9fb56ef3..e8552a179 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -43,7 +43,8 @@ use uucore::fs::{ }; use uucore::update_control::{self, UpdateMode}; use uucore::{ - crash, format_usage, help_about, help_section, help_usage, prompt_yes, show_error, show_warning, + crash, format_usage, help_about, help_section, help_usage, prompt_yes, show_error, + show_warning, util_name, }; use crate::copydir::copy_directory; @@ -1251,13 +1252,23 @@ fn copy_source( } impl OverwriteMode { - fn verify(&self, path: &Path) -> CopyResult<()> { + fn verify(&self, path: &Path, verbose: bool) -> CopyResult<()> { match *self { - Self::NoClobber => Err(Error::NotAllFilesCopied), + Self::NoClobber => { + if verbose { + println!("skipped {}", path.quote()); + } else { + eprintln!("{}: not replacing {}", util_name(), path.quote()); + } + Err(Error::NotAllFilesCopied) + } Self::Interactive(_) => { if prompt_yes!("overwrite {}?", path.quote()) { Ok(()) } else { + if verbose { + println!("skipped {}", path.quote()); + } Err(Error::Skipped) } } @@ -1465,7 +1476,7 @@ fn handle_existing_dest( return Err(format!("{} and {} are the same file", source.quote(), dest.quote()).into()); } - options.overwrite.verify(dest)?; + options.overwrite.verify(dest, options.verbose)?; let backup_path = backup_control::get_backup_path(options.backup, dest, &options.backup_suffix); if let Some(backup_path) = backup_path { @@ -1823,7 +1834,7 @@ fn copy_helper( File::create(dest).context(dest.display().to_string())?; } else if source_is_fifo && options.recursive && !options.copy_contents { #[cfg(unix)] - copy_fifo(dest, options.overwrite)?; + copy_fifo(dest, options.overwrite, options.verbose)?; } else if source_is_symlink { copy_link(source, dest, symlinked_files)?; } else { @@ -1848,9 +1859,9 @@ fn copy_helper( // "Copies" a FIFO by creating a new one. This workaround is because Rust's // built-in fs::copy does not handle FIFOs (see rust-lang/rust/issues/79390). #[cfg(unix)] -fn copy_fifo(dest: &Path, overwrite: OverwriteMode) -> CopyResult<()> { +fn copy_fifo(dest: &Path, overwrite: OverwriteMode, verbose: bool) -> CopyResult<()> { if dest.exists() { - overwrite.verify(dest)?; + overwrite.verify(dest, verbose)?; fs::remove_file(dest)?; } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 690aa8b4e..7f153343d 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -456,6 +456,29 @@ fn test_cp_arg_interactive_update() { .no_stdout(); } +#[test] +#[cfg(not(target_os = "android"))] +fn test_cp_arg_interactive_verbose() { + let (at, mut ucmd) = at_and_ucmd!(); + at.touch("a"); + at.touch("b"); + ucmd.args(&["-vi", "a", "b"]) + .pipe_in("N\n") + .fails() + .stdout_is("skipped 'b'\n"); +} + +#[test] +#[cfg(not(target_os = "android"))] +fn test_cp_arg_interactive_verbose_clobber() { + let (at, mut ucmd) = at_and_ucmd!(); + at.touch("a"); + at.touch("b"); + ucmd.args(&["-vin", "a", "b"]) + .fails() + .stdout_is("skipped 'b'\n"); +} + #[test] #[cfg(target_os = "linux")] fn test_cp_arg_link() { @@ -487,7 +510,8 @@ fn test_cp_arg_no_clobber() { ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .arg("--no-clobber") - .fails(); + .fails() + .stderr_contains("not replacing"); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "How are you?\n"); } From bbfa77dcad9057756fdc28846320d9a6e6b1e983 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 2 Jun 2023 09:46:24 +0200 Subject: [PATCH 035/253] cp: replace assert!(false) with panic!() --- tests/by-util/test_cp.rs | 42 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 7f153343d..9ccf6777e 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -2946,21 +2946,18 @@ fn test_cp_debug_default() { if !stdout_str .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } #[cfg(target_os = "linux")] if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } #[cfg(windows)] if !stdout_str .contains("copy offload: unsupported, reflink: unsupported, sparse detection: unsupported") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } } @@ -2987,8 +2984,7 @@ fn test_cp_debug_multiple_default() { if !stdout_str .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } // two files, two occurrences @@ -3007,8 +3003,7 @@ fn test_cp_debug_multiple_default() { { if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } // two files, two occurrences @@ -3026,8 +3021,7 @@ fn test_cp_debug_multiple_default() { if !stdout_str.contains( "copy offload: unsupported, reflink: unsupported, sparse detection: unsupported", ) { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } // two files, two occurrences @@ -3058,8 +3052,7 @@ fn test_cp_debug_sparse_reflink() { let stdout_str = result.stdout_str(); if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: zeros") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } } @@ -3079,8 +3072,7 @@ fn test_cp_debug_sparse_always() { let stdout_str = result.stdout_str(); if !stdout_str.contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } } @@ -3099,8 +3091,7 @@ fn test_cp_debug_sparse_never() { .succeeds(); let stdout_str = result.stdout_str(); if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } } @@ -3122,14 +3113,12 @@ fn test_cp_debug_sparse_auto() { if !stdout_str .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } #[cfg(target_os = "linux")] if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } } @@ -3152,8 +3141,7 @@ fn test_cp_debug_reflink_auto() { let stdout_str = result.stdout_str(); if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } } @@ -3163,8 +3151,7 @@ fn test_cp_debug_reflink_auto() { if !stdout_str .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } } } @@ -3186,7 +3173,6 @@ fn test_cp_debug_sparse_always_reflink_auto() { let stdout_str = result.stdout_str(); if !stdout_str.contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros") { - println!("Failure: stdout was \n{stdout_str}"); - assert!(false); + panic!("Failure: stdout was \n{stdout_str}"); } } From ca9cf3757b4e26e913c9e4d3b3384840308e10d5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 4 Jun 2023 09:15:37 +0200 Subject: [PATCH 036/253] specify the sccache version because of https://github.com/mozilla/sccache/issues/1789 --- .github/workflows/CICD.yml | 22 ++++++++++++++++++++++ .github/workflows/freebsd.yml | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index fb2300ba9..8c595537f 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -183,6 +183,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -293,6 +295,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -347,6 +351,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -435,6 +441,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: "`make build`" shell: bash run: | @@ -477,6 +485,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Test run: cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} env: @@ -504,6 +514,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Test run: cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} env: @@ -527,6 +539,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Install dependencies shell: bash run: | @@ -652,6 +666,8 @@ jobs: key: "${{ matrix.job.os }}_${{ matrix.job.target }}" - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -905,6 +921,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Install/setup prerequisites shell: bash run: | @@ -989,6 +1007,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Build coreutils as multiple binaries shell: bash run: | @@ -1073,6 +1093,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" # - name: Reattach HEAD ## may be needed for accurate code coverage info # run: git checkout ${{ github.head_ref }} - name: Initialize workflow variables diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 9507b3a56..50746154b 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -34,6 +34,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Prepare, build and test uses: vmactions/freebsd-vm@v0.3.0 with: @@ -124,6 +126,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.5.0" - name: Prepare, build and test uses: vmactions/freebsd-vm@v0.3.0 with: From ee4691f4a2f9b5942d87646d204fcec6da9f4cd1 Mon Sep 17 00:00:00 2001 From: Guillaume Ranquet Date: Thu, 1 Jun 2023 17:16:46 +0200 Subject: [PATCH 037/253] cp: makes --preserve requires = prevents --preserve to eat the next argument when no value is passed. default value for --preserve is set to mode,ownership(unix only),timestamps before the patch: cp --preserve foo bar error: invalid value 'foo' for '--preserve [...]' [possible values: mode, ownership, timestamps, context, link, links, xattr, all] Signed-off-by: Guillaume Ranquet --- src/uu/cp/src/cp.rs | 1 + tests/by-util/test_cp.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index e8552a179..60ef54095 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -515,6 +515,7 @@ pub fn uu_app() -> Command { PRESERVABLE_ATTRIBUTES, )) .num_args(0..) + .require_equals(true) .value_name("ATTR_LIST") .overrides_with_all([ options::ARCHIVE, diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 9ccf6777e..fa5845eac 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1223,6 +1223,33 @@ fn test_cp_preserve_no_args() { } } +#[test] +fn test_cp_preserve_no_args_before_opts() { + let (at, mut ucmd) = at_and_ucmd!(); + let src_file = "a"; + let dst_file = "b"; + + // Prepare the source file + at.touch(src_file); + #[cfg(unix)] + at.set_mode(src_file, 0o0500); + + // Copy + ucmd.arg("--preserve") + .arg(src_file) + .arg(dst_file) + .succeeds(); + + #[cfg(all(unix, not(target_os = "freebsd")))] + { + // Assert that the mode, ownership, and timestamps are preserved + // NOTICE: the ownership is not modified on the src file, because that requires root permissions + let metadata_src = at.metadata(src_file); + let metadata_dst = at.metadata(dst_file); + assert_metadata_eq!(metadata_src, metadata_dst); + } +} + #[test] fn test_cp_preserve_all() { let (at, mut ucmd) = at_and_ucmd!(); From a0f4576f8a98b18c76d803d18bf56eb341d632d0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Jun 2023 08:25:03 +0200 Subject: [PATCH 038/253] update of the release doc --- util/update-version.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/update-version.sh b/util/update-version.sh index 2e2dca903..e248d13cd 100755 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -7,9 +7,10 @@ # 2) run it: sh util/update-version.sh # 3) Do a spot check with "git diff" # 4) cargo test --release --features unix -# 5) Run util/publish.sh in dry mode (it will fail as packages needs more recent version of uucore) -# 6) Run util/publish.sh --do-it -# 7) In some cases, you might have to fix dependencies and run import +# 5) git commit -m "New release" +# 6) Run util/publish.sh in dry mode (it will fail as packages needs more recent version of uucore) +# 7) Run util/publish.sh --do-it +# 8) In some cases, you might have to fix dependencies and run import FROM="0.0.17" TO="0.0.18" From 830b7d5ce1621f5e40838e91d3a066d68ddc40c2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Jun 2023 08:25:23 +0200 Subject: [PATCH 039/253] New release --- Cargo.lock | 214 ++++++++++++------------- Cargo.toml | 212 ++++++++++++------------ src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/basenc/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chcon/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/dd/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dir/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/pr/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/runcon/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 4 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 4 +- src/uu/stty/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/vdir/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- src/uucore/Cargo.toml | 2 +- src/uucore_procs/Cargo.toml | 2 +- util/update-version.sh | 4 +- 109 files changed, 323 insertions(+), 323 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c38199dca..f45951917 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -394,7 +394,7 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "coreutils" -version = "0.0.18" +version = "0.0.19" dependencies = [ "chrono", "clap", @@ -2387,7 +2387,7 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uu_arch" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "platform-info", @@ -2396,7 +2396,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2404,7 +2404,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.18" +version = "0.0.19" dependencies = [ "uu_base32", "uucore", @@ -2412,7 +2412,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2420,7 +2420,7 @@ dependencies = [ [[package]] name = "uu_basenc" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uu_base32", @@ -2429,7 +2429,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "is-terminal", @@ -2440,7 +2440,7 @@ dependencies = [ [[package]] name = "uu_chcon" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "fts-sys", @@ -2452,7 +2452,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2460,7 +2460,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -2469,7 +2469,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2477,7 +2477,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2485,7 +2485,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "hex", @@ -2494,7 +2494,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2502,7 +2502,7 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "exacl", @@ -2518,7 +2518,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "regex", @@ -2528,7 +2528,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.18" +version = "0.0.19" dependencies = [ "bstr", "clap", @@ -2539,7 +2539,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.18" +version = "0.0.19" dependencies = [ "chrono", "clap", @@ -2552,7 +2552,7 @@ dependencies = [ [[package]] name = "uu_dd" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "gcd", @@ -2564,7 +2564,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "unicode-width", @@ -2573,7 +2573,7 @@ dependencies = [ [[package]] name = "uu_dir" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uu_ls", @@ -2582,7 +2582,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2590,7 +2590,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2598,7 +2598,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.18" +version = "0.0.19" dependencies = [ "chrono", "clap", @@ -2609,7 +2609,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2617,7 +2617,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "nix", @@ -2627,7 +2627,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "unicode-width", @@ -2636,7 +2636,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "num-bigint", @@ -2647,7 +2647,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "coz", @@ -2660,7 +2660,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2668,7 +2668,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "unicode-width", @@ -2677,7 +2677,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2685,7 +2685,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2693,7 +2693,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "hex", @@ -2704,7 +2704,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "memchr", @@ -2713,7 +2713,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -2722,7 +2722,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "hostname", @@ -2732,7 +2732,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "selinux", @@ -2741,7 +2741,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "file_diff", @@ -2753,7 +2753,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "memchr", @@ -2762,7 +2762,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "nix", @@ -2771,7 +2771,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2779,7 +2779,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2787,7 +2787,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -2796,7 +2796,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.18" +version = "0.0.19" dependencies = [ "chrono", "clap", @@ -2814,7 +2814,7 @@ dependencies = [ [[package]] name = "uu_mkdir" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2822,7 +2822,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -2831,7 +2831,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -2840,7 +2840,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "rand", @@ -2850,7 +2850,7 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "crossterm", @@ -2863,7 +2863,7 @@ dependencies = [ [[package]] name = "uu_mv" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "fs_extra", @@ -2873,7 +2873,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -2883,7 +2883,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "regex", @@ -2892,7 +2892,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "is-terminal", @@ -2902,7 +2902,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -2911,7 +2911,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2919,7 +2919,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.18" +version = "0.0.19" dependencies = [ "byteorder", "clap", @@ -2929,7 +2929,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2937,7 +2937,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -2946,7 +2946,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2954,7 +2954,7 @@ dependencies = [ [[package]] name = "uu_pr" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "itertools", @@ -2966,7 +2966,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2974,7 +2974,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2982,7 +2982,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "regex", @@ -2991,7 +2991,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -2999,7 +2999,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3007,7 +3007,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3015,7 +3015,7 @@ dependencies = [ [[package]] name = "uu_relpath" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3023,7 +3023,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3034,7 +3034,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3043,7 +3043,7 @@ dependencies = [ [[package]] name = "uu_runcon" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3054,7 +3054,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.18" +version = "0.0.19" dependencies = [ "bigdecimal", "clap", @@ -3065,7 +3065,7 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3075,7 +3075,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "memchr", @@ -3086,7 +3086,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "fundu", @@ -3095,7 +3095,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.18" +version = "0.0.19" dependencies = [ "binary-heap-plus", "clap", @@ -3114,7 +3114,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "memchr", @@ -3123,7 +3123,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3131,7 +3131,7 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "tempfile", @@ -3141,7 +3141,7 @@ dependencies = [ [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.18" +version = "0.0.19" dependencies = [ "cpp", "cpp_build", @@ -3151,7 +3151,7 @@ dependencies = [ [[package]] name = "uu_stty" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "nix", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3168,7 +3168,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3179,7 +3179,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "memchr", @@ -3190,7 +3190,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "fundu", @@ -3207,7 +3207,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3216,7 +3216,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3226,7 +3226,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3236,7 +3236,7 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "filetime", @@ -3248,7 +3248,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "nom", @@ -3257,7 +3257,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3265,7 +3265,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3273,7 +3273,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3281,7 +3281,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "is-terminal", @@ -3291,7 +3291,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "platform-info", @@ -3300,7 +3300,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "unicode-width", @@ -3309,7 +3309,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3317,7 +3317,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3325,7 +3325,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.18" +version = "0.0.19" dependencies = [ "chrono", "clap", @@ -3334,7 +3334,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3342,7 +3342,7 @@ dependencies = [ [[package]] name = "uu_vdir" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uu_ls", @@ -3351,7 +3351,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.18" +version = "0.0.19" dependencies = [ "bytecount", "clap", @@ -3364,7 +3364,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "uucore", @@ -3372,7 +3372,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "libc", @@ -3382,7 +3382,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.18" +version = "0.0.19" dependencies = [ "clap", "itertools", @@ -3392,7 +3392,7 @@ dependencies = [ [[package]] name = "uucore" -version = "0.0.18" +version = "0.0.19" dependencies = [ "blake2b_simd", "blake3", @@ -3428,7 +3428,7 @@ dependencies = [ [[package]] name = "uucore_procs" -version = "0.0.18" +version = "0.0.19" dependencies = [ "help_parser", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index ebd9a4bf4..c1b1c3dae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ [package] name = "coreutils" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -342,8 +342,8 @@ blake3 = "1.3.3" sm3 = "0.4.2" digest = "0.10.7" -uucore = { version=">=0.0.18", package="uucore", path="src/uucore" } -uucore_procs = { version=">=0.0.18", package="uucore_procs", path="src/uucore_procs" } +uucore = { version=">=0.0.19", package="uucore", path="src/uucore" } +uucore_procs = { version=">=0.0.19", package="uucore_procs", path="src/uucore_procs" } uu_ls = { version=">=0.0.18", path="src/uu/ls" } uu_base32 = { version=">=0.0.18", path="src/uu/base32"} @@ -361,110 +361,110 @@ zip = { workspace=true, optional = true } help_parser = { path="src/help_parser", optional = true } # * uutils -uu_test = { optional=true, version="0.0.18", package="uu_test", path="src/uu/test" } +uu_test = { optional=true, version="0.0.19", package="uu_test", path="src/uu/test" } # -arch = { optional=true, version="0.0.18", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.18", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.18", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.18", package="uu_basename", path="src/uu/basename" } -basenc = { optional=true, version="0.0.18", package="uu_basenc", path="src/uu/basenc" } -cat = { optional=true, version="0.0.18", package="uu_cat", path="src/uu/cat" } -chcon = { optional=true, version="0.0.18", package="uu_chcon", path="src/uu/chcon" } -chgrp = { optional=true, version="0.0.18", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.18", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.18", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.18", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.18", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.18", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.18", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.18", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.18", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.18", package="uu_date", path="src/uu/date" } -dd = { optional=true, version="0.0.18", package="uu_dd", path="src/uu/dd" } -df = { optional=true, version="0.0.18", package="uu_df", path="src/uu/df" } -dir = { optional=true, version="0.0.18", package="uu_dir", path="src/uu/dir" } -dircolors= { optional=true, version="0.0.18", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.18", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.18", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.18", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.18", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.18", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.18", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.18", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.18", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.18", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.18", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.18", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.18", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.18", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.18", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.18", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.18", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.18", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.18", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.18", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.18", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.18", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.18", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.18", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.18", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.18", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.18", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.18", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.18", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.18", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.18", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.18", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.18", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.18", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.18", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.18", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.18", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.18", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.18", package="uu_pinky", path="src/uu/pinky" } -pr = { optional=true, version="0.0.18", package="uu_pr", path="src/uu/pr" } -printenv = { optional=true, version="0.0.18", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.18", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.18", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.18", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.18", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.18", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.18", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.18", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.18", package="uu_rmdir", path="src/uu/rmdir" } -runcon = { optional=true, version="0.0.18", package="uu_runcon", path="src/uu/runcon" } -seq = { optional=true, version="0.0.18", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.18", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.18", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.18", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.18", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.18", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.18", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.18", package="uu_stdbuf", path="src/uu/stdbuf" } -stty = { optional=true, version="0.0.18", package="uu_stty", path="src/uu/stty" } -sum = { optional=true, version="0.0.18", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.18", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.18", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.18", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.18", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.18", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.18", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.18", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.18", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.18", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.18", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.18", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.18", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.18", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.18", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.18", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.18", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.18", package="uu_users", path="src/uu/users" } -vdir = { optional=true, version="0.0.18", package="uu_vdir", path="src/uu/vdir" } -wc = { optional=true, version="0.0.18", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.18", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.18", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.18", package="uu_yes", path="src/uu/yes" } +arch = { optional=true, version="0.0.19", package="uu_arch", path="src/uu/arch" } +base32 = { optional=true, version="0.0.19", package="uu_base32", path="src/uu/base32" } +base64 = { optional=true, version="0.0.19", package="uu_base64", path="src/uu/base64" } +basename = { optional=true, version="0.0.19", package="uu_basename", path="src/uu/basename" } +basenc = { optional=true, version="0.0.19", package="uu_basenc", path="src/uu/basenc" } +cat = { optional=true, version="0.0.19", package="uu_cat", path="src/uu/cat" } +chcon = { optional=true, version="0.0.19", package="uu_chcon", path="src/uu/chcon" } +chgrp = { optional=true, version="0.0.19", package="uu_chgrp", path="src/uu/chgrp" } +chmod = { optional=true, version="0.0.19", package="uu_chmod", path="src/uu/chmod" } +chown = { optional=true, version="0.0.19", package="uu_chown", path="src/uu/chown" } +chroot = { optional=true, version="0.0.19", package="uu_chroot", path="src/uu/chroot" } +cksum = { optional=true, version="0.0.19", package="uu_cksum", path="src/uu/cksum" } +comm = { optional=true, version="0.0.19", package="uu_comm", path="src/uu/comm" } +cp = { optional=true, version="0.0.19", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.19", package="uu_csplit", path="src/uu/csplit" } +cut = { optional=true, version="0.0.19", package="uu_cut", path="src/uu/cut" } +date = { optional=true, version="0.0.19", package="uu_date", path="src/uu/date" } +dd = { optional=true, version="0.0.19", package="uu_dd", path="src/uu/dd" } +df = { optional=true, version="0.0.19", package="uu_df", path="src/uu/df" } +dir = { optional=true, version="0.0.19", package="uu_dir", path="src/uu/dir" } +dircolors= { optional=true, version="0.0.19", package="uu_dircolors", path="src/uu/dircolors" } +dirname = { optional=true, version="0.0.19", package="uu_dirname", path="src/uu/dirname" } +du = { optional=true, version="0.0.19", package="uu_du", path="src/uu/du" } +echo = { optional=true, version="0.0.19", package="uu_echo", path="src/uu/echo" } +env = { optional=true, version="0.0.19", package="uu_env", path="src/uu/env" } +expand = { optional=true, version="0.0.19", package="uu_expand", path="src/uu/expand" } +expr = { optional=true, version="0.0.19", package="uu_expr", path="src/uu/expr" } +factor = { optional=true, version="0.0.19", package="uu_factor", path="src/uu/factor" } +false = { optional=true, version="0.0.19", package="uu_false", path="src/uu/false" } +fmt = { optional=true, version="0.0.19", package="uu_fmt", path="src/uu/fmt" } +fold = { optional=true, version="0.0.19", package="uu_fold", path="src/uu/fold" } +groups = { optional=true, version="0.0.19", package="uu_groups", path="src/uu/groups" } +hashsum = { optional=true, version="0.0.19", package="uu_hashsum", path="src/uu/hashsum" } +head = { optional=true, version="0.0.19", package="uu_head", path="src/uu/head" } +hostid = { optional=true, version="0.0.19", package="uu_hostid", path="src/uu/hostid" } +hostname = { optional=true, version="0.0.19", package="uu_hostname", path="src/uu/hostname" } +id = { optional=true, version="0.0.19", package="uu_id", path="src/uu/id" } +install = { optional=true, version="0.0.19", package="uu_install", path="src/uu/install" } +join = { optional=true, version="0.0.19", package="uu_join", path="src/uu/join" } +kill = { optional=true, version="0.0.19", package="uu_kill", path="src/uu/kill" } +link = { optional=true, version="0.0.19", package="uu_link", path="src/uu/link" } +ln = { optional=true, version="0.0.19", package="uu_ln", path="src/uu/ln" } +ls = { optional=true, version="0.0.19", package="uu_ls", path="src/uu/ls" } +logname = { optional=true, version="0.0.19", package="uu_logname", path="src/uu/logname" } +mkdir = { optional=true, version="0.0.19", package="uu_mkdir", path="src/uu/mkdir" } +mkfifo = { optional=true, version="0.0.19", package="uu_mkfifo", path="src/uu/mkfifo" } +mknod = { optional=true, version="0.0.19", package="uu_mknod", path="src/uu/mknod" } +mktemp = { optional=true, version="0.0.19", package="uu_mktemp", path="src/uu/mktemp" } +more = { optional=true, version="0.0.19", package="uu_more", path="src/uu/more" } +mv = { optional=true, version="0.0.19", package="uu_mv", path="src/uu/mv" } +nice = { optional=true, version="0.0.19", package="uu_nice", path="src/uu/nice" } +nl = { optional=true, version="0.0.19", package="uu_nl", path="src/uu/nl" } +nohup = { optional=true, version="0.0.19", package="uu_nohup", path="src/uu/nohup" } +nproc = { optional=true, version="0.0.19", package="uu_nproc", path="src/uu/nproc" } +numfmt = { optional=true, version="0.0.19", package="uu_numfmt", path="src/uu/numfmt" } +od = { optional=true, version="0.0.19", package="uu_od", path="src/uu/od" } +paste = { optional=true, version="0.0.19", package="uu_paste", path="src/uu/paste" } +pathchk = { optional=true, version="0.0.19", package="uu_pathchk", path="src/uu/pathchk" } +pinky = { optional=true, version="0.0.19", package="uu_pinky", path="src/uu/pinky" } +pr = { optional=true, version="0.0.19", package="uu_pr", path="src/uu/pr" } +printenv = { optional=true, version="0.0.19", package="uu_printenv", path="src/uu/printenv" } +printf = { optional=true, version="0.0.19", package="uu_printf", path="src/uu/printf" } +ptx = { optional=true, version="0.0.19", package="uu_ptx", path="src/uu/ptx" } +pwd = { optional=true, version="0.0.19", package="uu_pwd", path="src/uu/pwd" } +readlink = { optional=true, version="0.0.19", package="uu_readlink", path="src/uu/readlink" } +realpath = { optional=true, version="0.0.19", package="uu_realpath", path="src/uu/realpath" } +relpath = { optional=true, version="0.0.19", package="uu_relpath", path="src/uu/relpath" } +rm = { optional=true, version="0.0.19", package="uu_rm", path="src/uu/rm" } +rmdir = { optional=true, version="0.0.19", package="uu_rmdir", path="src/uu/rmdir" } +runcon = { optional=true, version="0.0.19", package="uu_runcon", path="src/uu/runcon" } +seq = { optional=true, version="0.0.19", package="uu_seq", path="src/uu/seq" } +shred = { optional=true, version="0.0.19", package="uu_shred", path="src/uu/shred" } +shuf = { optional=true, version="0.0.19", package="uu_shuf", path="src/uu/shuf" } +sleep = { optional=true, version="0.0.19", package="uu_sleep", path="src/uu/sleep" } +sort = { optional=true, version="0.0.19", package="uu_sort", path="src/uu/sort" } +split = { optional=true, version="0.0.19", package="uu_split", path="src/uu/split" } +stat = { optional=true, version="0.0.19", package="uu_stat", path="src/uu/stat" } +stdbuf = { optional=true, version="0.0.19", package="uu_stdbuf", path="src/uu/stdbuf" } +stty = { optional=true, version="0.0.19", package="uu_stty", path="src/uu/stty" } +sum = { optional=true, version="0.0.19", package="uu_sum", path="src/uu/sum" } +sync = { optional=true, version="0.0.19", package="uu_sync", path="src/uu/sync" } +tac = { optional=true, version="0.0.19", package="uu_tac", path="src/uu/tac" } +tail = { optional=true, version="0.0.19", package="uu_tail", path="src/uu/tail" } +tee = { optional=true, version="0.0.19", package="uu_tee", path="src/uu/tee" } +timeout = { optional=true, version="0.0.19", package="uu_timeout", path="src/uu/timeout" } +touch = { optional=true, version="0.0.19", package="uu_touch", path="src/uu/touch" } +tr = { optional=true, version="0.0.19", package="uu_tr", path="src/uu/tr" } +true = { optional=true, version="0.0.19", package="uu_true", path="src/uu/true" } +truncate = { optional=true, version="0.0.19", package="uu_truncate", path="src/uu/truncate" } +tsort = { optional=true, version="0.0.19", package="uu_tsort", path="src/uu/tsort" } +tty = { optional=true, version="0.0.19", package="uu_tty", path="src/uu/tty" } +uname = { optional=true, version="0.0.19", package="uu_uname", path="src/uu/uname" } +unexpand = { optional=true, version="0.0.19", package="uu_unexpand", path="src/uu/unexpand" } +uniq = { optional=true, version="0.0.19", package="uu_uniq", path="src/uu/uniq" } +unlink = { optional=true, version="0.0.19", package="uu_unlink", path="src/uu/unlink" } +uptime = { optional=true, version="0.0.19", package="uu_uptime", path="src/uu/uptime" } +users = { optional=true, version="0.0.19", package="uu_users", path="src/uu/users" } +vdir = { optional=true, version="0.0.19", package="uu_vdir", path="src/uu/vdir" } +wc = { optional=true, version="0.0.19", package="uu_wc", path="src/uu/wc" } +who = { optional=true, version="0.0.19", package="uu_who", path="src/uu/who" } +whoami = { optional=true, version="0.0.19", package="uu_whoami", path="src/uu/whoami" } +yes = { optional=true, version="0.0.19", package="uu_yes", path="src/uu/yes" } # this breaks clippy linting with: "tests/by-util/test_factor_benches.rs: No such file or directory (os error 2)" # factor_benches = { optional = true, version = "0.0.0", package = "uu_factor_benches", path = "tests/benches/factor" } diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index b2cdfdc17..10df726e1 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index e4a8464d9..077204e1f 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index e5ea4cf14..e21b34161 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index f234d1021..c17651506 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" diff --git a/src/uu/basenc/Cargo.toml b/src/uu/basenc/Cargo.toml index cc4264b51..3e8c3ed8a 100644 --- a/src/uu/basenc/Cargo.toml +++ b/src/uu/basenc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basenc" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "basenc ~ (uutils) decode/encode input" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 941637514..2b78e9da7 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" diff --git a/src/uu/chcon/Cargo.toml b/src/uu/chcon/Cargo.toml index e5dc6b93c..53165dfe0 100644 --- a/src/uu/chcon/Cargo.toml +++ b/src/uu/chcon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chcon" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "chcon ~ (uutils) change file security context" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 13b8c7e4d..cceb32658 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 8b7d09e92..af133128d 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index bc28d8640..0b4db615d 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index ca083753d..1c3527eda 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 61c66e704..707a7ee5c 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index 0371d46c1..31fda282f 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 32d34112b..b14add463 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.18" +version = "0.0.19" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 560ddf6e8..3d0bafb48 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 6e49ce4d4..d6b9d932f 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 923ca4aa7..852e8cc9d 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore humantime [package] name = "uu_date" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" diff --git a/src/uu/dd/Cargo.toml b/src/uu/dd/Cargo.toml index 04b60dc31..1b0b015be 100644 --- a/src/uu/dd/Cargo.toml +++ b/src/uu/dd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dd" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "dd ~ (uutils) copy and convert files" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 9cca407bb..159c87685 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" diff --git a/src/uu/dir/Cargo.toml b/src/uu/dir/Cargo.toml index c8cb861f9..2a3adda96 100644 --- a/src/uu/dir/Cargo.toml +++ b/src/uu/dir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dir" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "shortcut to ls -C -b" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 7d729f396..d922c1cf3 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index f002bf15a..cd211661d 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 22659bc0e..6e883f769 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 276fdaf85..90ea22598 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 689bb12a4..8a19ce121 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index f30fcbce5..1f923f9bc 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 26c9d6724..f28215e0f 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 8de973503..b70976b76 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 44d983788..84ac4e553 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 1446e8ba5..df51f659c 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 3358fb7cc..bb7e3fa07 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 940661bc4..3feb634b6 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 638b3b60f..84b19d6e5 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index a82678285..d680a6eb7 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index a31286bbd..67045e8f6 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index c39f8fdae..718bf43db 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index dd363340b..9e0a35f7f 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 789f84de3..89849059d 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.18" +version = "0.0.19" authors = [ "Ben Eills ", "uutils developers", diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index d92c032aa..a2c6d19bc 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 21010160c..e373bfe78 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 2d81883a6..6f034dcae 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index c06218fb7..b31f64f30 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index e75571e0f..19a4ab035 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 251268c2b..e162aeab1 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index e2b65c030..24ce412d3 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 8fd154a3f..2e24bb53d 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index ee272dbf7..8a50a61fc 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 7f1ac62ee..31bd53a00 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 573eafc43..a19fc577d 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 5bc660d08..8747c950c 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 3c5d763da..d63f25312 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index efa3f3e0b..ead669d3d 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 7067e51e8..40f332c5f 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 13202b739..ae2e74f06 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 2f3a2e69a..9ba3c0075 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index 28abbfce2..e7cc7d34e 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 36765594e..836aa05bd 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 01a626042..c37b0b481 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index f2c930831..efee7c06a 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index 414168c64..037db2ee7 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pr" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "pr ~ (uutils) convert text files for printing" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 007348a95..f3a7f2b40 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index aa64a24ef..c534ba544 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.18" +version = "0.0.19" authors = [ "Nathan Ross", "uutils developers", diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 8f2cda938..c3498c25b 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index af1451564..fd76eec5b 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index aed065207..718a38120 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 17af009c6..0ecd971c1 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 7046aafee..96fdca946 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 5151beb93..c69bd5964 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index f35817c6c..2a40ad058 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" diff --git a/src/uu/runcon/Cargo.toml b/src/uu/runcon/Cargo.toml index 5373658e4..0060e497b 100644 --- a/src/uu/runcon/Cargo.toml +++ b/src/uu/runcon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_runcon" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "runcon ~ (uutils) run command with specified security context" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index c217d067f..e996c2b5c 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore bigdecimal [package] name = "uu_seq" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index e085041c3..5d52ee58a 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 8c7dd7278..f86a1eac5 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 6091ac1da..ae05bdf0e 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 41d6bd66f..7889ab009 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index cae21b163..b9649ad5f 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index bd873404e..317634704 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 224af033e..06bd0fa51 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -20,7 +20,7 @@ tempfile = { workspace=true } uucore = { workspace=true } [build-dependencies] -libstdbuf = { version="0.0.18", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version="0.0.19", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index d9d94cd57..abd2aaa4e 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" @@ -19,7 +19,7 @@ crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo f [dependencies] cpp = "0.5" libc = { workspace=true } -uucore = { version=">=0.0.18", package="uucore", path="../../../../uucore" } +uucore = { version=">=0.0.19", package="uucore", path="../../../../uucore" } [build-dependencies] cpp_build = "0.5" diff --git a/src/uu/stty/Cargo.toml b/src/uu/stty/Cargo.toml index f6ea290d9..ec715314d 100644 --- a/src/uu/stty/Cargo.toml +++ b/src/uu/stty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stty" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "stty ~ (uutils) print or change terminal characteristics" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 37a997224..806c2171d 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 49cfbf1b5..c6062b7c1 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 0d9056915..ca68be99d 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "uu_tac" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index a82670f9e..e71c988aa 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore (libs) kqueue fundu [package] name = "uu_tail" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index b0cf0e916..ee4bedec8 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index b3229f506..794aa5377 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 8b92f9d8b..b4b24db12 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 0bb89ec84..3aac9abc4 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore humantime [package] name = "uu_touch" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 559546efd..4869941e9 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index bab8161d8..3171845de 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 0d5615eea..54578d038 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 08a035eac..46ee8a47e 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index ed4f2ba53..4e32f3873 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index a24113cb7..5c02c5e2e 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 5e4d486cb..537750d3d 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 1491f81f2..c1343ab01 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 99efdbaee..cc30f7dbd 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index fdd49cb84..ab38951c5 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 023b34a3e..ec32f3e8a 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" diff --git a/src/uu/vdir/Cargo.toml b/src/uu/vdir/Cargo.toml index 281e7158e..4d6248979 100644 --- a/src/uu/vdir/Cargo.toml +++ b/src/uu/vdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_vdir" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "shortcut to ls -l -b" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 2b42affb5..b781eaed6 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 5b5b57bf1..cae50b9a6 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index 7e13c14f3..3114f721a 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 9d661fb0d..40674f05a 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index ea6bb2424..0745ca03f 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "uucore" -version = "0.0.18" +version = "0.0.19" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index bb41a82a6..d2d3102e3 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore_procs" -version = "0.0.18" +version = "0.0.19" authors = ["Roy Ivy III "] license = "MIT" description = "uutils ~ 'uucore' proc-macros" diff --git a/util/update-version.sh b/util/update-version.sh index e248d13cd..b6340bf59 100755 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -12,8 +12,8 @@ # 7) Run util/publish.sh --do-it # 8) In some cases, you might have to fix dependencies and run import -FROM="0.0.17" -TO="0.0.18" +FROM="0.0.18" +TO="0.0.19" PROGS=$(ls -1d src/uu/*/Cargo.toml src/uu/stdbuf/src/libstdbuf/Cargo.toml src/uucore/Cargo.toml Cargo.toml) From a13d7f4060d3e200bbe375077b6c89ea389cea42 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Jun 2023 20:36:03 +0200 Subject: [PATCH 040/253] uuhelp_parser: add the desc --- src/help_parser/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/help_parser/Cargo.toml b/src/help_parser/Cargo.toml index d3a8a0f54..2c4080c81 100644 --- a/src/help_parser/Cargo.toml +++ b/src/help_parser/Cargo.toml @@ -3,3 +3,4 @@ name = "help_parser" version = "0.0.18" edition = "2021" license = "MIT" +description = "A collection of functions to parse the markdown code of help files" From c8b4e06828c7869eb7b2c2bc735e230366da208c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Jun 2023 20:37:38 +0200 Subject: [PATCH 041/253] add uuhelp_parser to the publish script --- util/publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/publish.sh b/util/publish.sh index d9039fa60..b656f6229 100755 --- a/util/publish.sh +++ b/util/publish.sh @@ -35,7 +35,7 @@ TOTAL_ORDER=$(echo -e $PARTIAL_ORDER | tsort | tac) TOTAL_ORDER=${TOTAL_ORDER#ROOT} set -e -for dir in src/uucore_procs/ src/uucore/ src/uu/stdbuf/src/libstdbuf/; do +for dir in src/uuhelp_parser/ src/uucore_procs/ src/uucore/ src/uu/stdbuf/src/libstdbuf/; do ( cd "$dir" #shellcheck disable=SC2086 From e3cb5a111de1a1ba1d64a74044921beb9d8e4385 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Jun 2023 20:38:55 +0200 Subject: [PATCH 042/253] Rename help_parser => uuhelp_parser --- Cargo.lock | 12 ++++++------ Cargo.toml | 4 ++-- src/bin/uudoc.rs | 6 +++--- src/uucore_procs/Cargo.toml | 2 +- src/uucore_procs/src/lib.rs | 6 +++--- src/{help_parser => uuhelp_parser}/Cargo.toml | 2 +- src/{help_parser => uuhelp_parser}/src/lib.rs | 0 7 files changed, 16 insertions(+), 16 deletions(-) rename src/{help_parser => uuhelp_parser}/Cargo.toml (86%) rename src/{help_parser => uuhelp_parser}/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index f45951917..5048b4aa0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -403,7 +403,6 @@ dependencies = [ "conv", "filetime", "glob", - "help_parser", "hex-literal", "is-terminal", "libc", @@ -529,6 +528,7 @@ dependencies = [ "uu_whoami", "uu_yes", "uucore", + "uuhelp_parser", "walkdir", "zip", ] @@ -1107,10 +1107,6 @@ dependencies = [ "ahash", ] -[[package]] -name = "help_parser" -version = "0.0.18" - [[package]] name = "hermit-abi" version = "0.1.19" @@ -3430,11 +3426,15 @@ dependencies = [ name = "uucore_procs" version = "0.0.19" dependencies = [ - "help_parser", "proc-macro2", "quote", + "uuhelp_parser", ] +[[package]] +name = "uuhelp_parser" +version = "0.0.18" + [[package]] name = "uuid" version = "1.2.2" diff --git a/Cargo.toml b/Cargo.toml index c1b1c3dae..7e851363f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ windows = [ "feat_os_windows" ] nightly = [] test_unimplemented = [] # * only build `uudoc` when `--feature uudoc` is activated -uudoc = ["zip", "dep:help_parser"] +uudoc = ["zip", "dep:uuhelp_parser"] ## features # "feat_acl" == enable support for ACLs (access control lists; by using`--features feat_acl`) # NOTE: @@ -358,7 +358,7 @@ selinux = { workspace=true, optional = true } textwrap = { workspace=true } zip = { workspace=true, optional = true } -help_parser = { path="src/help_parser", optional = true } +uuhelp_parser = { path="src/uuhelp_parser", optional = true } # * uutils uu_test = { optional=true, version="0.0.19", package="uu_test", path="src/uu/test" } diff --git a/src/bin/uudoc.rs b/src/bin/uudoc.rs index b7a2ce581..e37925825 100644 --- a/src/bin/uudoc.rs +++ b/src/bin/uudoc.rs @@ -178,7 +178,7 @@ impl<'a, 'b> MDWriter<'a, 'b> { fn usage(&mut self) -> io::Result<()> { if let Some(markdown) = &self.markdown { - let usage = help_parser::parse_usage(markdown); + let usage = uuhelp_parser::parse_usage(markdown); let usage = usage.replace("{}", self.name); writeln!(self.w, "\n```")?; @@ -191,7 +191,7 @@ impl<'a, 'b> MDWriter<'a, 'b> { fn about(&mut self) -> io::Result<()> { if let Some(markdown) = &self.markdown { - writeln!(self.w, "{}", help_parser::parse_about(markdown)) + writeln!(self.w, "{}", uuhelp_parser::parse_about(markdown)) } else { Ok(()) } @@ -199,7 +199,7 @@ impl<'a, 'b> MDWriter<'a, 'b> { fn after_help(&mut self) -> io::Result<()> { if let Some(markdown) = &self.markdown { - if let Some(after_help) = help_parser::parse_section("after help", markdown) { + if let Some(after_help) = uuhelp_parser::parse_section("after help", markdown) { return writeln!(self.w, "\n\n{after_help}"); } } diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index d2d3102e3..0ef44fbae 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -18,4 +18,4 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -help_parser = { path="../help_parser", version="0.0.18" } +uuhelp_parser = { path="../uuhelp_parser", version="0.0.18" } diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index 4bc2521b8..ba32f649b 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -58,7 +58,7 @@ fn render_markdown(s: &str) -> String { pub fn help_about(input: TokenStream) -> TokenStream { let input: Vec = input.into_iter().collect(); let filename = get_argument(&input, 0, "filename"); - let text: String = help_parser::parse_about(&read_help(&filename)); + let text: String = uuhelp_parser::parse_about(&read_help(&filename)); TokenTree::Literal(Literal::string(&text)).into() } @@ -72,7 +72,7 @@ pub fn help_about(input: TokenStream) -> TokenStream { pub fn help_usage(input: TokenStream) -> TokenStream { let input: Vec = input.into_iter().collect(); let filename = get_argument(&input, 0, "filename"); - let text: String = help_parser::parse_usage(&read_help(&filename)); + let text: String = uuhelp_parser::parse_usage(&read_help(&filename)); TokenTree::Literal(Literal::string(&text)).into() } @@ -106,7 +106,7 @@ pub fn help_section(input: TokenStream) -> TokenStream { let section = get_argument(&input, 0, "section"); let filename = get_argument(&input, 1, "filename"); - if let Some(text) = help_parser::parse_section(§ion, &read_help(&filename)) { + if let Some(text) = uuhelp_parser::parse_section(§ion, &read_help(&filename)) { let rendered = render_markdown(&text); TokenTree::Literal(Literal::string(&rendered)).into() } else { diff --git a/src/help_parser/Cargo.toml b/src/uuhelp_parser/Cargo.toml similarity index 86% rename from src/help_parser/Cargo.toml rename to src/uuhelp_parser/Cargo.toml index 2c4080c81..9f4c0d68d 100644 --- a/src/help_parser/Cargo.toml +++ b/src/uuhelp_parser/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "help_parser" +name = "uuhelp_parser" version = "0.0.18" edition = "2021" license = "MIT" diff --git a/src/help_parser/src/lib.rs b/src/uuhelp_parser/src/lib.rs similarity index 100% rename from src/help_parser/src/lib.rs rename to src/uuhelp_parser/src/lib.rs From 204d9b64f98ea81001c3da745356d98e9a185c1b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Jun 2023 21:06:34 +0200 Subject: [PATCH 043/253] uuhelp_parser: update of the version --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/uucore_procs/Cargo.toml | 2 +- src/uuhelp_parser/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5048b4aa0..33b7b498a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3433,7 +3433,7 @@ dependencies = [ [[package]] name = "uuhelp_parser" -version = "0.0.18" +version = "0.0.19" [[package]] name = "uuid" diff --git a/Cargo.toml b/Cargo.toml index 7e851363f..a5c768468 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -358,7 +358,7 @@ selinux = { workspace=true, optional = true } textwrap = { workspace=true } zip = { workspace=true, optional = true } -uuhelp_parser = { path="src/uuhelp_parser", optional = true } +uuhelp_parser = { optional=true, version=">=0.0.19", path="src/uuhelp_parser"} # * uutils uu_test = { optional=true, version="0.0.19", package="uu_test", path="src/uu/test" } diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index 0ef44fbae..9da5e5ab2 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -18,4 +18,4 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -uuhelp_parser = { path="../uuhelp_parser", version="0.0.18" } +uuhelp_parser = { path="../uuhelp_parser", version="0.0.19" } diff --git a/src/uuhelp_parser/Cargo.toml b/src/uuhelp_parser/Cargo.toml index 9f4c0d68d..ced3a0893 100644 --- a/src/uuhelp_parser/Cargo.toml +++ b/src/uuhelp_parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uuhelp_parser" -version = "0.0.18" +version = "0.0.19" edition = "2021" license = "MIT" description = "A collection of functions to parse the markdown code of help files" From c6ad9846f9c3d68e37dee50e3bee7277244455f5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Jun 2023 21:12:29 +0200 Subject: [PATCH 044/253] update of the version script --- util/update-version.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/update-version.sh b/util/update-version.sh index b6340bf59..106f296fc 100755 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -24,6 +24,9 @@ sed -i -e "s|version = \"$FROM\"|version = \"$TO\"|" $PROGS # Update uucore_procs sed -i -e "s|version = \"$FROM\"|version = \"$TO\"|" src/uucore_procs/Cargo.toml +# Update uuhelp_parser +sed -i -e "s|version = \"$FROM\"|version = \"$TO\"|" src/uuhelp_parser/Cargo.toml + # Update the stdbuf stuff sed -i -e "s|libstdbuf = { version=\"$FROM\"|libstdbuf = { version=\"$TO\"|" src/uu/stdbuf/Cargo.toml sed -i -e "s|= { optional=true, version=\"$FROM\", package=\"uu_|= { optional=true, version=\"$TO\", package=\"uu_|g" Cargo.toml From 9f38142522b92d7b2648ebadebe372869b8a63b7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 4 Jun 2023 11:27:50 +0200 Subject: [PATCH 045/253] add uuhelp to the ignore spell --- Cargo.toml | 2 +- src/bin/uudoc.rs | 2 +- src/uucore_procs/Cargo.toml | 1 + src/uucore_procs/src/lib.rs | 2 +- src/uuhelp_parser/Cargo.toml | 1 + util/publish.sh | 1 + util/update-version.sh | 2 ++ 7 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a5c768468..c2d858d92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ # coreutils (uutils) # * see the repository LICENSE, README, and CONTRIBUTING files for more information -# spell-checker:ignore (libs) libselinux gethostid procfs bigdecimal kqueue fundu mangen humantime +# spell-checker:ignore (libs) libselinux gethostid procfs bigdecimal kqueue fundu mangen humantime uuhelp [package] name = "coreutils" diff --git a/src/bin/uudoc.rs b/src/bin/uudoc.rs index e37925825..5ac858226 100644 --- a/src/bin/uudoc.rs +++ b/src/bin/uudoc.rs @@ -2,7 +2,7 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore tldr +// spell-checker:ignore tldr uuhelp use clap::Command; use std::collections::HashMap; diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index 9da5e5ab2..eedc9001c 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -1,3 +1,4 @@ +# spell-checker:ignore uuhelp [package] name = "uucore_procs" version = "0.0.19" diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index ba32f649b..b78da7822 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -1,5 +1,5 @@ // Copyright (C) ~ Roy Ivy III ; MIT license -// spell-checker:ignore backticks +// spell-checker:ignore backticks uuhelp use std::{fs::File, io::Read, path::PathBuf}; diff --git a/src/uuhelp_parser/Cargo.toml b/src/uuhelp_parser/Cargo.toml index ced3a0893..888d07534 100644 --- a/src/uuhelp_parser/Cargo.toml +++ b/src/uuhelp_parser/Cargo.toml @@ -1,3 +1,4 @@ +# spell-checker:ignore uuhelp [package] name = "uuhelp_parser" version = "0.0.19" diff --git a/util/publish.sh b/util/publish.sh index b656f6229..71830f1f9 100755 --- a/util/publish.sh +++ b/util/publish.sh @@ -1,4 +1,5 @@ #!/bin/sh +# spell-checker:ignore uuhelp ARG="" if test "$1" != "--do-it"; then ARG="--dry-run --allow-dirty" diff --git a/util/update-version.sh b/util/update-version.sh index 106f296fc..0fd15422a 100755 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -1,4 +1,6 @@ #!/bin/sh +# spell-checker:ignore uuhelp + # This is a stupid helper. I will mass replace all versions (including other crates) # So, it should be triple-checked From 29027405d722a1eb895c1cf167456a514d559cc3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 4 Jun 2023 13:03:31 +0200 Subject: [PATCH 046/253] Revert "specify the sccache version " --- .github/workflows/CICD.yml | 22 ---------------------- .github/workflows/freebsd.yml | 4 ---- 2 files changed, 26 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 8c595537f..fb2300ba9 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -183,8 +183,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -295,8 +293,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -351,8 +347,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -441,8 +435,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: "`make build`" shell: bash run: | @@ -485,8 +477,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Test run: cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} env: @@ -514,8 +504,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Test run: cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} env: @@ -539,8 +527,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Install dependencies shell: bash run: | @@ -666,8 +652,6 @@ jobs: key: "${{ matrix.job.os }}_${{ matrix.job.target }}" - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -921,8 +905,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Install/setup prerequisites shell: bash run: | @@ -1007,8 +989,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Build coreutils as multiple binaries shell: bash run: | @@ -1093,8 +1073,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" # - name: Reattach HEAD ## may be needed for accurate code coverage info # run: git checkout ${{ github.head_ref }} - name: Initialize workflow variables diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 50746154b..9507b3a56 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -34,8 +34,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Prepare, build and test uses: vmactions/freebsd-vm@v0.3.0 with: @@ -126,8 +124,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Prepare, build and test uses: vmactions/freebsd-vm@v0.3.0 with: From 7958c5d061c2a493ce8001e92ab0168eab0a8de7 Mon Sep 17 00:00:00 2001 From: x-dune <39018755+x-dune@users.noreply.github.com> Date: Sun, 4 Jun 2023 20:17:52 +0800 Subject: [PATCH 047/253] pr: use chrono instead of time --- Cargo.lock | 2 +- src/uu/pr/Cargo.toml | 2 +- src/uu/pr/src/pr.rs | 20 ++++++-------------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c38199dca..58750f1ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2956,11 +2956,11 @@ dependencies = [ name = "uu_pr" version = "0.0.18" dependencies = [ + "chrono", "clap", "itertools", "quick-error", "regex", - "time", "uucore", ] diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index 414168c64..0a506e613 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -16,11 +16,11 @@ path = "src/pr.rs" [dependencies] clap = { workspace=true } -time = { workspace=true, features = ["local-offset", "macros", "formatting"] } uucore = { workspace=true, features=["entries"] } quick-error = { workspace=true } itertools = { workspace=true } regex = { workspace=true } +chrono = { workspace=true } [[bin]] name = "pr" diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index b3be8a755..37674bad7 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -6,6 +6,7 @@ // spell-checker:ignore (ToDO) adFfmprt, kmerge +use chrono::{DateTime, Local}; use clap::{crate_version, Arg, ArgAction, ArgMatches, Command}; use itertools::Itertools; use quick_error::ResultExt; @@ -15,8 +16,6 @@ use std::fs::{metadata, File}; use std::io::{stdin, stdout, BufRead, BufReader, Lines, Read, Write}; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; -use time::macros::format_description; -use time::OffsetDateTime; use quick_error::quick_error; use uucore::display::Quotable; @@ -37,8 +36,7 @@ const DEFAULT_COLUMN_WIDTH: usize = 72; const DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512; const DEFAULT_COLUMN_SEPARATOR: &char = &TAB; const FF: u8 = 0x0C_u8; -const DATE_TIME_FORMAT: &[time::format_description::FormatItem] = - format_description!("[month repr:short] [day] [hour]:[minute] [year]"); +const DATE_TIME_FORMAT: &str = "%b %d %H:%M %Y"; mod options { pub const HEADER: &str = "header"; @@ -571,10 +569,8 @@ fn build_options( let line_separator = "\n".to_string(); let last_modified_time = if is_merge_mode || paths[0].eq(FILE_STDIN) { - // let date_time = Local::now(); - // date_time.format("%b %d %H:%M %Y").to_string() - let date_time = OffsetDateTime::now_local().unwrap(); - date_time.format(&DATE_TIME_FORMAT).unwrap() + let date_time = Local::now(); + date_time.format(DATE_TIME_FORMAT).to_string() } else { file_last_modified_time(paths.first().unwrap()) }; @@ -1215,12 +1211,8 @@ fn file_last_modified_time(path: &str) -> String { .map(|i| { i.modified() .map(|x| { - let date_time: OffsetDateTime = x.into(); - let offset = OffsetDateTime::now_local().unwrap().offset(); - date_time - .to_offset(offset) - .format(&DATE_TIME_FORMAT) - .unwrap() + let date_time: DateTime = x.into(); + date_time.format(DATE_TIME_FORMAT).to_string() }) .unwrap_or_default() }) From 29f011e28c4621aac7802260164b4d5edd3fc767 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 4 Jun 2023 14:55:16 +0200 Subject: [PATCH 048/253] Remove users crate --- Cargo.lock | 11 ----------- Cargo.toml | 1 - tests/by-util/test_chgrp.rs | 12 ++++++------ tests/by-util/test_chown.rs | 4 ++-- tests/by-util/test_date.rs | 12 ++++++------ tests/by-util/test_install.rs | 6 +++--- 6 files changed, 17 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c38199dca..b7ca5c517 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -424,7 +424,6 @@ dependencies = [ "textwrap", "time", "unindent", - "users", "uu_arch", "uu_base32", "uu_base64", @@ -2369,16 +2368,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa30f5ea51ff7edfc797c6d3f9ec8cbd8cfedef5371766b7181d33977f4814f" -[[package]] -name = "users" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032" -dependencies = [ - "libc", - "log", -] - [[package]] name = "utf8parse" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index ebd9a4bf4..e2c798830 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -499,7 +499,6 @@ rlimit = "0.9.1" [target.'cfg(unix)'.dev-dependencies] nix = { workspace=true, features=["process", "signal", "user"] } -rust-users = { version="0.11", package="users" } rand_pcg = "0.3" [build-dependencies] diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index 69224b0bd..cf6c62ff7 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -1,7 +1,7 @@ // spell-checker:ignore (words) nosuchgroup groupname use crate::common::util::TestScenario; -use rust_users::get_effective_gid; +use uucore::process::getegid; #[test] fn test_invalid_option() { @@ -53,7 +53,7 @@ fn test_invalid_group() { #[test] fn test_1() { - if get_effective_gid() != 0 { + if getegid() != 0 { new_ucmd!().arg("bin").arg(DIR).fails().stderr_contains( // linux fails with "Operation not permitted (os error 1)" // because of insufficient permissions, @@ -66,7 +66,7 @@ fn test_1() { #[test] fn test_fail_silently() { - if get_effective_gid() != 0 { + if getegid() != 0 { for opt in ["-f", "--silent", "--quiet", "--sil", "--qui"] { new_ucmd!() .arg(opt) @@ -137,7 +137,7 @@ fn test_reference() { // skip for root or MS-WSL // * MS-WSL is bugged (as of 2019-12-25), allowing non-root accounts su-level privileges for `chgrp` // * for MS-WSL, succeeds and stdout == 'group of /etc retained as root' - if !(get_effective_gid() == 0 || uucore::os::is_wsl_1()) { + if !(getegid() == 0 || uucore::os::is_wsl_1()) { new_ucmd!() .arg("-v") .arg("--reference=/etc/passwd") @@ -203,7 +203,7 @@ fn test_missing_files() { #[test] #[cfg(target_os = "linux")] fn test_big_p() { - if get_effective_gid() != 0 { + if getegid() != 0 { new_ucmd!() .arg("-RP") .arg("bin") @@ -218,7 +218,7 @@ fn test_big_p() { #[test] #[cfg(any(target_os = "linux", target_os = "android"))] fn test_big_h() { - if get_effective_gid() != 0 { + if getegid() != 0 { assert!( new_ucmd!() .arg("-RH") diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index 191e4a86b..7a1a4a6bd 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -2,7 +2,7 @@ use crate::common::util::{is_ci, run_ucmd_as_root, CmdResult, TestScenario}; #[cfg(any(target_os = "linux", target_os = "android"))] -use rust_users::get_effective_uid; +use uucore::process::geteuid; // Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'. // If we are running inside the CI and "needle" is in "stderr" skipping this test is @@ -701,7 +701,7 @@ fn test_root_preserve() { #[cfg(any(target_os = "linux", target_os = "android"))] #[test] fn test_big_p() { - if get_effective_uid() != 0 { + if geteuid() != 0 { new_ucmd!() .arg("-RP") .arg("bin") diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index c8c33aa89..669f02e33 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -1,7 +1,7 @@ use crate::common::util::TestScenario; use regex::Regex; #[cfg(all(unix, not(target_os = "macos")))] -use rust_users::get_effective_uid; +use uucore::process::geteuid; #[test] fn test_invalid_arg() { @@ -213,7 +213,7 @@ fn test_date_format_literal() { #[test] #[cfg(all(unix, not(target_os = "macos")))] fn test_date_set_valid() { - if get_effective_uid() == 0 { + if geteuid() == 0 { new_ucmd!() .arg("--set") .arg("2020-03-12 13:30:00+08:00") @@ -234,7 +234,7 @@ fn test_date_set_invalid() { #[test] #[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))] fn test_date_set_permissions_error() { - if !(get_effective_uid() == 0 || uucore::os::is_wsl_1()) { + if !(geteuid() == 0 || uucore::os::is_wsl_1()) { let result = new_ucmd!() .arg("--set") .arg("2020-03-11 21:45:00+08:00") @@ -261,7 +261,7 @@ fn test_date_set_mac_unavailable() { #[cfg(all(unix, not(target_os = "macos")))] /// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_2() { - if get_effective_uid() == 0 { + if geteuid() == 0 { let result = new_ucmd!() .arg("--set") .arg("Sat 20 Mar 2021 14:53:01 AWST") // spell-checker:disable-line @@ -325,7 +325,7 @@ fn test_date_for_file() { #[cfg(all(unix, not(target_os = "macos")))] /// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_3() { - if get_effective_uid() == 0 { + if geteuid() == 0 { let result = new_ucmd!() .arg("--set") .arg("Sat 20 Mar 2021 14:53:01") // Local timezone @@ -339,7 +339,7 @@ fn test_date_set_valid_3() { #[cfg(all(unix, not(target_os = "macos")))] /// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_4() { - if get_effective_uid() == 0 { + if geteuid() == 0 { let result = new_ucmd!() .arg("--set") .arg("2020-03-11 21:45:00") // Local timezone diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index a30737f05..d76ce1e01 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -2,12 +2,12 @@ use crate::common::util::{is_ci, TestScenario}; use filetime::FileTime; -use rust_users::{get_effective_gid, get_effective_uid}; use std::os::unix::fs::PermissionsExt; #[cfg(not(any(windows, target_os = "freebsd")))] use std::process::Command; #[cfg(any(target_os = "linux", target_os = "android"))] use std::thread::sleep; +use uucore::process::{getegid, geteuid}; #[test] fn test_invalid_arg() { @@ -322,7 +322,7 @@ fn test_install_target_new_file_with_group() { let (at, mut ucmd) = at_and_ucmd!(); let file = "file"; let dir = "target_dir"; - let gid = get_effective_gid(); + let gid = getegid(); at.touch(file); at.mkdir(dir); @@ -349,7 +349,7 @@ fn test_install_target_new_file_with_owner() { let (at, mut ucmd) = at_and_ucmd!(); let file = "file"; let dir = "target_dir"; - let uid = get_effective_uid(); + let uid = geteuid(); at.touch(file); at.mkdir(dir); From 126bbba17aa2a7937bbbfd902752884df3f683a1 Mon Sep 17 00:00:00 2001 From: Tracy Date: Sun, 4 Jun 2023 10:03:01 -0400 Subject: [PATCH 049/253] pwd: Fixes #4855 (#4937) Based on testing with GNU's pwd, it seems like the -P flag should take precedence over the use of the POSIXLY_CORRECT flag. Co-authored-by: Terts Diepraam --- src/uu/pwd/src/pwd.rs | 4 +++- tests/by-util/test_pwd.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index 7af194872..9e04dd38b 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -115,7 +115,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { // if POSIXLY_CORRECT is set, we want to a logical resolution. // This produces a different output when doing mkdir -p a/b && ln -s a/b c && cd c && pwd // We should get c in this case instead of a/b at the end of the path - let cwd = if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() { + let cwd = if matches.get_flag(OPT_PHYSICAL) { + physical_path() + } else if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() { logical_path() } else { physical_path() diff --git a/tests/by-util/test_pwd.rs b/tests/by-util/test_pwd.rs index 076e72089..1e43f5be6 100644 --- a/tests/by-util/test_pwd.rs +++ b/tests/by-util/test_pwd.rs @@ -116,7 +116,7 @@ fn test_symlinked_default_posix_p() { .env("POSIXLY_CORRECT", "1") .arg("-P") .succeeds() - .stdout_is(env.symdir + "\n"); + .stdout_is(env.subdir + "\n"); } #[cfg(not(windows))] From ee2aa85cd8fd7c061218be010239fa5efb91792c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 4 Jun 2023 14:03:47 +0000 Subject: [PATCH 050/253] chore(deps): update rust crate once_cell to 1.18.0 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c38199dca..d137adc58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1549,9 +1549,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "once_cell" -version = "1.17.2" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "onig" diff --git a/Cargo.toml b/Cargo.toml index ebd9a4bf4..238070fe0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -299,7 +299,7 @@ notify = { version = "=6.0.0", features=["macos_kqueue"]} num-bigint = "0.4.3" num-traits = "0.2.15" number_prefix = "0.4" -once_cell = "1.17.2" +once_cell = "1.18.0" onig = { version = "~6.4", default-features = false } ouroboros = "0.15.6" phf = "0.11.1" From 65a8e1540cb6cda640ca0125d420e83748c5ebcb Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 5 Jun 2023 10:09:03 +0200 Subject: [PATCH 051/253] Bump getrandom from 0.2.8 to 0.2.9 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c2af231b..7b9b230c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1073,9 +1073,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", "libc", From 1c4d7b2f879ac38c64e2a707eb8f9e39b1c6d117 Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Mon, 5 Jun 2023 16:34:50 +0800 Subject: [PATCH 052/253] install: remove time crate --- Cargo.lock | 1 - src/uu/install/Cargo.toml | 3 --- 2 files changed, 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c2af231b..7c826fac5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2732,7 +2732,6 @@ dependencies = [ "file_diff", "filetime", "libc", - "time", "uucore", ] diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 89849059d..b833babad 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -24,9 +24,6 @@ file_diff = { workspace=true } libc = { workspace=true } uucore = { workspace=true, features=["fs", "mode", "perms", "entries"] } -[dev-dependencies] -time = { workspace=true } - [[bin]] name = "install" path = "src/main.rs" From b0705062557ec5d497cf02d4ece27b0b37da8ce5 Mon Sep 17 00:00:00 2001 From: Detlev Casanova Date: Fri, 2 Jun 2023 14:42:47 -0400 Subject: [PATCH 053/253] tsort: Switch to BTreeHash and BTreeSet Using HashMap and HashSet give a valid topological sort, but the output will change randomly at each run. BTree based structures will guarantee that the output is always ordered in the same way. This also makes the ouptut similar to the output of the C version of the tools, on which some applications rely. --- src/uu/tsort/src/tsort.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index a70f32dfd..6e11a7f58 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -6,7 +6,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. use clap::{crate_version, Arg, Command}; -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeMap, BTreeSet}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; @@ -103,8 +103,8 @@ pub fn uu_app() -> Command { // but using integer may improve performance. #[derive(Default)] struct Graph { - in_edges: HashMap>, - out_edges: HashMap>, + in_edges: BTreeMap>, + out_edges: BTreeMap>, result: Vec, } @@ -122,7 +122,7 @@ impl Graph { } fn init_node(&mut self, n: &str) { - self.in_edges.insert(n.to_string(), HashSet::new()); + self.in_edges.insert(n.to_string(), BTreeSet::new()); self.out_edges.insert(n.to_string(), vec![]); } From 43a8d62b903d254af282cc70a4f52be55e302f63 Mon Sep 17 00:00:00 2001 From: Detlev Casanova Date: Mon, 5 Jun 2023 11:00:47 -0400 Subject: [PATCH 054/253] tsort: Add test for ordered floating nodes Signed-off-by: Detlev Casanova --- tests/by-util/test_tsort.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_tsort.rs b/tests/by-util/test_tsort.rs index 8b01e2a2d..62a74c31d 100644 --- a/tests/by-util/test_tsort.rs +++ b/tests/by-util/test_tsort.rs @@ -20,6 +20,14 @@ fn test_sort_self_loop() { .stdout_only("first\nsecond\n"); } +#[test] +fn test_sort_floating_nodes() { + new_ucmd!() + .pipe_in("d d\nc c\na a\nb b") + .succeeds() + .stdout_only("a\nb\nc\nd\n"); +} + #[test] fn test_no_such_file() { new_ucmd!() From c9f4c5dfb5fdb8d53156edd255680b16f650992c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 17:46:52 +0000 Subject: [PATCH 055/253] chore(deps): update rust crate regex to 1.8.4 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7c826fac5..75dd10da1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1899,9 +1899,9 @@ checksum = "f1bfbf25d7eb88ddcbb1ec3d755d0634da8f7657b2cb8b74089121409ab8228f" [[package]] name = "regex" -version = "1.8.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick 1.0.1", "memchr", diff --git a/Cargo.toml b/Cargo.toml index d939d43f7..bc4ca752d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -310,7 +310,7 @@ rand = { version = "0.8", features = ["small_rng"] } rand_core = "0.6" rayon = "1.7" redox_syscall = "0.3" -regex = "1.8.3" +regex = "1.8.4" rstest = "0.17.0" rust-ini = "0.18.0" same-file = "1.0.6" From 42a22c12f1ad54e85f11c4fc4f17af786589e39a Mon Sep 17 00:00:00 2001 From: Wandering Lethe Date: Mon, 5 Jun 2023 21:41:32 +0200 Subject: [PATCH 056/253] Remove time dependency from date Also upgrades humantime_to_duration to the latest version, it switched from time to chrono. Because touch still depends on time, its humantime_to_duration package version deviates from the workspace version. --- Cargo.lock | 47 +++++++++++++++++++++++++++++++++-------- Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 -- src/uu/date/src/date.rs | 12 ++++------- src/uu/touch/Cargo.toml | 3 ++- 5 files changed, 45 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7c826fac5..63d748f9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,7 +272,10 @@ checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", + "time 0.1.45", + "wasm-bindgen", "winapi", ] @@ -421,7 +424,7 @@ dependencies = [ "sha1", "tempfile", "textwrap", - "time", + "time 0.3.20", "unindent", "uu_arch", "uu_base32", @@ -1079,7 +1082,7 @@ checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1151,7 +1154,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "714764645f21cc70c4c151d7798dd158409641f37ad820bed65224aae403cbed" dependencies = [ "regex", - "time", + "time 0.3.20", +] + +[[package]] +name = "humantime_to_duration" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a674b970a2bbad01671718ca07604ca89258dd5e25d9af835c14ac6e0bc792" +dependencies = [ + "chrono", + "regex", ] [[package]] @@ -1434,7 +1447,7 @@ checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.45.0", ] @@ -2289,6 +2302,17 @@ dependencies = [ "syn", ] +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + [[package]] name = "time" version = "0.3.20" @@ -2528,9 +2552,8 @@ version = "0.0.19" dependencies = [ "chrono", "clap", - "humantime_to_duration", + "humantime_to_duration 0.3.0", "libc", - "time", "uucore", "windows-sys 0.48.0", ] @@ -3224,8 +3247,8 @@ version = "0.0.19" dependencies = [ "clap", "filetime", - "humantime_to_duration", - "time", + "humantime_to_duration 0.2.1", + "time 0.3.20", "uucore", "windows-sys 0.48.0", ] @@ -3401,7 +3424,7 @@ dependencies = [ "sm3", "tempfile", "thiserror", - "time", + "time 0.3.20", "uucore_procs", "walkdir", "wild", @@ -3446,6 +3469,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index d939d43f7..3df9aa1ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -286,7 +286,7 @@ fundu = "0.5.1" gcd = "2.3" glob = "0.3.1" half = "2.2" -humantime_to_duration = "0.2.1" +humantime_to_duration = "0.3.0" indicatif = "0.17" is-terminal = "0.4.7" itertools = "0.10.5" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 852e8cc9d..1ffcbed66 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -17,8 +17,6 @@ path = "src/date.rs" [dependencies] chrono = { workspace=true } -#/ TODO: check if we can avoid chrono+time -time = { workspace=true } clap = { workspace=true } uucore = { workspace=true } humantime_to_duration = { workspace=true } diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 381619f06..44b54be5e 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -9,7 +9,7 @@ // spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes humantime use chrono::format::{Item, StrftimeItems}; -use chrono::{DateTime, Duration as ChronoDuration, FixedOffset, Local, Offset, Utc}; +use chrono::{DateTime, Duration, FixedOffset, Local, Offset, Utc}; #[cfg(windows)] use chrono::{Datelike, Timelike}; use clap::{crate_version, Arg, ArgAction, Command}; @@ -18,7 +18,6 @@ use libc::{clock_settime, timespec, CLOCK_REALTIME}; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::PathBuf; -use time::Duration; use uucore::display::Quotable; #[cfg(not(any(target_os = "redox")))] use uucore::error::FromIo; @@ -226,13 +225,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let iter = std::iter::once(date); Box::new(iter) } - DateSource::Human(ref input) => { - // Get the current DateTime and convert the input time::Duration to chrono::Duration - // for things like "1 year ago" + DateSource::Human(relative_time) => { + // Get the current DateTime for things like "1 year ago" let current_time = DateTime::::from(Local::now()); - let input_chrono = ChronoDuration::seconds(input.as_seconds_f32() as i64) - + ChronoDuration::nanoseconds(input.subsec_nanoseconds() as i64); - let iter = std::iter::once(Ok(current_time + input_chrono)); + let iter = std::iter::once(Ok(current_time + relative_time)); Box::new(iter) } DateSource::File(ref path) => { diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 3aac9abc4..80840525c 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -18,7 +18,8 @@ path = "src/touch.rs" [dependencies] filetime = { workspace=true } clap = { workspace=true } -humantime_to_duration = { workspace=true } +# TODO: use workspace dependency (0.3) when switching from time to chrono +humantime_to_duration = "0.2.1" time = { workspace=true, features = ["parsing", "formatting", "local-offset", "macros"] } uucore = { workspace=true, features=["libc"] } From 2842d1fa0f2d0004d84805b73a413e31686bceb3 Mon Sep 17 00:00:00 2001 From: Wandering Lethe Date: Mon, 5 Jun 2023 22:54:26 +0200 Subject: [PATCH 057/253] Add duplicate packages to deny ban skips Duplicates of humantime_to_duration and time can be removed when touch switches from time to chrono --- deny.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deny.toml b/deny.toml index 14470b9b0..aa0203b9b 100644 --- a/deny.toml +++ b/deny.toml @@ -76,8 +76,11 @@ skip = [ { name = "windows_x86_64_msvc", version = "0.42.2" }, # tempfile { name = "redox_syscall", version = "0.3.5" }, - # cpp_macros - { name = "aho-corasick", version = "0.7.19" }, + # chrono -> time + { name = "wasi", version = "0.10.0+wasi-snapshot-preview1" }, + # touch can be remove when touch switches from time to chrono + { name = "humantime_to_duration", version = "0.2.1" }, + { name = "time", version = "0.3.20" }, ] # spell-checker: enable From 1ff4684f8a757ea570642d7a97f9486d8303f174 Mon Sep 17 00:00:00 2001 From: Wandering Lethe Date: Mon, 5 Jun 2023 23:01:26 +0200 Subject: [PATCH 058/253] Revert accidental removal of skipped deny --- deny.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deny.toml b/deny.toml index aa0203b9b..ba516de84 100644 --- a/deny.toml +++ b/deny.toml @@ -76,6 +76,8 @@ skip = [ { name = "windows_x86_64_msvc", version = "0.42.2" }, # tempfile { name = "redox_syscall", version = "0.3.5" }, + # cpp_macros + { name = "aho-corasick", version = "0.7.19" }, # chrono -> time { name = "wasi", version = "0.10.0+wasi-snapshot-preview1" }, # touch can be remove when touch switches from time to chrono From c68b665bf920bbf9d2757191f3b09cdf3b748574 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 14:39:50 +0000 Subject: [PATCH 059/253] fix(deps): update rust crate libc to 0.2.146 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/uucore/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75dd10da1..cce3816cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1309,9 +1309,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libloading" diff --git a/Cargo.toml b/Cargo.toml index bc4ca752d..c67aaa9a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -290,7 +290,7 @@ humantime_to_duration = "0.2.1" indicatif = "0.17" is-terminal = "0.4.7" itertools = "0.10.5" -libc = "0.2.144" +libc = "0.2.146" lscolors = { version = "0.14.0", default-features=false, features = ["nu-ansi-term"] } memchr = "2" nix = { version="0.26", default-features=false } diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 0745ca03f..d16c3c79e 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -32,7 +32,7 @@ time = { workspace=true, optional=true, features = ["formatting", "local-offset" data-encoding = { version="2.4", optional=true } data-encoding-macro = { version="0.1.13", optional=true } z85 = { version="3.0.5", optional=true } -libc = { version="0.2.144", optional=true } +libc = { version="0.2.146", optional=true } once_cell = { workspace=true } os_display = "0.1.3" From 3f33c5b816d5949271a31fee3d9a1e7370fd1baa Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Tue, 6 Jun 2023 20:55:42 +0530 Subject: [PATCH 060/253] ls: Implement --sort=width --- src/uu/ls/src/ls.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index e5ad4bcd4..7db591cf3 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -294,6 +294,7 @@ enum Sort { Time, Version, Extension, + Width, } #[derive(PartialEq)] @@ -496,6 +497,7 @@ fn extract_sort(options: &clap::ArgMatches) -> Sort { "size" => Sort::Size, "version" => Sort::Version, "extension" => Sort::Extension, + "width" => Sort::Width, // below should never happen as clap already restricts the values. _ => unreachable!("Invalid field for --sort"), } @@ -1322,9 +1324,9 @@ pub fn uu_app() -> Command { .arg( Arg::new(options::SORT) .long(options::SORT) - .help("Sort by : name, none (-U), time (-t), size (-S) or extension (-X)") + .help("Sort by : name, none (-U), time (-t), size (-S), extension (-X) or width") .value_name("field") - .value_parser(["name", "none", "time", "size", "version", "extension"]) + .value_parser(["name", "none", "time", "size", "version", "extension", "width"]) .require_equals(true) .overrides_with_all([ options::SORT, @@ -1937,6 +1939,12 @@ fn sort_entries(entries: &mut [PathData], config: &Config, out: &mut BufWriter entries.sort_by(|a, b| { + a.display_name + .len() + .cmp(&b.display_name.len()) + .then(a.display_name.cmp(&b.display_name)) + }), Sort::None => {} } From 21f1a119c3378e9cc17603352c1903a72845d4b2 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Tue, 6 Jun 2023 20:56:42 +0530 Subject: [PATCH 061/253] tests/ls: Implement tests for sort by width option --- tests/by-util/test_ls.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 45ced867a..49c2272c0 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1564,6 +1564,28 @@ fn test_ls_sort_name() { .stdout_is(".a\n.b\na\nb\n"); } +#[test] +fn test_ls_sort_width() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("aaaaa"); + at.touch("bbb"); + at.touch("cccc"); + at.touch("eee"); + at.touch("d"); + at.touch("fffff"); + at.touch("abc"); + at.touch("zz"); + at.touch("bcdef"); + + scene + .ucmd() + .arg("--sort=width") + .succeeds() + .stdout_is("d\nzz\nabc\nbbb\neee\ncccc\naaaaa\nbcdef\nfffff\n"); +} + #[test] fn test_ls_order_size() { let scene = TestScenario::new(util_name!()); From c26396087f9b802306e21d14fa02ce4200caa031 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 6 Jun 2023 17:44:04 +0200 Subject: [PATCH 062/253] ls: add words to spell-checker:ignore --- tests/by-util/test_ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 49c2272c0..1266a7cab 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore (words) READMECAREFULLY birthtime doesntexist oneline somebackup lrwx somefile somegroup somehiddenbackup somehiddenfile tabsize aaaaaaaa bbbb cccc dddddddd ncccc +// spell-checker:ignore (words) READMECAREFULLY birthtime doesntexist oneline somebackup lrwx somefile somegroup somehiddenbackup somehiddenfile tabsize aaaaaaaa bbbb cccc dddddddd ncccc neee naaaaa nbcdef nfffff #[cfg(any(unix, feature = "feat_selinux"))] use crate::common::util::expected_result; From 81313e63eab50a38ffa7c8d5bdcd769aac31ee3f Mon Sep 17 00:00:00 2001 From: Wandering Lethe Date: Tue, 6 Jun 2023 18:07:21 +0200 Subject: [PATCH 063/253] Upgrade humantime_to_duration to version 0.3.1. Latest patch fixes the transitive dependency on time. Which can now also be removed from the deny skipped bans. --- Cargo.lock | 38 +++++++++----------------------------- Cargo.toml | 2 +- deny.toml | 5 +---- 3 files changed, 11 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 63d748f9d..1603bdc56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,10 +272,7 @@ checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ "android-tzdata", "iana-time-zone", - "js-sys", "num-traits", - "time 0.1.45", - "wasm-bindgen", "winapi", ] @@ -424,7 +421,7 @@ dependencies = [ "sha1", "tempfile", "textwrap", - "time 0.3.20", + "time", "unindent", "uu_arch", "uu_base32", @@ -1082,7 +1079,7 @@ checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -1154,14 +1151,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "714764645f21cc70c4c151d7798dd158409641f37ad820bed65224aae403cbed" dependencies = [ "regex", - "time 0.3.20", + "time", ] [[package]] name = "humantime_to_duration" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a674b970a2bbad01671718ca07604ca89258dd5e25d9af835c14ac6e0bc792" +checksum = "1a80a233096ddccb74e62145f3a49cacea6a2669ee90f6e144e15fe28f4037c4" dependencies = [ "chrono", "regex", @@ -1447,7 +1444,7 @@ checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.45.0", ] @@ -2302,17 +2299,6 @@ dependencies = [ "syn", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.3.20" @@ -2552,7 +2538,7 @@ version = "0.0.19" dependencies = [ "chrono", "clap", - "humantime_to_duration 0.3.0", + "humantime_to_duration 0.3.1", "libc", "uucore", "windows-sys 0.48.0", @@ -3248,7 +3234,7 @@ dependencies = [ "clap", "filetime", "humantime_to_duration 0.2.1", - "time 0.3.20", + "time", "uucore", "windows-sys 0.48.0", ] @@ -3424,7 +3410,7 @@ dependencies = [ "sm3", "tempfile", "thiserror", - "time 0.3.20", + "time", "uucore_procs", "walkdir", "wild", @@ -3469,12 +3455,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 3df9aa1ac..9c8d769a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -286,7 +286,7 @@ fundu = "0.5.1" gcd = "2.3" glob = "0.3.1" half = "2.2" -humantime_to_duration = "0.3.0" +humantime_to_duration = "0.3.1" indicatif = "0.17" is-terminal = "0.4.7" itertools = "0.10.5" diff --git a/deny.toml b/deny.toml index ba516de84..c84984230 100644 --- a/deny.toml +++ b/deny.toml @@ -78,11 +78,8 @@ skip = [ { name = "redox_syscall", version = "0.3.5" }, # cpp_macros { name = "aho-corasick", version = "0.7.19" }, - # chrono -> time - { name = "wasi", version = "0.10.0+wasi-snapshot-preview1" }, - # touch can be remove when touch switches from time to chrono + # touch, can be remove when touch switches from time to chrono { name = "humantime_to_duration", version = "0.2.1" }, - { name = "time", version = "0.3.20" }, ] # spell-checker: enable From 1965ba268e9ffddbe70d61f8a870ebfb5257c8b6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 20:22:27 +0000 Subject: [PATCH 064/253] chore(deps): update rust crate tempfile to 3.6.0 --- Cargo.lock | 31 ++++++++++++++++--------------- Cargo.toml | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61d8fcf05..87b64c4ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -855,13 +855,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1248,7 +1248,7 @@ checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix 0.37.7", + "rustix 0.37.19", "windows-sys 0.48.0", ] @@ -1350,9 +1350,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.3.0" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd550e73688e6d578f0ac2119e32b797a327631a42f9433e59d02e139c8df60d" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" @@ -2012,16 +2012,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.7" +version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" +checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", - "linux-raw-sys 0.3.0", - "windows-sys 0.45.0", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", ] [[package]] @@ -2228,15 +2228,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.7", - "windows-sys 0.45.0", + "rustix 0.37.19", + "windows-sys 0.48.0", ] [[package]] @@ -2263,7 +2264,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ - "rustix 0.37.7", + "rustix 0.37.19", "windows-sys 0.48.0", ] diff --git a/Cargo.toml b/Cargo.toml index 1e6e22088..aac51b8c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -317,7 +317,7 @@ same-file = "1.0.6" selinux = "0.4" signal-hook = "0.3.15" smallvec = { version = "1.10", features = ["union"] } -tempfile = "3.5.0" +tempfile = "3.6.0" term_grid = "0.1.5" terminal_size = "0.2.6" textwrap = { version="0.16.0", features=["terminal_size"] } From 750eacc10c8cd11365696964f087590915186609 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 7 Jun 2023 10:42:01 +0200 Subject: [PATCH 065/253] mkdir: remove TEST_DIR consts in tests --- tests/by-util/test_mkdir.rs | 120 ++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 59 deletions(-) diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs index 425be8c35..c8dd7e243 100644 --- a/tests/by-util/test_mkdir.rs +++ b/tests/by-util/test_mkdir.rs @@ -12,20 +12,6 @@ use std::sync::Mutex; // when writing a test case, acquire this mutex before proceeding with the main logic of the test static TEST_MUTEX: Lazy> = Lazy::new(|| Mutex::new(())); -static TEST_DIR1: &str = "mkdir_test1"; -static TEST_DIR2: &str = "mkdir_test2"; -static TEST_DIR3: &str = "mkdir_test3"; -static TEST_DIR4: &str = "mkdir_test4/mkdir_test4_1"; -static TEST_DIR5: &str = "mkdir_test5/mkdir_test5_1"; -static TEST_DIR6: &str = "mkdir_test6"; -static TEST_FILE7: &str = "mkdir_test7"; -static TEST_DIR8: &str = "mkdir_test8/mkdir_test8_1/mkdir_test8_2"; -static TEST_DIR9: &str = "mkdir_test9/../mkdir_test9_1/../mkdir_test9_2"; -static TEST_DIR10: &str = "mkdir_test10/."; -static TEST_DIR11: &str = "mkdir_test11/.."; -#[cfg(not(windows))] -static TEST_DIR12: &str = "mkdir_test12"; - #[test] fn test_invalid_arg() { let _guard = TEST_MUTEX.lock(); @@ -35,15 +21,15 @@ fn test_invalid_arg() { #[test] fn test_mkdir_mkdir() { let _guard = TEST_MUTEX.lock(); - new_ucmd!().arg(TEST_DIR1).succeeds(); + new_ucmd!().arg("test_dir").succeeds(); } #[test] fn test_mkdir_verbose() { let _guard = TEST_MUTEX.lock(); - let expected = "mkdir: created directory 'mkdir_test1'\n"; + let expected = "mkdir: created directory 'test_dir'\n"; new_ucmd!() - .arg(TEST_DIR1) + .arg("test_dir") .arg("-v") .run() .stdout_is(expected); @@ -52,39 +38,47 @@ fn test_mkdir_verbose() { #[test] fn test_mkdir_dup_dir() { let _guard = TEST_MUTEX.lock(); + let scene = TestScenario::new(util_name!()); - scene.ucmd().arg(TEST_DIR2).succeeds(); - scene.ucmd().arg(TEST_DIR2).fails(); + let test_dir = "test_dir"; + + scene.ucmd().arg(test_dir).succeeds(); + scene.ucmd().arg(test_dir).fails(); } #[test] fn test_mkdir_mode() { let _guard = TEST_MUTEX.lock(); - new_ucmd!().arg("-m").arg("755").arg(TEST_DIR3).succeeds(); + new_ucmd!().arg("-m").arg("755").arg("test_dir").succeeds(); } #[test] fn test_mkdir_parent() { let _guard = TEST_MUTEX.lock(); let scene = TestScenario::new(util_name!()); - scene.ucmd().arg("-p").arg(TEST_DIR4).succeeds(); - scene.ucmd().arg("-p").arg(TEST_DIR4).succeeds(); - scene.ucmd().arg("--parent").arg(TEST_DIR4).succeeds(); - scene.ucmd().arg("--parents").arg(TEST_DIR4).succeeds(); + let test_dir = "parent_dir/child_dir"; + + scene.ucmd().arg("-p").arg(test_dir).succeeds(); + scene.ucmd().arg("-p").arg(test_dir).succeeds(); + scene.ucmd().arg("--parent").arg(test_dir).succeeds(); + scene.ucmd().arg("--parents").arg(test_dir).succeeds(); } #[test] fn test_mkdir_no_parent() { let _guard = TEST_MUTEX.lock(); - new_ucmd!().arg(TEST_DIR5).fails(); + new_ucmd!().arg("parent_dir/child_dir").fails(); } #[test] fn test_mkdir_dup_dir_parent() { let _guard = TEST_MUTEX.lock(); + let scene = TestScenario::new(util_name!()); - scene.ucmd().arg(TEST_DIR6).succeeds(); - scene.ucmd().arg("-p").arg(TEST_DIR6).succeeds(); + let test_dir = "test_dir"; + + scene.ucmd().arg(test_dir).succeeds(); + scene.ucmd().arg("-p").arg(test_dir).succeeds(); } #[cfg(not(windows))] @@ -158,12 +152,16 @@ fn test_mkdir_parent_mode_check_existing_parent() { #[test] fn test_mkdir_dup_file() { let _guard = TEST_MUTEX.lock(); + let scene = TestScenario::new(util_name!()); - scene.fixtures.touch(TEST_FILE7); - scene.ucmd().arg(TEST_FILE7).fails(); + let test_file = "test_file.txt"; + + scene.fixtures.touch(test_file); + + scene.ucmd().arg(test_file).fails(); // mkdir should fail for a file even if -p is specified. - scene.ucmd().arg("-p").arg(TEST_FILE7).fails(); + scene.ucmd().arg("-p").arg(test_file).fails(); } #[test] @@ -171,9 +169,10 @@ fn test_mkdir_dup_file() { fn test_symbolic_mode() { let _guard = TEST_MUTEX.lock(); let (at, mut ucmd) = at_and_ucmd!(); + let test_dir = "test_dir"; - ucmd.arg("-m").arg("a=rwx").arg(TEST_DIR1).succeeds(); - let perms = at.metadata(TEST_DIR1).permissions().mode(); + ucmd.arg("-m").arg("a=rwx").arg(test_dir).succeeds(); + let perms = at.metadata(test_dir).permissions().mode(); assert_eq!(perms, 0o40777); } @@ -182,12 +181,13 @@ fn test_symbolic_mode() { fn test_symbolic_alteration() { let _guard = TEST_MUTEX.lock(); let (at, mut ucmd) = at_and_ucmd!(); + let test_dir = "test_dir"; let default_umask = 0o022; let original_umask = unsafe { umask(default_umask) }; - ucmd.arg("-m").arg("-w").arg(TEST_DIR1).succeeds(); - let perms = at.metadata(TEST_DIR1).permissions().mode(); + ucmd.arg("-m").arg("-w").arg(test_dir).succeeds(); + let perms = at.metadata(test_dir).permissions().mode(); assert_eq!(perms, 0o40577); unsafe { umask(original_umask) }; @@ -198,60 +198,60 @@ fn test_symbolic_alteration() { fn test_multi_symbolic() { let _guard = TEST_MUTEX.lock(); let (at, mut ucmd) = at_and_ucmd!(); + let test_dir = "test_dir"; - ucmd.arg("-m") - .arg("u=rwx,g=rx,o=") - .arg(TEST_DIR1) - .succeeds(); - let perms = at.metadata(TEST_DIR1).permissions().mode(); + ucmd.arg("-m").arg("u=rwx,g=rx,o=").arg(test_dir).succeeds(); + let perms = at.metadata(test_dir).permissions().mode(); assert_eq!(perms, 0o40750); } #[test] fn test_recursive_reporting() { let _guard = TEST_MUTEX.lock(); + let test_dir = "test_dir/test_dir_a/test_dir_b"; + new_ucmd!() .arg("-p") .arg("-v") - .arg(TEST_DIR8) + .arg(test_dir) .succeeds() - .stdout_contains("created directory 'mkdir_test8'") - .stdout_contains("created directory 'mkdir_test8/mkdir_test8_1'") - .stdout_contains("created directory 'mkdir_test8/mkdir_test8_1/mkdir_test8_2'"); - new_ucmd!().arg("-v").arg(TEST_DIR8).fails().no_stdout(); + .stdout_contains("created directory 'test_dir'") + .stdout_contains("created directory 'test_dir/test_dir_a'") + .stdout_contains("created directory 'test_dir/test_dir_a/test_dir_b'"); + new_ucmd!().arg("-v").arg(test_dir).fails().no_stdout(); + + let test_dir = "test_dir/../test_dir_a/../test_dir_b"; + new_ucmd!() .arg("-p") .arg("-v") - .arg(TEST_DIR9) + .arg(test_dir) .succeeds() - .stdout_contains("created directory 'mkdir_test9'") - .stdout_contains("created directory 'mkdir_test9/../mkdir_test9_1'") - .stdout_contains("created directory 'mkdir_test9/../mkdir_test9_1/../mkdir_test9_2'"); + .stdout_contains("created directory 'test_dir'") + .stdout_contains("created directory 'test_dir/../test_dir_a'") + .stdout_contains("created directory 'test_dir/../test_dir_a/../test_dir_b'"); } #[test] fn test_mkdir_trailing_dot() { let _guard = TEST_MUTEX.lock(); let scene2 = TestScenario::new("ls"); - new_ucmd!() - .arg("-p") - .arg("-v") - .arg("mkdir_test10-2") - .succeeds(); + + new_ucmd!().arg("-p").arg("-v").arg("test_dir").succeeds(); new_ucmd!() .arg("-p") .arg("-v") - .arg(TEST_DIR10) + .arg("test_dir_a/.") .succeeds() - .stdout_contains("created directory 'mkdir_test10'"); + .stdout_contains("created directory 'test_dir_a'"); new_ucmd!() .arg("-p") .arg("-v") - .arg(TEST_DIR11) + .arg("test_dir_b/..") .succeeds() - .stdout_contains("created directory 'mkdir_test11'"); + .stdout_contains("created directory 'test_dir_b'"); let result = scene2.ucmd().arg("-al").run(); println!("ls dest {}", result.stdout_str()); } @@ -261,12 +261,14 @@ fn test_mkdir_trailing_dot() { fn test_umask_compliance() { fn test_single_case(umask_set: mode_t) { let _guard = TEST_MUTEX.lock(); + + let test_dir = "test_dir"; let (at, mut ucmd) = at_and_ucmd!(); let original_umask = unsafe { umask(umask_set) }; - ucmd.arg(TEST_DIR12).succeeds(); - let perms = at.metadata(TEST_DIR12).permissions().mode() as mode_t; + ucmd.arg(test_dir).succeeds(); + let perms = at.metadata(test_dir).permissions().mode() as mode_t; assert_eq!(perms, (!umask_set & 0o0777) + 0o40000); // before compare, add the set GUID, UID bits unsafe { From 3caa2c0d8fa4e214910ceaed6faf88a02c743a92 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 7 Jun 2023 10:44:11 +0200 Subject: [PATCH 066/253] mkdir: rename var "scene2" -> "scene" in test --- tests/by-util/test_mkdir.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs index c8dd7e243..11a860d5a 100644 --- a/tests/by-util/test_mkdir.rs +++ b/tests/by-util/test_mkdir.rs @@ -235,7 +235,6 @@ fn test_recursive_reporting() { #[test] fn test_mkdir_trailing_dot() { let _guard = TEST_MUTEX.lock(); - let scene2 = TestScenario::new("ls"); new_ucmd!().arg("-p").arg("-v").arg("test_dir").succeeds(); @@ -252,7 +251,9 @@ fn test_mkdir_trailing_dot() { .arg("test_dir_b/..") .succeeds() .stdout_contains("created directory 'test_dir_b'"); - let result = scene2.ucmd().arg("-al").run(); + + let scene = TestScenario::new("ls"); + let result = scene.ucmd().arg("-al").run(); println!("ls dest {}", result.stdout_str()); } From e115ee54462bd0cbc1065e29728a5cce85e504dd Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 6 Jun 2023 18:21:10 +0200 Subject: [PATCH 067/253] Run format toml in the CI --- .github/workflows/CICD.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index fb2300ba9..b52ea5098 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -1048,6 +1048,15 @@ jobs: name: toybox-result.json path: ${{ steps.vars.outputs.TEST_SUMMARY_FILE }} + toml_format: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v3 + + - name: Check + run: npx --yes @taplo/cli fmt --check + coverage: name: Code Coverage runs-on: ${{ matrix.job.os }} From 6ecef3a0e3ada3d98b9d82d24ecea8c80a12d9e4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 8 Jun 2023 09:07:12 +0200 Subject: [PATCH 068/253] Reformat TOML files with taplo npx --yes @taplo/cli fmt --- Cargo.toml | 620 ++++++++++++------------- Makefile.toml | 162 +++---- deny.toml | 62 +-- docs/book.toml | 2 +- src/uu/arch/Cargo.toml | 6 +- src/uu/base32/Cargo.toml | 4 +- src/uu/base64/Cargo.toml | 4 +- src/uu/basename/Cargo.toml | 4 +- src/uu/basenc/Cargo.toml | 6 +- src/uu/cat/Cargo.toml | 6 +- src/uu/chcon/Cargo.toml | 10 +- src/uu/chgrp/Cargo.toml | 4 +- src/uu/chmod/Cargo.toml | 6 +- src/uu/chown/Cargo.toml | 4 +- src/uu/chroot/Cargo.toml | 4 +- src/uu/cksum/Cargo.toml | 6 +- src/uu/comm/Cargo.toml | 4 +- src/uu/cp/Cargo.toml | 26 +- src/uu/csplit/Cargo.toml | 6 +- src/uu/cut/Cargo.toml | 10 +- src/uu/date/Cargo.toml | 15 +- src/uu/dd/Cargo.toml | 12 +- src/uu/df/Cargo.toml | 6 +- src/uu/dir/Cargo.toml | 6 +- src/uu/dircolors/Cargo.toml | 4 +- src/uu/dirname/Cargo.toml | 4 +- src/uu/du/Cargo.toml | 13 +- src/uu/echo/Cargo.toml | 4 +- src/uu/env/Cargo.toml | 8 +- src/uu/expand/Cargo.toml | 6 +- src/uu/expr/Cargo.toml | 10 +- src/uu/factor/Cargo.toml | 14 +- src/uu/false/Cargo.toml | 4 +- src/uu/fmt/Cargo.toml | 6 +- src/uu/fold/Cargo.toml | 4 +- src/uu/groups/Cargo.toml | 4 +- src/uu/hashsum/Cargo.toml | 10 +- src/uu/head/Cargo.toml | 6 +- src/uu/hostid/Cargo.toml | 6 +- src/uu/hostname/Cargo.toml | 9 +- src/uu/id/Cargo.toml | 6 +- src/uu/install/Cargo.toml | 15 +- src/uu/join/Cargo.toml | 6 +- src/uu/kill/Cargo.toml | 6 +- src/uu/link/Cargo.toml | 4 +- src/uu/ln/Cargo.toml | 4 +- src/uu/logname/Cargo.toml | 6 +- src/uu/ls/Cargo.toml | 24 +- src/uu/mkdir/Cargo.toml | 4 +- src/uu/mkfifo/Cargo.toml | 6 +- src/uu/mknod/Cargo.toml | 6 +- src/uu/mktemp/Cargo.toml | 8 +- src/uu/more/Cargo.toml | 14 +- src/uu/mv/Cargo.toml | 8 +- src/uu/nice/Cargo.toml | 8 +- src/uu/nl/Cargo.toml | 6 +- src/uu/nohup/Cargo.toml | 8 +- src/uu/nproc/Cargo.toml | 6 +- src/uu/numfmt/Cargo.toml | 4 +- src/uu/od/Cargo.toml | 8 +- src/uu/paste/Cargo.toml | 4 +- src/uu/pathchk/Cargo.toml | 6 +- src/uu/pinky/Cargo.toml | 4 +- src/uu/pr/Cargo.toml | 12 +- src/uu/printenv/Cargo.toml | 4 +- src/uu/printf/Cargo.toml | 9 +- src/uu/ptx/Cargo.toml | 6 +- src/uu/pwd/Cargo.toml | 4 +- src/uu/readlink/Cargo.toml | 4 +- src/uu/realpath/Cargo.toml | 4 +- src/uu/relpath/Cargo.toml | 4 +- src/uu/rm/Cargo.toml | 10 +- src/uu/rmdir/Cargo.toml | 6 +- src/uu/runcon/Cargo.toml | 10 +- src/uu/seq/Cargo.toml | 10 +- src/uu/shred/Cargo.toml | 8 +- src/uu/shuf/Cargo.toml | 10 +- src/uu/sleep/Cargo.toml | 6 +- src/uu/sort/Cargo.toml | 26 +- src/uu/split/Cargo.toml | 6 +- src/uu/stat/Cargo.toml | 4 +- src/uu/stdbuf/Cargo.toml | 8 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 9 +- src/uu/stty/Cargo.toml | 6 +- src/uu/sum/Cargo.toml | 4 +- src/uu/sync/Cargo.toml | 14 +- src/uu/tac/Cargo.toml | 8 +- src/uu/tail/Cargo.toml | 25 +- src/uu/tee/Cargo.toml | 6 +- src/uu/test/Cargo.toml | 8 +- src/uu/timeout/Cargo.toml | 8 +- src/uu/touch/Cargo.toml | 18 +- src/uu/tr/Cargo.toml | 6 +- src/uu/true/Cargo.toml | 4 +- src/uu/truncate/Cargo.toml | 4 +- src/uu/tsort/Cargo.toml | 4 +- src/uu/tty/Cargo.toml | 8 +- src/uu/uname/Cargo.toml | 6 +- src/uu/unexpand/Cargo.toml | 6 +- src/uu/uniq/Cargo.toml | 4 +- src/uu/unlink/Cargo.toml | 4 +- src/uu/uptime/Cargo.toml | 6 +- src/uu/users/Cargo.toml | 4 +- src/uu/vdir/Cargo.toml | 6 +- src/uu/wc/Cargo.toml | 14 +- src/uu/who/Cargo.toml | 4 +- src/uu/whoami/Cargo.toml | 12 +- src/uu/yes/Cargo.toml | 10 +- src/uucore/Cargo.toml | 66 +-- src/uucore_procs/Cargo.toml | 2 +- 110 files changed, 844 insertions(+), 861 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index aac51b8c6..179584604 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,11 +22,11 @@ edition = "2021" build = "build.rs" [features] -default = [ "feat_common_core" ] +default = ["feat_common_core"] ## OS feature shortcodes -macos = [ "feat_os_macos" ] -unix = [ "feat_os_unix" ] -windows = [ "feat_os_windows" ] +macos = ["feat_os_macos"] +unix = ["feat_os_unix"] +windows = ["feat_os_windows"] ## project-specific feature shortcodes nightly = [] test_unimplemented = [] @@ -42,225 +42,219 @@ feat_acl = ["cp/feat_acl"] # NOTE: # * The selinux(-sys) crate requires `libselinux` headers and shared library to be accessible in the C toolchain at compile time. # * Running a uutils compiled with `feat_selinux` requires an SELinux enabled Kernel at run time. -feat_selinux = ["cp/selinux", "id/selinux", "ls/selinux", "selinux", "feat_require_selinux"] +feat_selinux = [ + "cp/selinux", + "id/selinux", + "ls/selinux", + "selinux", + "feat_require_selinux", +] ## ## feature sets ## (common/core and Tier1) feature sets # "feat_common_core" == baseline core set of utilities which can be built/run on most targets feat_common_core = [ - "base32", - "base64", - "basename", - "basenc", - "cat", - "cksum", - "comm", - "cp", - "csplit", - "cut", - "date", - "df", - "dir", - "dircolors", - "dirname", - "dd", - "du", - "echo", - "env", - "expand", - "expr", - "factor", - "false", - "fmt", - "fold", - "hashsum", - "head", - "join", - "link", - "ln", - "ls", - "mkdir", - "mktemp", - "more", - "mv", - "nl", - "numfmt", - "od", - "paste", - "pr", - "printenv", - "printf", - "ptx", - "pwd", - "readlink", - "realpath", - "relpath", - "rm", - "rmdir", - "seq", - "shred", - "shuf", - "sleep", - "sort", - "split", - "sum", - "tac", - "tail", - "tee", - "test", - "tr", - "true", - "truncate", - "tsort", - "touch", - "unexpand", - "uniq", - "unlink", - "vdir", - "wc", - "yes", + "base32", + "base64", + "basename", + "basenc", + "cat", + "cksum", + "comm", + "cp", + "csplit", + "cut", + "date", + "df", + "dir", + "dircolors", + "dirname", + "dd", + "du", + "echo", + "env", + "expand", + "expr", + "factor", + "false", + "fmt", + "fold", + "hashsum", + "head", + "join", + "link", + "ln", + "ls", + "mkdir", + "mktemp", + "more", + "mv", + "nl", + "numfmt", + "od", + "paste", + "pr", + "printenv", + "printf", + "ptx", + "pwd", + "readlink", + "realpath", + "relpath", + "rm", + "rmdir", + "seq", + "shred", + "shuf", + "sleep", + "sort", + "split", + "sum", + "tac", + "tail", + "tee", + "test", + "tr", + "true", + "truncate", + "tsort", + "touch", + "unexpand", + "uniq", + "unlink", + "vdir", + "wc", + "yes", ] # "feat_Tier1" == expanded set of utilities which can be built/run on the usual rust "Tier 1" target platforms (ref: ) feat_Tier1 = [ - "feat_common_core", - # - "arch", - "hostname", - "nproc", - "sync", - "touch", - "uname", - "whoami", + "feat_common_core", + # + "arch", + "hostname", + "nproc", + "sync", + "touch", + "uname", + "whoami", ] ## (primary platforms) feature sets # "feat_os_macos" == set of utilities which can be built/run on the MacOS platform feat_os_macos = [ - "feat_os_unix", ## == a modern/usual *nix platform - # - "feat_require_unix_hostid", + "feat_os_unix", ## == a modern/usual *nix platform + # + "feat_require_unix_hostid", ] # "feat_os_unix" == set of utilities which can be built/run on modern/usual *nix platforms feat_os_unix = [ - "feat_Tier1", - # - "feat_require_crate_cpp", - "feat_require_unix", - "feat_require_unix_utmpx", + "feat_Tier1", + # + "feat_require_crate_cpp", + "feat_require_unix", + "feat_require_unix_utmpx", ] # "feat_os_windows" == set of utilities which can be built/run on modern/usual windows platforms feat_os_windows = [ - "feat_Tier1", ## == "feat_os_windows_legacy" + "hostname" + "feat_Tier1", ## == "feat_os_windows_legacy" + "hostname" ] ## (secondary platforms) feature sets # "feat_os_unix_gnueabihf" == set of utilities which can be built/run on the "arm-unknown-linux-gnueabihf" target (ARMv6 Linux [hardfloat]) feat_os_unix_gnueabihf = [ - "feat_Tier1", - # - "feat_require_unix", - "feat_require_unix_hostid", - "feat_require_unix_utmpx", + "feat_Tier1", + # + "feat_require_unix", + "feat_require_unix_hostid", + "feat_require_unix_utmpx", ] # "feat_os_unix_musl" == set of utilities which can be built/run on targets binding to the "musl" library (ref: ) feat_os_unix_musl = [ - "feat_Tier1", - # - "feat_require_unix", - "feat_require_unix_hostid", + "feat_Tier1", + # + "feat_require_unix", + "feat_require_unix_hostid", ] feat_os_unix_android = [ - "feat_Tier1", - # - "feat_require_unix", + "feat_Tier1", + # + "feat_require_unix", ] ## feature sets with requirements (restricting cross-platform availability) # # ** NOTE: these `feat_require_...` sets should be minimized as much as possible to encourage cross-platform availability of utilities # # "feat_require_crate_cpp" == set of utilities requiring the `cpp` crate (which fail to compile on several platforms; as of 2020-04-23) -feat_require_crate_cpp = [ - "stdbuf", -] +feat_require_crate_cpp = ["stdbuf"] # "feat_require_unix" == set of utilities requiring support which is only available on unix platforms (as of 2020-04-23) feat_require_unix = [ - "chgrp", - "chmod", - "chown", - "chroot", - "groups", - "id", - "install", - "kill", - "logname", - "mkfifo", - "mknod", - "nice", - "nohup", - "pathchk", - "stat", - "stty", - "timeout", - "tty", + "chgrp", + "chmod", + "chown", + "chroot", + "groups", + "id", + "install", + "kill", + "logname", + "mkfifo", + "mknod", + "nice", + "nohup", + "pathchk", + "stat", + "stty", + "timeout", + "tty", ] # "feat_require_unix_utmpx" == set of utilities requiring unix utmp/utmpx support # * ref: -feat_require_unix_utmpx = [ - "pinky", - "uptime", - "users", - "who", -] +feat_require_unix_utmpx = ["pinky", "uptime", "users", "who"] # "feat_require_unix_hostid" == set of utilities requiring gethostid in libc (only some unixes provide) -feat_require_unix_hostid = [ - "hostid", -] +feat_require_unix_hostid = ["hostid"] # "feat_require_selinux" == set of utilities depending on SELinux. -feat_require_selinux = [ - "chcon", - "runcon", -] +feat_require_selinux = ["chcon", "runcon"] ## (alternate/newer/smaller platforms) feature sets # "feat_os_unix_fuchsia" == set of utilities which can be built/run on the "Fuchsia" OS (refs: ; ) feat_os_unix_fuchsia = [ - "feat_common_core", - # - "feat_require_crate_cpp", - # - "chgrp", - "chmod", - "chown", - "du", - "groups", - "hostid", - "install", - "logname", - "mkfifo", - "mknod", - "nice", - "pathchk", - "tty", - "uname", - "unlink", + "feat_common_core", + # + "feat_require_crate_cpp", + # + "chgrp", + "chmod", + "chown", + "du", + "groups", + "hostid", + "install", + "logname", + "mkfifo", + "mknod", + "nice", + "pathchk", + "tty", + "uname", + "unlink", ] # "feat_os_unix_redox" == set of utilities which can be built/run on "Redox OS" (refs: ; ) feat_os_unix_redox = [ - "feat_common_core", - # - "chmod", - "uname", + "feat_common_core", + # + "chmod", + "uname", ] # "feat_os_windows_legacy" == slightly restricted set of utilities which can be built/run on early windows platforms (eg, "WinXP") feat_os_windows_legacy = [ - "feat_common_core", - # - "arch", - "nproc", - "sync", - "touch", - "whoami", + "feat_common_core", + # + "arch", + "nproc", + "sync", + "touch", + "whoami", ] ## # * bypass/override ~ translate 'test' feature name to avoid dependency collision with rust core 'test' crate (o/w surfaces as compiler errors during testing) -test = [ "uu_test" ] +test = ["uu_test"] [workspace.dependencies] bigdecimal = "0.3" @@ -268,7 +262,11 @@ binary-heap-plus = "0.5.0" bstr = "1.5" bytecount = "0.6.3" byteorder = "1.4.3" -chrono = { version="^0.4.26", default-features=false, features=["std", "alloc", "clock"]} +chrono = { version = "^0.4.26", default-features = false, features = [ + "std", + "alloc", + "clock", +] } clap = { version = "4.3", features = ["wrap_help", "cargo"] } clap_complete = "4.3" clap_mangen = "0.2" @@ -291,11 +289,13 @@ indicatif = "0.17" is-terminal = "0.4.7" itertools = "0.10.5" libc = "0.2.146" -lscolors = { version = "0.14.0", default-features=false, features = ["nu-ansi-term"] } +lscolors = { version = "0.14.0", default-features = false, features = [ + "nu-ansi-term", +] } memchr = "2" -nix = { version="0.26", default-features=false } +nix = { version = "0.26", default-features = false } nom = "7.1.3" -notify = { version = "=6.0.0", features=["macos_kqueue"]} +notify = { version = "=6.0.0", features = ["macos_kqueue"] } num-bigint = "0.4.3" num-traits = "0.2.15" number_prefix = "0.4" @@ -320,17 +320,17 @@ smallvec = { version = "1.10", features = ["union"] } tempfile = "3.6.0" term_grid = "0.1.5" terminal_size = "0.2.6" -textwrap = { version="0.16.0", features=["terminal_size"] } +textwrap = { version = "0.16.0", features = ["terminal_size"] } thiserror = "1.0" -time = { version="0.3" } +time = { version = "0.3" } unicode-segmentation = "1.10.1" unicode-width = "0.1.10" utf-8 = "0.7.6" walkdir = "2.3" winapi-util = "0.1.5" -windows-sys = { version="0.48.0", default-features=false } +windows-sys = { version = "0.48.0", default-features = false } xattr = "1.0.0" -zip = { version = "0.6.6", default_features=false, features=["deflate"] } +zip = { version = "0.6.6", default_features = false, features = ["deflate"] } hex = "0.4.3" md-5 = "0.10.5" @@ -342,129 +342,129 @@ blake3 = "1.3.3" sm3 = "0.4.2" digest = "0.10.7" -uucore = { version=">=0.0.19", package="uucore", path="src/uucore" } -uucore_procs = { version=">=0.0.19", package="uucore_procs", path="src/uucore_procs" } -uu_ls = { version=">=0.0.18", path="src/uu/ls" } -uu_base32 = { version=">=0.0.18", path="src/uu/base32"} +uucore = { version = ">=0.0.19", package = "uucore", path = "src/uucore" } +uucore_procs = { version = ">=0.0.19", package = "uucore_procs", path = "src/uucore_procs" } +uu_ls = { version = ">=0.0.18", path = "src/uu/ls" } +uu_base32 = { version = ">=0.0.18", path = "src/uu/base32" } [dependencies] -clap = { workspace=true } -once_cell = { workspace=true } -uucore = { workspace=true } -clap_complete = { workspace=true } -clap_mangen = { workspace=true } -phf = { workspace=true } -selinux = { workspace=true, optional = true } -textwrap = { workspace=true } -zip = { workspace=true, optional = true } +clap = { workspace = true } +once_cell = { workspace = true } +uucore = { workspace = true } +clap_complete = { workspace = true } +clap_mangen = { workspace = true } +phf = { workspace = true } +selinux = { workspace = true, optional = true } +textwrap = { workspace = true } +zip = { workspace = true, optional = true } -uuhelp_parser = { optional=true, version=">=0.0.19", path="src/uuhelp_parser"} +uuhelp_parser = { optional = true, version = ">=0.0.19", path = "src/uuhelp_parser" } # * uutils -uu_test = { optional=true, version="0.0.19", package="uu_test", path="src/uu/test" } +uu_test = { optional = true, version = "0.0.19", package = "uu_test", path = "src/uu/test" } # -arch = { optional=true, version="0.0.19", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.19", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.19", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.19", package="uu_basename", path="src/uu/basename" } -basenc = { optional=true, version="0.0.19", package="uu_basenc", path="src/uu/basenc" } -cat = { optional=true, version="0.0.19", package="uu_cat", path="src/uu/cat" } -chcon = { optional=true, version="0.0.19", package="uu_chcon", path="src/uu/chcon" } -chgrp = { optional=true, version="0.0.19", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.19", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.19", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.19", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.19", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.19", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.19", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.19", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.19", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.19", package="uu_date", path="src/uu/date" } -dd = { optional=true, version="0.0.19", package="uu_dd", path="src/uu/dd" } -df = { optional=true, version="0.0.19", package="uu_df", path="src/uu/df" } -dir = { optional=true, version="0.0.19", package="uu_dir", path="src/uu/dir" } -dircolors= { optional=true, version="0.0.19", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.19", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.19", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.19", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.19", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.19", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.19", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.19", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.19", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.19", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.19", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.19", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.19", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.19", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.19", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.19", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.19", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.19", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.19", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.19", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.19", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.19", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.19", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.19", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.19", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.19", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.19", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.19", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.19", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.19", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.19", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.19", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.19", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.19", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.19", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.19", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.19", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.19", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.19", package="uu_pinky", path="src/uu/pinky" } -pr = { optional=true, version="0.0.19", package="uu_pr", path="src/uu/pr" } -printenv = { optional=true, version="0.0.19", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.19", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.19", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.19", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.19", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.19", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.19", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.19", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.19", package="uu_rmdir", path="src/uu/rmdir" } -runcon = { optional=true, version="0.0.19", package="uu_runcon", path="src/uu/runcon" } -seq = { optional=true, version="0.0.19", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.19", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.19", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.19", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.19", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.19", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.19", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.19", package="uu_stdbuf", path="src/uu/stdbuf" } -stty = { optional=true, version="0.0.19", package="uu_stty", path="src/uu/stty" } -sum = { optional=true, version="0.0.19", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.19", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.19", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.19", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.19", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.19", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.19", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.19", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.19", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.19", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.19", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.19", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.19", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.19", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.19", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.19", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.19", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.19", package="uu_users", path="src/uu/users" } -vdir = { optional=true, version="0.0.19", package="uu_vdir", path="src/uu/vdir" } -wc = { optional=true, version="0.0.19", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.19", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.19", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.19", package="uu_yes", path="src/uu/yes" } +arch = { optional = true, version = "0.0.19", package = "uu_arch", path = "src/uu/arch" } +base32 = { optional = true, version = "0.0.19", package = "uu_base32", path = "src/uu/base32" } +base64 = { optional = true, version = "0.0.19", package = "uu_base64", path = "src/uu/base64" } +basename = { optional = true, version = "0.0.19", package = "uu_basename", path = "src/uu/basename" } +basenc = { optional = true, version = "0.0.19", package = "uu_basenc", path = "src/uu/basenc" } +cat = { optional = true, version = "0.0.19", package = "uu_cat", path = "src/uu/cat" } +chcon = { optional = true, version = "0.0.19", package = "uu_chcon", path = "src/uu/chcon" } +chgrp = { optional = true, version = "0.0.19", package = "uu_chgrp", path = "src/uu/chgrp" } +chmod = { optional = true, version = "0.0.19", package = "uu_chmod", path = "src/uu/chmod" } +chown = { optional = true, version = "0.0.19", package = "uu_chown", path = "src/uu/chown" } +chroot = { optional = true, version = "0.0.19", package = "uu_chroot", path = "src/uu/chroot" } +cksum = { optional = true, version = "0.0.19", package = "uu_cksum", path = "src/uu/cksum" } +comm = { optional = true, version = "0.0.19", package = "uu_comm", path = "src/uu/comm" } +cp = { optional = true, version = "0.0.19", package = "uu_cp", path = "src/uu/cp" } +csplit = { optional = true, version = "0.0.19", package = "uu_csplit", path = "src/uu/csplit" } +cut = { optional = true, version = "0.0.19", package = "uu_cut", path = "src/uu/cut" } +date = { optional = true, version = "0.0.19", package = "uu_date", path = "src/uu/date" } +dd = { optional = true, version = "0.0.19", package = "uu_dd", path = "src/uu/dd" } +df = { optional = true, version = "0.0.19", package = "uu_df", path = "src/uu/df" } +dir = { optional = true, version = "0.0.19", package = "uu_dir", path = "src/uu/dir" } +dircolors = { optional = true, version = "0.0.19", package = "uu_dircolors", path = "src/uu/dircolors" } +dirname = { optional = true, version = "0.0.19", package = "uu_dirname", path = "src/uu/dirname" } +du = { optional = true, version = "0.0.19", package = "uu_du", path = "src/uu/du" } +echo = { optional = true, version = "0.0.19", package = "uu_echo", path = "src/uu/echo" } +env = { optional = true, version = "0.0.19", package = "uu_env", path = "src/uu/env" } +expand = { optional = true, version = "0.0.19", package = "uu_expand", path = "src/uu/expand" } +expr = { optional = true, version = "0.0.19", package = "uu_expr", path = "src/uu/expr" } +factor = { optional = true, version = "0.0.19", package = "uu_factor", path = "src/uu/factor" } +false = { optional = true, version = "0.0.19", package = "uu_false", path = "src/uu/false" } +fmt = { optional = true, version = "0.0.19", package = "uu_fmt", path = "src/uu/fmt" } +fold = { optional = true, version = "0.0.19", package = "uu_fold", path = "src/uu/fold" } +groups = { optional = true, version = "0.0.19", package = "uu_groups", path = "src/uu/groups" } +hashsum = { optional = true, version = "0.0.19", package = "uu_hashsum", path = "src/uu/hashsum" } +head = { optional = true, version = "0.0.19", package = "uu_head", path = "src/uu/head" } +hostid = { optional = true, version = "0.0.19", package = "uu_hostid", path = "src/uu/hostid" } +hostname = { optional = true, version = "0.0.19", package = "uu_hostname", path = "src/uu/hostname" } +id = { optional = true, version = "0.0.19", package = "uu_id", path = "src/uu/id" } +install = { optional = true, version = "0.0.19", package = "uu_install", path = "src/uu/install" } +join = { optional = true, version = "0.0.19", package = "uu_join", path = "src/uu/join" } +kill = { optional = true, version = "0.0.19", package = "uu_kill", path = "src/uu/kill" } +link = { optional = true, version = "0.0.19", package = "uu_link", path = "src/uu/link" } +ln = { optional = true, version = "0.0.19", package = "uu_ln", path = "src/uu/ln" } +ls = { optional = true, version = "0.0.19", package = "uu_ls", path = "src/uu/ls" } +logname = { optional = true, version = "0.0.19", package = "uu_logname", path = "src/uu/logname" } +mkdir = { optional = true, version = "0.0.19", package = "uu_mkdir", path = "src/uu/mkdir" } +mkfifo = { optional = true, version = "0.0.19", package = "uu_mkfifo", path = "src/uu/mkfifo" } +mknod = { optional = true, version = "0.0.19", package = "uu_mknod", path = "src/uu/mknod" } +mktemp = { optional = true, version = "0.0.19", package = "uu_mktemp", path = "src/uu/mktemp" } +more = { optional = true, version = "0.0.19", package = "uu_more", path = "src/uu/more" } +mv = { optional = true, version = "0.0.19", package = "uu_mv", path = "src/uu/mv" } +nice = { optional = true, version = "0.0.19", package = "uu_nice", path = "src/uu/nice" } +nl = { optional = true, version = "0.0.19", package = "uu_nl", path = "src/uu/nl" } +nohup = { optional = true, version = "0.0.19", package = "uu_nohup", path = "src/uu/nohup" } +nproc = { optional = true, version = "0.0.19", package = "uu_nproc", path = "src/uu/nproc" } +numfmt = { optional = true, version = "0.0.19", package = "uu_numfmt", path = "src/uu/numfmt" } +od = { optional = true, version = "0.0.19", package = "uu_od", path = "src/uu/od" } +paste = { optional = true, version = "0.0.19", package = "uu_paste", path = "src/uu/paste" } +pathchk = { optional = true, version = "0.0.19", package = "uu_pathchk", path = "src/uu/pathchk" } +pinky = { optional = true, version = "0.0.19", package = "uu_pinky", path = "src/uu/pinky" } +pr = { optional = true, version = "0.0.19", package = "uu_pr", path = "src/uu/pr" } +printenv = { optional = true, version = "0.0.19", package = "uu_printenv", path = "src/uu/printenv" } +printf = { optional = true, version = "0.0.19", package = "uu_printf", path = "src/uu/printf" } +ptx = { optional = true, version = "0.0.19", package = "uu_ptx", path = "src/uu/ptx" } +pwd = { optional = true, version = "0.0.19", package = "uu_pwd", path = "src/uu/pwd" } +readlink = { optional = true, version = "0.0.19", package = "uu_readlink", path = "src/uu/readlink" } +realpath = { optional = true, version = "0.0.19", package = "uu_realpath", path = "src/uu/realpath" } +relpath = { optional = true, version = "0.0.19", package = "uu_relpath", path = "src/uu/relpath" } +rm = { optional = true, version = "0.0.19", package = "uu_rm", path = "src/uu/rm" } +rmdir = { optional = true, version = "0.0.19", package = "uu_rmdir", path = "src/uu/rmdir" } +runcon = { optional = true, version = "0.0.19", package = "uu_runcon", path = "src/uu/runcon" } +seq = { optional = true, version = "0.0.19", package = "uu_seq", path = "src/uu/seq" } +shred = { optional = true, version = "0.0.19", package = "uu_shred", path = "src/uu/shred" } +shuf = { optional = true, version = "0.0.19", package = "uu_shuf", path = "src/uu/shuf" } +sleep = { optional = true, version = "0.0.19", package = "uu_sleep", path = "src/uu/sleep" } +sort = { optional = true, version = "0.0.19", package = "uu_sort", path = "src/uu/sort" } +split = { optional = true, version = "0.0.19", package = "uu_split", path = "src/uu/split" } +stat = { optional = true, version = "0.0.19", package = "uu_stat", path = "src/uu/stat" } +stdbuf = { optional = true, version = "0.0.19", package = "uu_stdbuf", path = "src/uu/stdbuf" } +stty = { optional = true, version = "0.0.19", package = "uu_stty", path = "src/uu/stty" } +sum = { optional = true, version = "0.0.19", package = "uu_sum", path = "src/uu/sum" } +sync = { optional = true, version = "0.0.19", package = "uu_sync", path = "src/uu/sync" } +tac = { optional = true, version = "0.0.19", package = "uu_tac", path = "src/uu/tac" } +tail = { optional = true, version = "0.0.19", package = "uu_tail", path = "src/uu/tail" } +tee = { optional = true, version = "0.0.19", package = "uu_tee", path = "src/uu/tee" } +timeout = { optional = true, version = "0.0.19", package = "uu_timeout", path = "src/uu/timeout" } +touch = { optional = true, version = "0.0.19", package = "uu_touch", path = "src/uu/touch" } +tr = { optional = true, version = "0.0.19", package = "uu_tr", path = "src/uu/tr" } +true = { optional = true, version = "0.0.19", package = "uu_true", path = "src/uu/true" } +truncate = { optional = true, version = "0.0.19", package = "uu_truncate", path = "src/uu/truncate" } +tsort = { optional = true, version = "0.0.19", package = "uu_tsort", path = "src/uu/tsort" } +tty = { optional = true, version = "0.0.19", package = "uu_tty", path = "src/uu/tty" } +uname = { optional = true, version = "0.0.19", package = "uu_uname", path = "src/uu/uname" } +unexpand = { optional = true, version = "0.0.19", package = "uu_unexpand", path = "src/uu/unexpand" } +uniq = { optional = true, version = "0.0.19", package = "uu_uniq", path = "src/uu/uniq" } +unlink = { optional = true, version = "0.0.19", package = "uu_unlink", path = "src/uu/unlink" } +uptime = { optional = true, version = "0.0.19", package = "uu_uptime", path = "src/uu/uptime" } +users = { optional = true, version = "0.0.19", package = "uu_users", path = "src/uu/users" } +vdir = { optional = true, version = "0.0.19", package = "uu_vdir", path = "src/uu/vdir" } +wc = { optional = true, version = "0.0.19", package = "uu_wc", path = "src/uu/wc" } +who = { optional = true, version = "0.0.19", package = "uu_who", path = "src/uu/who" } +whoami = { optional = true, version = "0.0.19", package = "uu_whoami", path = "src/uu/whoami" } +yes = { optional = true, version = "0.0.19", package = "uu_yes", path = "src/uu/yes" } # this breaks clippy linting with: "tests/by-util/test_factor_benches.rs: No such file or directory (os error 2)" # factor_benches = { optional = true, version = "0.0.0", package = "uu_factor_benches", path = "tests/benches/factor" } @@ -475,21 +475,21 @@ yes = { optional=true, version="0.0.19", package="uu_yes", path="src/uu/yes #pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) [dev-dependencies] -chrono = { workspace=true } +chrono = { workspace = true } conv = "0.3" -filetime = { workspace=true } -glob = { workspace=true } -libc = { workspace=true } +filetime = { workspace = true } +glob = { workspace = true } +libc = { workspace = true } pretty_assertions = "1" -rand = { workspace=true } -regex = { workspace=true } -sha1 = { version="0.10", features=["std"] } -tempfile = { workspace=true } -time = { workspace=true, features=["local-offset"] } +rand = { workspace = true } +regex = { workspace = true } +sha1 = { version = "0.10", features = ["std"] } +tempfile = { workspace = true } +time = { workspace = true, features = ["local-offset"] } unindent = "0.2" -uucore = { workspace=true, features=["entries", "process", "signals"] } -walkdir = { workspace=true } -is-terminal = { workspace=true } +uucore = { workspace = true, features = ["entries", "process", "signals"] } +walkdir = { workspace = true } +is-terminal = { workspace = true } hex-literal = "0.4.1" rstest = "0.17.0" @@ -498,11 +498,11 @@ procfs = { version = "0.15", default-features = false } rlimit = "0.9.1" [target.'cfg(unix)'.dev-dependencies] -nix = { workspace=true, features=["process", "signal", "user"] } +nix = { workspace = true, features = ["process", "signal", "user"] } rand_pcg = "0.3" [build-dependencies] -phf_codegen = { workspace=true } +phf_codegen = { workspace = true } [[bin]] name = "coreutils" diff --git a/Makefile.toml b/Makefile.toml index ded2cd55b..84698df5f 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -20,15 +20,12 @@ run_task = "_init" [tasks._init] private = true -dependencies = [ - "_init-vars", -] +dependencies = ["_init-vars"] [tasks._init-vars] private = true script_runner = "@duckscript" -script = [ -''' +script = [''' # reset build/test flags set_env CARGO_MAKE_CARGO_BUILD_TEST_FLAGS "" # determine features @@ -90,54 +87,36 @@ for arg in "${args_utils_list}" end args_utils = trim "${args_utils}" set_env CARGO_MAKE_TASK_BUILD_UTILS_ARGS "${args_utils}" -''' -] +'''] ### tasks [tasks.default] description = "## *DEFAULT* Build (debug-mode) and test project" category = "[project]" -dependencies = [ - "action-build-debug", - "test-terse", -] +dependencies = ["action-build-debug", "test-terse"] ## [tasks.build] description = "## Build (release-mode) project" category = "[project]" -dependencies = [ - "core::pre-build", - "action-build-release", - "core::post-build", -] +dependencies = ["core::pre-build", "action-build-release", "core::post-build"] [tasks.build-debug] description = "## Build (debug-mode) project" category = "[project]" -dependencies = [ - "action-build-debug", -] +dependencies = ["action-build-debug"] [tasks.build-examples] description = "## Build (release-mode) project example(s); usage: `cargo make (build-examples | examples) [EXAMPLE]...`" category = "[project]" -dependencies = [ - "core::pre-build", - "action-build-examples", - "core::post-build", -] +dependencies = ["core::pre-build", "action-build-examples", "core::post-build"] [tasks.build-features] description = "## Build (with features; release-mode) project; usage: `cargo make (build-features | features) FEATURE...`" category = "[project]" -dependencies = [ - "core::pre-build", - "action-build-features", - "core::post-build", -] +dependencies = ["core::pre-build", "action-build-features", "core::post-build"] [tasks.build-release] alias = "build" @@ -148,9 +127,7 @@ alias = "build-debug" [tasks.example] description = "hidden singular-form alias for 'examples'" category = "[project]" -dependencies = [ - "examples", -] +dependencies = ["examples"] [tasks.examples] alias = "build-examples" @@ -161,17 +138,12 @@ alias = "build-features" [tasks.format] description = "## Format code files (with `cargo fmt`; includes tests)" category = "[project]" -dependencies = [ - "action-format", - "action-format-tests", -] +dependencies = ["action-format", "action-format-tests"] [tasks.help] description = "## Display help" category = "[project]" -dependencies = [ - "action-display-help", -] +dependencies = ["action-display-help"] [tasks.install] description = "## Install project binary (to $HOME/.cargo/bin)" @@ -182,10 +154,7 @@ args = ["install", "--path", "."] [tasks.lint] description = "## Display lint report" category = "[project]" -dependencies = [ - "action-clippy", - "action-fmt_report", -] +dependencies = ["action-clippy", "action-fmt_report"] [tasks.release] alias = "build" @@ -193,48 +162,32 @@ alias = "build" [tasks.test] description = "## Run project tests" category = "[project]" -dependencies = [ - "core::pre-test", - "core::test", - "core::post-test", -] +dependencies = ["core::pre-test", "core::test", "core::post-test"] [tasks.test-terse] description = "## Run project tests (with terse/summary output)" category = "[project]" -dependencies = [ - "core::pre-test", - "action-test_quiet", - "core::post-test", -] +dependencies = ["core::pre-test", "action-test_quiet", "core::post-test"] [tasks.test-util] description = "## Test (individual) utilities; usage: `cargo make (test-util | test-uutil) [UTIL_NAME...]`" category = "[project]" -dependencies = [ - "action-test-utils", -] +dependencies = ["action-test-utils"] [tasks.test-utils] description = "hidden plural-form alias for 'test-util'" category = "[project]" -dependencies = [ - "test-util", -] +dependencies = ["test-util"] [tasks.test-uutil] description = "hidden alias for 'test-util'" category = "[project]" -dependencies = [ - "test-util", -] +dependencies = ["test-util"] [tasks.test-uutils] description = "hidden alias for 'test-util'" category = "[project]" -dependencies = [ - "test-util", -] +dependencies = ["test-util"] [tasks.uninstall] description = "## Remove project binary (from $HOME/.cargo/bin)" @@ -246,63 +199,66 @@ args = ["uninstall"] description = "## Build (individual; release-mode) utilities; usage: `cargo make (util | uutil) [UTIL_NAME...]`" category = "[project]" dependencies = [ - "core::pre-build", - "action-determine-utils", - "action-build-utils", - "core::post-build", + "core::pre-build", + "action-determine-utils", + "action-build-utils", + "core::post-build", ] [tasks.utils] description = "hidden plural-form alias for 'util'" category = "[project]" -dependencies = [ - "util", -] +dependencies = ["util"] [tasks.uutil] description = "hidden alias for 'util'" category = "[project]" -dependencies = [ - "util", -] +dependencies = ["util"] [tasks.uutils] description = "hidden plural-form alias for 'util'" category = "[project]" -dependencies = [ - "util", -] +dependencies = ["util"] ### actions [tasks.action-build-release] description = "`cargo build --release`" command = "cargo" -args = ["build", "--release", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )" ] +args = ["build", "--release", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"] [tasks.action-build-debug] description = "`cargo build`" command = "cargo" -args = ["build", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )" ] +args = ["build", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"] [tasks.action-build-examples] description = "`cargo build (--examples|(--example EXAMPLE)...)`" command = "cargo" -args = ["build", "--release", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )", "${CARGO_MAKE_TASK_BUILD_EXAMPLES_ARGS}" ] +args = [ + "build", + "--release", + "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )", + "${CARGO_MAKE_TASK_BUILD_EXAMPLES_ARGS}", +] [tasks.action-build-features] description = "`cargo build --release --features FEATURES`" command = "cargo" -args = ["build", "--release", "--no-default-features", "--features", "${CARGO_MAKE_TASK_BUILD_FEATURES_ARGS}" ] +args = [ + "build", + "--release", + "--no-default-features", + "--features", + "${CARGO_MAKE_TASK_BUILD_FEATURES_ARGS}", +] [tasks.action-build-utils] description = "Build individual utilities" -dependencies = [ - "action-determine-utils", -] +dependencies = ["action-determine-utils"] command = "cargo" # args = ["build", "@@remove-empty(CARGO_MAKE_TASK_BUILD_UTILS_ARGS)" ] -args = ["build", "--release", "@@split(CARGO_MAKE_TASK_BUILD_UTILS_ARGS, )" ] +args = ["build", "--release", "@@split(CARGO_MAKE_TASK_BUILD_UTILS_ARGS, )"] [tasks.action-clippy] description = "`cargo clippy` lint report" @@ -311,8 +267,7 @@ args = ["clippy", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"] [tasks.action-determine-utils] script_runner = "@duckscript" -script = [ -''' +script = [''' package_options = get_env CARGO_MAKE_TASK_BUILD_UTILS_ARGS if is_empty "${package_options}" show_utils = get_env CARGO_MAKE_VAR_SHOW_UTILS @@ -335,13 +290,11 @@ if is_empty "${package_options}" package_options = trim "${package_options}" end_if set_env CARGO_MAKE_TASK_BUILD_UTILS_ARGS "${package_options}" -''' -] +'''] [tasks.action-determine-tests] script_runner = "@duckscript" -script = [ -''' +script = [''' test_files = glob_array tests/**/*.rs for file in ${test_files} file = replace "${file}" "\\" "/" @@ -354,8 +307,7 @@ for file in ${test_files} end_if end set_env CARGO_MAKE_VAR_TESTS "${tests}" -''' -] +'''] [tasks.action-format] description = "`cargo fmt`" @@ -364,9 +316,7 @@ args = ["fmt"] [tasks.action-format-tests] description = "`cargo fmt` tests" -dependencies = [ - "action-determine-tests", -] +dependencies = ["action-determine-tests"] command = "cargo" args = ["fmt", "--", "@@split(CARGO_MAKE_VAR_TESTS, )"] @@ -381,16 +331,18 @@ args = ["fmt", "--", "--check"] [tasks.action-spellcheck-codespell] description = "`codespell` spellcheck repository" command = "codespell" # (from `pip install codespell`) -args = [".", "--skip=*/.git,./target,./tests/fixtures", "--ignore-words-list=mut,od"] +args = [ + ".", + "--skip=*/.git,./target,./tests/fixtures", + "--ignore-words-list=mut,od", +] [tasks.action-test-utils] description = "Build individual utilities" -dependencies = [ - "action-determine-utils", -] +dependencies = ["action-determine-utils"] command = "cargo" # args = ["build", "@@remove-empty(CARGO_MAKE_TASK_BUILD_UTILS_ARGS)" ] -args = ["test", "@@split(CARGO_MAKE_TASK_BUILD_UTILS_ARGS, )" ] +args = ["test", "@@split(CARGO_MAKE_TASK_BUILD_UTILS_ARGS, )"] [tasks.action-test_quiet] description = "Test (in `--quiet` mode)" @@ -399,8 +351,7 @@ args = ["test", "--quiet", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"] [tasks.action-display-help] script_runner = "@duckscript" -script = [ -''' +script = [''' echo "" echo "usage: `cargo make TARGET [ARGS...]`" echo "" @@ -432,5 +383,4 @@ script = [ end_if end echo "" -''' -] +'''] diff --git a/deny.toml b/deny.toml index c84984230..3aaee354a 100644 --- a/deny.toml +++ b/deny.toml @@ -11,7 +11,7 @@ unmaintained = "warn" yanked = "warn" notice = "warn" ignore = [ - #"RUSTSEC-0000-0000", + #"RUSTSEC-0000-0000", ] # This section is considered when running `cargo deny check licenses` @@ -20,15 +20,15 @@ ignore = [ [licenses] unlicensed = "deny" allow = [ - "MIT", - "Apache-2.0", - "ISC", - "BSD-2-Clause", - "BSD-2-Clause-FreeBSD", - "BSD-3-Clause", - "CC0-1.0", - "MPL-2.0", # XXX considered copyleft? - "Unicode-DFS-2016", + "MIT", + "Apache-2.0", + "ISC", + "BSD-2-Clause", + "BSD-2-Clause-FreeBSD", + "BSD-3-Clause", + "CC0-1.0", + "MPL-2.0", # XXX considered copyleft? + "Unicode-DFS-2016", ] copyleft = "deny" allow-osi-fsf-free = "neither" @@ -59,27 +59,27 @@ highlight = "all" # introduces it. # spell-checker: disable skip = [ - # is-terminal - { name = "hermit-abi", version = "0.3.1" }, - # procfs - { name = "rustix", version = "0.36.14" }, - { name = "linux-raw-sys", version = "0.1.4" }, - # various crates - { name = "windows-sys", version = "0.45.0" }, - { name = "windows-targets", version = "0.42.2" }, - { name = "windows_aarch64_gnullvm", version = "0.42.2" }, - { name = "windows_aarch64_msvc", version = "0.42.2" }, - { name = "windows_i686_gnu", version = "0.42.2" }, - { name = "windows_i686_msvc", version = "0.42.2" }, - { name = "windows_x86_64_gnu", version = "0.42.2" }, - { name = "windows_x86_64_gnullvm", version = "0.42.2" }, - { name = "windows_x86_64_msvc", version = "0.42.2" }, - # tempfile - { name = "redox_syscall", version = "0.3.5" }, - # cpp_macros - { name = "aho-corasick", version = "0.7.19" }, - # touch, can be remove when touch switches from time to chrono - { name = "humantime_to_duration", version = "0.2.1" }, + # is-terminal + { name = "hermit-abi", version = "0.3.1" }, + # procfs + { name = "rustix", version = "0.36.14" }, + { name = "linux-raw-sys", version = "0.1.4" }, + # various crates + { name = "windows-sys", version = "0.45.0" }, + { name = "windows-targets", version = "0.42.2" }, + { name = "windows_aarch64_gnullvm", version = "0.42.2" }, + { name = "windows_aarch64_msvc", version = "0.42.2" }, + { name = "windows_i686_gnu", version = "0.42.2" }, + { name = "windows_i686_msvc", version = "0.42.2" }, + { name = "windows_x86_64_gnu", version = "0.42.2" }, + { name = "windows_x86_64_gnullvm", version = "0.42.2" }, + { name = "windows_x86_64_msvc", version = "0.42.2" }, + # tempfile + { name = "redox_syscall", version = "0.3.5" }, + # cpp_macros + { name = "aho-corasick", version = "0.7.19" }, + # touch, can be remove when touch switches from time to chrono + { name = "humantime_to_duration", version = "0.2.1" }, ] # spell-checker: enable diff --git a/docs/book.toml b/docs/book.toml index b9b31cfaf..f2da19338 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -10,4 +10,4 @@ git-repository-url = "https://github.com/rust-lang/cargo/tree/master/src/doc/src [preprocessor.toc] command = "mdbook-toc" -renderer = ["html"] \ No newline at end of file +renderer = ["html"] diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 10df726e1..42ac16b89 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/arch.rs" [dependencies] -platform-info = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true } +platform-info = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "arch" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 077204e1f..ea718e8dc 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/base32.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features = ["encoding"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["encoding"] } [[bin]] name = "base32" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index e21b34161..ba8229073 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/base64.rs" [dependencies] -uucore = { workspace=true, features = ["encoding"] } -uu_base32 = { workspace=true } +uucore = { workspace = true, features = ["encoding"] } +uu_base32 = { workspace = true } [[bin]] name = "base64" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index c17651506..a1ea12c5e 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/basename.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "basename" diff --git a/src/uu/basenc/Cargo.toml b/src/uu/basenc/Cargo.toml index 3e8c3ed8a..20665402a 100644 --- a/src/uu/basenc/Cargo.toml +++ b/src/uu/basenc/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/basenc.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features = ["encoding"] } -uu_base32 = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["encoding"] } +uu_base32 = { workspace = true } [[bin]] name = "basenc" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 2b78e9da7..e341fb535 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -15,13 +15,13 @@ edition = "2021" path = "src/cat.rs" [dependencies] -clap = { workspace=true } +clap = { workspace = true } thiserror = { workspace = true } is-terminal = { workspace = true } -uucore = { workspace=true, features=["fs", "pipes"] } +uucore = { workspace = true, features = ["fs", "pipes"] } [target.'cfg(unix)'.dependencies] -nix = { workspace=true } +nix = { workspace = true } [[bin]] name = "cat" diff --git a/src/uu/chcon/Cargo.toml b/src/uu/chcon/Cargo.toml index 53165dfe0..58d6b9b46 100644 --- a/src/uu/chcon/Cargo.toml +++ b/src/uu/chcon/Cargo.toml @@ -14,12 +14,12 @@ edition = "2021" path = "src/chcon.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries", "fs", "perms"] } -selinux = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries", "fs", "perms"] } +selinux = { workspace = true } thiserror = { workspace = true } -libc = { workspace=true } -fts-sys = { workspace=true } +libc = { workspace = true } +fts-sys = { workspace = true } [[bin]] name = "chcon" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index cceb32658..97ffc09b7 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/chgrp.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries", "fs", "perms"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries", "fs", "perms"] } [[bin]] name = "chgrp" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index af133128d..a4b4b799d 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/chmod.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true, features=["fs", "mode"] } +clap = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true, features = ["fs", "mode"] } [[bin]] name = "chmod" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 0b4db615d..cd1f881ee 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/chown.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries", "fs", "perms"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries", "fs", "perms"] } [[bin]] name = "chown" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 1c3527eda..1256a96c8 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/chroot.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries", "fs"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries", "fs"] } [[bin]] name = "chroot" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 707a7ee5c..345dfb238 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/cksum.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["sum"] } -hex = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["sum"] } +hex = { workspace = true } [[bin]] name = "cksum" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index 31fda282f..e5947bb84 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/comm.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "comm" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index b14add463..ff8f21160 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -2,9 +2,9 @@ name = "uu_cp" version = "0.0.19" authors = [ - "Jordy Dickinson ", - "Joshua S. Miller ", - "uutils developers", + "Jordy Dickinson ", + "Joshua S. Miller ", + "uutils developers", ] license = "MIT" description = "cp ~ (uutils) copy SOURCE to DESTINATION" @@ -19,18 +19,18 @@ edition = "2021" path = "src/cp.rs" [dependencies] -clap = { workspace=true } -filetime = { workspace=true } -libc = { workspace=true } -quick-error = { workspace=true } -selinux = { workspace=true, optional=true } -uucore = { workspace=true, features=["entries", "fs", "perms", "mode"] } -walkdir = { workspace=true } -indicatif = { workspace=true } +clap = { workspace = true } +filetime = { workspace = true } +libc = { workspace = true } +quick-error = { workspace = true } +selinux = { workspace = true, optional = true } +uucore = { workspace = true, features = ["entries", "fs", "perms", "mode"] } +walkdir = { workspace = true } +indicatif = { workspace = true } [target.'cfg(unix)'.dependencies] -xattr = { workspace=true } -exacl = { workspace=true, optional=true } +xattr = { workspace = true } +exacl = { workspace = true, optional = true } [[bin]] name = "cp" diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 3d0bafb48..023d97243 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/csplit.rs" [dependencies] -clap = { workspace=true } +clap = { workspace = true } thiserror = { workspace = true } -regex = { workspace=true } -uucore = { workspace=true, features=["entries", "fs"] } +regex = { workspace = true } +uucore = { workspace = true, features = ["entries", "fs"] } [[bin]] name = "csplit" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index d6b9d932f..6e8c28d74 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -15,11 +15,11 @@ edition = "2021" path = "src/cut.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } -memchr = { workspace=true } -bstr = { workspace=true } -is-terminal = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } +memchr = { workspace = true } +bstr = { workspace = true } +is-terminal = { workspace = true } [[bin]] name = "cut" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 1ffcbed66..62308bf53 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -16,16 +16,19 @@ edition = "2021" path = "src/date.rs" [dependencies] -chrono = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true } -humantime_to_duration = { workspace=true } +chrono = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true } +humantime_to_duration = { workspace = true } [target.'cfg(unix)'.dependencies] -libc = { workspace=true } +libc = { workspace = true } [target.'cfg(windows)'.dependencies] -windows-sys = { workspace=true, features = ["Win32_Foundation", "Win32_System_SystemInformation"] } +windows-sys = { workspace = true, features = [ + "Win32_Foundation", + "Win32_System_SystemInformation", +] } [[bin]] name = "date" diff --git a/src/uu/dd/Cargo.toml b/src/uu/dd/Cargo.toml index 1b0b015be..0ac25657e 100644 --- a/src/uu/dd/Cargo.toml +++ b/src/uu/dd/Cargo.toml @@ -15,16 +15,16 @@ edition = "2021" path = "src/dd.rs" [dependencies] -clap = { workspace=true } -gcd = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true, features=["memo"] } +clap = { workspace = true } +gcd = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true, features = ["memo"] } [target.'cfg(any(target_os = "linux"))'.dependencies] -nix = { workspace=true, features = ["fs"] } +nix = { workspace = true, features = ["fs"] } [target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] -signal-hook = { workspace=true } +signal-hook = { workspace = true } [[bin]] name = "dd" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 159c87685..0974a443c 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/df.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["libc", "fsext"] } -unicode-width = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["libc", "fsext"] } +unicode-width = { workspace = true } [[bin]] name = "df" diff --git a/src/uu/dir/Cargo.toml b/src/uu/dir/Cargo.toml index 2a3adda96..d61b041dc 100644 --- a/src/uu/dir/Cargo.toml +++ b/src/uu/dir/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/dir.rs" [dependencies] -clap = { workspace=true, features = ["env"] } -uucore = { workspace=true, features=["entries", "fs"] } -uu_ls = { workspace=true } +clap = { workspace = true, features = ["env"] } +uucore = { workspace = true, features = ["entries", "fs"] } +uu_ls = { workspace = true } [[bin]] name = "dir" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index d922c1cf3..952e7ad3f 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/dircolors.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "dircolors" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index cd211661d..46dec707d 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/dirname.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "dirname" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 6e883f769..693e7c81c 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -15,14 +15,17 @@ edition = "2021" path = "src/du.rs" [dependencies] -chrono = { workspace=true } +chrono = { workspace = true } # For the --exclude & --exclude-from options -glob = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true } +glob = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true } [target.'cfg(target_os = "windows")'.dependencies] -windows-sys = { workspace=true, features = ["Win32_Storage_FileSystem", "Win32_Foundation"] } +windows-sys = { workspace = true, features = [ + "Win32_Storage_FileSystem", + "Win32_Foundation", +] } [[bin]] name = "du" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 90ea22598..e12460a51 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/echo.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "echo" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 8a19ce121..2b05cd3e7 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -15,12 +15,12 @@ edition = "2021" path = "src/env.rs" [dependencies] -clap = { workspace=true } -rust-ini = { workspace=true } -uucore = { workspace=true, features=["signals"]} +clap = { workspace = true } +rust-ini = { workspace = true } +uucore = { workspace = true, features = ["signals"] } [target.'cfg(unix)'.dependencies] -nix = { workspace=true, features = ["signal"] } +nix = { workspace = true, features = ["signal"] } [[bin]] diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 1f923f9bc..dd0b76982 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/expand.rs" [dependencies] -clap = { workspace=true } -unicode-width = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +unicode-width = { workspace = true } +uucore = { workspace = true } [[bin]] name = "expand" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index f28215e0f..68224ee45 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -15,11 +15,11 @@ edition = "2021" path = "src/expr.rs" [dependencies] -clap = { workspace=true } -num-bigint = { workspace=true } -num-traits = { workspace=true } -onig = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +num-bigint = { workspace = true } +num-traits = { workspace = true } +onig = { workspace = true } +uucore = { workspace = true } [[bin]] name = "expr" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index b70976b76..a0fc539e1 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -12,15 +12,15 @@ categories = ["command-line-utilities"] edition = "2021" [build-dependencies] -num-traits = { workspace=true } # used in src/numerics.rs, which is included by build.rs +num-traits = { workspace = true } # used in src/numerics.rs, which is included by build.rs [dependencies] -clap = { workspace=true } -coz = { workspace=true, optional = true } -num-traits = { workspace=true } -rand = { workspace=true } -smallvec = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +coz = { workspace = true, optional = true } +num-traits = { workspace = true } +rand = { workspace = true } +smallvec = { workspace = true } +uucore = { workspace = true } [dev-dependencies] quickcheck = "1.0.3" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 84ac4e553..88b5751cb 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/false.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "false" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index df51f659c..0de6218b8 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/fmt.rs" [dependencies] -clap = { workspace=true } -unicode-width = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +unicode-width = { workspace = true } +uucore = { workspace = true } [[bin]] name = "fmt" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index bb7e3fa07..f0377c5ab 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/fold.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "fold" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 3feb634b6..a33b34f76 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/groups.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries", "process"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries", "process"] } [[bin]] name = "groups" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 84b19d6e5..0a12254d0 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -15,11 +15,11 @@ edition = "2021" path = "src/hashsum.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["sum"] } -memchr = { workspace=true } -regex = { workspace=true } -hex = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["sum"] } +memchr = { workspace = true } +regex = { workspace = true } +hex = { workspace = true } [[bin]] name = "hashsum" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index d680a6eb7..6b53b1526 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/head.rs" [dependencies] -clap = { workspace=true } -memchr = { workspace=true } -uucore = { workspace=true, features=["ringbuffer", "lines"] } +clap = { workspace = true } +memchr = { workspace = true } +uucore = { workspace = true, features = ["ringbuffer", "lines"] } [[bin]] name = "head" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 67045e8f6..175c31930 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/hostid.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true } [[bin]] name = "hostid" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 718bf43db..d94a703eb 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -15,12 +15,15 @@ edition = "2021" path = "src/hostname.rs" [dependencies] -clap = { workspace=true } +clap = { workspace = true } hostname = { version = "0.3", features = ["set"] } -uucore = { workspace=true, features=["wide"] } +uucore = { workspace = true, features = ["wide"] } [target.'cfg(target_os = "windows")'.dependencies] -windows-sys = { workspace=true, features = ["Win32_Networking_WinSock", "Win32_Foundation"] } +windows-sys = { workspace = true, features = [ + "Win32_Networking_WinSock", + "Win32_Foundation", +] } [[bin]] name = "hostname" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 9e0a35f7f..4d32f6e59 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/id.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries", "process"] } -selinux = { workspace=true, optional=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries", "process"] } +selinux = { workspace = true, optional = true } [[bin]] name = "id" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index b833babad..14be22a97 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,10 +1,7 @@ [package] name = "uu_install" version = "0.0.19" -authors = [ - "Ben Eills ", - "uutils developers", -] +authors = ["Ben Eills ", "uutils developers"] license = "MIT" description = "install ~ (uutils) copy files from SOURCE to DESTINATION (with specified attributes)" @@ -18,11 +15,11 @@ edition = "2021" path = "src/install.rs" [dependencies] -clap = { workspace=true } -filetime = { workspace=true } -file_diff = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true, features=["fs", "mode", "perms", "entries"] } +clap = { workspace = true } +filetime = { workspace = true } +file_diff = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true, features = ["fs", "mode", "perms", "entries"] } [[bin]] name = "install" diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index a2c6d19bc..946056cc1 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/join.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } -memchr = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } +memchr = { workspace = true } [[bin]] name = "join" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index e373bfe78..1f5515d03 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/kill.rs" [dependencies] -clap = { workspace=true } -nix = { workspace=true, features = ["signal"] } -uucore = { workspace=true, features=["signals"] } +clap = { workspace = true } +nix = { workspace = true, features = ["signal"] } +uucore = { workspace = true, features = ["signals"] } [[bin]] name = "kill" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 6f034dcae..fae9d59d9 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/link.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "link" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index b31f64f30..c4260cb8f 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/ln.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "ln" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 19a4ab035..a6bb6b0b7 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/logname.rs" [dependencies] -libc = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true } +libc = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "logname" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index e162aeab1..196e29795 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -15,18 +15,18 @@ edition = "2021" path = "src/ls.rs" [dependencies] -clap = { workspace=true, features = ["env"] } -chrono = { workspace=true } -unicode-width = { workspace=true } -number_prefix = { workspace=true } -term_grid = { workspace=true } -terminal_size = { workspace=true } -glob = { workspace=true } -lscolors = { workspace=true } -uucore = { workspace=true, features = ["entries", "fs"] } -once_cell = { workspace=true } -is-terminal = { workspace=true } -selinux = { workspace=true, optional = true } +clap = { workspace = true, features = ["env"] } +chrono = { workspace = true } +unicode-width = { workspace = true } +number_prefix = { workspace = true } +term_grid = { workspace = true } +terminal_size = { workspace = true } +glob = { workspace = true } +lscolors = { workspace = true } +uucore = { workspace = true, features = ["entries", "fs"] } +once_cell = { workspace = true } +is-terminal = { workspace = true } +selinux = { workspace = true, optional = true } [[bin]] name = "ls" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 24ce412d3..9d1edc5c6 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/mkdir.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["fs", "mode"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["fs", "mode"] } [[bin]] name = "mkdir" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 2e24bb53d..54a4a51b5 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/mkfifo.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true } [[bin]] name = "mkfifo" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 8a50a61fc..d73ea59b7 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -16,9 +16,9 @@ name = "uu_mknod" path = "src/mknod.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true, features=["mode"] } +clap = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true, features = ["mode"] } [[bin]] name = "mknod" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 31bd53a00..001bf5411 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/mktemp.rs" [dependencies] -clap = { workspace=true } -rand = { workspace=true } -tempfile = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +rand = { workspace = true } +tempfile = { workspace = true } +uucore = { workspace = true } [[bin]] name = "mktemp" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index a19fc577d..ff677ad87 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -15,15 +15,15 @@ edition = "2021" path = "src/more.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } -crossterm = { workspace=true } -is-terminal = { workspace=true } -unicode-width = { workspace=true } -unicode-segmentation = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } +crossterm = { workspace = true } +is-terminal = { workspace = true } +unicode-width = { workspace = true } +unicode-segmentation = { workspace = true } [target.'cfg(all(unix, not(target_os = "fuchsia")))'.dependencies] -nix = { workspace=true } +nix = { workspace = true } [[bin]] name = "more" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 8747c950c..2e67ec151 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/mv.rs" [dependencies] -clap = { workspace=true } -fs_extra = { workspace=true } -indicatif = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +fs_extra = { workspace = true } +indicatif = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "mv" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index d63f25312..70d6f0f87 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/nice.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -nix = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +libc = { workspace = true } +nix = { workspace = true } +uucore = { workspace = true } [[bin]] name = "nice" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index ead669d3d..020eba829 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/nl.rs" [dependencies] -clap = { workspace=true } -regex = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +regex = { workspace = true } +uucore = { workspace = true } [[bin]] name = "nl" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 40f332c5f..74bdd89ae 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/nohup.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -is-terminal = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +libc = { workspace = true } +is-terminal = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "nohup" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index ae2e74f06..239afef5e 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/nproc.rs" [dependencies] -libc = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true, features=["fs"] } +libc = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "nproc" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 9ba3c0075..e17b4e56e 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/numfmt.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "numfmt" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index e7cc7d34e..f26006d7e 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/od.rs" [dependencies] -byteorder = { workspace=true } -clap = { workspace=true } -half = { workspace=true } -uucore = { workspace=true } +byteorder = { workspace = true } +clap = { workspace = true } +half = { workspace = true } +uucore = { workspace = true } [[bin]] name = "od" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 836aa05bd..e9a78d828 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/paste.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "paste" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index c37b0b481..f11d85b5c 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/pathchk.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true } [[bin]] name = "pathchk" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index efee7c06a..ee17a46c5 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/pinky.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["utmpx", "entries"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["utmpx", "entries"] } [[bin]] name = "pinky" diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index 888daee90..bae1b251d 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -15,12 +15,12 @@ edition = "2021" path = "src/pr.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries"] } -quick-error = { workspace=true } -itertools = { workspace=true } -regex = { workspace=true } -chrono = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries"] } +quick-error = { workspace = true } +itertools = { workspace = true } +regex = { workspace = true } +chrono = { workspace = true } [[bin]] name = "pr" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index f3a7f2b40..59dcee778 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/printenv.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "printenv" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index c534ba544..51812945f 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,10 +1,7 @@ [package] name = "uu_printf" version = "0.0.19" -authors = [ - "Nathan Ross", - "uutils developers", -] +authors = ["Nathan Ross", "uutils developers"] license = "MIT" description = "printf ~ (uutils) FORMAT and display ARGUMENTS" @@ -18,8 +15,8 @@ edition = "2021" path = "src/printf.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["memo"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["memo"] } [[bin]] name = "printf" diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index c3498c25b..358c640db 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/ptx.rs" [dependencies] -clap = { workspace=true } -regex = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +regex = { workspace = true } +uucore = { workspace = true } [[bin]] name = "ptx" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index fd76eec5b..60cb9aae0 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/pwd.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "pwd" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 718a38120..4a0ad66e5 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/readlink.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "readlink" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 0ecd971c1..9b2b5352c 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/realpath.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "realpath" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 96fdca946..4108d612c 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/relpath.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "relpath" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index c69bd5964..ec46031d0 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -15,15 +15,15 @@ edition = "2021" path = "src/rm.rs" [dependencies] -clap = { workspace=true } -walkdir = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +walkdir = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [target.'cfg(unix)'.dependencies] -libc = { workspace=true } +libc = { workspace = true } [target.'cfg(windows)'.dependencies] -windows-sys = { workspace=true, features = ["Win32_Storage_FileSystem"] } +windows-sys = { workspace = true, features = ["Win32_Storage_FileSystem"] } [[bin]] name = "rm" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 2a40ad058..6c152a82a 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/rmdir.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["fs"] } -libc = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["fs"] } +libc = { workspace = true } [[bin]] name = "rmdir" diff --git a/src/uu/runcon/Cargo.toml b/src/uu/runcon/Cargo.toml index 0060e497b..191d9f013 100644 --- a/src/uu/runcon/Cargo.toml +++ b/src/uu/runcon/Cargo.toml @@ -14,11 +14,11 @@ edition = "2021" path = "src/runcon.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries", "fs", "perms"] } -selinux = { workspace=true } -thiserror = { workspace=true } -libc = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries", "fs", "perms"] } +selinux = { workspace = true } +thiserror = { workspace = true } +libc = { workspace = true } [[bin]] name = "runcon" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index e996c2b5c..e327b3eba 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -16,11 +16,11 @@ edition = "2021" path = "src/seq.rs" [dependencies] -bigdecimal = { workspace=true } -clap = { workspace=true } -num-bigint = { workspace=true } -num-traits = { workspace=true } -uucore = { workspace=true, features=["memo"] } +bigdecimal = { workspace = true } +clap = { workspace = true } +num-bigint = { workspace = true } +num-traits = { workspace = true } +uucore = { workspace = true, features = ["memo"] } [[bin]] name = "seq" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 5d52ee58a..3da23ff2b 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/shred.rs" [dependencies] -clap = { workspace=true } -rand = { workspace=true } -uucore = { workspace=true } -libc = { workspace=true } +clap = { workspace = true } +rand = { workspace = true } +uucore = { workspace = true } +libc = { workspace = true } [[bin]] name = "shred" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index f86a1eac5..974791ee1 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -15,11 +15,11 @@ edition = "2021" path = "src/shuf.rs" [dependencies] -clap = { workspace=true } -memchr = { workspace=true } -rand = { workspace=true } -rand_core = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +memchr = { workspace = true } +rand = { workspace = true } +rand_core = { workspace = true } +uucore = { workspace = true } [[bin]] name = "shuf" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index ae05bdf0e..2cd38988e 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/sleep.rs" [dependencies] -clap = { workspace=true } -fundu = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +fundu = { workspace = true } +uucore = { workspace = true } [[bin]] name = "sleep" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 7889ab009..7540522ed 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,19 +15,19 @@ edition = "2021" path = "src/sort.rs" [dependencies] -binary-heap-plus = { workspace=true } -clap = { workspace=true } -compare = { workspace=true } -ctrlc = { workspace=true } -fnv = { workspace=true } -itertools = { workspace=true } -memchr = { workspace=true } -ouroboros = { workspace=true } -rand = { workspace=true } -rayon = { workspace=true } -tempfile = { workspace=true } -unicode-width = { workspace=true } -uucore = { workspace=true, features=["fs"] } +binary-heap-plus = { workspace = true } +clap = { workspace = true } +compare = { workspace = true } +ctrlc = { workspace = true } +fnv = { workspace = true } +itertools = { workspace = true } +memchr = { workspace = true } +ouroboros = { workspace = true } +rand = { workspace = true } +rayon = { workspace = true } +tempfile = { workspace = true } +unicode-width = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "sort" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index b9649ad5f..32cfd6fda 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/split.rs" [dependencies] -clap = { workspace=true } -memchr = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +memchr = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "split" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 317634704..3f165c357 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/stat.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries", "libc", "fs", "fsext"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries", "libc", "fs", "fsext"] } [[bin]] name = "stat" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 06bd0fa51..bce2f8dba 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -15,12 +15,12 @@ edition = "2021" path = "src/stdbuf.rs" [dependencies] -clap = { workspace=true } -tempfile = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +tempfile = { workspace = true } +uucore = { workspace = true } [build-dependencies] -libstdbuf = { version="0.0.19", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version = "0.0.19", package = "uu_stdbuf_libstdbuf", path = "src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index abd2aaa4e..b3f186118 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -14,12 +14,15 @@ edition = "2021" [lib] name = "libstdbuf" path = "src/libstdbuf.rs" -crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo from spitting out a warning +crate-type = [ + "cdylib", + "rlib", +] # XXX: note: the rlib is just to prevent Cargo from spitting out a warning [dependencies] cpp = "0.5" -libc = { workspace=true } -uucore = { version=">=0.0.19", package="uucore", path="../../../../uucore" } +libc = { workspace = true } +uucore = { version = ">=0.0.19", package = "uucore", path = "../../../../uucore" } [build-dependencies] cpp_build = "0.5" diff --git a/src/uu/stty/Cargo.toml b/src/uu/stty/Cargo.toml index ec715314d..220651003 100644 --- a/src/uu/stty/Cargo.toml +++ b/src/uu/stty/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/stty.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } -nix = { workspace=true, features = ["term", "ioctl"] } +clap = { workspace = true } +uucore = { workspace = true } +nix = { workspace = true, features = ["term", "ioctl"] } [[bin]] name = "stty" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 806c2171d..37b4d21e0 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/sum.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "sum" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index c6062b7c1..36d110046 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -15,15 +15,19 @@ edition = "2021" path = "src/sync.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true, features=["wide"] } +clap = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true, features = ["wide"] } [target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] -nix = { workspace=true } +nix = { workspace = true } [target.'cfg(target_os = "windows")'.dependencies] -windows-sys = { workspace=true, features = ["Win32_Storage_FileSystem", "Win32_System_WindowsProgramming", "Win32_Foundation"] } +windows-sys = { workspace = true, features = [ + "Win32_Storage_FileSystem", + "Win32_System_WindowsProgramming", + "Win32_Foundation", +] } [[bin]] name = "sync" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index ca68be99d..a1c2e076a 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -17,11 +17,11 @@ edition = "2021" path = "src/tac.rs" [dependencies] -memchr = { workspace=true } +memchr = { workspace = true } memmap2 = "0.6" -regex = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true } +regex = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "tac" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index e71c988aa..81213b588 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -16,21 +16,24 @@ edition = "2021" path = "src/tail.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -memchr = { workspace=true } -notify = { workspace=true } -uucore = { workspace=true } -same-file = { workspace=true } -is-terminal = { workspace=true } -fundu = { workspace=true } +clap = { workspace = true } +libc = { workspace = true } +memchr = { workspace = true } +notify = { workspace = true } +uucore = { workspace = true } +same-file = { workspace = true } +is-terminal = { workspace = true } +fundu = { workspace = true } [target.'cfg(windows)'.dependencies] -windows-sys = { workspace=true, features = ["Win32_System_Threading", "Win32_Foundation"] } -winapi-util = { workspace=true } +windows-sys = { workspace = true, features = [ + "Win32_System_Threading", + "Win32_Foundation", +] } +winapi-util = { workspace = true } [dev-dependencies] -rstest = { workspace=true } +rstest = { workspace = true } [[bin]] name = "tail" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index ee4bedec8..21d64c0c2 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/tee.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true, features=["libc", "signals"] } +clap = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true, features = ["libc", "signals"] } [[bin]] name = "tee" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index 794aa5377..3c2f27401 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -15,12 +15,12 @@ edition = "2021" path = "src/test.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +libc = { workspace = true } +uucore = { workspace = true } [target.'cfg(target_os = "redox")'.dependencies] -redox_syscall = { workspace=true } +redox_syscall = { workspace = true } [[bin]] name = "test" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index b4b24db12..43cadf3e5 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/timeout.rs" [dependencies] -clap = { workspace=true } -libc = { workspace=true } -nix = { workspace=true, features = ["signal"] } -uucore = { workspace=true, features=["process", "signals"] } +clap = { workspace = true } +libc = { workspace = true } +nix = { workspace = true, features = ["signal"] } +uucore = { workspace = true, features = ["process", "signals"] } [[bin]] name = "timeout" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 80840525c..f90725197 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -16,15 +16,23 @@ edition = "2021" path = "src/touch.rs" [dependencies] -filetime = { workspace=true } -clap = { workspace=true } +filetime = { workspace = true } +clap = { workspace = true } # TODO: use workspace dependency (0.3) when switching from time to chrono humantime_to_duration = "0.2.1" -time = { workspace=true, features = ["parsing", "formatting", "local-offset", "macros"] } -uucore = { workspace=true, features=["libc"] } +time = { workspace = true, features = [ + "parsing", + "formatting", + "local-offset", + "macros", +] } +uucore = { workspace = true, features = ["libc"] } [target.'cfg(target_os = "windows")'.dependencies] -windows-sys = { workspace=true, features = ["Win32_Storage_FileSystem", "Win32_Foundation"] } +windows-sys = { workspace = true, features = [ + "Win32_Storage_FileSystem", + "Win32_Foundation", +] } [[bin]] name = "touch" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 4869941e9..e3eba0a10 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/tr.rs" [dependencies] -nom = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true } +nom = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "tr" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 3171845de..f7f7e1a6a 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/true.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "true" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 54578d038..bf36e8257 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/truncate.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "truncate" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 46ee8a47e..b7df32a1d 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/tsort.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "tsort" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 4e32f3873..d3d16d22a 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -15,10 +15,10 @@ edition = "2021" path = "src/tty.rs" [dependencies] -clap = { workspace=true } -nix = { workspace=true, features=["term"] } -is-terminal = { workspace=true } -uucore = { workspace=true, features=["fs"] } +clap = { workspace = true } +nix = { workspace = true, features = ["term"] } +is-terminal = { workspace = true } +uucore = { workspace = true, features = ["fs"] } [[bin]] name = "tty" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 5c02c5e2e..7b5f455a3 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/uname.rs" [dependencies] -platform-info = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true } +platform-info = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "uname" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 537750d3d..b3d5e1b40 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/unexpand.rs" [dependencies] -clap = { workspace=true } -unicode-width = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +unicode-width = { workspace = true } +uucore = { workspace = true } [[bin]] name = "unexpand" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index c1343ab01..dec4bf2a4 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/uniq.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "uniq" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index cc30f7dbd..10ec571d1 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/unlink.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true } [[bin]] name = "unlink" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index ab38951c5..b92254cda 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/uptime.rs" [dependencies] -chrono = { workspace=true } -clap = { workspace=true } -uucore = { workspace=true, features=["libc", "utmpx"] } +chrono = { workspace = true } +clap = { workspace = true } +uucore = { workspace = true, features = ["libc", "utmpx"] } [[bin]] name = "uptime" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index ec32f3e8a..81af58629 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/users.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["utmpx"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["utmpx"] } [[bin]] name = "users" diff --git a/src/uu/vdir/Cargo.toml b/src/uu/vdir/Cargo.toml index 4d6248979..68d0c34ae 100644 --- a/src/uu/vdir/Cargo.toml +++ b/src/uu/vdir/Cargo.toml @@ -15,9 +15,9 @@ edition = "2021" path = "src/vdir.rs" [dependencies] -clap = { workspace=true, features = ["env"] } -uucore = { workspace=true, features=["entries", "fs"] } -uu_ls = { workspace=true } +clap = { workspace = true, features = ["env"] } +uucore = { workspace = true, features = ["entries", "fs"] } +uu_ls = { workspace = true } [[bin]] name = "vdir" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index b781eaed6..363483bf8 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -15,15 +15,15 @@ edition = "2021" path = "src/wc.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["pipes"] } -bytecount = { workspace=true } -thiserror = { workspace=true } -unicode-width = { workspace=true } +clap = { workspace = true } +uucore = { workspace = true, features = ["pipes"] } +bytecount = { workspace = true } +thiserror = { workspace = true } +unicode-width = { workspace = true } [target.'cfg(unix)'.dependencies] -nix = { workspace=true } -libc = { workspace=true } +nix = { workspace = true } +libc = { workspace = true } [[bin]] name = "wc" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index cae50b9a6..bfbd7909d 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" path = "src/who.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["utmpx"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["utmpx"] } [[bin]] name = "who" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index 3114f721a..fe06a0a7e 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -15,14 +15,18 @@ edition = "2021" path = "src/whoami.rs" [dependencies] -clap = { workspace=true } -uucore = { workspace=true, features=["entries"] } +clap = { workspace = true } +uucore = { workspace = true, features = ["entries"] } [target.'cfg(target_os = "windows")'.dependencies] -windows-sys = { workspace=true, features = ["Win32_NetworkManagement_NetManagement", "Win32_System_WindowsProgramming", "Win32_Foundation"] } +windows-sys = { workspace = true, features = [ + "Win32_NetworkManagement_NetManagement", + "Win32_System_WindowsProgramming", + "Win32_Foundation", +] } [target.'cfg(unix)'.dependencies] -libc = { workspace=true } +libc = { workspace = true } [[bin]] name = "whoami" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 40674f05a..0e2b934f3 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -15,15 +15,15 @@ edition = "2021" path = "src/yes.rs" [dependencies] -clap = { workspace=true } -itertools = { workspace=true } +clap = { workspace = true } +itertools = { workspace = true } [target.'cfg(unix)'.dependencies] -uucore = { workspace=true, features=["pipes", "signals"] } -nix = { workspace=true } +uucore = { workspace = true, features = ["pipes", "signals"] } +nix = { workspace = true } [target.'cfg(not(unix))'.dependencies] -uucore = { workspace=true, features=["pipes"] } +uucore = { workspace = true, features = ["pipes"] } [[bin]] name = "yes" diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index d16c3c79e..7fa4aa344 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -15,50 +15,58 @@ categories = ["command-line-utilities"] edition = "2021" [lib] -path="src/lib/lib.rs" +path = "src/lib/lib.rs" [dependencies] -clap = { workspace=true } -uucore_procs = { workspace=true } -dns-lookup = { version="2.0.2", optional=true } +clap = { workspace = true } +uucore_procs = { workspace = true } +dns-lookup = { version = "2.0.2", optional = true } dunce = "1.0.4" wild = "2.1" glob = "0.3.1" # * optional -itertools = { version="0.10.5", optional=true } -thiserror = { workspace=true, optional=true } -time = { workspace=true, optional=true, features = ["formatting", "local-offset", "macros"] } +itertools = { version = "0.10.5", optional = true } +thiserror = { workspace = true, optional = true } +time = { workspace = true, optional = true, features = [ + "formatting", + "local-offset", + "macros", +] } # * "problem" dependencies (pinned) -data-encoding = { version="2.4", optional=true } -data-encoding-macro = { version="0.1.13", optional=true } -z85 = { version="3.0.5", optional=true } -libc = { version="0.2.146", optional=true } -once_cell = { workspace=true } +data-encoding = { version = "2.4", optional = true } +data-encoding-macro = { version = "0.1.13", optional = true } +z85 = { version = "3.0.5", optional = true } +libc = { version = "0.2.146", optional = true } +once_cell = { workspace = true } os_display = "0.1.3" -digest = { workspace=true } -hex = { workspace=true } -memchr = { workspace=true } -md-5 = { workspace=true } -sha1 = { workspace=true } -sha2 = { workspace=true } -sha3 = { workspace=true } -blake2b_simd = { workspace=true } -blake3 = { workspace=true } -sm3 = { workspace=true } +digest = { workspace = true } +hex = { workspace = true } +memchr = { workspace = true } +md-5 = { workspace = true } +sha1 = { workspace = true } +sha2 = { workspace = true } +sha3 = { workspace = true } +blake2b_simd = { workspace = true } +blake3 = { workspace = true } +sm3 = { workspace = true } [target.'cfg(unix)'.dependencies] -walkdir = { workspace=true, optional=true } -nix = { workspace=true, features = ["fs", "uio", "zerocopy", "signal"] } +walkdir = { workspace = true, optional = true } +nix = { workspace = true, features = ["fs", "uio", "zerocopy", "signal"] } [dev-dependencies] -clap = { workspace=true } -once_cell = { workspace=true } -tempfile = { workspace=true } +clap = { workspace = true } +once_cell = { workspace = true } +tempfile = { workspace = true } [target.'cfg(target_os = "windows")'.dependencies] -winapi-util = { version= "0.1.5", optional=true } -windows-sys = { version = "0.48.0", optional = true, default-features = false, features = ["Win32_Storage_FileSystem", "Win32_Foundation", "Win32_System_WindowsProgramming"] } +winapi-util = { version = "0.1.5", optional = true } +windows-sys = { version = "0.48.0", optional = true, default-features = false, features = [ + "Win32_Storage_FileSystem", + "Win32_Foundation", + "Win32_System_WindowsProgramming", +] } [features] default = [] diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index eedc9001c..a83baf1d4 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -19,4 +19,4 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -uuhelp_parser = { path="../uuhelp_parser", version="0.0.19" } +uuhelp_parser = { path = "../uuhelp_parser", version = "0.0.19" } From e817e6fc27cc61cc754de3ab418522c6ef74b3a1 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 8 Jun 2023 10:52:15 +0200 Subject: [PATCH 069/253] deny.toml: add comments --- deny.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/deny.toml b/deny.toml index 3aaee354a..57e432767 100644 --- a/deny.toml +++ b/deny.toml @@ -63,16 +63,25 @@ skip = [ { name = "hermit-abi", version = "0.3.1" }, # procfs { name = "rustix", version = "0.36.14" }, + # rustix { name = "linux-raw-sys", version = "0.1.4" }, # various crates { name = "windows-sys", version = "0.45.0" }, + # windows-sys { name = "windows-targets", version = "0.42.2" }, + # windows-targets { name = "windows_aarch64_gnullvm", version = "0.42.2" }, + # windows-targets { name = "windows_aarch64_msvc", version = "0.42.2" }, + # windows-targets { name = "windows_i686_gnu", version = "0.42.2" }, + # windows-targets { name = "windows_i686_msvc", version = "0.42.2" }, + # windows-targets { name = "windows_x86_64_gnu", version = "0.42.2" }, + # windows-targets { name = "windows_x86_64_gnullvm", version = "0.42.2" }, + # windows-targets { name = "windows_x86_64_msvc", version = "0.42.2" }, # tempfile { name = "redox_syscall", version = "0.3.5" }, From d26c596a4ceb609d306732afcf95215324ef135e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 8 Jun 2023 11:02:36 +0000 Subject: [PATCH 070/253] fix(deps): update rust crate memmap2 to 0.7 --- Cargo.lock | 4 ++-- src/uu/tac/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87b64c4ef..10f1bf040 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1405,9 +1405,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9ff02d2efdc645fca1ee55f45545b996e7da776b5b60c4e170334457551693" +checksum = "180d4b35be83d33392d1d1bfbd2ae1eca7ff5de1a94d3fc87faaa99a069e7cbd" dependencies = [ "libc", ] diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index a1c2e076a..4455ebe13 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -18,7 +18,7 @@ path = "src/tac.rs" [dependencies] memchr = { workspace = true } -memmap2 = "0.6" +memmap2 = "0.7" regex = { workspace = true } clap = { workspace = true } uucore = { workspace = true } From e1fd9e5342484c6a1943a26977a69c502da9fd30 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 8 Jun 2023 22:55:22 +0000 Subject: [PATCH 071/253] chore(deps): update rust crate blake3 to 1.4.0 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10f1bf040..0357f7fe0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -192,9 +192,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", "arrayvec", diff --git a/Cargo.toml b/Cargo.toml index 179584604..3d20bb97d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -338,7 +338,7 @@ sha1 = "0.10.5" sha2 = "0.10.6" sha3 = "0.10.8" blake2b_simd = "1.0.1" -blake3 = "1.3.3" +blake3 = "1.4.0" sm3 = "0.4.2" digest = "0.10.7" From ad96a1b8a065fa42903079d9c2b296700954908b Mon Sep 17 00:00:00 2001 From: Frantisek Kropac Date: Sat, 10 Jun 2023 09:22:01 +0200 Subject: [PATCH 072/253] Find MountInfo properly when symlink is used (#4929) * Find MountInfo properly when symlink is entered According to GNU implementation the entered path is being compared with the canonicalized device name in MountInfo. Co-authored-by: Frantisek Kropac Co-authored-by: Sylvestre Ledru --- Cargo.lock | 1 + src/uu/df/Cargo.toml | 3 +++ src/uu/df/src/filesystem.rs | 24 ++++++++++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0357f7fe0..b7f071c5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2562,6 +2562,7 @@ name = "uu_df" version = "0.0.19" dependencies = [ "clap", + "tempfile", "unicode-width", "uucore", ] diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 0974a443c..2be3967af 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -19,6 +19,9 @@ clap = { workspace = true } uucore = { workspace = true, features = ["libc", "fsext"] } unicode-width = { workspace = true } +[dev-dependencies] +tempfile = "3" + [[bin]] name = "df" path = "src/main.rs" diff --git a/src/uu/df/src/filesystem.rs b/src/uu/df/src/filesystem.rs index 461815e67..813846a6c 100644 --- a/src/uu/df/src/filesystem.rs +++ b/src/uu/df/src/filesystem.rs @@ -42,7 +42,7 @@ pub(crate) struct Filesystem { /// This function returns the element of `mounts` on which `path` is /// mounted. If there are no matches, this function returns /// [`None`]. If there are two or more matches, then the single -/// [`MountInfo`] with the longest mount directory is returned. +/// [`MountInfo`] with the device name corresponding to the entered path. /// /// If `canonicalize` is `true`, then the `path` is canonicalized /// before checking whether it matches any mount directories. @@ -68,9 +68,19 @@ where path.as_ref().to_path_buf() }; + // Find the potential mount point that matches entered path let maybe_mount_point = mounts .iter() - .find(|mi| mi.dev_name.eq(&path.to_string_lossy())); + // Create pair MountInfo, canonicalized device name + // TODO Abstract from accessing real filesystem to + // make code more testable + .map(|m| (m, std::fs::canonicalize(&m.dev_name))) + // Ignore non existing paths + .filter(|m| m.1.is_ok()) + .map(|m| (m.0, m.1.ok().unwrap())) + // Try to find canonicalized device name corresponding to entered path + .find(|m| m.1.eq(&path)) + .map(|m| m.0); maybe_mount_point.or_else(|| { mounts @@ -211,10 +221,16 @@ mod tests { #[test] fn test_dev_name_match() { + let tmp = tempfile::TempDir::new().expect("Failed to create temp dir"); + let dev_name = std::fs::canonicalize(tmp.path()) + .expect("Failed to canonicalize tmp path") + .to_string_lossy() + .to_string(); + let mut mount_info = mount_info("/foo"); - mount_info.dev_name = "/dev/sda2".to_string(); + mount_info.dev_name = dev_name.clone(); let mounts = [mount_info]; - let actual = mount_info_from_path(&mounts, "/dev/sda2", false).unwrap(); + let actual = mount_info_from_path(&mounts, dev_name, false).unwrap(); assert!(mount_info_eq(actual, &mounts[0])); } } From ab42b1e5995dec8dfbf145c0229afc9a0c71d920 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Sat, 10 Jun 2023 18:31:30 +0530 Subject: [PATCH 073/253] uucore: add function which checks hardlink as well as directed symlink --- src/uucore/src/lib/features/fs.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index 797be9c2c..a97e8ac9c 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -648,6 +648,36 @@ pub fn are_hardlinks_to_same_file(source: &Path, target: &Path) -> bool { source_metadata.ino() == target_metadata.ino() && source_metadata.dev() == target_metadata.dev() } +#[cfg(not(unix))] +pub fn are_hardlinks_or_one_way_symlink_to_same_file(_source: &Path, _target: &Path) -> bool { + false +} + +/// Checks if either two paths are hard links to the same file or if the source path is a symbolic link which when fully resolved points to target path +/// +/// # Arguments +/// +/// * `source` - A reference to a `Path` representing the source path. +/// * `target` - A reference to a `Path` representing the target path. +/// +/// # Returns +/// +/// * `bool` - Returns `true` if either of above conditions are true, and `false` otherwise. +#[cfg(unix)] +pub fn are_hardlinks_or_one_way_symlink_to_same_file(source: &Path, target: &Path) -> bool { + let source_metadata = match fs::metadata(source) { + Ok(metadata) => metadata, + Err(_) => return false, + }; + + let target_metadata = match fs::symlink_metadata(target) { + Ok(metadata) => metadata, + Err(_) => return false, + }; + + source_metadata.ino() == target_metadata.ino() && source_metadata.dev() == target_metadata.dev() +} + #[cfg(test)] mod tests { // Note this useful idiom: importing names from outer (for mod tests) scope. From 28ad5cab9f25f15e6584ac6eb97dec301670dc31 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Sat, 10 Jun 2023 18:32:09 +0530 Subject: [PATCH 074/253] mv: fix GNU test tests/mv/into-self-2.sh --- src/uu/mv/src/mv.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 5ca677c69..523183b0b 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -25,7 +25,7 @@ use std::path::{Path, PathBuf}; use uucore::backup_control::{self, BackupMode}; use uucore::display::Quotable; use uucore::error::{set_exit_code, FromIo, UError, UResult, USimpleError, UUsageError}; -use uucore::fs::are_hardlinks_to_same_file; +use uucore::fs::are_hardlinks_or_one_way_symlink_to_same_file; use uucore::update_control::{self, UpdateMode}; use uucore::{format_usage, help_about, help_section, help_usage, prompt_yes, show}; @@ -255,7 +255,7 @@ fn handle_two_paths(source: &Path, target: &Path, b: &Behavior) -> UResult<()> { return Err(MvError::NoSuchFile(source.quote().to_string()).into()); } - if (source.eq(target) || are_hardlinks_to_same_file(source, target)) + if (source.eq(target) || are_hardlinks_or_one_way_symlink_to_same_file(source, target)) && b.backup != BackupMode::SimpleBackup { if source.eq(Path::new(".")) || source.ends_with("/.") || source.is_file() { From 6bc15aac99d6fd77d09fa8cc88b109f6a18c39d5 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Sat, 10 Jun 2023 18:32:41 +0530 Subject: [PATCH 075/253] tests/mv: Test for particular edge cases when handling symlink files --- tests/by-util/test_mv.rs | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index f73d3249d..cef95d195 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -417,6 +417,54 @@ fn test_mv_same_hardlink() { .stderr_is(format!("mv: '{file_a}' and '{file_b}' are the same file\n",)); } +#[test] +#[cfg(all(unix, not(target_os = "android")))] +fn test_mv_same_symlink() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_same_file_a"; + let file_b = "test_mv_same_file_b"; + let file_c = "test_mv_same_file_c"; + + at.touch(file_a); + + at.symlink_file(file_a, file_b); + + ucmd.arg(file_b) + .arg(file_a) + .fails() + .stderr_is(format!("mv: '{file_b}' and '{file_a}' are the same file\n",)); + + let (at2, mut ucmd2) = at_and_ucmd!(); + at2.touch(file_a); + + at2.symlink_file(file_a, file_b); + ucmd2.arg(file_a).arg(file_b).succeeds(); + assert!(at2.file_exists(file_b)); + assert!(!at2.file_exists(file_a)); + + let (at3, mut ucmd3) = at_and_ucmd!(); + at3.touch(file_a); + + at3.symlink_file(file_a, file_b); + at3.symlink_file(file_b, file_c); + + ucmd3.arg(file_c).arg(file_b).succeeds(); + assert!(!at3.symlink_exists(file_c)); + assert!(at3.symlink_exists(file_b)); + + let (at4, mut ucmd4) = at_and_ucmd!(); + at4.touch(file_a); + + at4.symlink_file(file_a, file_b); + at4.symlink_file(file_b, file_c); + + ucmd4 + .arg(file_c) + .arg(file_a) + .fails() + .stderr_is(format!("mv: '{file_c}' and '{file_a}' are the same file\n",)); +} + #[test] #[cfg(all(unix, not(target_os = "android")))] fn test_mv_same_hardlink_backup_simple() { From 67114ac63c580a7a7ff9e75ef7605b3d20385c91 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 11 Jun 2023 14:05:26 +0200 Subject: [PATCH 076/253] date: switch to parse_datetime --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 4 ++-- deny.toml | 2 -- src/uu/date/Cargo.toml | 4 ++-- src/uu/date/src/date.rs | 4 ++-- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bba47cff6..a92d01416 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1154,16 +1154,6 @@ dependencies = [ "time", ] -[[package]] -name = "humantime_to_duration" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a80a233096ddccb74e62145f3a49cacea6a2669ee90f6e144e15fe28f4037c4" -dependencies = [ - "chrono", - "regex", -] - [[package]] name = "iana-time-zone" version = "0.1.53" @@ -1654,6 +1644,16 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "parse_datetime" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fecceaede7767a9a98058687a321bc91742eff7670167a34104afb30fc8757df" +dependencies = [ + "chrono", + "regex", +] + [[package]] name = "peeking_take_while" version = "0.1.2" @@ -2539,8 +2539,8 @@ version = "0.0.19" dependencies = [ "chrono", "clap", - "humantime_to_duration 0.3.1", "libc", + "parse_datetime", "uucore", "windows-sys 0.48.0", ] @@ -3235,7 +3235,7 @@ version = "0.0.19" dependencies = [ "clap", "filetime", - "humantime_to_duration 0.2.1", + "humantime_to_duration", "time", "uucore", "windows-sys 0.48.0", diff --git a/Cargo.toml b/Cargo.toml index 6f7cec3c9..09e120957 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ # coreutils (uutils) # * see the repository LICENSE, README, and CONTRIBUTING files for more information -# spell-checker:ignore (libs) libselinux gethostid procfs bigdecimal kqueue fundu mangen humantime uuhelp +# spell-checker:ignore (libs) libselinux gethostid procfs bigdecimal kqueue fundu mangen datetime uuhelp [package] name = "coreutils" @@ -284,7 +284,6 @@ fundu = "1.0.0" gcd = "2.3" glob = "0.3.1" half = "2.2" -humantime_to_duration = "0.3.1" indicatif = "0.17" is-terminal = "0.4.7" itertools = "0.10.5" @@ -302,6 +301,7 @@ number_prefix = "0.4" once_cell = "1.18.0" onig = { version = "~6.4", default-features = false } ouroboros = "0.15.6" +parse_datetime = "0.4.0" phf = "0.11.1" phf_codegen = "0.11.1" platform-info = "2.0.1" diff --git a/deny.toml b/deny.toml index 57e432767..8687fbfae 100644 --- a/deny.toml +++ b/deny.toml @@ -87,8 +87,6 @@ skip = [ { name = "redox_syscall", version = "0.3.5" }, # cpp_macros { name = "aho-corasick", version = "0.7.19" }, - # touch, can be remove when touch switches from time to chrono - { name = "humantime_to_duration", version = "0.2.1" }, ] # spell-checker: enable diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 62308bf53..e28762493 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,4 +1,4 @@ -# spell-checker:ignore humantime +# spell-checker:ignore datetime [package] name = "uu_date" version = "0.0.19" @@ -19,7 +19,7 @@ path = "src/date.rs" chrono = { workspace = true } clap = { workspace = true } uucore = { workspace = true } -humantime_to_duration = { workspace = true } +parse_datetime = { workspace = true } [target.'cfg(unix)'.dependencies] libc = { workspace = true } diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 44b54be5e..7bd64839c 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -6,7 +6,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes humantime +// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes use chrono::format::{Item, StrftimeItems}; use chrono::{DateTime, Duration, FixedOffset, Local, Offset, Utc}; @@ -170,7 +170,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { }; let date_source = if let Some(date) = matches.get_one::(OPT_DATE) { - if let Ok(duration) = humantime_to_duration::from_str(date.as_str()) { + if let Ok(duration) = parse_datetime::from_str(date.as_str()) { DateSource::Human(duration) } else { DateSource::Custom(date.into()) From 18cbb862e21380d7714b2a0729fe2aea323c83d0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 11 Jun 2023 18:53:42 +0200 Subject: [PATCH 077/253] Create a FUNDING.yml file The sponsor will be used for improving the CI machines on github --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..ccae1f831 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: uutils From c113284a4bf6441e59d621bc1022f23d48405f85 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Mon, 12 Jun 2023 23:46:33 +0530 Subject: [PATCH 078/253] uucore: modify are_hardlinks_to_same_file to check only immediate metadata --- src/uucore/src/lib/features/fs.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index a97e8ac9c..e92d0977f 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -635,12 +635,12 @@ pub fn are_hardlinks_to_same_file(_source: &Path, _target: &Path) -> bool { /// * `bool` - Returns `true` if the paths are hard links to the same file, and `false` otherwise. #[cfg(unix)] pub fn are_hardlinks_to_same_file(source: &Path, target: &Path) -> bool { - let source_metadata = match fs::metadata(source) { + let source_metadata = match fs::symlink_metadata(source) { Ok(metadata) => metadata, Err(_) => return false, }; - let target_metadata = match fs::metadata(target) { + let target_metadata = match fs::symlink_metadata(target) { Ok(metadata) => metadata, Err(_) => return false, }; From fa11315ce7f2b47c098cb5b3741a0b0b1e11eb9e Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Mon, 12 Jun 2023 23:48:49 +0530 Subject: [PATCH 079/253] mv: check strictly for hard links first before checking for symlinks to catch a very special case, plus ensure only nobackupmode is considered --- src/uu/mv/src/mv.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 523183b0b..6289e79f9 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -25,7 +25,7 @@ use std::path::{Path, PathBuf}; use uucore::backup_control::{self, BackupMode}; use uucore::display::Quotable; use uucore::error::{set_exit_code, FromIo, UError, UResult, USimpleError, UUsageError}; -use uucore::fs::are_hardlinks_or_one_way_symlink_to_same_file; +use uucore::fs::{are_hardlinks_or_one_way_symlink_to_same_file, are_hardlinks_to_same_file}; use uucore::update_control::{self, UpdateMode}; use uucore::{format_usage, help_about, help_section, help_usage, prompt_yes, show}; @@ -255,8 +255,10 @@ fn handle_two_paths(source: &Path, target: &Path, b: &Behavior) -> UResult<()> { return Err(MvError::NoSuchFile(source.quote().to_string()).into()); } - if (source.eq(target) || are_hardlinks_or_one_way_symlink_to_same_file(source, target)) - && b.backup != BackupMode::SimpleBackup + if (source.eq(target) + || are_hardlinks_to_same_file(source, target) + || are_hardlinks_or_one_way_symlink_to_same_file(source, target)) + && b.backup == BackupMode::NoBackup { if source.eq(Path::new(".")) || source.ends_with("/.") || source.is_file() { return Err( From 269ffc12b47243fcd16dcda561eee558f4eb12dd Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Mon, 12 Jun 2023 23:49:28 +0530 Subject: [PATCH 080/253] tests/mv: add tests to check for copying symlinks onto hardlinks to symlink --- tests/by-util/test_mv.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index cef95d195..0c292c50d 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -465,6 +465,35 @@ fn test_mv_same_symlink() { .stderr_is(format!("mv: '{file_c}' and '{file_a}' are the same file\n",)); } +#[test] +#[cfg(all(unix, not(target_os = "android")))] +fn test_mv_hardlink_to_symlink() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "file"; + let symlink_file = "symlink"; + let hardlink_to_symlink_file = "hardlink_to_symlink"; + + at.touch(file); + at.symlink_file(file, symlink_file); + at.hard_link(symlink_file, hardlink_to_symlink_file); + + ucmd.arg(symlink_file).arg(hardlink_to_symlink_file).fails(); + + let (at2, mut ucmd2) = at_and_ucmd!(); + + at2.touch(file); + at2.symlink_file(file, symlink_file); + at2.hard_link(symlink_file, hardlink_to_symlink_file); + + ucmd2 + .arg("--backup") + .arg(symlink_file) + .arg(hardlink_to_symlink_file) + .succeeds(); + assert!(!at2.symlink_exists(symlink_file)); + assert!(at2.symlink_exists(&format!("{hardlink_to_symlink_file}~"))); +} + #[test] #[cfg(all(unix, not(target_os = "android")))] fn test_mv_same_hardlink_backup_simple() { From fe5bf911e54cd0a7631061d62a08372c1ff333c8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 13 Jun 2023 06:09:54 +0000 Subject: [PATCH 081/253] chore(deps): update davidanson/markdownlint-cli2-action action to v11 --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index b52ea5098..47da567b2 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -319,7 +319,7 @@ jobs: shell: bash run: | RUSTDOCFLAGS="-Dwarnings" cargo doc ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-deps --workspace --document-private-items - - uses: DavidAnson/markdownlint-cli2-action@v10 + - uses: DavidAnson/markdownlint-cli2-action@v11 with: command: fix globs: | From 24b979c8219f45ede57f304c5e6029619829cf15 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 14 Jun 2023 10:35:13 +0200 Subject: [PATCH 082/253] uucore: introduce ShortcutValueParser --- src/uucore/src/lib/lib.rs | 1 + src/uucore/src/lib/parser.rs | 1 + .../src/lib/parser/shortcut_value_parser.rs | 141 ++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 src/uucore/src/lib/parser/shortcut_value_parser.rs diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index e76e540c8..ca9a48d25 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -33,6 +33,7 @@ pub use crate::mods::version_cmp; pub use crate::parser::parse_glob; pub use crate::parser::parse_size; pub use crate::parser::parse_time; +pub use crate::parser::shortcut_value_parser; // * feature-gated modules #[cfg(feature = "encoding")] diff --git a/src/uucore/src/lib/parser.rs b/src/uucore/src/lib/parser.rs index 8eae16bbf..fc3e46b5c 100644 --- a/src/uucore/src/lib/parser.rs +++ b/src/uucore/src/lib/parser.rs @@ -1,3 +1,4 @@ pub mod parse_glob; pub mod parse_size; pub mod parse_time; +pub mod shortcut_value_parser; diff --git a/src/uucore/src/lib/parser/shortcut_value_parser.rs b/src/uucore/src/lib/parser/shortcut_value_parser.rs new file mode 100644 index 000000000..0b0716158 --- /dev/null +++ b/src/uucore/src/lib/parser/shortcut_value_parser.rs @@ -0,0 +1,141 @@ +use clap::{ + builder::{PossibleValue, TypedValueParser}, + error::{ContextKind, ContextValue, ErrorKind}, +}; + +#[derive(Clone)] +pub struct ShortcutValueParser(Vec); + +/// `ShortcutValueParser` is similar to clap's `PossibleValuesParser`: it verifies that the value is +/// from an enumerated set of `PossibleValue`. +/// +/// Whereas `PossibleValuesParser` only accepts exact matches, `ShortcutValueParser` also accepts +/// shortcuts as long as they are unambiguous. +impl ShortcutValueParser { + pub fn new(values: impl Into) -> Self { + values.into() + } +} + +impl TypedValueParser for ShortcutValueParser { + type Value = String; + + fn parse_ref( + &self, + cmd: &clap::Command, + arg: Option<&clap::Arg>, + value: &std::ffi::OsStr, + ) -> Result { + let value = value + .to_str() + .ok_or(clap::Error::new(ErrorKind::InvalidUtf8))?; + + let matched_values: Vec<_> = self + .0 + .iter() + .filter(|x| x.get_name().starts_with(value)) + .collect(); + + if matched_values.len() == 1 { + Ok(matched_values[0].get_name().to_string()) + } else { + let mut err = clap::Error::new(ErrorKind::InvalidValue).with_cmd(cmd); + + if let Some(arg) = arg { + err.insert( + ContextKind::InvalidArg, + ContextValue::String(arg.to_string()), + ); + } + + err.insert( + ContextKind::InvalidValue, + ContextValue::String(value.to_string()), + ); + + err.insert( + ContextKind::ValidValue, + ContextValue::Strings(self.0.iter().map(|x| x.get_name().to_string()).collect()), + ); + + Err(err) + } + } + + fn possible_values(&self) -> Option + '_>> { + Some(Box::new(self.0.iter().cloned())) + } +} + +impl From for ShortcutValueParser +where + I: IntoIterator, + T: Into, +{ + fn from(values: I) -> Self { + Self(values.into_iter().map(|t| t.into()).collect()) + } +} + +#[cfg(test)] +mod tests { + use std::ffi::OsStr; + + use clap::{builder::TypedValueParser, error::ErrorKind, Command}; + + use super::ShortcutValueParser; + + #[test] + fn test_parse_ref() { + let cmd = Command::new("cmd"); + let parser = ShortcutValueParser::new(["abcd"]); + let values = ["a", "ab", "abc", "abcd"]; + + for value in values { + let result = parser.parse_ref(&cmd, None, OsStr::new(value)); + assert_eq!("abcd", result.unwrap()); + } + } + + #[test] + fn test_parse_ref_with_invalid_value() { + let cmd = Command::new("cmd"); + let parser = ShortcutValueParser::new(["abcd"]); + let invalid_values = ["e", "abe", "abcde"]; + + for invalid_value in invalid_values { + let result = parser.parse_ref(&cmd, None, OsStr::new(invalid_value)); + assert_eq!(ErrorKind::InvalidValue, result.unwrap_err().kind()); + } + } + + #[test] + fn test_parse_ref_with_ambiguous_value() { + let cmd = Command::new("cmd"); + let parser = ShortcutValueParser::new(["abcd", "abef"]); + let ambiguous_values = ["a", "ab"]; + + for ambiguous_value in ambiguous_values { + let result = parser.parse_ref(&cmd, None, OsStr::new(ambiguous_value)); + assert_eq!(ErrorKind::InvalidValue, result.unwrap_err().kind()); + } + + let result = parser.parse_ref(&cmd, None, OsStr::new("abc")); + assert_eq!("abcd", result.unwrap()); + + let result = parser.parse_ref(&cmd, None, OsStr::new("abe")); + assert_eq!("abef", result.unwrap()); + } + + #[test] + #[cfg(unix)] + fn test_parse_ref_with_invalid_utf8() { + use std::os::unix::prelude::OsStrExt; + + let parser = ShortcutValueParser::new(["abcd"]); + let cmd = Command::new("cmd"); + + let result = parser.parse_ref(&cmd, None, OsStr::from_bytes(&[0xc3 as u8, 0x28 as u8])); + assert_eq!(ErrorKind::InvalidUtf8, result.unwrap_err().kind()); + } +} From 643afbd731949c3a55db59eb1c2c7bb656d22d55 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 14 Jun 2023 10:36:14 +0200 Subject: [PATCH 083/253] date: use ShortcutValueParser --- src/uu/date/src/date.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 7bd64839c..adfb74128 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -26,14 +26,13 @@ use uucore::{format_usage, help_about, help_usage, show}; #[cfg(windows)] use windows_sys::Win32::{Foundation::SYSTEMTIME, System::SystemInformation::SetSystemTime}; +use uucore::shortcut_value_parser::ShortcutValueParser; + // Options const DATE: &str = "date"; const HOURS: &str = "hours"; const MINUTES: &str = "minutes"; const SECONDS: &str = "seconds"; -const HOUR: &str = "hour"; -const MINUTE: &str = "minute"; -const SECOND: &str = "second"; const NS: &str = "ns"; const ABOUT: &str = help_about!("date.md"); @@ -110,9 +109,9 @@ enum Iso8601Format { impl<'a> From<&'a str> for Iso8601Format { fn from(s: &str) -> Self { match s { - HOURS | HOUR => Self::Hours, - MINUTES | MINUTE => Self::Minutes, - SECONDS | SECOND => Self::Seconds, + HOURS => Self::Hours, + MINUTES => Self::Minutes, + SECONDS => Self::Seconds, NS => Self::Ns, DATE => Self::Date, // Note: This is caught by clap via `possible_values` @@ -131,7 +130,7 @@ impl<'a> From<&'a str> for Rfc3339Format { fn from(s: &str) -> Self { match s { DATE => Self::Date, - SECONDS | SECOND => Self::Seconds, + SECONDS => Self::Seconds, NS => Self::Ns, // Should be caught by clap _ => panic!("Invalid format: {s}"), @@ -317,7 +316,9 @@ pub fn uu_app() -> Command { .short('I') .long(OPT_ISO_8601) .value_name("FMT") - .value_parser([DATE, HOUR, HOURS, MINUTE, MINUTES, SECOND, SECONDS, NS]) + .value_parser(ShortcutValueParser::new([ + DATE, HOURS, MINUTES, SECONDS, NS, + ])) .num_args(0..=1) .default_missing_value(OPT_DATE) .help(ISO_8601_HELP_STRING), @@ -333,7 +334,7 @@ pub fn uu_app() -> Command { Arg::new(OPT_RFC_3339) .long(OPT_RFC_3339) .value_name("FMT") - .value_parser([DATE, SECOND, SECONDS, NS]) + .value_parser(ShortcutValueParser::new([DATE, SECONDS, NS])) .help(RFC_3339_HELP_STRING), ) .arg( From 3506dd11b8562e08c9cb3f0a7abc69ac514de5d0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 15 Jun 2023 19:18:09 +0000 Subject: [PATCH 084/253] chore(deps): update rust crate sha2 to 0.10.7 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a92d01416..84d6a9c34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2096,9 +2096,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", diff --git a/Cargo.toml b/Cargo.toml index 09e120957..a7df5d46a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -335,7 +335,7 @@ zip = { version = "0.6.6", default_features = false, features = ["deflate"] } hex = "0.4.3" md-5 = "0.10.5" sha1 = "0.10.5" -sha2 = "0.10.6" +sha2 = "0.10.7" sha3 = "0.10.8" blake2b_simd = "1.0.1" blake3 = "1.4.0" From 6865f91fd3b92ea9338ef4c7a2c96780a195c926 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 16 Jun 2023 00:01:15 +0000 Subject: [PATCH 085/253] chore(deps): update rust crate notify to v6.0.1 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a92d01416..1c9553fe6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1462,9 +1462,9 @@ dependencies = [ [[package]] name = "notify" -version = "6.0.0" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d9ba6c734de18ca27c8cef5cd7058aa4ac9f63596131e4c7e41e579319032a2" +checksum = "5738a2795d57ea20abec2d6d76c6081186709c0024187cd5977265eda6598b51" dependencies = [ "bitflags", "crossbeam-channel", diff --git a/Cargo.toml b/Cargo.toml index 09e120957..d35f38ddb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -294,7 +294,7 @@ lscolors = { version = "0.14.0", default-features = false, features = [ memchr = "2" nix = { version = "0.26", default-features = false } nom = "7.1.3" -notify = { version = "=6.0.0", features = ["macos_kqueue"] } +notify = { version = "=6.0.1", features = ["macos_kqueue"] } num-bigint = "0.4.3" num-traits = "0.2.15" number_prefix = "0.4" From 47d0ac4a421b370e4655051d59b05830aa8138da Mon Sep 17 00:00:00 2001 From: John Shin Date: Sat, 17 Jun 2023 19:31:27 -0700 Subject: [PATCH 086/253] sync: fix error msg --- src/uu/sync/src/sync.rs | 4 ++-- tests/by-util/test_sync.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index e12703bca..821ad639b 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -173,7 +173,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let path = Path::new(&f); if let Err(e) = open(path, OFlag::O_NONBLOCK, Mode::empty()) { if e != Errno::EACCES || (e == Errno::EACCES && path.is_dir()) { - return e.map_err_context(|| format!("cannot stat {}", f.quote()))?; + return e.map_err_context(|| format!("error opening {}", f.quote()))?; } } } @@ -183,7 +183,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { if !Path::new(&f).exists() { return Err(USimpleError::new( 1, - format!("cannot stat {}: No such file or directory", f.quote()), + format!("error opening {}: No such file or directory", f.quote()), )); } } diff --git a/tests/by-util/test_sync.rs b/tests/by-util/test_sync.rs index d55a874ba..9cae3b8a0 100644 --- a/tests/by-util/test_sync.rs +++ b/tests/by-util/test_sync.rs @@ -41,7 +41,7 @@ fn test_sync_no_existing_files() { .arg("--data") .arg("do-no-exist") .fails() - .stderr_contains("cannot stat"); + .stderr_contains("error opening"); } #[test] @@ -63,9 +63,9 @@ fn test_sync_no_permission_dir() { ts.ccmd("chmod").arg("0").arg(dir).succeeds(); let result = ts.ucmd().arg("--data").arg(dir).fails(); - result.stderr_contains("sync: cannot stat 'foo': Permission denied"); + result.stderr_contains("sync: error opening 'foo': Permission denied"); let result = ts.ucmd().arg(dir).fails(); - result.stderr_contains("sync: cannot stat 'foo': Permission denied"); + result.stderr_contains("sync: error opening 'foo': Permission denied"); } #[cfg(not(target_os = "windows"))] From 5882151eb10878e177df2f483c7ca0b234a52b54 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 18 Jun 2023 15:13:15 +0200 Subject: [PATCH 087/253] deny.toml: add hashbrown to skip list --- deny.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deny.toml b/deny.toml index 8687fbfae..780de3c8c 100644 --- a/deny.toml +++ b/deny.toml @@ -87,6 +87,8 @@ skip = [ { name = "redox_syscall", version = "0.3.5" }, # cpp_macros { name = "aho-corasick", version = "0.7.19" }, + # ordered-multimap (via rust-ini) + { name = "hashbrown", version = "0.13.2" }, ] # spell-checker: enable From 9fbc98fc4edb505d830fa696dad8fd1e8d684e7b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 18 Jun 2023 14:05:34 +0000 Subject: [PATCH 088/253] chore(deps): update rust crate rust-ini to 0.19.0 --- Cargo.lock | 62 +++++++++++++++++++++++++++++++++++++++++++++++------- Cargo.toml | 2 +- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7394c98a1..2e39978ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -371,6 +371,28 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "const-random" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368a7a772ead6ce7e1de82bfb04c485f3db8ec744f72925af5735e29a22cc18e" +dependencies = [ + "const-random-macro", + "proc-macro-hack", +] + +[[package]] +name = "const-random-macro" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d7d6ab3c3a2282db210df5f02c4dab6e0a7057af0fb7ebd4070f30fe05c0ddb" +dependencies = [ + "getrandom", + "once_cell", + "proc-macro-hack", + "tiny-keccak", +] + [[package]] name = "constant_time_eq" version = "0.2.4" @@ -809,9 +831,12 @@ dependencies = [ [[package]] name = "dlv-list" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" +checksum = "d529fd73d344663edfd598ccb3f344e46034db51ebd103518eae34338248ad73" +dependencies = [ + "const-random", +] [[package]] name = "dns-lookup" @@ -1106,6 +1131,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1572,12 +1603,12 @@ dependencies = [ [[package]] name = "ordered-multimap" -version = "0.4.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +checksum = "4ed8acf08e98e744e5384c8bc63ceb0364e68a6854187221c18df61c4797690e" dependencies = [ "dlv-list", - "hashbrown", + "hashbrown 0.13.2", ] [[package]] @@ -1774,6 +1805,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + [[package]] name = "proc-macro2" version = "1.0.47" @@ -1973,9 +2010,9 @@ dependencies = [ [[package]] name = "rust-ini" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +checksum = "7e2a3bcec1f113553ef1c88aae6c020a369d03d55b58de9869a0908930385091" dependencies = [ "cfg-if", "ordered-multimap", @@ -2329,6 +2366,15 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "typenum" version = "1.15.0" @@ -2347,7 +2393,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", "regex", ] diff --git a/Cargo.toml b/Cargo.toml index c0f6ab779..e92f6719e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -312,7 +312,7 @@ rayon = "1.7" redox_syscall = "0.3" regex = "1.8.4" rstest = "0.17.0" -rust-ini = "0.18.0" +rust-ini = "0.19.0" same-file = "1.0.6" selinux = "0.4" signal-hook = "0.3.15" From 7306be6e5862fd7081ea735effe6c17290523d19 Mon Sep 17 00:00:00 2001 From: Kostiantyn Hryshchuk Date: Sun, 18 Jun 2023 15:26:23 +0200 Subject: [PATCH 089/253] fixed shred -u for windows fixed shred panic on windows --- src/uu/shred/src/shred.rs | 4 +++- tests/by-util/test_shred.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 5ec1d1213..fd14a3245 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -532,7 +532,9 @@ fn wipe_name(orig_path: &Path, verbose: bool) -> Option { } // Sync every file rename - let new_file = File::open(new_path.clone()) + let new_file = OpenOptions::new() + .write(true) + .open(new_path.clone()) .expect("Failed to open renamed file for syncing"); new_file.sync_all().expect("Failed to sync renamed file"); diff --git a/tests/by-util/test_shred.rs b/tests/by-util/test_shred.rs index a34345aee..d98b840c4 100644 --- a/tests/by-util/test_shred.rs +++ b/tests/by-util/test_shred.rs @@ -18,7 +18,7 @@ fn test_shred_remove() { at.touch(file_b); // Shred file_a. - scene.ucmd().arg("-u").arg(file_a).run(); + scene.ucmd().arg("-u").arg(file_a).succeeds(); // file_a was deleted, file_b exists. assert!(!at.file_exists(file_a)); From b7154a80e121e75429769c6c04ac16bc9dc1325d Mon Sep 17 00:00:00 2001 From: Damon Harris Date: Sun, 18 Jun 2023 07:41:11 +0530 Subject: [PATCH 090/253] od: fix parsing of hex input ending with `E` --- src/uu/od/src/parse_nrofbytes.rs | 3 ++- tests/by-util/test_od.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/uu/od/src/parse_nrofbytes.rs b/src/uu/od/src/parse_nrofbytes.rs index 4c310755b..7d3bca03d 100644 --- a/src/uu/od/src/parse_nrofbytes.rs +++ b/src/uu/od/src/parse_nrofbytes.rs @@ -43,7 +43,7 @@ pub fn parse_number_of_bytes(s: &str) -> Result { len -= 1; } #[cfg(target_pointer_width = "64")] - Some('E') => { + Some('E') if radix != 16 => { multiply = 1024 * 1024 * 1024 * 1024 * 1024 * 1024; len -= 1; } @@ -84,6 +84,7 @@ fn test_parse_number_of_bytes() { // hex input assert_eq!(15, parse_number_of_bytes("0xf").unwrap()); + assert_eq!(14, parse_number_of_bytes("0XE").unwrap()); assert_eq!(15, parse_number_of_bytes("0XF").unwrap()); assert_eq!(27, parse_number_of_bytes("0x1b").unwrap()); assert_eq!(16 * 1024, parse_number_of_bytes("0x10k").unwrap()); diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index 24626cd76..54ac06384 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -627,6 +627,35 @@ fn test_skip_bytes() { )); } +#[test] +fn test_skip_bytes_hex() { + let input = "abcdefghijklmnopq"; // spell-checker:disable-line + new_ucmd!() + .arg("-c") + .arg("--skip-bytes=0xB") + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( + " + 0000013 l m n o p q + 0000021 + ", + )); + new_ucmd!() + .arg("-c") + .arg("--skip-bytes=0xE") + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( + " + 0000016 o p q + 0000021 + ", + )); +} + #[test] fn test_skip_bytes_error() { let input = "12345"; From 6ebfaf4b9d5ff2350a4b87b18a326cd0e8b50c14 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 12 Jun 2023 15:58:49 +0200 Subject: [PATCH 091/253] sort: migrate from ouroboros to self_cell --- Cargo.lock | 67 ++++--------------------------------- Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/sort/src/chunks.rs | 31 ++++++++--------- src/uu/sort/src/ext_sort.rs | 2 +- src/uu/sort/src/merge.rs | 2 +- 6 files changed, 27 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e39978ca..5721d1f55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" - [[package]] name = "adler" version = "1.0.2" @@ -43,12 +37,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aliasable" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" - [[package]] name = "android-tzdata" version = "0.1.1" @@ -1620,29 +1608,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "ouroboros" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" -dependencies = [ - "aliasable", - "ouroboros_macro", -] - -[[package]] -name = "ouroboros_macro" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" -dependencies = [ - "Inflector", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "output_vt100" version = "0.1.3" @@ -1781,30 +1746,6 @@ dependencies = [ "yansi", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro-hack" version = "0.5.20+deprecated" @@ -2082,6 +2023,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +[[package]] +name = "self_cell" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3926e239738d36060909ffe6f511502f92149a45a1fade7fe031cb2d33e88b" + [[package]] name = "selinux" version = "0.4.0" @@ -3145,9 +3092,9 @@ dependencies = [ "fnv", "itertools", "memchr", - "ouroboros", "rand", "rayon", + "self_cell", "tempfile", "unicode-width", "uucore", diff --git a/Cargo.toml b/Cargo.toml index e92f6719e..8f639c036 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -300,7 +300,6 @@ num-traits = "0.2.15" number_prefix = "0.4" once_cell = "1.18.0" onig = { version = "~6.4", default-features = false } -ouroboros = "0.15.6" parse_datetime = "0.4.0" phf = "0.11.1" phf_codegen = "0.11.1" @@ -314,6 +313,7 @@ regex = "1.8.4" rstest = "0.17.0" rust-ini = "0.19.0" same-file = "1.0.6" +self_cell = "1.0.0" selinux = "0.4" signal-hook = "0.3.15" smallvec = { version = "1.10", features = ["union"] } diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 7540522ed..533b31831 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -22,9 +22,9 @@ ctrlc = { workspace = true } fnv = { workspace = true } itertools = { workspace = true } memchr = { workspace = true } -ouroboros = { workspace = true } rand = { workspace = true } rayon = { workspace = true } +self_cell = { workspace = true } tempfile = { workspace = true } unicode-width = { workspace = true } uucore = { workspace = true, features = ["fs"] } diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index 9b60d5f5b..ffee7e453 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -16,21 +16,22 @@ use std::{ }; use memchr::memchr_iter; -use ouroboros::self_referencing; +use self_cell::self_cell; use uucore::error::{UResult, USimpleError}; use crate::{numeric_str_cmp::NumInfo, GeneralF64ParseResult, GlobalSettings, Line, SortError}; -/// The chunk that is passed around between threads. -/// `lines` consist of slices into `buffer`. -#[self_referencing(pub_extras)] -#[derive(Debug)] -pub struct Chunk { - pub buffer: Vec, - #[borrows(buffer)] - #[covariant] - pub contents: ChunkContents<'this>, -} +self_cell!( + /// The chunk that is passed around between threads. + pub struct Chunk { + owner: Vec, + + #[covariant] + dependent: ChunkContents, + } + + impl {Debug} +); #[derive(Debug)] pub struct ChunkContents<'a> { @@ -48,7 +49,7 @@ pub struct LineData<'a> { impl Chunk { /// Destroy this chunk and return its components to be reused. pub fn recycle(mut self) -> RecycledChunk { - let recycled_contents = self.with_contents_mut(|contents| { + let recycled_contents = self.with_dependent_mut(|_, contents| { contents.lines.clear(); contents.line_data.selections.clear(); contents.line_data.num_infos.clear(); @@ -81,15 +82,15 @@ impl Chunk { selections: recycled_contents.1, num_infos: recycled_contents.2, parsed_floats: recycled_contents.3, - buffer: self.into_heads().buffer, + buffer: self.into_owner(), } } pub fn lines(&self) -> &Vec { - &self.borrow_contents().lines + &self.borrow_dependent().lines } pub fn line_data(&self) -> &LineData { - &self.borrow_contents().line_data + &self.borrow_dependent().line_data } } diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 45ddc7304..27cb12d0b 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -158,7 +158,7 @@ fn reader_writer< /// The function that is executed on the sorter thread. fn sorter(receiver: &Receiver, sender: &SyncSender, settings: &GlobalSettings) { while let Ok(mut payload) = receiver.recv() { - payload.with_contents_mut(|contents| { + payload.with_dependent_mut(|_, contents| { sort_by(&mut contents.lines, settings, &contents.line_data); }); if sender.send(payload).is_err() { diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index f6da0ee32..7c682d88f 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -288,7 +288,7 @@ impl<'a> FileMerger<'a> { file_number: file.file_number, }); - file.current_chunk.with_contents(|contents| { + file.current_chunk.with_dependent(|_, contents| { let current_line = &contents.lines[file.line_idx]; if settings.unique { if let Some(prev) = &prev { From bf7f3783d1b2d075e93eb60bc32fb8ed8ddbff46 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 19 Jun 2023 19:10:53 +0200 Subject: [PATCH 092/253] yes: allow --version Test: tests/help/help-version-getopt.sh --- src/uu/yes/src/yes.rs | 3 ++- tests/by-util/test_yes.rs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/uu/yes/src/yes.rs b/src/uu/yes/src/yes.rs index fd5124064..72c19b872 100644 --- a/src/uu/yes/src/yes.rs +++ b/src/uu/yes/src/yes.rs @@ -9,7 +9,7 @@ // cSpell:ignore strs -use clap::{builder::ValueParser, Arg, ArgAction, Command}; +use clap::{builder::ValueParser, crate_version, Arg, ArgAction, Command}; use std::error::Error; use std::ffi::OsString; use std::io::{self, Write}; @@ -44,6 +44,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app() -> Command { Command::new(uucore::util_name()) + .version(crate_version!()) .about(ABOUT) .override_usage(format_usage(USAGE)) .arg( diff --git a/tests/by-util/test_yes.rs b/tests/by-util/test_yes.rs index 89a68e7e1..a674f8245 100644 --- a/tests/by-util/test_yes.rs +++ b/tests/by-util/test_yes.rs @@ -35,6 +35,11 @@ fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails().code_is(1); } +#[test] +fn test_version() { + new_ucmd!().arg("--version").succeeds(); +} + #[test] fn test_simple() { run(NO_ARGS, b"y\ny\ny\ny\n"); From e70d7d3b90c66596ab54b573c55f10a407bcdb2f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 19 Jun 2023 22:32:49 +0200 Subject: [PATCH 093/253] Hack the tests/help/help-version-getopt.sh tests: * "hostid BEFORE --help" doesn't fail for GNU. we fail. we are probably doing better * "hostid BEFORE --help AFTER " same for this --- util/build-gnu.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 13fef7bb9..e3a523e34 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -232,3 +232,8 @@ sed -i -e "s/Try 'mv --help' for more information/For more information, try '--h sed -i -E "s|^([^#]*2_31.*)$|#\1|g" tests/misc/printf-cov.pl sed -i -e "s/du: invalid -t argument/du: invalid --threshold argument/" -e "s/du: option requires an argument/error: a value is required for '--threshold ' but none was supplied/" -e "/Try 'du --help' for more information./d" tests/du/threshold.sh + +# disable two kind of tests: +# "hostid BEFORE --help" doesn't fail for GNU. we fail. we are probably doing better +# "hostid BEFORE --help AFTER " same for this +sed -i -e "s/env \$prog \$BEFORE \$opt > out2/env \$prog \$BEFORE \$opt > out2 #/" -e "s/env \$prog \$BEFORE \$opt AFTER > out3/env \$prog \$BEFORE \$opt AFTER > out3 #/" -e "s/compare exp out2/compare exp out2 #/" -e "s/compare exp out3/compare exp out3 #/" tests/help/help-version-getopt.sh From e990f87edcac67e9df7f75d67a1c6c5fdce6548f Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 20 Jun 2023 15:23:54 +0200 Subject: [PATCH 094/253] touch: rename CURRENT to TIMESTAMP --- src/uu/touch/src/touch.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 55663fdab..8a21a2f5c 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -29,7 +29,7 @@ pub mod options { pub mod sources { pub static DATE: &str = "date"; pub static REFERENCE: &str = "reference"; - pub static CURRENT: &str = "current"; + pub static TIMESTAMP: &str = "timestamp"; } pub static HELP: &str = "help"; pub static ACCESS: &str = "access"; @@ -120,12 +120,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { (timestamp, timestamp) } (None, None) => { - let timestamp = - if let Some(current) = matches.get_one::(options::sources::CURRENT) { - parse_timestamp(current)? - } else { - local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap()) - }; + let timestamp = if let Some(ts) = matches.get_one::(options::sources::TIMESTAMP) + { + parse_timestamp(ts)? + } else { + local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap()) + }; (timestamp, timestamp) } }; @@ -243,7 +243,7 @@ pub fn uu_app() -> Command { .action(ArgAction::SetTrue), ) .arg( - Arg::new(options::sources::CURRENT) + Arg::new(options::sources::TIMESTAMP) .short('t') .help("use [[CC]YY]MMDDhhmm[.ss] instead of the current time") .value_name("STAMP"), @@ -255,7 +255,7 @@ pub fn uu_app() -> Command { .allow_hyphen_values(true) .help("parse argument and use it instead of current time") .value_name("STRING") - .conflicts_with(options::sources::CURRENT), + .conflicts_with(options::sources::TIMESTAMP), ) .arg( Arg::new(options::MODIFICATION) @@ -288,7 +288,7 @@ pub fn uu_app() -> Command { .value_name("FILE") .value_parser(ValueParser::os_string()) .value_hint(clap::ValueHint::AnyPath) - .conflicts_with(options::sources::CURRENT), + .conflicts_with(options::sources::TIMESTAMP), ) .arg( Arg::new(options::TIME) @@ -311,7 +311,7 @@ pub fn uu_app() -> Command { .group( ArgGroup::new(options::SOURCES) .args([ - options::sources::CURRENT, + options::sources::TIMESTAMP, options::sources::DATE, options::sources::REFERENCE, ]) From 98ef87af867cca01ea13f08e09eac147f15bc2ae Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 20 Jun 2023 15:28:32 +0200 Subject: [PATCH 095/253] touch: cleanup "spell-checker:ignore" line --- src/uu/touch/src/touch.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 8a21a2f5c..4efea56c4 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -6,7 +6,7 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -// spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm clapv PWSTR lpszfilepath hresult mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond humantime +// spell-checker:ignore (ToDO) filetime datetime MMDDhhmm lpszfilepath mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond humantime use clap::builder::ValueParser; use clap::{crate_version, Arg, ArgAction, ArgGroup, Command}; From 01af46e914e20936ae2c68ee4c06891233fdd0a0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 20 Jun 2023 15:45:55 +0200 Subject: [PATCH 096/253] Use misc instead of test Co-authored-by: Daniel Hofstetter --- util/build-gnu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index e3a523e34..2b7e5c0bf 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -236,4 +236,4 @@ sed -i -e "s/du: invalid -t argument/du: invalid --threshold argument/" -e "s/du # disable two kind of tests: # "hostid BEFORE --help" doesn't fail for GNU. we fail. we are probably doing better # "hostid BEFORE --help AFTER " same for this -sed -i -e "s/env \$prog \$BEFORE \$opt > out2/env \$prog \$BEFORE \$opt > out2 #/" -e "s/env \$prog \$BEFORE \$opt AFTER > out3/env \$prog \$BEFORE \$opt AFTER > out3 #/" -e "s/compare exp out2/compare exp out2 #/" -e "s/compare exp out3/compare exp out3 #/" tests/help/help-version-getopt.sh +sed -i -e "s/env \$prog \$BEFORE \$opt > out2/env \$prog \$BEFORE \$opt > out2 #/" -e "s/env \$prog \$BEFORE \$opt AFTER > out3/env \$prog \$BEFORE \$opt AFTER > out3 #/" -e "s/compare exp out2/compare exp out2 #/" -e "s/compare exp out3/compare exp out3 #/" tests/misc/help-version-getopt.sh From c3f2ac6f044e1d00cb440214c7ddb5d5bdeea505 Mon Sep 17 00:00:00 2001 From: yt2b Date: Tue, 20 Jun 2023 23:20:22 +0900 Subject: [PATCH 097/253] yes: add --version option --- src/uu/yes/src/yes.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/yes/src/yes.rs b/src/uu/yes/src/yes.rs index fd5124064..72c19b872 100644 --- a/src/uu/yes/src/yes.rs +++ b/src/uu/yes/src/yes.rs @@ -9,7 +9,7 @@ // cSpell:ignore strs -use clap::{builder::ValueParser, Arg, ArgAction, Command}; +use clap::{builder::ValueParser, crate_version, Arg, ArgAction, Command}; use std::error::Error; use std::ffi::OsString; use std::io::{self, Write}; @@ -44,6 +44,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app() -> Command { Command::new(uucore::util_name()) + .version(crate_version!()) .about(ABOUT) .override_usage(format_usage(USAGE)) .arg( From a3fe70f7b2669202b70fa70c7df2a983230db8f0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 20 Jun 2023 23:14:54 +0200 Subject: [PATCH 098/253] try to fix ignore intermittent --- .github/workflows/GnuTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GnuTests.yml b/.github/workflows/GnuTests.yml index 372bf0717..eb3e22a80 100644 --- a/.github/workflows/GnuTests.yml +++ b/.github/workflows/GnuTests.yml @@ -205,7 +205,7 @@ jobs: path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}' # https://github.com/uutils/coreutils/issues/4294 # https://github.com/uutils/coreutils/issues/4295 - IGNORE_INTERMITTENT='${path_UUTILS}/.github/workflows/ignore-intermittent.txt' + IGNORE_INTERMITTENT="${path_UUTILS}/.github/workflows/ignore-intermittent.txt" mkdir -p ${{ steps.vars.outputs.path_reference }} From 98d242de7e880ae52667e651aa3e9cef8c9cee08 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 22 Jun 2023 10:04:37 +0200 Subject: [PATCH 099/253] nl: fix typo in nl.md --- src/uu/nl/nl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/nl/nl.md b/src/uu/nl/nl.md index b64b9f627..d7cfc698f 100644 --- a/src/uu/nl/nl.md +++ b/src/uu/nl/nl.md @@ -1,4 +1,4 @@ -#nl +# nl ``` nl [OPTION]... [FILE]... From c32139784a33619344179ff85e9f18cf4c2c32eb Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 22 Jun 2023 14:30:53 +0200 Subject: [PATCH 100/253] nl: implement Default for Settings --- src/uu/nl/src/nl.rs | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 44fdec8c7..d3e90bc75 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -42,6 +42,24 @@ pub struct Settings { number_separator: String, } +impl Default for Settings { + fn default() -> Self { + Self { + header_numbering: NumberingStyle::NumberForNone, + body_numbering: NumberingStyle::NumberForAll, + footer_numbering: NumberingStyle::NumberForNone, + section_delimiter: ['\\', ':'], + starting_line_number: 1, + line_increment: 1, + join_blank_lines: 1, + number_width: 6, + number_format: NumberFormat::Right, + renumber: true, + number_separator: String::from("\t"), + } + } +} + // NumberingStyle stores which lines are to be numbered. // The possible options are: // 1. Number all lines @@ -87,20 +105,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uu_app().try_get_matches_from(args)?; - // A mutable settings object, initialized with the defaults. - let mut settings = Settings { - header_numbering: NumberingStyle::NumberForNone, - body_numbering: NumberingStyle::NumberForAll, - footer_numbering: NumberingStyle::NumberForNone, - section_delimiter: ['\\', ':'], - starting_line_number: 1, - line_increment: 1, - join_blank_lines: 1, - number_width: 6, - number_format: NumberFormat::Right, - renumber: true, - number_separator: String::from("\t"), - }; + let mut settings = Settings::default(); // Update the settings from the command line options, and terminate the // program if some options could not successfully be parsed. From d00134640bb19cc91f706e511c16ef31c14502d7 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 22 Jun 2023 14:33:32 +0200 Subject: [PATCH 101/253] nl: use "const" instead of "static" --- src/uu/nl/src/nl.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index d3e90bc75..809ff2650 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -18,8 +18,8 @@ use uucore::{format_usage, help_about, help_usage}; mod helper; -static ABOUT: &str = help_about!("nl.md"); -static USAGE: &str = help_usage!("nl.md"); +const ABOUT: &str = help_about!("nl.md"); +const USAGE: &str = help_usage!("nl.md"); // Settings store options used by nl to produce its output. pub struct Settings { From 0010fece35cf81274474c00b97ed9d7cb4095bc8 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 22 Jun 2023 14:35:04 +0200 Subject: [PATCH 102/253] nl: remove "spell-checker:ignore" line --- src/uu/nl/src/nl.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 809ff2650..7e18d7588 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -6,8 +6,6 @@ // * file that was distributed with this source code. // * -// spell-checker:ignore (ToDO) corasick memchr - use clap::{crate_version, Arg, ArgAction, Command}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; From 0144a3c78fc8f86767fc67ff19b1e5b7a33de471 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Jun 2023 13:43:21 +0000 Subject: [PATCH 103/253] fix(deps): update rust crate itertools to 0.11.0 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/uucore/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e39978ca..25414fb03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1275,9 +1275,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] diff --git a/Cargo.toml b/Cargo.toml index e92f6719e..c49b1c432 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -286,7 +286,7 @@ glob = "0.3.1" half = "2.2" indicatif = "0.17" is-terminal = "0.4.7" -itertools = "0.10.5" +itertools = "0.11.0" libc = "0.2.146" lscolors = { version = "0.14.0", default-features = false, features = [ "nu-ansi-term", diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 7fa4aa344..8fd5769c9 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -25,7 +25,7 @@ dunce = "1.0.4" wild = "2.1" glob = "0.3.1" # * optional -itertools = { version = "0.10.5", optional = true } +itertools = { version = "0.11.0", optional = true } thiserror = { workspace = true, optional = true } time = { workspace = true, optional = true, features = [ "formatting", From d57a5eb6a3c5f9f01b54f49d4961dc649763494f Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 24 Jun 2023 07:07:38 +0200 Subject: [PATCH 104/253] seq: remove two chars in seq.md --- src/uu/seq/seq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/seq/seq.md b/src/uu/seq/seq.md index 065404e20..8e67391e4 100644 --- a/src/uu/seq/seq.md +++ b/src/uu/seq/seq.md @@ -5,5 +5,5 @@ Display numbers from FIRST to LAST, in steps of INCREMENT. ``` seq [OPTION]... LAST seq [OPTION]... FIRST LAST -seq [OPTION]... FIRST INCREMENT LAST"; +seq [OPTION]... FIRST INCREMENT LAST ``` From 9324a52a5692319e97293b310e65041b7b9337ee Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 Jun 2023 08:25:07 +0000 Subject: [PATCH 105/253] chore(deps): update rust crate phf_codegen to 0.11.2 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 25414fb03..1e4265dc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1702,9 +1702,9 @@ dependencies = [ [[package]] name = "phf_codegen" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ "phf_generator", "phf_shared", diff --git a/Cargo.toml b/Cargo.toml index c49b1c432..21c455f0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -303,7 +303,7 @@ onig = { version = "~6.4", default-features = false } ouroboros = "0.15.6" parse_datetime = "0.4.0" phf = "0.11.1" -phf_codegen = "0.11.1" +phf_codegen = "0.11.2" platform-info = "2.0.1" quick-error = "2.0.1" rand = { version = "0.8", features = ["small_rng"] } From a02b3354e6fdba967e71a1cc2807fc7ccd1c9b88 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 Jun 2023 11:23:11 +0000 Subject: [PATCH 106/253] chore(deps): update rust crate phf to 0.11.2 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e4265dc7..240c14bc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1693,9 +1693,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "phf" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ "phf_shared", ] @@ -1722,9 +1722,9 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ "siphasher", ] diff --git a/Cargo.toml b/Cargo.toml index 21c455f0a..d975bace9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -302,7 +302,7 @@ once_cell = "1.18.0" onig = { version = "~6.4", default-features = false } ouroboros = "0.15.6" parse_datetime = "0.4.0" -phf = "0.11.1" +phf = "0.11.2" phf_codegen = "0.11.2" platform-info = "2.0.1" quick-error = "2.0.1" From ddcdda44db9ebbd8a8c73f6a167b0b76a7236915 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Jun 2023 00:18:33 +0200 Subject: [PATCH 107/253] Remove the auto capitalization of error message --- src/uucore/src/lib/mods/error.rs | 11 +---------- tests/by-util/test_cp.rs | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/uucore/src/lib/mods/error.rs b/src/uucore/src/lib/mods/error.rs index e564c7bb5..f0f62569d 100644 --- a/src/uucore/src/lib/mods/error.rs +++ b/src/uucore/src/lib/mods/error.rs @@ -396,7 +396,7 @@ impl Display for UIoError { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { use std::io::ErrorKind::*; - let mut message; + let message; let message = if self.inner.raw_os_error().is_some() { // These are errors that come directly from the OS. // We want to normalize their messages across systems, @@ -424,7 +424,6 @@ impl Display for UIoError { // (https://github.com/rust-lang/rust/issues/86442) // are stabilized, we should add them to the match statement. message = strip_errno(&self.inner); - capitalize(&mut message); &message } } @@ -435,7 +434,6 @@ impl Display for UIoError { // a file that was not found. // There are also errors with entirely custom messages. message = self.inner.to_string(); - capitalize(&mut message); &message }; if let Some(ctx) = &self.context { @@ -446,13 +444,6 @@ impl Display for UIoError { } } -/// Capitalize the first character of an ASCII string. -fn capitalize(text: &mut str) { - if let Some(first) = text.get_mut(..1) { - first.make_ascii_uppercase(); - } -} - /// Strip the trailing " (os error XX)" from io error strings. pub fn strip_errno(err: &std::io::Error) -> String { let mut msg = err.to_string(); diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index fa5845eac..5289489ea 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -2724,7 +2724,7 @@ fn test_copy_dir_preserve_permissions_inaccessible_file() { ucmd.args(&["-p", "-R", "d1", "d2"]) .fails() .code_is(1) - .stderr_only("cp: cannot open 'd1/f' for reading: Permission denied\n"); + .stderr_only("cp: cannot open 'd1/f' for reading: permission denied\n"); assert!(at.dir_exists("d2")); assert!(!at.file_exists("d2/f")); From 2f1b710752864bad86acf97a97bc5291efcfcce0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 25 Jun 2023 12:12:26 +0000 Subject: [PATCH 108/253] chore(deps): update vmactions/freebsd-vm action to v0.3.1 --- .github/workflows/freebsd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 9507b3a56..095ec3230 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -35,7 +35,7 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - name: Prepare, build and test - uses: vmactions/freebsd-vm@v0.3.0 + uses: vmactions/freebsd-vm@v0.3.1 with: usesh: true # We need jq to run show-utils.sh and bash to use inline shell string replacement @@ -125,7 +125,7 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - name: Prepare, build and test - uses: vmactions/freebsd-vm@v0.3.0 + uses: vmactions/freebsd-vm@v0.3.1 with: usesh: true # sync: sshfs From ae90bad6cf0baeec5441b594cdebdd357b0cdce3 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 25 Jun 2023 16:53:50 +0200 Subject: [PATCH 109/253] docs: add seq to extensions; add some backticks --- docs/src/extensions.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/src/extensions.md b/docs/src/extensions.md index 281d8ef2e..428ae84ca 100644 --- a/docs/src/extensions.md +++ b/docs/src/extensions.md @@ -61,7 +61,11 @@ feature is adopted from [FreeBSD](https://www.freebsd.org/cgi/man.cgi?cut). ## `fmt` -`fmt` has additional flags for prefixes: `-P/--skip-prefix`, `-x/--exact-prefix`, and -`-X/--exact-skip-prefix`. With `-m/--preserve-headers`, an attempt is made to detect and preserve -mail headers in the input. `-q/--quick` breaks lines more quickly. And `-T/--tab-width` defines the +`fmt` has additional flags for prefixes: `-P`/`--skip-prefix`, `-x`/`--exact-prefix`, and +`-X`/`--exact-skip-prefix`. With `-m`/`--preserve-headers`, an attempt is made to detect and preserve +mail headers in the input. `-q`/`--quick` breaks lines more quickly. And `-T`/`--tab-width` defines the number of spaces representing a tab when determining the line length. + +## `seq` + +`seq` provides `-t`/`--terminator` to set the terminator character. From 824097d22469d07e658597182a110a618d545763 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 25 Jun 2023 19:09:01 +0000 Subject: [PATCH 110/253] fix(deps): update rust crate libc to 0.2.147 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/uucore/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 240c14bc5..b50c79e02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1340,9 +1340,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" diff --git a/Cargo.toml b/Cargo.toml index d975bace9..6ec760a27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -287,7 +287,7 @@ half = "2.2" indicatif = "0.17" is-terminal = "0.4.7" itertools = "0.11.0" -libc = "0.2.146" +libc = "0.2.147" lscolors = { version = "0.14.0", default-features = false, features = [ "nu-ansi-term", ] } diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 8fd5769c9..19054811c 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -36,7 +36,7 @@ time = { workspace = true, optional = true, features = [ data-encoding = { version = "2.4", optional = true } data-encoding-macro = { version = "0.1.13", optional = true } z85 = { version = "3.0.5", optional = true } -libc = { version = "0.2.146", optional = true } +libc = { version = "0.2.147", optional = true } once_cell = { workspace = true } os_display = "0.1.3" From 0ba972b2139cc90317e5c560dd3c2e44beb5d3ac Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 25 Jun 2023 19:15:50 +0000 Subject: [PATCH 111/253] chore(deps): update rust crate self_cell to 1.0.1 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0d0f11e0..5c095a916 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2025,9 +2025,9 @@ checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "self_cell" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3926e239738d36060909ffe6f511502f92149a45a1fade7fe031cb2d33e88b" +checksum = "4c309e515543e67811222dbc9e3dd7e1056279b782e1dacffe4242b718734fb6" [[package]] name = "selinux" diff --git a/Cargo.toml b/Cargo.toml index 609bd3e57..3be87fad8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -313,7 +313,7 @@ regex = "1.8.4" rstest = "0.17.0" rust-ini = "0.19.0" same-file = "1.0.6" -self_cell = "1.0.0" +self_cell = "1.0.1" selinux = "0.4" signal-hook = "0.3.15" smallvec = { version = "1.10", features = ["union"] } From 0b06f2b4a8543a014afa15927728d16d9ba38eca Mon Sep 17 00:00:00 2001 From: Nikolai Date: Wed, 19 Apr 2023 05:06:32 +0100 Subject: [PATCH 112/253] fixing seq panic on none --- src/uu/seq/src/error.rs | 24 +++++++++++++++++++----- src/uu/seq/src/seq.rs | 11 +++++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/uu/seq/src/error.rs b/src/uu/seq/src/error.rs index ae641a978..ad6b5733a 100644 --- a/src/uu/seq/src/error.rs +++ b/src/uu/seq/src/error.rs @@ -25,6 +25,9 @@ pub enum SeqError { /// The parameter is the increment argument as a [`String`] as read /// from the command line. ZeroIncrement(String), + + /// No arguments were passed to this function, 1 or more is required + NoArguments, } impl SeqError { @@ -33,6 +36,7 @@ impl SeqError { match self { Self::ParseError(s, _) => s, Self::ZeroIncrement(s) => s, + Self::NoArguments => "", } } @@ -40,11 +44,12 @@ impl SeqError { fn argtype(&self) -> &str { match self { Self::ParseError(_, e) => match e { - ParseNumberError::Float => "floating point argument", - ParseNumberError::Nan => "'not-a-number' argument", - ParseNumberError::Hex => "hexadecimal argument", + ParseNumberError::Float => "invalid floating point argument: ", + ParseNumberError::Nan => "invalid 'not-a-number' argument: ", + ParseNumberError::Hex => "invalid hexadecimal argument: ", }, - Self::ZeroIncrement(_) => "Zero increment value", + Self::ZeroIncrement(_) => "invalid Zero increment value: ", + Self::NoArguments => "missing operand", } } } @@ -63,6 +68,15 @@ impl Error for SeqError {} impl Display for SeqError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "invalid {}: {}", self.argtype(), self.arg().quote()) + write!( + f, + "{}{}", + self.argtype(), + if self.arg() != "" { + self.arg().quote().to_string() + } else { + "".to_string() + } + ) } } diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 97382ed1b..44e0a7744 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -58,10 +58,13 @@ type RangeFloat = (ExtendedBigDecimal, ExtendedBigDecimal, ExtendedBigDecimal); pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uu_app().try_get_matches_from(args)?; - let numbers = matches - .get_many::(ARG_NUMBERS) - .unwrap() - .collect::>(); + let numbers_option = matches.get_many::(ARG_NUMBERS); + + if numbers_option.is_none() { + return Err(SeqError::NoArguments.into()); + } + + let numbers = numbers_option.unwrap().collect::>(); let options = SeqOptions { separator: matches From 644fd1c93ed38a0752380f111c93b9c7b6ff6256 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Jun 2023 22:29:08 +0200 Subject: [PATCH 113/253] fix some clippy warnings --- src/uu/seq/src/error.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/seq/src/error.rs b/src/uu/seq/src/error.rs index ad6b5733a..4945914d1 100644 --- a/src/uu/seq/src/error.rs +++ b/src/uu/seq/src/error.rs @@ -72,10 +72,10 @@ impl Display for SeqError { f, "{}{}", self.argtype(), - if self.arg() != "" { - self.arg().quote().to_string() + if self.arg() == "" { + String::new() } else { - "".to_string() + self.arg().quote().to_string() } ) } From b34e7f7bf6b7fe851a7579e92aa6be37fc95e9be Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 20 Jun 2023 11:28:05 -0700 Subject: [PATCH 114/253] du: directories have apparent size of 0 --- src/uu/du/src/du.rs | 4 +- tests/by-util/test_du.rs | 117 +++++++++++++-------------------------- tests/common/util.rs | 11 ++++ 3 files changed, 52 insertions(+), 80 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 3325ca1f5..db385c720 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -145,7 +145,7 @@ impl Stat { return Ok(Self { path: path.to_path_buf(), is_dir: metadata.is_dir(), - size: metadata.len(), + size: if path.is_dir() { 0 } else { metadata.len() }, blocks: metadata.blocks(), inodes: 1, inode: Some(file_info), @@ -162,7 +162,7 @@ impl Stat { Ok(Self { path: path.to_path_buf(), is_dir: metadata.is_dir(), - size: metadata.len(), + size: if path.is_dir() { 0 } else { metadata.len() }, blocks: size_on_disk / 1024 * 2, inode: file_info, inodes: 1, diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 699746f03..892b5cfb1 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -580,97 +580,58 @@ fn test_du_invalid_threshold() { #[test] fn test_du_apparent_size() { - let ts = TestScenario::new(util_name!()); - let result = ts.ucmd().arg("--apparent-size").succeeds(); + let (at, mut ucmd) = at_and_ucmd!(); - #[cfg(any(target_os = "linux", target_os = "android"))] + at.mkdir_all("a/b"); + + at.write("a/b/file1", "foo"); + at.write("a/b/file2", "foobar"); + + let result = ucmd.args(&["--apparent-size", "--all", "a"]).succeeds(); + + #[cfg(not(target_os = "windows"))] { - let result_reference = unwrap_or_return!(expected_result(&ts, &["--apparent-size"])); - assert_eq!(result.stdout_str(), result_reference.stdout_str()); + result.stdout_contains_line("1\ta/b/file2"); + result.stdout_contains_line("1\ta/b/file1"); + result.stdout_contains_line("1\ta/b"); + result.stdout_contains_line("1\ta"); } - #[cfg(not(any(target_os = "linux", target_os = "android")))] - _du_apparent_size(result.stdout_str()); -} - -#[cfg(target_os = "windows")] -fn _du_apparent_size(s: &str) { - assert_eq!( - s, - "1\t.\\subdir\\deeper\\deeper_dir -1\t.\\subdir\\deeper -6\t.\\subdir\\links -6\t.\\subdir -6\t. -" - ); -} -#[cfg(target_vendor = "apple")] -fn _du_apparent_size(s: &str) { - assert_eq!( - s, - "1\t./subdir/deeper/deeper_dir -1\t./subdir/deeper -6\t./subdir/links -6\t./subdir -6\t. -" - ); -} -#[cfg(target_os = "freebsd")] -fn _du_apparent_size(s: &str) { - assert_eq!( - s, - "1\t./subdir/deeper/deeper_dir -2\t./subdir/deeper -6\t./subdir/links -8\t./subdir -8\t. -" - ); -} -#[cfg(all( - not(target_vendor = "apple"), - not(target_os = "windows"), - not(target_os = "freebsd") -))] -fn _du_apparent_size(s: &str) { - assert_eq!( - s, - "5\t./subdir/deeper/deeper_dir -9\t./subdir/deeper -10\t./subdir/links -22\t./subdir -26\t. -" - ); + #[cfg(target_os = "windows")] + { + result.stdout_contains_line("1\ta\\b\\file2"); + result.stdout_contains_line("1\ta\\b\\file1"); + result.stdout_contains_line("1\ta\\b"); + result.stdout_contains_line("1\ta"); + } } #[test] fn test_du_bytes() { - let ts = TestScenario::new(util_name!()); - let result = ts.ucmd().arg("--bytes").succeeds(); + let (at, mut ucmd) = at_and_ucmd!(); - #[cfg(any(target_os = "linux", target_os = "android"))] + at.mkdir_all("a/b"); + + at.write("a/b/file1", "foo"); + at.write("a/b/file2", "foobar"); + + let result = ucmd.args(&["--bytes", "--all", "a"]).succeeds(); + + #[cfg(not(target_os = "windows"))] { - let result_reference = unwrap_or_return!(expected_result(&ts, &["--bytes"])); - assert_eq!(result.stdout_str(), result_reference.stdout_str()); + result.stdout_contains_line("6\ta/b/file2"); + result.stdout_contains_line("3\ta/b/file1"); + result.stdout_contains_line("9\ta/b"); + result.stdout_contains_line("9\ta"); } #[cfg(target_os = "windows")] - result.stdout_contains("5145\t.\\subdir\n"); - #[cfg(target_vendor = "apple")] - result.stdout_contains("5625\t./subdir\n"); - #[cfg(target_os = "freebsd")] - result.stdout_contains("7193\t./subdir\n"); - #[cfg(all( - not(target_vendor = "apple"), - not(target_os = "windows"), - not(target_os = "freebsd"), - not(target_os = "linux"), - not(target_os = "android"), - ))] - result.stdout_contains("21529\t./subdir\n"); + { + result.stdout_contains_line("6\ta\\b\\file2"); + result.stdout_contains_line("3\ta\\b\\file1"); + result.stdout_contains_line("9\ta\\b"); + result.stdout_contains_line("9\ta"); + } } #[test] diff --git a/tests/common/util.rs b/tests/common/util.rs index 0898a4ad7..995312f08 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -659,6 +659,17 @@ impl CmdResult { self } + #[track_caller] + pub fn stdout_contains_line>(&self, cmp: T) -> &Self { + assert!( + self.stdout_str().lines().any(|line| line == cmp.as_ref()), + "'{}' does not contain line '{}'", + self.stdout_str(), + cmp.as_ref() + ); + self + } + #[track_caller] pub fn stderr_contains>(&self, cmp: T) -> &Self { assert!( From c64f3ccbdd2810fbd6d85b0573772c20efe20d31 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 04:29:30 +0000 Subject: [PATCH 115/253] chore(deps): update rust crate fundu to 1.1.0 --- Cargo.lock | 13 +++++++++++-- Cargo.toml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0d0f11e0..3055d7394 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -969,9 +969,18 @@ dependencies = [ [[package]] name = "fundu" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47af3b646bdd738395be2db903fc11a5923b5e206016b8d4ad6db890bcae9bd5" +checksum = "d579dcb632d86591bdd7fc445e705b96cb2a7fb5488d918d956f392b6148e898" +dependencies = [ + "fundu-core", +] + +[[package]] +name = "fundu-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a363b75dd1e4b5bd2cdc305c47399c524cae24638b368b66b1a4c2a36482801f" [[package]] name = "futures" diff --git a/Cargo.toml b/Cargo.toml index 609bd3e57..cd52536f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -280,7 +280,7 @@ filetime = "0.2" fnv = "1.0.7" fs_extra = "1.3.0" fts-sys = "0.2" -fundu = "1.0.0" +fundu = "1.1.0" gcd = "2.3" glob = "0.3.1" half = "2.2" From 80c7ed9732562633a63aea8d0705b7ffe9a99bf8 Mon Sep 17 00:00:00 2001 From: Guillaume Ranquet Date: Thu, 8 Jun 2023 11:26:21 +0200 Subject: [PATCH 116/253] ls: force fetching metadata when called with -L -Z The metadata are not used but it permits to check the symlink is valid. We then return 1 on invalid symlinks when ls is invoked with ls -L -Z Signed-off-by: Guillaume Ranquet --- src/uu/ls/src/ls.rs | 14 ++++++++++++++ tests/by-util/test_ls.rs | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 7db591cf3..342c52cba 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -3008,6 +3008,20 @@ fn display_inode(metadata: &Metadata) -> String { #[allow(unused_variables)] fn get_security_context(config: &Config, p_buf: &Path, must_dereference: bool) -> String { let substitute_string = "?".to_string(); + // If we must dereference, ensure that the symlink is actually valid even if the system + // does not support SELinux. + // Conforms to the GNU coreutils where a dangling symlink results in exit code 1. + if must_dereference { + match get_metadata(p_buf, must_dereference) { + Err(err) => { + // The Path couldn't be dereferenced, so return early and set exit code 1 + // to indicate a minor error + show!(LsError::IOErrorContext(err, p_buf.to_path_buf(), false)); + return substitute_string; + } + Ok(md) => (), + } + } if config.selinux_supported { #[cfg(feature = "selinux")] { diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 1266a7cab..ad2c6424f 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -3137,6 +3137,16 @@ fn test_ls_dangling_symlinks() { .stderr_contains("No such file or directory") .stdout_contains(if cfg!(windows) { "dangle" } else { "? dangle" }); + scene + .ucmd() + .arg("-LZ") + .arg("temp_dir") + .fails() + .code_is(1) + .stderr_contains("cannot access") + .stderr_contains("No such file or directory") + .stdout_contains(if cfg!(windows) { "dangle" } else { "? dangle" }); + scene .ucmd() .arg("-Ll") From c05dbfa3b4f813019c2c668ace7fbc2fbf806c93 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 26 Jun 2023 16:21:59 +0200 Subject: [PATCH 117/253] seq: rename "--widths" to "--equal-width" for compatibility with GNU seq --- src/uu/seq/src/seq.rs | 14 +++++++------- tests/by-util/test_seq.rs | 11 +++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 97382ed1b..4562ddb7d 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -31,7 +31,7 @@ const USAGE: &str = help_usage!("seq.md"); const OPT_SEPARATOR: &str = "separator"; const OPT_TERMINATOR: &str = "terminator"; -const OPT_WIDTHS: &str = "widths"; +const OPT_EQUAL_WIDTH: &str = "equal-width"; const OPT_FORMAT: &str = "format"; const ARG_NUMBERS: &str = "numbers"; @@ -40,7 +40,7 @@ const ARG_NUMBERS: &str = "numbers"; struct SeqOptions<'a> { separator: String, terminator: String, - widths: bool, + equal_width: bool, format: Option<&'a str>, } @@ -74,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { .map(|s| s.as_str()) .unwrap_or("\n") .to_string(), - widths: matches.get_flag(OPT_WIDTHS), + equal_width: matches.get_flag(OPT_EQUAL_WIDTH), format: matches.get_one::(OPT_FORMAT).map(|s| s.as_str()), }; @@ -123,7 +123,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { (first, increment, last), &options.separator, &options.terminator, - options.widths, + options.equal_width, padding, options.format, ) @@ -137,7 +137,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { largest_dec, &options.separator, &options.terminator, - options.widths, + options.equal_width, padding, options.format, ), @@ -170,9 +170,9 @@ pub fn uu_app() -> Command { .help("Terminator character (defaults to \\n)"), ) .arg( - Arg::new(OPT_WIDTHS) + Arg::new(OPT_EQUAL_WIDTH) .short('w') - .long("widths") + .long("equal-width") .help("Equalize widths of all numbers by padding with zeros") .action(ArgAction::SetTrue), ) diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 63015b24a..02509b3b5 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -208,10 +208,13 @@ fn test_separator_and_terminator() { #[test] fn test_equalize_widths() { - new_ucmd!() - .args(&["-w", "5", "10"]) - .run() - .stdout_is("05\n06\n07\n08\n09\n10\n"); + let args = ["-w", "--equal-width"]; + for arg in args { + new_ucmd!() + .args(&[arg, "5", "10"]) + .run() + .stdout_is("05\n06\n07\n08\n09\n10\n"); + } } #[test] From 479340306ee339705dd8c15ebf549bf2a5d7ce24 Mon Sep 17 00:00:00 2001 From: Ideflop <94184575+Ideflop@users.noreply.github.com> Date: Mon, 5 Jun 2023 18:48:45 +0200 Subject: [PATCH 118/253] more: implement arguments -u/--plain and -F/--from-line --- src/uu/more/src/more.rs | 78 +++++++++++++++++++++++++------------- tests/by-util/test_more.rs | 8 ++++ 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index a43489566..43c5c5163 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -50,10 +50,11 @@ pub mod options { pub const FILES: &str = "files"; } -const MULTI_FILE_TOP_PROMPT: &str = "::::::::::::::\n{}\n::::::::::::::\n"; +const MULTI_FILE_TOP_PROMPT: &str = "\r::::::::::::::\n\r{}\n\r::::::::::::::\n"; struct Options { clean_print: bool, + from_line: usize, lines: Option, print_over: bool, silent: bool, @@ -72,8 +73,13 @@ impl Options { (None, Some(number)) if number > 0 => Some(number + 1), (_, _) => None, }; + let from_line = match matches.get_one::(options::FROM_LINE).copied() { + Some(number) if number > 1 => number - 1, + _ => 0, + }; Self { clean_print: matches.get_flag(options::CLEAN_PRINT), + from_line, lines, print_over: matches.get_flag(options::PRINT_OVER), silent: matches.get_flag(options::SILENT), @@ -90,7 +96,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { Err(e) => return Err(e.into()), }; - let options = Options::from(&matches); + let mut options = Options::from(&matches); let mut buff = String::new(); @@ -115,9 +121,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { format!("cannot open {}: No such file or directory", file.quote()), )); } - if length > 1 { - buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", file.to_str().unwrap())); - } let opened_file = match File::open(file) { Err(why) => { terminal::disable_raw_mode().unwrap(); @@ -130,14 +133,21 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { }; let mut reader = BufReader::new(opened_file); reader.read_to_string(&mut buff).unwrap(); - more(&buff, &mut stdout, next_file.copied(), &options)?; + more( + &buff, + &mut stdout, + length > 1, + file.to_str(), + next_file.copied(), + &mut options, + )?; buff.clear(); } reset_term(&mut stdout); } else if !std::io::stdin().is_terminal() { stdin().read_to_string(&mut buff).unwrap(); let mut stdout = setup_term(); - more(&buff, &mut stdout, None, &options)?; + more(&buff, &mut stdout, false, None, None, &mut options)?; reset_term(&mut stdout); } else { return Err(UUsageError::new(1, "bad usage")); @@ -179,6 +189,22 @@ pub fn uu_app() -> Command { .help("Squeeze multiple blank lines into one") .action(ArgAction::SetTrue), ) + .arg( + Arg::new(options::PLAIN) + .short('u') + .long(options::PLAIN) + .action(ArgAction::SetTrue) + .hide(true), + ) + .arg( + Arg::new(options::FROM_LINE) + .short('F') + .long(options::FROM_LINE) + .num_args(1) + .value_name("number") + .value_parser(value_parser!(usize)) + .help("Display file beginning from line number"), + ) .arg( Arg::new(options::LINES) .short('n') @@ -191,7 +217,6 @@ pub fn uu_app() -> Command { .arg( Arg::new(options::NUMBER) .long(options::NUMBER) - .required(false) .num_args(1) .value_parser(value_parser!(u16).range(0..)) .help("Same as --lines"), @@ -210,21 +235,6 @@ pub fn uu_app() -> Command { .long(options::NO_PAUSE) .help("Suppress pause after form feed"), ) - .arg( - Arg::new(options::PLAIN) - .short('u') - .long(options::PLAIN) - .help("Suppress underlining and bold"), - ) - .arg( - Arg::new(options::FROM_LINE) - .short('F') - .allow_hyphen_values(true) - .required(false) - .takes_value(true) - .value_name("number") - .help("Display file beginning from line number"), - ) .arg( Arg::new(options::PATTERN) .short('P') @@ -273,8 +283,10 @@ fn reset_term(_: &mut usize) {} fn more( buff: &str, stdout: &mut Stdout, + multiple_file: bool, + file: Option<&str>, next_file: Option<&str>, - options: &Options, + options: &mut Options, ) -> UResult<()> { let (cols, mut rows) = terminal::size().unwrap(); if let Some(number) = options.lines { @@ -284,7 +296,22 @@ fn more( let lines = break_buff(buff, usize::from(cols)); let mut pager = Pager::new(rows, lines, next_file, options); + + if multiple_file { + execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); + stdout.write_all( + MULTI_FILE_TOP_PROMPT + .replace("{}", file.unwrap_or_default()) + .as_bytes(), + )?; + pager.content_rows -= 3; + } pager.draw(stdout, None); + if multiple_file { + options.from_line = 0; + pager.content_rows += 3; + } + if pager.should_close() { return Ok(()); } @@ -406,7 +433,7 @@ impl<'a> Pager<'a> { fn new(rows: u16, lines: Vec, next_file: Option<&'a str>, options: &Options) -> Self { let line_count = lines.len(); Self { - upper_mark: 0, + upper_mark: options.from_line, content_rows: rows.saturating_sub(1), lines, next_file, @@ -535,7 +562,6 @@ impl<'a> Pager<'a> { }; let status = format!("--More--({status_inner})"); - let banner = match (self.silent, wrong_key) { (true, Some(key)) => format!( "{status} [Unknown key: '{key}'. Press 'h' for instructions. (unimplemented)]" diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index 95a4818b5..15388bbf6 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -21,9 +21,15 @@ fn test_valid_arg() { new_ucmd!().arg("-s").succeeds(); new_ucmd!().arg("--squeeze").succeeds(); + new_ucmd!().arg("-u").succeeds(); + new_ucmd!().arg("--plain").succeeds(); + new_ucmd!().arg("-n").arg("10").succeeds(); new_ucmd!().arg("--lines").arg("0").succeeds(); new_ucmd!().arg("--number").arg("0").succeeds(); + + new_ucmd!().arg("-F").arg("10").succeeds(); + new_ucmd!().arg("--from-line").arg("0").succeeds(); } } @@ -34,6 +40,8 @@ fn test_invalid_arg() { new_ucmd!().arg("--lines").arg("-10").fails(); new_ucmd!().arg("--number").arg("-10").fails(); + + new_ucmd!().arg("--from-line").arg("-10").fails(); } } From 77f8201fb8ab48e8f290c564e0c3dfe68b2a7687 Mon Sep 17 00:00:00 2001 From: Ideflop <94184575+Ideflop@users.noreply.github.com> Date: Mon, 5 Jun 2023 18:55:44 +0200 Subject: [PATCH 119/253] more: fix bug not displaying next file message and not stopping at end of file --- src/uu/more/src/more.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 43c5c5163..c488ba8af 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -312,7 +312,7 @@ fn more( pager.content_rows += 3; } - if pager.should_close() { + if pager.should_close() && next_file.is_none() { return Ok(()); } @@ -499,10 +499,10 @@ impl<'a> Pager<'a> { } fn draw(&mut self, stdout: &mut std::io::Stdout, wrong_key: Option) { + self.draw_lines(stdout); let lower_mark = self .line_count .min(self.upper_mark.saturating_add(self.content_rows.into())); - self.draw_lines(stdout); self.draw_prompt(stdout, lower_mark, wrong_key); stdout.flush().unwrap(); } From c4c3a354f84ff9786453b1d7ae5cda2e328ddcf4 Mon Sep 17 00:00:00 2001 From: Ideflop <94184575+Ideflop@users.noreply.github.com> Date: Tue, 6 Jun 2023 22:03:44 +0200 Subject: [PATCH 120/253] tests/more: test argument --from-line --- tests/by-util/test_more.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index 15388bbf6..d94a92185 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -45,6 +45,40 @@ fn test_invalid_arg() { } } +#[test] +fn test_argument_from_file() { + if std::io::stdout().is_terminal() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file = "test_file"; + + at.write(file, "1\n2"); + + // output all lines + scene + .ucmd() + .arg("-F") + .arg("0") + .arg(file) + .succeeds() + .no_stderr() + .stdout_contains("1") + .stdout_contains("2"); + + // output only the second line + scene + .ucmd() + .arg("-F") + .arg("2") + .arg(file) + .succeeds() + .no_stderr() + .stdout_contains("2") + .stdout_does_not_contain("1"); + } +} + #[test] fn test_more_dir_arg() { // Run the test only if there's a valid terminal, else do nothing From 0ff00ec44c8b8b124457e201f3ae32d379c00f23 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 26 Jun 2023 16:27:09 -0700 Subject: [PATCH 121/253] uucore: leading zeros are ignored in version compare --- src/uucore/src/lib/mods/version_cmp.rs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/uucore/src/lib/mods/version_cmp.rs b/src/uucore/src/lib/mods/version_cmp.rs index 99b8c8b40..2bbaffd25 100644 --- a/src/uucore/src/lib/mods/version_cmp.rs +++ b/src/uucore/src/lib/mods/version_cmp.rs @@ -141,8 +141,7 @@ pub fn version_cmp(mut a: &str, mut b: &str) -> Ordering { b = &b[b_numerical_end..]; if a.is_empty() && b.is_empty() { - // Default to the lexical comparison. - return str_cmp; + return std::cmp::Ordering::Equal; } } } @@ -229,14 +228,14 @@ mod tests { // Leading zeroes assert_eq!( version_cmp("012", "12"), - Ordering::Less, - "A single leading zero can make a difference" + Ordering::Equal, + "A single leading zero does not make a difference" ); assert_eq!( version_cmp("000800", "0000800"), - Ordering::Greater, - "Leading number of zeroes is used even if both non-zero number of zeros" + Ordering::Equal, + "Multiple leading zeros do not make a difference" ); // Numbers and other characters combined @@ -280,14 +279,8 @@ mod tests { assert_eq!( version_cmp("aa10aa0022", "aa010aa022"), - Ordering::Greater, - "The leading zeroes of the first number has priority." - ); - - assert_eq!( - version_cmp("aa10aa0022", "aa10aa022"), - Ordering::Less, - "The leading zeroes of other numbers than the first are used." + Ordering::Equal, + "Test multiple numeric values with leading zeros" ); assert_eq!( @@ -307,7 +300,7 @@ mod tests { assert_eq!( version_cmp("aa2000000000000000000000bb", "aa002000000000000000000000bb"), - Ordering::Greater, + Ordering::Equal, "Leading zeroes for numbers larger than u64::MAX are \ handled correctly without crashing" ); From ca315499c3372f51aafb16949f5e7b22e45f5309 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 26 Jun 2023 16:45:57 -0700 Subject: [PATCH 122/253] ls: update test result for version compare --- tests/by-util/test_ls.rs | 49 ++++------------------------------------ 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 1266a7cab..6814a640e 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2312,56 +2312,15 @@ fn test_ls_version_sort() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; for filename in [ - "a2", - "b1", - "b20", - "a1.4", - "a1.40", - "b3", - "b11", - "b20b", - "b20a", - "a100", - "a1.13", - "aa", - "a1", - "aaa", - "a1.00000040", - "abab", - "ab", - "a01.40", - "a001.001", - "a01.0000001", - "a01.001", - "a001.01", + "a2", "b1", "b20", "a1.4", "b3", "b11", "b20b", "b20a", "a100", "a1.13", "aa", "a1", "aaa", + "abab", "ab", "a01.40", "a001.001", ] { at.touch(filename); } let mut expected = vec![ - "a1", - "a001.001", - "a001.01", - "a01.0000001", - "a01.001", - "a1.4", - "a1.13", - "a01.40", - "a1.00000040", - "a1.40", - "a2", - "a100", - "aa", - "aaa", - "ab", - "abab", - "b1", - "b3", - "b11", - "b20", - "b20a", - "b20b", - "", // because of '\n' at the end of the output + "a1", "a001.001", "a1.4", "a1.13", "a01.40", "a2", "a100", "aa", "aaa", "ab", "abab", "b1", + "b3", "b11", "b20", "b20a", "b20b", "", // because of '\n' at the end of the output ]; let result = scene.ucmd().arg("-1v").succeeds(); From 01f70768d99e47a290568edaf165472a118fa39c Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 27 Jun 2023 14:57:06 +0200 Subject: [PATCH 123/253] cp: fix "unused variable" warnings on Windows --- tests/by-util/test_cp.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 5289489ea..3a00870c5 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1110,12 +1110,12 @@ fn test_cp_parents_with_permissions_copy_file() { at.mkdir_all("p1/p2"); at.touch(file); - let p1_mode = 0o0777; - let p2_mode = 0o0711; - let file_mode = 0o0702; - #[cfg(unix)] { + let p1_mode = 0o0777; + let p2_mode = 0o0711; + let file_mode = 0o0702; + at.set_mode("p1", p1_mode); at.set_mode("p1/p2", p2_mode); at.set_mode(file, file_mode); @@ -1151,12 +1151,12 @@ fn test_cp_parents_with_permissions_copy_dir() { at.mkdir_all(dir2); at.touch(file); - let p1_mode = 0o0777; - let p2_mode = 0o0711; - let file_mode = 0o0702; - #[cfg(unix)] { + let p1_mode = 0o0777; + let p2_mode = 0o0711; + let file_mode = 0o0702; + at.set_mode("p1", p1_mode); at.set_mode("p1/p2", p2_mode); at.set_mode(file, file_mode); @@ -3134,6 +3134,8 @@ fn test_cp_debug_sparse_auto() { .arg("a") .arg("b") .succeeds(); + + #[cfg(any(target_os = "linux", target_os = "macos"))] let stdout_str = result.stdout_str(); #[cfg(target_os = "macos")] From c99d81a05b1db27531686589d0635191f7a8c5f5 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 27 Jun 2023 15:05:27 +0200 Subject: [PATCH 124/253] du: fix "unused import" warning on Windows --- tests/by-util/test_du.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 892b5cfb1..d365bd87e 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -6,6 +6,7 @@ // spell-checker:ignore (paths) sublink subwords azerty azeaze xcwww azeaz amaz azea qzerty tazerty tsublink #[cfg(not(windows))] use regex::Regex; +#[cfg(not(windows))] use std::io::Write; #[cfg(any(target_os = "linux", target_os = "android"))] From 732dbb3f125ffa8540bba3a6de5e66f39c681fa3 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 27 Jun 2023 16:46:50 +0200 Subject: [PATCH 125/253] cp: fix "unused variable" warning on Windows --- tests/by-util/test_cp.rs | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 3a00870c5..3074513de 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -3127,8 +3127,9 @@ fn test_cp_debug_sparse_auto() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts - .ucmd() + + #[cfg(not(any(target_os = "linux", target_os = "macos")))] + ts.ucmd() .arg("--debug") .arg("--sparse=auto") .arg("a") @@ -3136,18 +3137,29 @@ fn test_cp_debug_sparse_auto() { .succeeds(); #[cfg(any(target_os = "linux", target_os = "macos"))] - let stdout_str = result.stdout_str(); - - #[cfg(target_os = "macos")] - if !stdout_str - .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") { - panic!("Failure: stdout was \n{stdout_str}"); - } + let result = ts + .ucmd() + .arg("--debug") + .arg("--sparse=auto") + .arg("a") + .arg("b") + .succeeds(); - #[cfg(target_os = "linux")] - if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); + let stdout_str = result.stdout_str(); + + #[cfg(target_os = "macos")] + if !stdout_str + .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") + { + panic!("Failure: stdout was \n{stdout_str}"); + } + + #[cfg(target_os = "linux")] + if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") + { + panic!("Failure: stdout was \n{stdout_str}"); + } } } From d2e7ba2da1abe2bb2c1af710a36b50b2b8b50842 Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 27 Jun 2023 12:15:58 -0700 Subject: [PATCH 126/253] sort: add tests for stable and unstable sort --- src/uucore/src/lib/mods/version_cmp.rs | 8 +++----- tests/by-util/test_sort.rs | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/uucore/src/lib/mods/version_cmp.rs b/src/uucore/src/lib/mods/version_cmp.rs index 2bbaffd25..828b7f2a6 100644 --- a/src/uucore/src/lib/mods/version_cmp.rs +++ b/src/uucore/src/lib/mods/version_cmp.rs @@ -106,7 +106,7 @@ pub fn version_cmp(mut a: &str, mut b: &str) -> Ordering { // 1. Compare leading non-numerical part // 2. Compare leading numerical part // 3. Repeat - loop { + while !a.is_empty() || !b.is_empty() { let a_numerical_start = a.find(|c: char| c.is_ascii_digit()).unwrap_or(a.len()); let b_numerical_start = b.find(|c: char| c.is_ascii_digit()).unwrap_or(b.len()); @@ -139,11 +139,9 @@ pub fn version_cmp(mut a: &str, mut b: &str) -> Ordering { a = &a[a_numerical_end..]; b = &b[b_numerical_end..]; - - if a.is_empty() && b.is_empty() { - return std::cmp::Ordering::Equal; - } } + + Ordering::Equal } #[cfg(test)] diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index e66a405ab..0c8af8969 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -134,6 +134,25 @@ fn test_version_empty_lines() { test_helper("version-empty-lines", &["-V", "--version-sort"]); } +#[test] +fn test_version_sort_unstable() { + new_ucmd!() + .arg("--sort=version") + .pipe_in("0.1\n0.02\n0.2\n0.002\n0.3\n") + .succeeds() + .stdout_is("0.1\n0.002\n0.02\n0.2\n0.3\n"); +} + +#[test] +fn test_version_sort_stable() { + new_ucmd!() + .arg("--stable") + .arg("--sort=version") + .pipe_in("0.1\n0.02\n0.2\n0.002\n0.3\n") + .succeeds() + .stdout_is("0.1\n0.02\n0.2\n0.002\n0.3\n"); +} + #[test] fn test_human_numeric_whitespace() { test_helper( From 2d76a3b88e8922a8f7c4cc76cbab38bbafa1b155 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 28 Jun 2023 14:43:35 +0200 Subject: [PATCH 127/253] df: disable failing tests on Windows --- tests/by-util/test_df.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_df.rs b/tests/by-util/test_df.rs index a5100e471..926d1be5d 100644 --- a/tests/by-util/test_df.rs +++ b/tests/by-util/test_df.rs @@ -258,7 +258,7 @@ fn test_type_option() { } #[test] -#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD +#[cfg(not(any(target_os = "freebsd", target_os = "windows")))] // FIXME: fix test for FreeBSD & Win fn test_type_option_with_file() { let fs_type = new_ucmd!() .args(&["--output=fstype", "."]) @@ -806,7 +806,7 @@ fn test_output_file_all_filesystems() { } #[test] -#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD +#[cfg(not(any(target_os = "freebsd", target_os = "windows")))] // FIXME: fix test for FreeBSD & Win fn test_output_file_specific_files() { // Create three files. let (at, mut ucmd) = at_and_ucmd!(); @@ -825,7 +825,7 @@ fn test_output_file_specific_files() { } #[test] -#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD +#[cfg(not(any(target_os = "freebsd", target_os = "windows")))] // FIXME: fix test for FreeBSD & Win fn test_file_column_width_if_filename_contains_unicode_chars() { let (at, mut ucmd) = at_and_ucmd!(); at.touch("äöü.txt"); @@ -848,7 +848,7 @@ fn test_output_field_no_more_than_once() { } #[test] -#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD +#[cfg(not(any(target_os = "freebsd", target_os = "windows")))] // FIXME: fix test for FreeBSD & Win fn test_nonexistent_file() { new_ucmd!() .arg("does-not-exist") From 24aff229da4adba9e9ab5ed05e536f57d9a7ee3a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 23 Jun 2023 23:58:38 +0200 Subject: [PATCH 128/253] Add a function to detect if file is likely to be the simple backup file --- src/uucore/src/lib/mods/backup_control.rs | 52 +++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/uucore/src/lib/mods/backup_control.rs b/src/uucore/src/lib/mods/backup_control.rs index 2d161c43f..9998c7560 100644 --- a/src/uucore/src/lib/mods/backup_control.rs +++ b/src/uucore/src/lib/mods/backup_control.rs @@ -438,6 +438,32 @@ fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf { } } +/// Returns true if the source file is likely to be the simple backup file for the target file. +/// +/// # Arguments +/// +/// * `source` - A Path reference that holds the source (backup) file path. +/// * `target` - A Path reference that holds the target file path. +/// * `suffix` - Str that holds the backup suffix. +/// +/// # Examples +/// +/// ``` +/// use std::path::Path; +/// use uucore::backup_control::source_is_target_backup; +/// let source = Path::new("data.txt~"); +/// let target = Path::new("data.txt"); +/// let suffix = String::from("~"); +/// +/// assert_eq!(source_is_target_backup(&source, &target, &suffix), true); +/// ``` +/// +pub fn source_is_target_backup(source: &Path, target: &Path, suffix: &str) -> bool { + let source_filename = source.to_string_lossy(); + let target_backup_filename = format!("{}{suffix}", target.to_string_lossy()); + source_filename == target_backup_filename +} + // // Tests for this module // @@ -626,4 +652,30 @@ mod tests { let result = determine_backup_suffix(&matches); assert_eq!(result, "-v"); } + #[test] + fn test_source_is_target_backup() { + let source = Path::new("data.txt.bak"); + let target = Path::new("data.txt"); + let suffix = String::from(".bak"); + + assert!(source_is_target_backup(&source, &target, &suffix)); + } + + #[test] + fn test_source_is_not_target_backup() { + let source = Path::new("data.txt"); + let target = Path::new("backup.txt"); + let suffix = String::from(".bak"); + + assert!(!source_is_target_backup(&source, &target, &suffix)); + } + + #[test] + fn test_source_is_target_backup_with_tilde_suffix() { + let source = Path::new("example~"); + let target = Path::new("example"); + let suffix = String::from("~"); + + assert!(source_is_target_backup(&source, &target, &suffix)); + } } From 40c598852b7a3e6f7bca8ac2dbe4e1ffc662c3ca Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 24 Jun 2023 00:06:54 +0200 Subject: [PATCH 129/253] mv: add the check with --b=simple and when the source is a backup --- src/uu/mv/src/mv.rs | 13 ++++++++++++- tests/by-util/test_mv.rs | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 6289e79f9..32214b302 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -22,7 +22,7 @@ use std::os::unix; #[cfg(windows)] use std::os::windows; use std::path::{Path, PathBuf}; -use uucore::backup_control::{self, BackupMode}; +use uucore::backup_control::{self, source_is_target_backup, BackupMode}; use uucore::display::Quotable; use uucore::error::{set_exit_code, FromIo, UError, UResult, USimpleError, UUsageError}; use uucore::fs::{are_hardlinks_or_one_way_symlink_to_same_file, are_hardlinks_to_same_file}; @@ -251,6 +251,17 @@ fn parse_paths(files: &[OsString], b: &Behavior) -> Vec { } fn handle_two_paths(source: &Path, target: &Path, b: &Behavior) -> UResult<()> { + if b.backup == BackupMode::SimpleBackup && source_is_target_backup(source, target, &b.suffix) { + return Err(io::Error::new( + io::ErrorKind::NotFound, + format!( + "backing up {} might destroy source; {} not moved", + target.quote(), + source.quote() + ), + ) + .into()); + } if source.symlink_metadata().is_err() { return Err(MvError::NoSuchFile(source.quote().to_string()).into()); } diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 0c292c50d..ceaa4ba22 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -510,6 +510,22 @@ fn test_mv_same_hardlink_backup_simple() { .succeeds(); } +#[test] +#[cfg(all(unix, not(target_os = "android")))] +fn test_mv_same_hardlink_backup_simple_destroy() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_same_file_a~"; + let file_b = "test_mv_same_file_a"; + at.touch(file_a); + at.touch(file_b); + + ucmd.arg(file_a) + .arg(file_b) + .arg("--b=simple") + .fails() + .stderr_contains("backing up 'test_mv_same_file_a' might destroy source"); +} + #[test] fn test_mv_same_file_not_dot_dir() { let (at, mut ucmd) = at_and_ucmd!(); From 14e5f89a0e0426f49e4bd2f8006e94687968a4c2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 28 Jun 2023 23:04:50 +0200 Subject: [PATCH 130/253] Move memmap2 in the root workpace --- Cargo.toml | 3 ++- src/uu/tac/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4d7619142..ed9971d95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ # coreutils (uutils) # * see the repository LICENSE, README, and CONTRIBUTING files for more information -# spell-checker:ignore (libs) libselinux gethostid procfs bigdecimal kqueue fundu mangen datetime uuhelp +# spell-checker:ignore (libs) libselinux gethostid procfs bigdecimal kqueue fundu mangen datetime uuhelp memmap [package] name = "coreutils" @@ -292,6 +292,7 @@ lscolors = { version = "0.14.0", default-features = false, features = [ "nu-ansi-term", ] } memchr = "2" +memmap2 = "0.7" nix = { version = "0.26", default-features = false } nom = "7.1.3" notify = { version = "=6.0.1", features = ["macos_kqueue"] } diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 4455ebe13..32682facd 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -18,7 +18,7 @@ path = "src/tac.rs" [dependencies] memchr = { workspace = true } -memmap2 = "0.7" +memmap2 = { workspace = true } regex = { workspace = true } clap = { workspace = true } uucore = { workspace = true } From 5a1829e897a8ffdfec411883b45fced6a56afedd Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 29 Jun 2023 10:18:50 +0200 Subject: [PATCH 131/253] Bump proc-macro2 from 1.0.47 to 1.0.63 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6bfc3fbf..fa23c1ace 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1763,9 +1763,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] From a7f95d5a23826ad5bcdd4d2b8fbbb0b622295010 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Wed, 28 Jun 2023 21:38:13 -0700 Subject: [PATCH 132/253] hashsum: use file_stem() instead of file_name() This program matches the binary name to determine which algorithm to use. On Windows, `file_name()` was matching against a string with `.exe`, causing binaries like `sha256sum.exe` to not properly detect the algorithm. By using `file_stem()`, we exclude the `.exe` from matching, achieving similar and correct behavior on Windows. --- src/uu/hashsum/src/hashsum.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 7b571efcd..cc1b050fd 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -306,7 +306,7 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> { // if there is no program name for some reason, default to "hashsum" let program = args.next().unwrap_or_else(|| OsString::from(NAME)); let binary_name = Path::new(&program) - .file_name() + .file_stem() .unwrap_or_else(|| OsStr::new(NAME)) .to_string_lossy(); From 9bf1fb58387454bc608b605eee4fac253a1b43fb Mon Sep 17 00:00:00 2001 From: Joseph Jon Booker Date: Wed, 28 Jun 2023 23:10:45 -0500 Subject: [PATCH 133/253] util/build-gnu.sh reword error w/o gnu coreutils For a new contributor, the message given by `utils/build-gnu.sh` is fairly confusing - it starts with several lines of noise (showing variables that are set in the script) followed by an error about missing "GNU" and a `git` command string. This commit changes the script to explicitly instruct the user to run the `git clone` command. Since the GNU coreutils repository is probably missing for new developers, this error is shown if the repository is missing without including VARIABLE=value lines that are not actionable yet. --- util/build-gnu.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 2b7e5c0bf..88f4eda98 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -11,28 +11,31 @@ ME="${0}" ME_dir="$(dirname -- "$(readlink -fm -- "${ME}")")" REPO_main_dir="$(dirname -- "${ME_dir}")" -echo "ME='${ME}'" -echo "ME_dir='${ME_dir}'" -echo "REPO_main_dir='${REPO_main_dir}'" - ### * config (from environment with fallback defaults); note: GNU is expected to be a sibling repo directory path_UUTILS=${path_UUTILS:-${REPO_main_dir}} path_GNU="$(readlink -fm -- "${path_GNU:-${path_UUTILS}/../gnu}")" -echo "path_UUTILS='${path_UUTILS}'" -echo "path_GNU='${path_GNU}'" - ### if test ! -d "${path_GNU}"; then - echo "Could not find GNU (expected at '${path_GNU}')" + echo "Could not find GNU coreutils (expected at '${path_GNU}')" + echo "Run the following to download into the expected path:" echo "git clone --recurse-submodules https://github.com/coreutils/coreutils.git \"${path_GNU}\"" exit 1 fi ### +echo "ME='${ME}'" +echo "ME_dir='${ME_dir}'" +echo "REPO_main_dir='${REPO_main_dir}'" + +echo "path_UUTILS='${path_UUTILS}'" +echo "path_GNU='${path_GNU}'" + +### + UU_MAKE_PROFILE=${UU_MAKE_PROFILE:-release} echo "UU_MAKE_PROFILE='${UU_MAKE_PROFILE}'" From 863f91eca9cbcd1847c5af1b42a2e4288e4e07f4 Mon Sep 17 00:00:00 2001 From: crapStone Date: Thu, 29 Jun 2023 15:34:19 +0000 Subject: [PATCH 134/253] fix typos some arguments had the wrong case --- src/uu/dd/dd.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/dd/dd.md b/src/uu/dd/dd.md index b60fc14fa..504910884 100644 --- a/src/uu/dd/dd.md +++ b/src/uu/dd/dd.md @@ -13,7 +13,7 @@ Copy, and optionally convert, a file system resource ### Operands -- `Bs=BYTES` : read and write up to BYTES bytes at a time (default: 512); +- `bs=BYTES` : read and write up to BYTES bytes at a time (default: 512); overwrites `ibs` and `obs`. - `cbs=BYTES` : the 'conversion block size' in bytes. Applies to the `conv=block`, and `conv=unblock` operations. @@ -114,7 +114,7 @@ Copy, and optionally convert, a file system resource ### General Flags -- `Direct` : use direct I/O for data. +- `direct` : use direct I/O for data. - `directory` : fail unless the given input (if used as an iflag) or output (if used as an oflag) is a directory. - `dsync` : use synchronized I/O for data. From 4cdff3ba89ad4247ccd8e66bb307962a0155f0ae Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 30 Jun 2023 10:31:47 +0200 Subject: [PATCH 135/253] docs: add "ls --long" to extensions --- docs/src/extensions.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/src/extensions.md b/docs/src/extensions.md index 428ae84ca..ae3d974fe 100644 --- a/docs/src/extensions.md +++ b/docs/src/extensions.md @@ -69,3 +69,8 @@ number of spaces representing a tab when determining the line length. ## `seq` `seq` provides `-t`/`--terminator` to set the terminator character. + +## `ls` + +GNU `ls` provides two ways to use a long listing format: `-l` and `--format=long`. We support a +third way: `--long`. From 42bf580f132cd4951b31837f02d2d2a4849e8ecc Mon Sep 17 00:00:00 2001 From: sbentmar Date: Sat, 1 Jul 2023 17:08:12 +0200 Subject: [PATCH 136/253] numfmt: add --invalid option (#4249) * numfmt: add invalid option * numfmt: return code 0 if ignore or warn * numfmt: implement all --invalid modes * numfmt: validate stdout and stderr * numfmt: remove unnecessary code * numfmt: apply formatting * numfmt: fix clippy issues * numfmt: fix failing test cases * numfmt: fix formatting * numfmt: fix bug when handling broken pipe * numfmt: fix bug where extra newline was added * numfmt: add test cases for edge cases * numfmt: simplify error handling * numfmt: remove redundant if * numfmt: add newline between functions * numfmt: fix failing test cases * numfmt: add support for arg numbers using --invalid * numfmt: simplify error handling in value handlers * numfmt: fix merge conflict and align prints * numfmt: fix clippy suggestion * numfmt: replace "valid" with "invalid" in tests * numfmt: move INVALID to respect alph. order * numfmt: move printlns outside of match to avoid duplication Co-authored-by: Sylvestre Ledru * numfmt: remove empty line --------- Co-authored-by: Daniel Hofstetter Co-authored-by: Sylvestre Ledru --- src/uu/numfmt/src/numfmt.rs | 146 ++++++++++++++++++++++++++++++----- src/uu/numfmt/src/options.rs | 41 ++++++++++ tests/by-util/test_numfmt.rs | 75 +++++++++++++++++- 3 files changed, 241 insertions(+), 21 deletions(-) diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index f1fd4b115..112d68746 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -11,11 +11,13 @@ use crate::options::*; use crate::units::{Result, Unit}; use clap::{crate_version, parser::ValueSource, Arg, ArgAction, ArgMatches, Command}; use std::io::{BufRead, Write}; +use std::str::FromStr; + use units::{IEC_BASES, SI_BASES}; use uucore::display::Quotable; -use uucore::error::UResult; +use uucore::error::{UError, UResult}; use uucore::ranges::Range; -use uucore::{format_usage, help_about, help_section, help_usage}; +use uucore::{format_usage, help_about, help_section, help_usage, show, show_error}; pub mod errors; pub mod format; @@ -28,12 +30,8 @@ const USAGE: &str = help_usage!("numfmt.md"); fn handle_args<'a>(args: impl Iterator, options: &NumfmtOptions) -> UResult<()> { for l in args { - match format_and_print(l, options) { - Ok(_) => Ok(()), - Err(e) => Err(NumfmtError::FormattingError(e.to_string())), - }?; + format_and_handle_validation(l, options)?; } - Ok(()) } @@ -41,23 +39,41 @@ fn handle_buffer(input: R, options: &NumfmtOptions) -> UResult<()> where R: BufRead, { - let mut lines = input.lines(); - for (idx, line) in lines.by_ref().enumerate() { - match line { - Ok(l) if idx < options.header => { - println!("{l}"); + for (idx, line_result) in input.lines().by_ref().enumerate() { + match line_result { + Ok(line) if idx < options.header => { + println!("{line}"); Ok(()) } - Ok(l) => match format_and_print(&l, options) { - Ok(_) => Ok(()), - Err(e) => Err(NumfmtError::FormattingError(e.to_string())), - }, - Err(e) => Err(NumfmtError::IoError(e.to_string())), + Ok(line) => format_and_handle_validation(line.as_ref(), options), + Err(err) => return Err(Box::new(NumfmtError::IoError(err.to_string()))), }?; } Ok(()) } +fn format_and_handle_validation(input_line: &str, options: &NumfmtOptions) -> UResult<()> { + let handled_line = format_and_print(input_line, options); + + if let Err(error_message) = handled_line { + match options.invalid { + InvalidModes::Abort => { + return Err(Box::new(NumfmtError::FormattingError(error_message))); + } + InvalidModes::Fail => { + show!(NumfmtError::FormattingError(error_message)); + } + InvalidModes::Warn => { + show_error!("{}", error_message); + } + InvalidModes::Ignore => {} + }; + println!("{}", input_line); + } + + Ok(()) +} + fn parse_unit(s: &str) -> Result { match s { "auto" => Ok(Unit::Auto), @@ -201,6 +217,9 @@ fn parse_options(args: &ArgMatches) -> Result { .get_one::(options::SUFFIX) .map(|s| s.to_owned()); + let invalid = + InvalidModes::from_str(args.get_one::(options::INVALID).unwrap()).unwrap(); + Ok(NumfmtOptions { transform, padding, @@ -210,6 +229,7 @@ fn parse_options(args: &ArgMatches) -> Result { round, suffix, format, + invalid, }) } @@ -357,6 +377,17 @@ pub fn uu_app() -> Command { ) .value_name("SUFFIX"), ) + .arg( + Arg::new(options::INVALID) + .long(options::INVALID) + .help( + "set the failure mode for invalid input; \ + valid options are abort, fail, warn or ignore", + ) + .default_value("abort") + .value_parser(["abort", "fail", "warn", "ignore"]) + .value_name("INVALID"), + ) .arg( Arg::new(options::NUMBER) .hide(true) @@ -366,9 +397,11 @@ pub fn uu_app() -> Command { #[cfg(test)] mod tests { + use uucore::error::get_exit_code; + use super::{ - handle_buffer, parse_unit_size, parse_unit_size_suffix, FormatOptions, NumfmtOptions, - Range, RoundMethod, TransformOptions, Unit, + handle_args, handle_buffer, parse_unit_size, parse_unit_size_suffix, FormatOptions, + InvalidModes, NumfmtOptions, Range, RoundMethod, TransformOptions, Unit, }; use std::io::{BufReader, Error, ErrorKind, Read}; struct MockBuffer {} @@ -394,6 +427,7 @@ mod tests { round: RoundMethod::Nearest, suffix: None, format: FormatOptions::default(), + invalid: InvalidModes::Abort, } } @@ -409,6 +443,20 @@ mod tests { assert_eq!(result.code(), 1); } + #[test] + fn broken_buffer_returns_io_error_after_header() { + let mock_buffer = MockBuffer {}; + let mut options = get_valid_options(); + options.header = 0; + let result = handle_buffer(BufReader::new(mock_buffer), &options) + .expect_err("returned Ok after receiving IO error"); + let result_debug = format!("{:?}", result); + let result_display = format!("{}", result); + assert_eq!(result_debug, "IoError(\"broken pipe\")"); + assert_eq!(result_display, "broken pipe"); + assert_eq!(result.code(), 1); + } + #[test] fn non_numeric_returns_formatting_error() { let input_value = b"135\nhello"; @@ -431,6 +479,66 @@ mod tests { assert!(result.is_ok(), "did not return Ok for valid input"); } + #[test] + fn warn_returns_ok_for_invalid_input() { + let input_value = b"5\n4Q\n"; + let mut options = get_valid_options(); + options.invalid = InvalidModes::Warn; + let result = handle_buffer(BufReader::new(&input_value[..]), &options); + assert!(result.is_ok(), "did not return Ok for invalid input"); + } + + #[test] + fn ignore_returns_ok_for_invalid_input() { + let input_value = b"5\n4Q\n"; + let mut options = get_valid_options(); + options.invalid = InvalidModes::Ignore; + let result = handle_buffer(BufReader::new(&input_value[..]), &options); + assert!(result.is_ok(), "did not return Ok for invalid input"); + } + + #[test] + fn buffer_fail_returns_status_2_for_invalid_input() { + let input_value = b"5\n4Q\n"; + let mut options = get_valid_options(); + options.invalid = InvalidModes::Fail; + handle_buffer(BufReader::new(&input_value[..]), &options).unwrap(); + assert!( + get_exit_code() == 2, + "should set exit code 2 for formatting errors" + ); + } + + #[test] + fn abort_returns_status_2_for_invalid_input() { + let input_value = b"5\n4Q\n"; + let mut options = get_valid_options(); + options.invalid = InvalidModes::Abort; + let result = handle_buffer(BufReader::new(&input_value[..]), &options); + assert!(result.is_err(), "did not return err for invalid input"); + } + + #[test] + fn args_fail_returns_status_2_for_invalid_input() { + let input_value = ["5", "4Q"].into_iter(); + let mut options = get_valid_options(); + options.invalid = InvalidModes::Fail; + handle_args(input_value, &options).unwrap(); + assert!( + get_exit_code() == 2, + "should set exit code 2 for formatting errors" + ); + } + + #[test] + fn args_warn_returns_status_0_for_invalid_input() { + let input_value = ["5", "4Q"].into_iter(); + let mut options = get_valid_options(); + options.invalid = InvalidModes::Warn; + let result = handle_args(input_value, &options); + assert!(result.is_ok(), "did not return ok for invalid input"); + } + #[test] fn test_parse_unit_size() { assert_eq!(1, parse_unit_size("1").unwrap()); diff --git a/src/uu/numfmt/src/options.rs b/src/uu/numfmt/src/options.rs index b70cf87e4..bef4a8ce3 100644 --- a/src/uu/numfmt/src/options.rs +++ b/src/uu/numfmt/src/options.rs @@ -13,6 +13,7 @@ pub const FROM_UNIT: &str = "from-unit"; pub const FROM_UNIT_DEFAULT: &str = "1"; pub const HEADER: &str = "header"; pub const HEADER_DEFAULT: &str = "1"; +pub const INVALID: &str = "invalid"; pub const NUMBER: &str = "NUMBER"; pub const PADDING: &str = "padding"; pub const ROUND: &str = "round"; @@ -29,6 +30,14 @@ pub struct TransformOptions { pub to_unit: usize, } +#[derive(Debug, PartialEq, Eq)] +pub enum InvalidModes { + Abort, + Fail, + Warn, + Ignore, +} + pub struct NumfmtOptions { pub transform: TransformOptions, pub padding: isize, @@ -38,6 +47,7 @@ pub struct NumfmtOptions { pub round: RoundMethod, pub suffix: Option, pub format: FormatOptions, + pub invalid: InvalidModes, } #[derive(Clone, Copy)] @@ -227,6 +237,20 @@ impl FromStr for FormatOptions { } } +impl FromStr for InvalidModes { + type Err = String; + + fn from_str(s: &str) -> Result { + match s.to_lowercase().as_str() { + "abort" => Ok(Self::Abort), + "fail" => Ok(Self::Fail), + "warn" => Ok(Self::Warn), + "ignore" => Ok(Self::Ignore), + unknown => Err(format!("Unknown invalid mode: {unknown}")), + } + } +} + #[cfg(test)] mod tests { use super::*; @@ -336,4 +360,21 @@ mod tests { assert_eq!(expected_options, "%0'0'0'f".parse().unwrap()); assert_eq!(expected_options, "%'0'0'0f".parse().unwrap()); } + + #[test] + fn test_set_invalid_mode() { + assert_eq!(Ok(InvalidModes::Abort), InvalidModes::from_str("abort")); + assert_eq!(Ok(InvalidModes::Abort), InvalidModes::from_str("ABORT")); + + assert_eq!(Ok(InvalidModes::Fail), InvalidModes::from_str("fail")); + assert_eq!(Ok(InvalidModes::Fail), InvalidModes::from_str("FAIL")); + + assert_eq!(Ok(InvalidModes::Ignore), InvalidModes::from_str("ignore")); + assert_eq!(Ok(InvalidModes::Ignore), InvalidModes::from_str("IGNORE")); + + assert_eq!(Ok(InvalidModes::Warn), InvalidModes::from_str("warn")); + assert_eq!(Ok(InvalidModes::Warn), InvalidModes::from_str("WARN")); + + assert!(InvalidModes::from_str("something unknown").is_err()); + } } diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index fbfe68427..561752db3 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -666,8 +666,79 @@ fn test_invalid_stdin_number_in_middle_of_input() { } #[test] -fn test_invalid_argument_number_returns_status_2() { - new_ucmd!().args(&["hello"]).fails().code_is(2); +fn test_invalid_stdin_number_with_warn_returns_status_0() { + new_ucmd!() + .args(&["--invalid=warn"]) + .pipe_in("4Q") + .succeeds() + .stdout_is("4Q\n") + .stderr_is("numfmt: invalid suffix in input: '4Q'\n"); +} + +#[test] +fn test_invalid_stdin_number_with_ignore_returns_status_0() { + new_ucmd!() + .args(&["--invalid=ignore"]) + .pipe_in("4Q") + .succeeds() + .stdout_only("4Q\n"); +} + +#[test] +fn test_invalid_stdin_number_with_abort_returns_status_2() { + new_ucmd!() + .args(&["--invalid=abort"]) + .pipe_in("4Q") + .fails() + .code_is(2) + .stderr_only("numfmt: invalid suffix in input: '4Q'\n"); +} + +#[test] +fn test_invalid_stdin_number_with_fail_returns_status_2() { + new_ucmd!() + .args(&["--invalid=fail"]) + .pipe_in("4Q") + .fails() + .code_is(2) + .stdout_is("4Q\n") + .stderr_is("numfmt: invalid suffix in input: '4Q'\n"); +} + +#[test] +fn test_invalid_arg_number_with_warn_returns_status_0() { + new_ucmd!() + .args(&["--invalid=warn", "4Q"]) + .succeeds() + .stdout_is("4Q\n") + .stderr_is("numfmt: invalid suffix in input: '4Q'\n"); +} + +#[test] +fn test_invalid_arg_number_with_ignore_returns_status_0() { + new_ucmd!() + .args(&["--invalid=ignore", "4Q"]) + .succeeds() + .stdout_only("4Q\n"); +} + +#[test] +fn test_invalid_arg_number_with_abort_returns_status_2() { + new_ucmd!() + .args(&["--invalid=abort", "4Q"]) + .fails() + .code_is(2) + .stderr_only("numfmt: invalid suffix in input: '4Q'\n"); +} + +#[test] +fn test_invalid_arg_number_with_fail_returns_status_2() { + new_ucmd!() + .args(&["--invalid=fail", "4Q"]) + .fails() + .code_is(2) + .stdout_is("4Q\n") + .stderr_is("numfmt: invalid suffix in input: '4Q'\n"); } #[test] From ba509a1489b5ae6f9ec1505083327eaf0db5b541 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 3 Jul 2023 09:24:37 +0200 Subject: [PATCH 137/253] cp: use mkdir_all() instead of mkdir() in test --- tests/by-util/test_cp.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 3074513de..2bfd8231c 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -2345,12 +2345,8 @@ fn test_dir_recursive_copy() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - at.mkdir("parent1"); - at.mkdir("parent2"); - at.mkdir("parent1/child"); - at.mkdir("parent2/child1"); - at.mkdir("parent2/child1/child2"); - at.mkdir("parent2/child1/child2/child3"); + at.mkdir_all("parent1/child"); + at.mkdir_all("parent2/child1/child2/child3"); // case-1: copy parent1 -> parent1: should fail scene From 5a667db43daee79fd67c329f0dd808d6bbbf8357 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 3 Jul 2023 13:20:48 +0200 Subject: [PATCH 138/253] tail: clean up some small things in input parsing --- src/uu/tail/src/args.rs | 5 +++-- src/uu/tail/src/paths.rs | 9 ++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index eff332230..487e366e6 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -7,7 +7,7 @@ use crate::paths::Input; use crate::{parse, platform, Quotable}; -use clap::crate_version; +use clap::{crate_version, value_parser}; use clap::{Arg, ArgAction, ArgMatches, Command}; use fundu::DurationParser; use is_terminal::IsTerminal; @@ -283,7 +283,7 @@ impl Settings { } settings.inputs = matches - .get_raw(options::ARG_FILES) + .get_many::(options::ARG_FILES) .map(|v| v.map(Input::from).collect()) .unwrap_or_else(|| vec![Input::default()]); @@ -584,6 +584,7 @@ pub fn uu_app() -> Command { Arg::new(options::ARG_FILES) .action(ArgAction::Append) .num_args(1..) + .value_parser(value_parser!(OsString)) .value_hint(clap::ValueHint::FilePath), ) } diff --git a/src/uu/tail/src/paths.rs b/src/uu/tail/src/paths.rs index cce3270a8..5ed654037 100644 --- a/src/uu/tail/src/paths.rs +++ b/src/uu/tail/src/paths.rs @@ -10,10 +10,7 @@ use std::ffi::OsStr; use std::fs::{File, Metadata}; use std::io::{Seek, SeekFrom}; #[cfg(unix)] -use std::os::unix::{ - fs::{FileTypeExt, MetadataExt}, - prelude::OsStrExt, -}; +use std::os::unix::fs::{FileTypeExt, MetadataExt}; use std::path::{Path, PathBuf}; use uucore::error::UResult; @@ -26,9 +23,7 @@ pub enum InputKind { #[cfg(unix)] impl From<&OsStr> for InputKind { fn from(value: &OsStr) -> Self { - const DASH: [u8; 1] = [b'-']; - - if value.as_bytes() == DASH { + if value == OsStr::new("-") { Self::Stdin } else { Self::File(PathBuf::from(value)) From 9aef5ac35b974e1f081fd4d5d0e29a4e41fd58c5 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 11 Jun 2023 10:35:32 -0500 Subject: [PATCH 139/253] deps ~ change from 'humantime_to_duration' to 'parse_datetime' --- Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 5 ++--- src/uu/touch/src/touch.rs | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ed9971d95..2828c00df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ # coreutils (uutils) # * see the repository LICENSE, README, and CONTRIBUTING files for more information -# spell-checker:ignore (libs) libselinux gethostid procfs bigdecimal kqueue fundu mangen datetime uuhelp memmap +# spell-checker:ignore (libs) bigdecimal datetime fundu gethostid kqueue libselinux mangen memmap procfs uuhelp [package] name = "coreutils" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index f90725197..4e27027a2 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,4 +1,4 @@ -# spell-checker:ignore humantime +# spell-checker:ignore datetime [package] name = "uu_touch" version = "0.0.19" @@ -18,8 +18,7 @@ path = "src/touch.rs" [dependencies] filetime = { workspace = true } clap = { workspace = true } -# TODO: use workspace dependency (0.3) when switching from time to chrono -humantime_to_duration = "0.2.1" +parse_datetime = { workspace = true } time = { workspace = true, features = [ "parsing", "formatting", diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 4efea56c4..d3d4a08c5 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -84,7 +84,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { ) { (Some(reference), Some(date)) => { let (atime, mtime) = stat(Path::new(reference), !matches.get_flag(options::NO_DEREF))?; - if let Ok(offset) = humantime_to_duration::from_str(date) { + if let Ok(offset) = parse_datetime::from_str(date) { let mut seconds = offset.whole_seconds(); let mut nanos = offset.subsec_nanoseconds(); if nanos < 0 { @@ -445,7 +445,7 @@ fn parse_date(s: &str) -> UResult { } } - if let Ok(duration) = humantime_to_duration::from_str(s) { + if let Ok(duration) = parse_datetime::from_str(s) { let now_local = time::OffsetDateTime::now_local().unwrap(); let diff = now_local.checked_add(duration).unwrap(); return Ok(local_dt_to_filetime(diff)); From af64bde92b5f29cc1cb6519e29aae821b6afcf23 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 11 Jun 2023 19:45:06 -0500 Subject: [PATCH 140/253] fix/touch ~ time crate usage errors --- src/uu/touch/src/touch.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index d3d4a08c5..f4784f155 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -85,12 +85,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { (Some(reference), Some(date)) => { let (atime, mtime) = stat(Path::new(reference), !matches.get_flag(options::NO_DEREF))?; if let Ok(offset) = parse_datetime::from_str(date) { - let mut seconds = offset.whole_seconds(); - let mut nanos = offset.subsec_nanoseconds(); - if nanos < 0 { - nanos += 1_000_000_000; - seconds -= 1; - } + let seconds = offset.num_seconds(); + let nanos = offset.num_nanoseconds().unwrap_or(0) % 1_000_000_000; let ref_atime_secs = atime.unix_seconds(); let ref_atime_nanos = atime.nanoseconds(); @@ -447,7 +443,11 @@ fn parse_date(s: &str) -> UResult { if let Ok(duration) = parse_datetime::from_str(s) { let now_local = time::OffsetDateTime::now_local().unwrap(); - let diff = now_local.checked_add(duration).unwrap(); + let diff = now_local + .checked_add(time::Duration::nanoseconds( + duration.num_nanoseconds().unwrap(), + )) + .unwrap(); return Ok(local_dt_to_filetime(diff)); } From e491bbdbed1e0ad45a97ec423780713557c4bb6d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 3 Jul 2023 08:51:23 +0200 Subject: [PATCH 141/253] cp: allow multiple usages of -R/-r Closes: #5027 works for all other rm args --- src/uu/cp/src/cp.rs | 1 + tests/by-util/test_cp.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 60ef54095..de9dd1c91 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -383,6 +383,7 @@ pub fn uu_app() -> Command { backup_control::BACKUP_CONTROL_LONG_HELP )) .infer_long_args(true) + .args_override_self(true) .arg( Arg::new(options::TARGET_DIRECTORY) .short('t') diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 3074513de..4e6993679 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -158,6 +158,20 @@ fn test_cp_recurse() { assert_eq!(at.read(TEST_COPY_TO_FOLDER_NEW_FILE), "Hello, World!\n"); } +#[test] +#[cfg(not(target_os = "macos"))] +fn test_cp_recurse_several() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.arg("-r") + .arg("-r") + .arg(TEST_COPY_FROM_FOLDER) + .arg(TEST_COPY_TO_FOLDER_NEW) + .succeeds(); + + // Check the content of the destination file that was copied. + assert_eq!(at.read(TEST_COPY_TO_FOLDER_NEW_FILE), "Hello, World!\n"); +} + #[test] fn test_cp_with_dirs_t() { let (at, mut ucmd) = at_and_ucmd!(); From e6ec1490aac2c7df5eed59791126e61c97070549 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 3 Jul 2023 14:28:39 +0200 Subject: [PATCH 142/253] touch: use parse_datetime in Cargo.lock --- Cargo.lock | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa23c1ace..77afc4470 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1172,16 +1172,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "humantime_to_duration" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714764645f21cc70c4c151d7798dd158409641f37ad820bed65224aae403cbed" -dependencies = [ - "regex", - "time", -] - [[package]] name = "iana-time-zone" version = "0.1.53" @@ -3237,7 +3227,7 @@ version = "0.0.19" dependencies = [ "clap", "filetime", - "humantime_to_duration", + "parse_datetime", "time", "uucore", "windows-sys 0.48.0", From d033db35739d8bf2170aeab6128f8d8374b0919b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 3 Jul 2023 22:56:32 +0200 Subject: [PATCH 143/253] split: reject some invalid values Matches what is done in tests/split/fail.sh (still doesn't work) --- src/uu/split/src/split.rs | 39 +++++++++++++++++++++++++------------ tests/by-util/test_split.rs | 33 +++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 6e29e6f4b..8f6821de1 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -267,7 +267,11 @@ impl NumberType { let num_chunks = n_str .parse() .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?; - Ok(Self::Bytes(num_chunks)) + if num_chunks > 0 { + Ok(Self::Bytes(num_chunks)) + } else { + Err(NumberTypeError::NumberOfChunks(s.to_string())) + } } ["l", n_str] => { let num_chunks = n_str @@ -357,6 +361,20 @@ impl fmt::Display for StrategyError { impl Strategy { /// Parse a strategy from the command-line arguments. fn from(matches: &ArgMatches) -> Result { + fn get_and_parse( + matches: &ArgMatches, + option: &str, + strategy: fn(u64) -> Strategy, + error: fn(ParseSizeError) -> StrategyError, + ) -> Result { + let s = matches.get_one::(option).unwrap(); + let n = parse_size(&s).map_err(error)?; + if n > 0 { + Ok(strategy(n)) + } else { + Err(error(ParseSizeError::ParseFailure(s.to_string()))) + } + } // Check that the user is not specifying more than one strategy. // // Note: right now, this exact behavior cannot be handled by @@ -370,20 +388,17 @@ impl Strategy { ) { (false, false, false, false) => Ok(Self::Lines(1000)), (true, false, false, false) => { - let s = matches.get_one::(OPT_LINES).unwrap(); - let n = parse_size(s).map_err(StrategyError::Lines)?; - Ok(Self::Lines(n)) + get_and_parse(matches, OPT_LINES, Self::Lines, StrategyError::Lines) } (false, true, false, false) => { - let s = matches.get_one::(OPT_BYTES).unwrap(); - let n = parse_size(s).map_err(StrategyError::Bytes)?; - Ok(Self::Bytes(n)) - } - (false, false, true, false) => { - let s = matches.get_one::(OPT_LINE_BYTES).unwrap(); - let n = parse_size(s).map_err(StrategyError::Bytes)?; - Ok(Self::LineBytes(n)) + get_and_parse(matches, OPT_BYTES, Self::Bytes, StrategyError::Bytes) } + (false, false, true, false) => get_and_parse( + matches, + OPT_LINE_BYTES, + Self::LineBytes, + StrategyError::Bytes, + ), (false, false, false, true) => { let s = matches.get_one::(OPT_NUMBER).unwrap(); let number_type = NumberType::from(s).map_err(StrategyError::NumberType)?; diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 1395a4fa2..35e5ebb05 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -758,3 +758,36 @@ fn test_round_robin() { assert_eq!(file_read("xaa"), "1\n3\n5\n"); assert_eq!(file_read("xab"), "2\n4\n"); } + +#[test] +fn test_split_invalid_input() { + // Test if stdout/stderr for '--lines' option is correct + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch("file"); + + scene + .ucmd() + .args(&["--lines", "0", "file"]) + .fails() + .no_stdout() + .stderr_contains("split: invalid number of lines: 0"); + scene + .ucmd() + .args(&["-C", "0", "file"]) + .fails() + .no_stdout() + .stderr_contains("split: invalid number of bytes: 0"); + scene + .ucmd() + .args(&["-b", "0", "file"]) + .fails() + .no_stdout() + .stderr_contains("split: invalid number of bytes: 0"); + scene + .ucmd() + .args(&["-n", "0", "file"]) + .fails() + .no_stdout() + .stderr_contains("split: invalid number of chunks: 0"); +} From 18e5c5b5f7f2dddc8b20419d863c2c8786b441f4 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 4 Jul 2023 07:02:18 +0200 Subject: [PATCH 144/253] numfmt: remove duplicate info from help output --- src/uu/numfmt/src/numfmt.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 112d68746..b0a5670d4 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -360,10 +360,7 @@ pub fn uu_app() -> Command { .arg( Arg::new(options::ROUND) .long(options::ROUND) - .help( - "use METHOD for rounding when scaling; METHOD can be: up,\ - down, from-zero, towards-zero, nearest", - ) + .help("use METHOD for rounding when scaling") .value_name("METHOD") .default_value("from-zero") .value_parser(["up", "down", "from-zero", "towards-zero", "nearest"]), @@ -380,10 +377,7 @@ pub fn uu_app() -> Command { .arg( Arg::new(options::INVALID) .long(options::INVALID) - .help( - "set the failure mode for invalid input; \ - valid options are abort, fail, warn or ignore", - ) + .help("set the failure mode for invalid input") .default_value("abort") .value_parser(["abort", "fail", "warn", "ignore"]) .value_name("INVALID"), From 8e2401c8ee13b3f16d5903d3a8aa8c4eeaafa912 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 07:39:59 +0000 Subject: [PATCH 145/253] chore(deps): update rust crate rlimit to 0.10.0 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77afc4470..8390e592e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1909,9 +1909,9 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "rlimit" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a29d87a652dc4d43c586328706bb5cdff211f3f39a530f240b53f7221dab8e" +checksum = "9b5b8be0bc0ef630d24f8fa836b3a3463479b2343b29f9a8fa905c71a8c7b69b" dependencies = [ "libc", ] diff --git a/Cargo.toml b/Cargo.toml index 2828c00df..daa44eb6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -496,7 +496,7 @@ rstest = "0.17.0" [target.'cfg(any(target_os = "linux", target_os = "android"))'.dev-dependencies] procfs = { version = "0.15", default-features = false } -rlimit = "0.9.1" +rlimit = "0.10.0" [target.'cfg(unix)'.dev-dependencies] nix = { workspace = true, features = ["process", "signal", "user"] } From fee5225cb6be6b03d6b9f854fcc55a91f8c95441 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 4 Jul 2023 10:37:10 +0200 Subject: [PATCH 146/253] nl: make --no-renumber a flag --- src/uu/nl/src/helper.rs | 2 +- src/uu/nl/src/nl.rs | 3 ++- tests/by-util/test_nl.rs | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index a62936d75..dc2e9dfd8 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -29,7 +29,7 @@ fn parse_style(chars: &[char]) -> Result { pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> Vec { // This vector holds error messages encountered. let mut errs: Vec = vec![]; - settings.renumber = !opts.contains_id(options::NO_RENUMBER); + settings.renumber = opts.get_flag(options::NO_RENUMBER); match opts.get_one::(options::NUMBER_SEPARATOR) { None => {} Some(val) => { diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 7e18d7588..2e9bf92a0 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -213,7 +213,8 @@ pub fn uu_app() -> Command { Arg::new(options::NO_RENUMBER) .short('p') .long(options::NO_RENUMBER) - .help("do not reset line numbers at logical pages"), + .help("do not reset line numbers at logical pages") + .action(ArgAction::SetFalse), ) .arg( Arg::new(options::NUMBER_SEPARATOR) diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index 7317d8cca..39c076d43 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -71,3 +71,10 @@ fn test_sections_and_styles() { } // spell-checker:enable } + +#[test] +fn test_no_renumber() { + for arg in ["-p", "--no-renumber"] { + new_ucmd!().arg(arg).succeeds(); + } +} From 66afeef84adf47066f00c76e6516e46b982f74cf Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 4 Jul 2023 16:40:58 +0200 Subject: [PATCH 147/253] Bump hermit-abi and num_cpus hermit-abi from 0.3.1 -> 0.3.2 num_cpus from 1.14.0 -> 1.16.0 --- Cargo.lock | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8390e592e..8b4104e93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1136,18 +1136,9 @@ checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -1243,7 +1234,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi", "libc", "windows-sys 0.48.0", ] @@ -1254,7 +1245,7 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi", "io-lifetimes", "rustix 0.37.19", "windows-sys 0.48.0", @@ -1537,11 +1528,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi", "libc", ] From 9ac31e057df99c181e6609c966ce2de0b79bec5b Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 4 Jul 2023 16:42:25 +0200 Subject: [PATCH 148/253] deny.toml: remove hermit-abi from skip list --- deny.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/deny.toml b/deny.toml index 780de3c8c..c52b321dd 100644 --- a/deny.toml +++ b/deny.toml @@ -59,8 +59,6 @@ highlight = "all" # introduces it. # spell-checker: disable skip = [ - # is-terminal - { name = "hermit-abi", version = "0.3.1" }, # procfs { name = "rustix", version = "0.36.14" }, # rustix From 264d29a1695f95228d90f794d78d3e6a0631cb18 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 4 Jul 2023 18:45:11 +0200 Subject: [PATCH 149/253] fix the clippy warning --- src/uu/split/src/split.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 8f6821de1..f1be0c47d 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -368,7 +368,7 @@ impl Strategy { error: fn(ParseSizeError) -> StrategyError, ) -> Result { let s = matches.get_one::(option).unwrap(); - let n = parse_size(&s).map_err(error)?; + let n = parse_size(s).map_err(error)?; if n > 0 { Ok(strategy(n)) } else { From 4acd02c7a1cac5762ab301b4724fa498a9c0ff53 Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 4 Jul 2023 16:08:54 -0700 Subject: [PATCH 150/253] ls: string compare if version_cmp returns equal --- src/uu/ls/src/ls.rs | 6 +++-- tests/by-util/test_ls.rs | 49 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 7db591cf3..a5438f518 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1931,8 +1931,10 @@ fn sort_entries(entries: &mut [PathData], config: &Config, out: &mut BufWriter entries.sort_by_key(|k| Reverse(k.md(out).map(|md| md.len()).unwrap_or(0))), // The default sort in GNU ls is case insensitive Sort::Name => entries.sort_by(|a, b| a.display_name.cmp(&b.display_name)), - Sort::Version => entries - .sort_by(|a, b| version_cmp(&a.p_buf.to_string_lossy(), &b.p_buf.to_string_lossy())), + Sort::Version => entries.sort_by(|a, b| { + version_cmp(&a.p_buf.to_string_lossy(), &b.p_buf.to_string_lossy()) + .then(a.p_buf.to_string_lossy().cmp(&b.p_buf.to_string_lossy())) + }), Sort::Extension => entries.sort_by(|a, b| { a.p_buf .extension() diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 6814a640e..1266a7cab 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2312,15 +2312,56 @@ fn test_ls_version_sort() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; for filename in [ - "a2", "b1", "b20", "a1.4", "b3", "b11", "b20b", "b20a", "a100", "a1.13", "aa", "a1", "aaa", - "abab", "ab", "a01.40", "a001.001", + "a2", + "b1", + "b20", + "a1.4", + "a1.40", + "b3", + "b11", + "b20b", + "b20a", + "a100", + "a1.13", + "aa", + "a1", + "aaa", + "a1.00000040", + "abab", + "ab", + "a01.40", + "a001.001", + "a01.0000001", + "a01.001", + "a001.01", ] { at.touch(filename); } let mut expected = vec![ - "a1", "a001.001", "a1.4", "a1.13", "a01.40", "a2", "a100", "aa", "aaa", "ab", "abab", "b1", - "b3", "b11", "b20", "b20a", "b20b", "", // because of '\n' at the end of the output + "a1", + "a001.001", + "a001.01", + "a01.0000001", + "a01.001", + "a1.4", + "a1.13", + "a01.40", + "a1.00000040", + "a1.40", + "a2", + "a100", + "aa", + "aaa", + "ab", + "abab", + "b1", + "b3", + "b11", + "b20", + "b20a", + "b20b", + "", // because of '\n' at the end of the output ]; let result = scene.ucmd().arg("-1v").succeeds(); From e9405250f49a5a649c860e0d62039ad28310cf53 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 26 Jun 2023 16:27:09 -0700 Subject: [PATCH 151/253] uucore: leading zeros are ignored in version compare --- src/uucore/src/lib/mods/version_cmp.rs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/uucore/src/lib/mods/version_cmp.rs b/src/uucore/src/lib/mods/version_cmp.rs index 99b8c8b40..2bbaffd25 100644 --- a/src/uucore/src/lib/mods/version_cmp.rs +++ b/src/uucore/src/lib/mods/version_cmp.rs @@ -141,8 +141,7 @@ pub fn version_cmp(mut a: &str, mut b: &str) -> Ordering { b = &b[b_numerical_end..]; if a.is_empty() && b.is_empty() { - // Default to the lexical comparison. - return str_cmp; + return std::cmp::Ordering::Equal; } } } @@ -229,14 +228,14 @@ mod tests { // Leading zeroes assert_eq!( version_cmp("012", "12"), - Ordering::Less, - "A single leading zero can make a difference" + Ordering::Equal, + "A single leading zero does not make a difference" ); assert_eq!( version_cmp("000800", "0000800"), - Ordering::Greater, - "Leading number of zeroes is used even if both non-zero number of zeros" + Ordering::Equal, + "Multiple leading zeros do not make a difference" ); // Numbers and other characters combined @@ -280,14 +279,8 @@ mod tests { assert_eq!( version_cmp("aa10aa0022", "aa010aa022"), - Ordering::Greater, - "The leading zeroes of the first number has priority." - ); - - assert_eq!( - version_cmp("aa10aa0022", "aa10aa022"), - Ordering::Less, - "The leading zeroes of other numbers than the first are used." + Ordering::Equal, + "Test multiple numeric values with leading zeros" ); assert_eq!( @@ -307,7 +300,7 @@ mod tests { assert_eq!( version_cmp("aa2000000000000000000000bb", "aa002000000000000000000000bb"), - Ordering::Greater, + Ordering::Equal, "Leading zeroes for numbers larger than u64::MAX are \ handled correctly without crashing" ); From b42a5b87412e91a4e3a42fb01bbe9326c0d9e2ed Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 26 Jun 2023 16:45:57 -0700 Subject: [PATCH 152/253] ls: update test result for version compare --- tests/by-util/test_ls.rs | 49 ++++------------------------------------ 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index ad2c6424f..f376cf53d 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2312,56 +2312,15 @@ fn test_ls_version_sort() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; for filename in [ - "a2", - "b1", - "b20", - "a1.4", - "a1.40", - "b3", - "b11", - "b20b", - "b20a", - "a100", - "a1.13", - "aa", - "a1", - "aaa", - "a1.00000040", - "abab", - "ab", - "a01.40", - "a001.001", - "a01.0000001", - "a01.001", - "a001.01", + "a2", "b1", "b20", "a1.4", "b3", "b11", "b20b", "b20a", "a100", "a1.13", "aa", "a1", "aaa", + "abab", "ab", "a01.40", "a001.001", ] { at.touch(filename); } let mut expected = vec![ - "a1", - "a001.001", - "a001.01", - "a01.0000001", - "a01.001", - "a1.4", - "a1.13", - "a01.40", - "a1.00000040", - "a1.40", - "a2", - "a100", - "aa", - "aaa", - "ab", - "abab", - "b1", - "b3", - "b11", - "b20", - "b20a", - "b20b", - "", // because of '\n' at the end of the output + "a1", "a001.001", "a1.4", "a1.13", "a01.40", "a2", "a100", "aa", "aaa", "ab", "abab", "b1", + "b3", "b11", "b20", "b20a", "b20b", "", // because of '\n' at the end of the output ]; let result = scene.ucmd().arg("-1v").succeeds(); From 844cbdc5a46ef7d5b645306b8677227b3a523e8d Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 27 Jun 2023 12:15:58 -0700 Subject: [PATCH 153/253] sort: add tests for stable and unstable sort --- src/uucore/src/lib/mods/version_cmp.rs | 8 +++----- tests/by-util/test_sort.rs | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/uucore/src/lib/mods/version_cmp.rs b/src/uucore/src/lib/mods/version_cmp.rs index 2bbaffd25..828b7f2a6 100644 --- a/src/uucore/src/lib/mods/version_cmp.rs +++ b/src/uucore/src/lib/mods/version_cmp.rs @@ -106,7 +106,7 @@ pub fn version_cmp(mut a: &str, mut b: &str) -> Ordering { // 1. Compare leading non-numerical part // 2. Compare leading numerical part // 3. Repeat - loop { + while !a.is_empty() || !b.is_empty() { let a_numerical_start = a.find(|c: char| c.is_ascii_digit()).unwrap_or(a.len()); let b_numerical_start = b.find(|c: char| c.is_ascii_digit()).unwrap_or(b.len()); @@ -139,11 +139,9 @@ pub fn version_cmp(mut a: &str, mut b: &str) -> Ordering { a = &a[a_numerical_end..]; b = &b[b_numerical_end..]; - - if a.is_empty() && b.is_empty() { - return std::cmp::Ordering::Equal; - } } + + Ordering::Equal } #[cfg(test)] diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index e66a405ab..0c8af8969 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -134,6 +134,25 @@ fn test_version_empty_lines() { test_helper("version-empty-lines", &["-V", "--version-sort"]); } +#[test] +fn test_version_sort_unstable() { + new_ucmd!() + .arg("--sort=version") + .pipe_in("0.1\n0.02\n0.2\n0.002\n0.3\n") + .succeeds() + .stdout_is("0.1\n0.002\n0.02\n0.2\n0.3\n"); +} + +#[test] +fn test_version_sort_stable() { + new_ucmd!() + .arg("--stable") + .arg("--sort=version") + .pipe_in("0.1\n0.02\n0.2\n0.002\n0.3\n") + .succeeds() + .stdout_is("0.1\n0.02\n0.2\n0.002\n0.3\n"); +} + #[test] fn test_human_numeric_whitespace() { test_helper( From 51a4fa0c49e8197e2b0e8a8f92e55e3c673f492a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 5 Jul 2023 10:14:12 +0200 Subject: [PATCH 154/253] Bump iana-time-zone-haiku from 0.1.1 to 0.1.2 --- Cargo.lock | 89 +++--------------------------------------------------- 1 file changed, 5 insertions(+), 84 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b4104e93..d7c6391de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,9 +233,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.77" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cexpr" @@ -324,16 +324,6 @@ dependencies = [ "roff", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "colorchoice" version = "1.0.0" @@ -730,50 +720,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -[[package]] -name = "cxx" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "data-encoding" version = "2.4.0" @@ -1179,12 +1125,11 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] @@ -1332,15 +1277,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "link-cplusplus" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" -dependencies = [ - "cc", -] - [[package]] name = "linux-raw-sys" version = "0.1.4" @@ -2007,12 +1943,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scratch" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" - [[package]] name = "self_cell" version = "1.0.1" @@ -2223,15 +2153,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - [[package]] name = "terminal_size" version = "0.2.6" From 2947c00e4c97367314ecd9b49e5837af043626a5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:30:04 +0000 Subject: [PATCH 155/253] chore(deps): update rust crate bigdecimal to 0.4 --- Cargo.lock | 11 +++++++++-- Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d7c6391de..0a5947364 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,10 +121,11 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bigdecimal" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744" +checksum = "5274a6b6e0ee020148397245b973e30163b7bffbc6d473613f850cb99888581e" dependencies = [ + "libm", "num-bigint", "num-integer", "num-traits", @@ -1277,6 +1278,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "libm" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" + [[package]] name = "linux-raw-sys" version = "0.1.4" diff --git a/Cargo.toml b/Cargo.toml index daa44eb6a..0737bcd38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -257,7 +257,7 @@ feat_os_windows_legacy = [ test = ["uu_test"] [workspace.dependencies] -bigdecimal = "0.3" +bigdecimal = "0.4" binary-heap-plus = "0.5.0" bstr = "1.5" bytecount = "0.6.3" From 98264e9cdf62cc891c5cfeaac8f20c8f3a04848e Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 5 Jul 2023 15:51:23 +0200 Subject: [PATCH 156/253] seq: add test for call without args --- tests/by-util/test_seq.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 63015b24a..187e7533f 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -7,6 +7,14 @@ fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails().code_is(1); } +#[test] +fn test_no_args() { + new_ucmd!() + .fails() + .code_is(1) + .stderr_contains("missing operand"); +} + #[test] fn test_hex_rejects_sign_after_identifier() { new_ucmd!() From 357dd5fd8893520852e5781ebcdd6cc7e5e69f70 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 5 Jul 2023 16:00:16 +0200 Subject: [PATCH 157/253] initial oranda setup --- .gitignore | 1 + README.md | 11 +++++++++++ docs/src/oranda.css | 4 ++++ oranda.json | 13 +++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 docs/src/oranda.css create mode 100644 oranda.json diff --git a/.gitignore b/.gitignore index 77e8f717e..ed4e54ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ target/ /busybox/ /.vscode/ /.vs/ +/public/ *~ .*.swp .*.swo diff --git a/README.md b/README.md index 5a9f968ae..76d30bf61 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ +
![uutils logo](docs/src/logo.svg) @@ -19,11 +20,14 @@ --- +
uutils coreutils is a cross-platform reimplementation of the GNU coreutils in [Rust](http://www.rust-lang.org). While all programs have been implemented, some options might be missing or different behavior might be experienced. +
+ To install it: ```shell @@ -31,6 +35,8 @@ cargo install coreutils ~/.cargo/bin/coreutils ``` +
+ ## Goals @@ -42,6 +48,8 @@ uutils aims to work on as many platforms as possible, to be able to use the same utils on Linux, Mac, Windows and other platforms. This ensures, for example, that scripts can be easily transferred between platforms. +
+ ## Documentation uutils has both user and developer documentation available: @@ -52,6 +60,7 @@ uutils has both user and developer documentation available: Both can also be generated locally, the instructions for that can be found in the [coreutils docs](https://github.com/uutils/uutils.github.io) repository. + ## Requirements @@ -301,6 +310,8 @@ See for the main meta bugs ![Evolution over time](https://github.com/uutils/coreutils-tracking/blob/main/gnu-results.png?raw=true) +
+ ## Contributing To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md). diff --git a/docs/src/oranda.css b/docs/src/oranda.css new file mode 100644 index 000000000..5581cc0c5 --- /dev/null +++ b/docs/src/oranda.css @@ -0,0 +1,4 @@ +.logo { + display: block; + height: 170px; +} diff --git a/oranda.json b/oranda.json new file mode 100644 index 000000000..b0a93c19a --- /dev/null +++ b/oranda.json @@ -0,0 +1,13 @@ +{ + "project": { + "name": "uutils coreutils" + }, + "components": { + "changelog": true + }, + "styles": { + "theme": "light", + "logo": "docs/src/logo.svg", + "additional_css": ["docs/src/oranda.css"] + } +} From 389741eda3d821ce5ab603a82b0eef0689c33b35 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 18:14:40 +0000 Subject: [PATCH 158/253] chore(deps): update rust crate bstr to 1.6 --- Cargo.lock | 9 ++++----- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a5947364..cba85bf58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,12 +204,11 @@ dependencies = [ [[package]] name = "bstr" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", - "once_cell", "regex-automata", "serde", ] @@ -1831,9 +1830,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.1.10" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "fa250384981ea14565685dea16a9ccc4d1c541a13f82b9c168572264d1df8c56" [[package]] name = "regex-syntax" diff --git a/Cargo.toml b/Cargo.toml index 0737bcd38..28a8cd5a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -259,7 +259,7 @@ test = ["uu_test"] [workspace.dependencies] bigdecimal = "0.4" binary-heap-plus = "0.5.0" -bstr = "1.5" +bstr = "1.6" bytecount = "0.6.3" byteorder = "1.4.3" chrono = { version = "^0.4.26", default-features = false, features = [ From c6be1c10ba8e6cf6d49d0ab882cd9e2511fe8f06 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 22:57:39 +0000 Subject: [PATCH 159/253] chore(deps): update rust crate smallvec to 1.11 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a5947364..6217f2655 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2088,9 +2088,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smawk" diff --git a/Cargo.toml b/Cargo.toml index 0737bcd38..001c522e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -317,7 +317,7 @@ same-file = "1.0.6" self_cell = "1.0.1" selinux = "0.4" signal-hook = "0.3.15" -smallvec = { version = "1.10", features = ["union"] } +smallvec = { version = "1.11", features = ["union"] } tempfile = "3.6.0" term_grid = "0.1.5" terminal_size = "0.2.6" From eb3164002a30cef4e7b8338f0d5a2b7e30059722 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 6 Jul 2023 05:41:42 +0000 Subject: [PATCH 160/253] chore(deps): update rust crate regex to 1.9.0 --- Cargo.lock | 14 ++++++++++---- Cargo.toml | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cba85bf58..78ab1c0a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1819,12 +1819,13 @@ checksum = "f1bfbf25d7eb88ddcbb1ec3d755d0634da8f7657b2cb8b74089121409ab8228f" [[package]] name = "regex" -version = "1.8.4" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "89089e897c013b3deb627116ae56a6955a72b8bed395c9526af31c9fe528b484" dependencies = [ "aho-corasick 1.0.1", "memchr", + "regex-automata", "regex-syntax", ] @@ -1833,12 +1834,17 @@ name = "regex-automata" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa250384981ea14565685dea16a9ccc4d1c541a13f82b9c168572264d1df8c56" +dependencies = [ + "aho-corasick 1.0.1", + "memchr", + "regex-syntax", +] [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" [[package]] name = "rlimit" diff --git a/Cargo.toml b/Cargo.toml index 28a8cd5a5..123f1f9ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -310,7 +310,7 @@ rand = { version = "0.8", features = ["small_rng"] } rand_core = "0.6" rayon = "1.7" redox_syscall = "0.3" -regex = "1.8.4" +regex = "1.9.0" rstest = "0.17.0" rust-ini = "0.19.0" same-file = "1.0.6" From ac4ff2ac0e3056550c292a5e862eb3e1aaa2480a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 6 Jul 2023 10:26:29 +0200 Subject: [PATCH 161/253] seq: simplify error handling Co-authored-by: Terts Diepraam --- src/uu/seq/src/error.rs | 45 +++++++++++------------------------------ 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/src/uu/seq/src/error.rs b/src/uu/seq/src/error.rs index 4945914d1..fc8452e13 100644 --- a/src/uu/seq/src/error.rs +++ b/src/uu/seq/src/error.rs @@ -2,7 +2,7 @@ // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// spell-checker:ignore numberparse argtype +// spell-checker:ignore numberparse //! Errors returned by seq. use std::error::Error; use std::fmt::Display; @@ -30,29 +30,6 @@ pub enum SeqError { NoArguments, } -impl SeqError { - /// The [`String`] argument as read from the command-line. - fn arg(&self) -> &str { - match self { - Self::ParseError(s, _) => s, - Self::ZeroIncrement(s) => s, - Self::NoArguments => "", - } - } - - /// The type of argument that is causing the error. - fn argtype(&self) -> &str { - match self { - Self::ParseError(_, e) => match e { - ParseNumberError::Float => "invalid floating point argument: ", - ParseNumberError::Nan => "invalid 'not-a-number' argument: ", - ParseNumberError::Hex => "invalid hexadecimal argument: ", - }, - Self::ZeroIncrement(_) => "invalid Zero increment value: ", - Self::NoArguments => "missing operand", - } - } -} impl UError for SeqError { /// Always return 1. fn code(&self) -> i32 { @@ -68,15 +45,17 @@ impl Error for SeqError {} impl Display for SeqError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{}{}", - self.argtype(), - if self.arg() == "" { - String::new() - } else { - self.arg().quote().to_string() + match self { + Self::ParseError(s, e) => { + let error_type = match e { + ParseNumberError::Float => "floating point", + ParseNumberError::Nan => "'not-a-number'", + ParseNumberError::Hex => "hexadecimal", + }; + write!(f, "invalid {error_type} argument: {}", s.quote()) } - ) + Self::ZeroIncrement(s) => write!(f, "invalid Zero increment value: {}", s.quote()), + Self::NoArguments => write!(f, "missing operand"), + } } } From 725f226941543ae4effc9207ca433069859d872b Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 6 Jul 2023 15:07:10 +0200 Subject: [PATCH 162/253] Bump syn from 1.0.103 to 1.0.109 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e23c6732..390ed531a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2133,9 +2133,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", From 24c74d0f573a508cf82204fa55fd909d47eab693 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 6 Jul 2023 15:10:22 +0200 Subject: [PATCH 163/253] deny.toml: add syn to skip list --- deny.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deny.toml b/deny.toml index c52b321dd..46d35ad03 100644 --- a/deny.toml +++ b/deny.toml @@ -87,6 +87,8 @@ skip = [ { name = "aho-corasick", version = "0.7.19" }, # ordered-multimap (via rust-ini) { name = "hashbrown", version = "0.13.2" }, + # various crates + { name = "syn", version = "1.0.109" }, ] # spell-checker: enable From 8089909448449854dba1f9647e254c77e68be05c Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 6 Jul 2023 15:14:38 +0200 Subject: [PATCH 164/253] Cargo.toml: use "workspace = true" for rstest --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e857e5fed..417c7f920 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -492,7 +492,7 @@ uucore = { workspace = true, features = ["entries", "process", "signals"] } walkdir = { workspace = true } is-terminal = { workspace = true } hex-literal = "0.4.1" -rstest = "0.17.0" +rstest = { workspace = true } [target.'cfg(any(target_os = "linux", target_os = "android"))'.dev-dependencies] procfs = { version = "0.15", default-features = false } From 3edea14ae8f964ed29d47259ffaca5715b06e9b2 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 7 Jul 2023 10:54:47 +0200 Subject: [PATCH 165/253] docs: add "du" to extensions --- docs/src/extensions.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/src/extensions.md b/docs/src/extensions.md index ae3d974fe..eeb00ff35 100644 --- a/docs/src/extensions.md +++ b/docs/src/extensions.md @@ -74,3 +74,7 @@ number of spaces representing a tab when determining the line length. GNU `ls` provides two ways to use a long listing format: `-l` and `--format=long`. We support a third way: `--long`. + +## `du` + +`du` allows `birth` and `creation` as values for the `--time` argument to show the creation time. From 90a763137c6330c1c9df52932ed1eb466e21e945 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:36:30 +0000 Subject: [PATCH 166/253] chore(deps): update rust crate rstest to 0.18.1 --- Cargo.lock | 54 +++++++++++++++++++++++++++++++++++++----------------- Cargo.toml | 2 +- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 390ed531a..e512643dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,7 +158,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn", + "syn 1.0.109", "which", ] @@ -562,7 +562,7 @@ dependencies = [ "lazy_static", "proc-macro2", "regex", - "syn", + "syn 1.0.109", "unicode-xid", ] @@ -574,7 +574,7 @@ checksum = "76071bb9c8c4dd2b5eb209907deab7b031323cf1be3dfdc6ec5d37f4f187d8a1" dependencies = [ "lazy_static", "proc-macro2", - "syn", + "syn 1.0.109", ] [[package]] @@ -589,7 +589,7 @@ dependencies = [ "lazy_static", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -701,7 +701,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -743,7 +743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fdf3fce3ce863539ec1d7fd1b6dcc3c645663376b43ed376bbf887733e4f772" dependencies = [ "data-encoding", - "syn", + "syn 1.0.109", ] [[package]] @@ -984,7 +984,7 @@ checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1725,9 +1725,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.21" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -1846,6 +1846,12 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" +[[package]] +name = "relative-path" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf2521270932c3c7bed1a59151222bd7643c79310f2916f01925e1e16255698" + [[package]] name = "rlimit" version = "0.10.0" @@ -1863,9 +1869,9 @@ checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316" [[package]] name = "rstest" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de1bb486a691878cd320c2f0d319ba91eeaa2e894066d8b5f8f117c000e9d962" +checksum = "2b96577ca10cb3eade7b337eb46520108a67ca2818a24d0b63f41fd62bc9651c" dependencies = [ "futures", "futures-timer", @@ -1875,15 +1881,18 @@ dependencies = [ [[package]] name = "rstest_macros" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290ca1a1c8ca7edb7c3283bd44dc35dd54fdec6253a3912e201ba1072018fca8" +checksum = "225e674cf31712b8bb15fdbca3ec0c1b9d825c5a24407ff2b7e005fb6a29ba03" dependencies = [ "cfg-if", + "glob", "proc-macro2", "quote", + "regex", + "relative-path", "rustc_version", - "syn", + "syn 2.0.23", "unicode-ident", ] @@ -2142,6 +2151,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.6.0" @@ -2204,7 +2224,7 @@ checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3400,7 +3420,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -3422,7 +3442,7 @@ checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index 417c7f920..cb814602f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -311,7 +311,7 @@ rand_core = "0.6" rayon = "1.7" redox_syscall = "0.3" regex = "1.9.0" -rstest = "0.17.0" +rstest = "0.18.1" rust-ini = "0.19.0" same-file = "1.0.6" self_cell = "1.0.1" From 4f24d81e86b19c5870e12190f5c4474c80ab83bf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 18:29:31 +0000 Subject: [PATCH 167/253] chore(deps): update rust crate regex to 1.9.1 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e512643dc..4abfb1fdb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1819,9 +1819,9 @@ checksum = "f1bfbf25d7eb88ddcbb1ec3d755d0634da8f7657b2cb8b74089121409ab8228f" [[package]] name = "regex" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89089e897c013b3deb627116ae56a6955a72b8bed395c9526af31c9fe528b484" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick 1.0.1", "memchr", @@ -1831,9 +1831,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa250384981ea14565685dea16a9ccc4d1c541a13f82b9c168572264d1df8c56" +checksum = "e9aaecc05d5c4b5f7da074b9a0d1a0867e71fd36e7fc0482d8bcfe8e8fc56290" dependencies = [ "aho-corasick 1.0.1", "memchr", diff --git a/Cargo.toml b/Cargo.toml index cb814602f..f6b4e19d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -310,7 +310,7 @@ rand = { version = "0.8", features = ["small_rng"] } rand_core = "0.6" rayon = "1.7" redox_syscall = "0.3" -regex = "1.9.0" +regex = "1.9.1" rstest = "0.18.1" rust-ini = "0.19.0" same-file = "1.0.6" From 79b44597315a3046d736a44c155ab66537077578 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 8 Jul 2023 00:32:32 +0200 Subject: [PATCH 168/253] add oranda to the spell ignore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 76d30bf61..4929224d1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ - +
From 85b9b61dd8a44e92ced13505c8faf4882061a1d1 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Sat, 8 Jul 2023 01:35:58 +0300 Subject: [PATCH 169/253] stty: Finish '--save' support Argument parsing for this exists, but the option doesn't change output in any way. Finish the support. Closes #3862 --- src/uu/stty/src/stty.rs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index e09662471..6b77f175a 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -244,12 +244,30 @@ fn print_terminal_size(termios: &Termios, opts: &Options) -> nix::Result<()> { Ok(()) } +fn print_in_save_format(termios: &Termios) { + print!( + "{:x}:{:x}:{:x}:{:x}", + termios.input_flags.bits(), + termios.output_flags.bits(), + termios.control_flags.bits(), + termios.local_flags.bits() + ); + for cc in termios.control_chars { + print!(":{cc:x}"); + } + println!(); +} + fn print_settings(termios: &Termios, opts: &Options) -> nix::Result<()> { - print_terminal_size(termios, opts)?; - print_flags(termios, opts, CONTROL_FLAGS); - print_flags(termios, opts, INPUT_FLAGS); - print_flags(termios, opts, OUTPUT_FLAGS); - print_flags(termios, opts, LOCAL_FLAGS); + if opts.save { + print_in_save_format(termios); + } else { + print_terminal_size(termios, opts)?; + print_flags(termios, opts, CONTROL_FLAGS); + print_flags(termios, opts, INPUT_FLAGS); + print_flags(termios, opts, OUTPUT_FLAGS); + print_flags(termios, opts, LOCAL_FLAGS); + } Ok(()) } From cf6f7856e45c84acfad56c14f1b4174a1bc0d963 Mon Sep 17 00:00:00 2001 From: yt2b Date: Sat, 8 Jul 2023 10:43:20 +0900 Subject: [PATCH 170/253] ls: fix --l option --- src/uu/ls/src/ls.rs | 1 + tests/by-util/test_ls.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 342c52cba..f45fa0cd6 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1202,6 +1202,7 @@ pub fn uu_app() -> Command { Arg::new(options::quoting::LITERAL) .short('N') .long(options::quoting::LITERAL) + .alias("l") .help("Use literal quoting style. Equivalent to `--quoting-style=literal`") .overrides_with_all([ options::QUOTING_STYLE, diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index ad2c6424f..2eef69121 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -22,7 +22,6 @@ use std::time::Duration; const LONG_ARGS: &[&str] = &[ "-l", "--long", - "--l", "--format=long", "--for=long", "--format=verbose", @@ -2411,6 +2410,7 @@ fn test_ls_quoting_style() { ("--quoting-style=literal", "one?two"), ("-N", "one?two"), ("--literal", "one?two"), + ("--l", "one?two"), ("--quoting-style=c", "\"one\\ntwo\""), ("-Q", "\"one\\ntwo\""), ("--quote-name", "\"one\\ntwo\""), @@ -2435,6 +2435,7 @@ fn test_ls_quoting_style() { ("--quoting-style=literal", "one\ntwo"), ("-N", "one\ntwo"), ("--literal", "one\ntwo"), + ("--l", "one\ntwo"), ("--quoting-style=shell", "one\ntwo"), // FIXME: GNU ls quotes this case ("--quoting-style=shell-always", "'one\ntwo'"), ] { @@ -2496,6 +2497,7 @@ fn test_ls_quoting_style() { ("--quoting-style=literal", "one two"), ("-N", "one two"), ("--literal", "one two"), + ("--l", "one two"), ("--quoting-style=c", "\"one two\""), ("-Q", "\"one two\""), ("--quote-name", "\"one two\""), From 6f5416bddb15ca77756e402d49bdfd5ac14c1bae Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 8 Jul 2023 06:33:27 +0200 Subject: [PATCH 171/253] cspell: ignore oranda.json --- .vscode/cSpell.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/cSpell.json b/.vscode/cSpell.json index edac1c21e..6ceb038c2 100644 --- a/.vscode/cSpell.json +++ b/.vscode/cSpell.json @@ -19,6 +19,7 @@ // files to ignore (globs supported) "ignorePaths": [ "Cargo.lock", + "oranda.json", "target/**", "tests/**/fixtures/**", "src/uu/dd/test-resources/**", From bde9030e4e62e5c2ff04388a2e0839d1245c044a Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Sat, 8 Jul 2023 00:20:35 +0300 Subject: [PATCH 172/253] stty: Support setting baud rate Part of #3859. --- src/uu/stty/src/stty.rs | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index e09662471..faff9d49c 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -3,14 +3,15 @@ // * For the full copyright and license information, please view the LICENSE file // * that was distributed with this source code. -// spell-checker:ignore clocal tcgetattr tcsetattr tcsanow tiocgwinsz tiocswinsz cfgetospeed ushort +// spell-checker:ignore clocal tcgetattr tcsetattr tcsanow tiocgwinsz tiocswinsz cfgetospeed cfsetospeed ushort mod flags; use clap::{crate_version, Arg, ArgAction, ArgMatches, Command}; use nix::libc::{c_ushort, O_NONBLOCK, TIOCGWINSZ, TIOCSWINSZ}; use nix::sys::termios::{ - cfgetospeed, tcgetattr, tcsetattr, ControlFlags, InputFlags, LocalFlags, OutputFlags, Termios, + cfgetospeed, cfsetospeed, tcgetattr, tcsetattr, ControlFlags, InputFlags, LocalFlags, + OutputFlags, Termios, }; use nix::{ioctl_read_bad, ioctl_write_ptr_bad}; use std::io::{self, stdout}; @@ -290,6 +291,8 @@ fn print_flags(termios: &Termios, opts: &Options, flags: &[Flag< /// The value inside the `Break` variant of the `ControlFlow` indicates whether /// the setting has been applied. fn apply_setting(termios: &mut Termios, s: &str) -> ControlFlow { + apply_baud_rate_flag(termios, s)?; + let (remove, name) = match s.strip_prefix('-') { Some(s) => (true, s), None => (false, s), @@ -332,6 +335,39 @@ fn apply_flag( ControlFlow::Continue(()) } +fn apply_baud_rate_flag(termios: &mut Termios, input: &str) -> ControlFlow { + // BSDs use a u32 for the baud rate, so any decimal number applies. + #[cfg(any( + target_os = "freebsd", + target_os = "dragonfly", + target_os = "ios", + target_os = "macos", + target_os = "netbsd", + target_os = "openbsd" + ))] + if let Ok(n) = input.parse::() { + cfsetospeed(termios, n).expect("Failed to set baud rate"); + return ControlFlow::Break(true); + } + + // Other platforms use an enum. + #[cfg(not(any( + target_os = "freebsd", + target_os = "dragonfly", + target_os = "ios", + target_os = "macos", + target_os = "netbsd", + target_os = "openbsd" + )))] + for (text, baud_rate) in BAUD_RATES { + if *text == input { + cfsetospeed(termios, *baud_rate).expect("Failed to set baud rate"); + return ControlFlow::Break(true); + } + } + ControlFlow::Continue(()) +} + pub fn uu_app() -> Command { Command::new(uucore::util_name()) .version(crate_version!()) From bdd8729cc289e713f90db39d55050fc567166258 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Sat, 8 Jul 2023 12:49:20 +0200 Subject: [PATCH 173/253] fix: fixpr.yml unrecognized named-value: 'steps' simplify passing variables to github output fix warning with add-and-commit action --- .github/workflows/FixPR.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/FixPR.yml b/.github/workflows/FixPR.yml index e1729b173..97b0be34a 100644 --- a/.github/workflows/FixPR.yml +++ b/.github/workflows/FixPR.yml @@ -31,12 +31,12 @@ jobs: id: vars shell: bash run: | - ## VARs setup - outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; } # surface MSRV from CICD workflow RUST_MIN_SRV=$(grep -P "^\s+RUST_MIN_SRV:" .github/workflows/CICD.yml | grep -Po "(?<=\x22)\d+[.]\d+(?:[.]\d+)?(?=\x22)" ) - outputs RUST_MIN_SRV - - uses: dtolnay/rust-toolchain@${{ steps.vars.outputs.RUST_MIN_SRV }} + echo "RUST_MIN_SRV=${RUST_MIN_SRV}" >> $GITHUB_OUTPUT + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ steps.vars.outputs.RUST_MIN_SRV }} - uses: Swatinem/rust-cache@v2 - name: Ensure updated 'Cargo.lock' shell: bash @@ -67,7 +67,7 @@ jobs: - name: Commit any changes (to '${{ env.BRANCH_TARGET }}') uses: EndBug/add-and-commit@v9 with: - branch: ${{ env.BRANCH_TARGET }} + new_branch: ${{ env.BRANCH_TARGET }} default_author: github_actions message: "maint ~ refresh 'Cargo.lock'" add: Cargo.lock @@ -90,13 +90,11 @@ jobs: id: vars shell: bash run: | - ## VARs setup - outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; } # target-specific options # * CARGO_FEATURES_OPTION CARGO_FEATURES_OPTION='' ; if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi - outputs CARGO_FEATURES_OPTION + echo "CARGO_FEATURES_OPTION=${CARGO_FEATURES_OPTION}" >> $GITHUB_OUTPUT - uses: dtolnay/rust-toolchain@master with: toolchain: stable @@ -114,7 +112,7 @@ jobs: - name: Commit any changes (to '${{ env.BRANCH_TARGET }}') uses: EndBug/add-and-commit@v9 with: - branch: ${{ env.BRANCH_TARGET }} + new_branch: ${{ env.BRANCH_TARGET }} default_author: github_actions message: "maint ~ rustfmt (`cargo fmt`)" env: From 6f91371e613a4a835286c8f5e7c6b7ba0ba659bd Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 8 Jul 2023 16:13:35 +0200 Subject: [PATCH 174/253] touch: accept "modify" & "mtime" for --time arg --- src/uu/touch/src/touch.rs | 2 +- tests/by-util/test_touch.rs | 44 ++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index f4784f155..230a6bb70 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -295,7 +295,7 @@ pub fn uu_app() -> Command { equivalent to -m", ) .value_name("WORD") - .value_parser(["access", "atime", "use"]), + .value_parser(["access", "atime", "use", "modify", "mtime"]), ) .arg( Arg::new(ARG_FILES) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 0e4eade3d..cd2a70bdb 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -204,19 +204,23 @@ fn test_touch_set_cymdhms_time() { #[test] fn test_touch_set_only_atime() { - let (at, mut ucmd) = at_and_ucmd!(); + let atime_args = ["-a", "--time=access", "--time=atime", "--time=use"]; let file = "test_touch_set_only_atime"; - ucmd.args(&["-t", "201501011234", "-a", file]) - .succeeds() - .no_stderr(); + for atime_arg in atime_args { + let (at, mut ucmd) = at_and_ucmd!(); - assert!(at.file_exists(file)); + ucmd.args(&["-t", "201501011234", atime_arg, file]) + .succeeds() + .no_stderr(); - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); - let (atime, mtime) = get_file_times(&at, file); - assert!(atime != mtime); - assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240); + assert!(at.file_exists(file)); + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); + let (atime, mtime) = get_file_times(&at, file); + assert!(atime != mtime); + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240); + } } #[test] @@ -301,19 +305,23 @@ fn test_touch_set_both_time_and_date() { #[test] fn test_touch_set_only_mtime() { - let (at, mut ucmd) = at_and_ucmd!(); + let mtime_args = ["-m", "--time=modify", "--time=mtime"]; let file = "test_touch_set_only_mtime"; - ucmd.args(&["-t", "201501011234", "-m", file]) - .succeeds() - .no_stderr(); + for mtime_arg in mtime_args { + let (at, mut ucmd) = at_and_ucmd!(); - assert!(at.file_exists(file)); + ucmd.args(&["-t", "201501011234", mtime_arg, file]) + .succeeds() + .no_stderr(); - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); - let (atime, mtime) = get_file_times(&at, file); - assert!(atime != mtime); - assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240); + assert!(at.file_exists(file)); + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); + let (atime, mtime) = get_file_times(&at, file); + assert!(atime != mtime); + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240); + } } #[test] From bc25b5156760300c9b48c2f5cf7d675807e8aea4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 9 Jul 2023 12:08:10 +0000 Subject: [PATCH 175/253] chore(deps): update rust crate fundu to 1.2.0 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4abfb1fdb..825519bbe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -915,18 +915,18 @@ dependencies = [ [[package]] name = "fundu" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d579dcb632d86591bdd7fc445e705b96cb2a7fb5488d918d956f392b6148e898" +checksum = "34804ed59f10b3a630c79822ebf7370b562b7281028369e9baa40547c17f8bdc" dependencies = [ "fundu-core", ] [[package]] name = "fundu-core" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a363b75dd1e4b5bd2cdc305c47399c524cae24638b368b66b1a4c2a36482801f" +checksum = "71a99190954ca83bade03ba054799b17a158ea948a6855c6bb8121adb6b49d9f" [[package]] name = "futures" diff --git a/Cargo.toml b/Cargo.toml index f6b4e19d3..cbd2deb69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -280,7 +280,7 @@ filetime = "0.2" fnv = "1.0.7" fs_extra = "1.3.0" fts-sys = "0.2" -fundu = "1.1.0" +fundu = "1.2.0" gcd = "2.3" glob = "0.3.1" half = "2.2" From f67ef7fb1176111f85e9f2b8aea335459b0d9786 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 9 Jul 2023 16:08:38 +0200 Subject: [PATCH 176/253] nl: change value name to match help text --- src/uu/nl/src/nl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 2e9bf92a0..ffb276f11 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -165,7 +165,7 @@ pub fn uu_app() -> Command { .short('b') .long(options::BODY_NUMBERING) .help("use STYLE for numbering body lines") - .value_name("SYNTAX"), + .value_name("STYLE"), ) .arg( Arg::new(options::SECTION_DELIMITER) From 4db5a60667005ddc48235463f84ef342776a6014 Mon Sep 17 00:00:00 2001 From: John Shin Date: Sun, 9 Jul 2023 15:29:42 -0700 Subject: [PATCH 177/253] ls: add back version cmp test --- tests/by-util/test_ls.rs | 49 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index a6835f279..2eef69121 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2311,15 +2311,56 @@ fn test_ls_version_sort() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; for filename in [ - "a2", "b1", "b20", "a1.4", "b3", "b11", "b20b", "b20a", "a100", "a1.13", "aa", "a1", "aaa", - "abab", "ab", "a01.40", "a001.001", + "a2", + "b1", + "b20", + "a1.4", + "a1.40", + "b3", + "b11", + "b20b", + "b20a", + "a100", + "a1.13", + "aa", + "a1", + "aaa", + "a1.00000040", + "abab", + "ab", + "a01.40", + "a001.001", + "a01.0000001", + "a01.001", + "a001.01", ] { at.touch(filename); } let mut expected = vec![ - "a1", "a001.001", "a1.4", "a1.13", "a01.40", "a2", "a100", "aa", "aaa", "ab", "abab", "b1", - "b3", "b11", "b20", "b20a", "b20b", "", // because of '\n' at the end of the output + "a1", + "a001.001", + "a001.01", + "a01.0000001", + "a01.001", + "a1.4", + "a1.13", + "a01.40", + "a1.00000040", + "a1.40", + "a2", + "a100", + "aa", + "aaa", + "ab", + "abab", + "b1", + "b3", + "b11", + "b20", + "b20a", + "b20b", + "", // because of '\n' at the end of the output ]; let result = scene.ucmd().arg("-1v").succeeds(); From cb50208909f83fd19e3cde29d10b6c4a2f0cfb11 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 10 Jul 2023 07:25:04 +0200 Subject: [PATCH 178/253] nl: use value parser for "--number-format" --- src/uu/nl/src/helper.rs | 21 ++++--------------- src/uu/nl/src/nl.rs | 16 ++++++++++++++- tests/by-util/test_nl.rs | 44 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index dc2e9dfd8..f83b79b5b 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -36,23 +36,10 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> settings.number_separator = val.to_owned(); } } - match opts.get_one::(options::NUMBER_FORMAT) { - None => {} - Some(val) => match val.as_str() { - "ln" => { - settings.number_format = crate::NumberFormat::Left; - } - "rn" => { - settings.number_format = crate::NumberFormat::Right; - } - "rz" => { - settings.number_format = crate::NumberFormat::RightZero; - } - _ => { - errs.push(String::from("Illegal value for -n")); - } - }, - } + settings.number_format = opts + .get_one::(options::NUMBER_FORMAT) + .map(Into::into) + .unwrap_or_default(); match opts.get_one::(options::BODY_NUMBERING) { None => {} Some(val) => { diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index ffb276f11..e4d1535ed 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -75,12 +75,25 @@ enum NumberingStyle { // NumberFormat specifies how line numbers are output within their allocated // space. They are justified to the left or right, in the latter case with // the option of having all unused space to its left turned into leading zeroes. +#[derive(Default)] enum NumberFormat { Left, + #[default] Right, RightZero, } +impl> From for NumberFormat { + fn from(s: T) -> Self { + match s.as_ref() { + "ln" => Self::Left, + "rn" => Self::Right, + "rz" => Self::RightZero, + _ => unreachable!("Should have been caught by clap"), + } + } +} + pub mod options { pub const HELP: &str = "help"; pub const FILE: &str = "file"; @@ -207,7 +220,8 @@ pub fn uu_app() -> Command { .short('n') .long(options::NUMBER_FORMAT) .help("insert line numbers according to FORMAT") - .value_name("FORMAT"), + .value_name("FORMAT") + .value_parser(["ln", "rn", "rz"]), ) .arg( Arg::new(options::NO_RENUMBER) diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index 39c076d43..6b5e600da 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -1,3 +1,4 @@ +// spell-checker:ignore ninvalid use crate::common::util::TestScenario; #[test] @@ -78,3 +79,46 @@ fn test_no_renumber() { new_ucmd!().arg(arg).succeeds(); } } + +#[test] +fn test_number_format_ln() { + for arg in ["-nln", "--number-format=ln"] { + new_ucmd!() + .arg(arg) + .pipe_in("test") + .succeeds() + .stdout_is("1 \ttest\n"); + } +} + +#[test] +fn test_number_format_rn() { + for arg in ["-nrn", "--number-format=rn"] { + new_ucmd!() + .arg(arg) + .pipe_in("test") + .succeeds() + .stdout_is(" 1\ttest\n"); + } +} + +#[test] +fn test_number_format_rz() { + for arg in ["-nrz", "--number-format=rz"] { + new_ucmd!() + .arg(arg) + .pipe_in("test") + .succeeds() + .stdout_is("000001\ttest\n"); + } +} + +#[test] +fn test_invalid_number_format() { + for arg in ["-ninvalid", "--number-format=invalid"] { + new_ucmd!() + .arg(arg) + .fails() + .stderr_contains("invalid value 'invalid'"); + } +} From eb2123ee155cc2c126fd4590c28b784fc87b993a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 11 Jul 2023 14:26:54 +0200 Subject: [PATCH 179/253] nl: add "after help" --- src/uu/nl/nl.md | 16 ++++++++++++++++ src/uu/nl/src/nl.rs | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/uu/nl/nl.md b/src/uu/nl/nl.md index d7cfc698f..bf3952cb2 100644 --- a/src/uu/nl/nl.md +++ b/src/uu/nl/nl.md @@ -5,3 +5,19 @@ nl [OPTION]... [FILE]... ``` Number lines of files + +## After Help + +`STYLE` is one of: + +* `a` number all lines +* `t` number only nonempty lines +* `n` number no lines +* `pBRE` number only lines that contain a match for the basic regular + expression, `BRE` + +`FORMAT` is one of: + +* `ln` left justified, no leading zeros +* `rn` right justified, no leading zeros +* `rz` right justified, leading zeros diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index ffb276f11..e9cd9b876 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -12,11 +12,12 @@ use std::io::{stdin, BufRead, BufReader, Read}; use std::iter::repeat; use std::path::Path; use uucore::error::{FromIo, UResult, USimpleError}; -use uucore::{format_usage, help_about, help_usage}; +use uucore::{format_usage, help_about, help_section, help_usage}; mod helper; const ABOUT: &str = help_about!("nl.md"); +const AFTER_HELP: &str = help_section!("after help", "nl.md"); const USAGE: &str = help_usage!("nl.md"); // Settings store options used by nl to produce its output. @@ -146,6 +147,7 @@ pub fn uu_app() -> Command { .about(ABOUT) .version(crate_version!()) .override_usage(format_usage(USAGE)) + .after_help(AFTER_HELP) .infer_long_args(true) .disable_help_flag(true) .arg( From 826adc62aae7415b2d9fe941eb91dde353f1dab2 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 10 Jul 2023 14:59:02 +0200 Subject: [PATCH 180/253] nl: show error if --number-width is zero Co-authored-by: Sylvestre Ledru --- src/uu/nl/src/helper.rs | 15 +++++---------- src/uu/nl/src/nl.rs | 3 ++- tests/by-util/test_nl.rs | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index f83b79b5b..1c4e3386e 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -94,17 +94,12 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> } } } - match opts.get_one::(options::NUMBER_WIDTH) { + match opts.get_one::(options::NUMBER_WIDTH) { None => {} - Some(val) => { - let conv: Option = val.parse().ok(); - match conv { - None => { - errs.push(String::from("Illegal value for -w")); - } - Some(num) => settings.number_width = num, - } - } + Some(num) if *num > 0 => settings.number_width = *num, + Some(_) => errs.push(String::from( + "Invalid line number field width: ‘0’: Numerical result out of range", + )), } match opts.get_one::(options::STARTING_LINE_NUMBER) { None => {} diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 9caeffd36..8c0e89a44 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -251,7 +251,8 @@ pub fn uu_app() -> Command { .short('w') .long(options::NUMBER_WIDTH) .help("use NUMBER columns for line numbers") - .value_name("NUMBER"), + .value_name("NUMBER") + .value_parser(clap::value_parser!(usize)), ) } diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index 6b5e600da..db8ed051e 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore ninvalid +// spell-checker:ignore ninvalid winvalid use crate::common::util::TestScenario; #[test] @@ -122,3 +122,37 @@ fn test_invalid_number_format() { .stderr_contains("invalid value 'invalid'"); } } + +#[test] +fn test_number_width() { + for width in 1..10 { + for arg in [format!("-w{width}"), format!("--number-width={width}")] { + let spaces = " ".repeat(width - 1); + new_ucmd!() + .arg(arg) + .pipe_in("test") + .succeeds() + .stdout_is(format!("{spaces}1\ttest\n")); + } + } +} + +#[test] +fn test_number_width_zero() { + for arg in ["-w0", "--number-width=0"] { + new_ucmd!() + .arg(arg) + .fails() + .stderr_contains("Invalid line number field width: ‘0’: Numerical result out of range"); + } +} + +#[test] +fn test_invalid_number_width() { + for arg in ["-winvalid", "--number-width=invalid"] { + new_ucmd!() + .arg(arg) + .fails() + .stderr_contains("invalid value 'invalid'"); + } +} From 697866ae3abba90ec5303ac3840142c91914dcfa Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 12 Jul 2023 09:04:26 +0200 Subject: [PATCH 181/253] update platform-info 2.0.2 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 825519bbe..dd05c6292 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1646,9 +1646,9 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "platform-info" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827dc4f7a81331d48c8abf11b5ac18673b390d33e9632327e286d940289aefab" +checksum = "d6259c4860e53bf665016f1b2f46a8859cadfa717581dc9d597ae4069de6300f" dependencies = [ "libc", "winapi", diff --git a/Cargo.toml b/Cargo.toml index cbd2deb69..2e70772e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -304,7 +304,7 @@ onig = { version = "~6.4", default-features = false } parse_datetime = "0.4.0" phf = "0.11.2" phf_codegen = "0.11.2" -platform-info = "2.0.1" +platform-info = "2.0.2" quick-error = "2.0.1" rand = { version = "0.8", features = ["small_rng"] } rand_core = "0.6" From 20b1f11daa7a420bb40c5d1c48a25a4fa91a5b6d Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 12 Jul 2023 15:25:02 +0200 Subject: [PATCH 182/253] nl: add test for "--number-separator" and replace "match" with "if let" --- src/uu/nl/src/helper.rs | 7 ++----- tests/by-util/test_nl.rs | 11 +++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 1c4e3386e..341f116c3 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -30,11 +30,8 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> // This vector holds error messages encountered. let mut errs: Vec = vec![]; settings.renumber = opts.get_flag(options::NO_RENUMBER); - match opts.get_one::(options::NUMBER_SEPARATOR) { - None => {} - Some(val) => { - settings.number_separator = val.to_owned(); - } + if let Some(val) = opts.get_one::(options::NUMBER_SEPARATOR) { + settings.number_separator = val.to_owned(); } settings.number_format = opts .get_one::(options::NUMBER_FORMAT) diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index db8ed051e..f75f3f483 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -156,3 +156,14 @@ fn test_invalid_number_width() { .stderr_contains("invalid value 'invalid'"); } } + +#[test] +fn test_number_separator() { + for arg in ["-s:-:", "--number-separator=:-:"] { + new_ucmd!() + .arg(arg) + .pipe_in("test") + .succeeds() + .stdout_is(" 1:-:test\n"); + } +} From 504b9e15a06ff13fb0fb3e40b4e227148e773eb9 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Wed, 12 Jul 2023 23:23:58 +0530 Subject: [PATCH 183/253] Clamp overflowing values in --width to maximum --- src/uu/ls/src/ls.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index ae19b133f..cead745cd 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -17,6 +17,8 @@ use lscolors::LsColors; use number_prefix::NumberPrefix; use once_cell::unsync::OnceCell; use std::collections::HashSet; +use std::num::IntErrorKind; + #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::{ @@ -657,6 +659,19 @@ fn extract_indicator_style(options: &clap::ArgMatches) -> IndicatorStyle { } } +fn parse_width(s: &str) -> Result { + let radix = match s.starts_with('0') && s.len() > 1 { + true => 8, + false => 10, + }; + match u16::from_str_radix(s, radix) { + Ok(x) => Ok(x), + Err(e) => match e.kind() { + IntErrorKind::PosOverflow => Ok(u16::MAX), + _ => Err(LsError::InvalidLineWidth(s.into())), + }, + } +} impl Config { #[allow(clippy::cognitive_complexity)] pub fn from(options: &clap::ArgMatches) -> UResult { @@ -795,20 +810,7 @@ impl Config { }; let width = match options.get_one::(options::WIDTH) { - Some(x) => { - if x.starts_with('0') && x.len() > 1 { - // Read number as octal - match u16::from_str_radix(x, 8) { - Ok(v) => v, - Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()), - } - } else { - match x.parse::() { - Ok(u) => u, - Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()), - } - } - } + Some(x) => parse_width(x)?, None => match terminal_size::terminal_size() { Some((width, _)) => width.0, None => match std::env::var_os("COLUMNS") { From 9e2653423925623ab1405e6e39ca8aa6c7627e13 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Wed, 12 Jul 2023 23:24:26 +0530 Subject: [PATCH 184/253] tests/ls: Test overflowing decimal and octal values of --width --- tests/by-util/test_ls.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 2eef69121..15ded8e6b 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -670,6 +670,23 @@ fn test_ls_width() { .stdout_only("test-width-1 test-width-3\ntest-width-2 test-width-4\n"); } + for option in [ + "-w 100000000000000", + "-w=100000000000000", + "--width=100000000000000", + "--width 100000000000000", + "-w 07777777777777777777", + "-w=07777777777777777777", + "--width=07777777777777777777", + "--width 07777777777777777777", + ] { + scene + .ucmd() + .args(&option.split(' ').collect::>()) + .arg("-C") + .succeeds() + .stdout_only("test-width-1 test-width-2 test-width-3 test-width-4\n"); + } scene .ucmd() .arg("-w=bad") From e7dc201f164a3d45d78e199ca482d42a5d207dd5 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 13 Jul 2023 09:29:33 +0200 Subject: [PATCH 185/253] Bump pretty_assertions from 1.3.0 to 1.4.0 --- Cargo.lock | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd05c6292..1187b2e11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -694,16 +694,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "ctor" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn 1.0.109", -] - [[package]] name = "ctrlc" version = "3.4.0" @@ -1540,15 +1530,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "output_vt100" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" -dependencies = [ - "winapi", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -1668,13 +1649,11 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "pretty_assertions" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25e9bcb20aa780fd0bb16b72403a9064d6b3f22f026946029acb941a50af755" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" dependencies = [ - "ctor", "diff", - "output_vt100", "yansi", ] From 1ba50340358fb77aff0dd338b1ededd4f62fdbcd Mon Sep 17 00:00:00 2001 From: Starccy <452276725@qq.com> Date: Thu, 13 Jul 2023 15:32:25 +0800 Subject: [PATCH 186/253] chore: add new workflow to check shell scripts --- .github/workflows/CheckScripts.yml | 74 ++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/CheckScripts.yml diff --git a/.github/workflows/CheckScripts.yml b/.github/workflows/CheckScripts.yml new file mode 100644 index 000000000..e1b3b24d2 --- /dev/null +++ b/.github/workflows/CheckScripts.yml @@ -0,0 +1,74 @@ +name: CheckScripts + +# spell-checker:ignore ludeeus mfinelli + +env: + SCRIPT_DIR: 'util' + +on: + push: + branches: + - main + paths: + - 'util/**/*.sh' + pull_request: + branches: + - main + paths: + - 'util/**/*.sh' + +# End the current execution if there is a new changeset in the PR. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + shell_check: + name: ShellScript/Check + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + env: + SHELLCHECK_OPTS: -s bash + with: + severity: warning + scandir: ${{ env.SCRIPT_DIR }} + format: tty + + shell_fmt: + name: ShellScript/Format + # no need to run in pr events + # shfmt will be performed on main branch when the PR is merged + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + needs: [ shell_check ] + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v3 + - name: Setup shfmt + uses: mfinelli/setup-shfmt@v2 + - name: Run shfmt + shell: bash + run: | + # show differs first for every files that need to be formatted + # fmt options: bash syntax, 4 spaces indent, indent for switch-case + echo "## show the differences between formatted and original scripts..." + find ${{ env.SCRIPT_DIR }} -name "*.sh" -print0 | xargs -0 shfmt -ln=bash -i 4 -ci -d || true + # perform a shell format + echo "## perform a shell format..." + # ignore the error code because `-d` will always return false when the file has difference + find ${{ env.SCRIPT_DIR }} -name "*.sh" -print0 | xargs -0 shfmt -ln=bash -i 4 -ci -w + - name: Commit any changes + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + message: "style: auto format by CI (shfmt)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From 97a369c755b088d7014f9672d349621413a6a283 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 13 Jul 2023 10:06:48 +0200 Subject: [PATCH 187/253] deny.toml: remove MPL license from allow list --- deny.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/deny.toml b/deny.toml index 46d35ad03..34233952b 100644 --- a/deny.toml +++ b/deny.toml @@ -27,7 +27,6 @@ allow = [ "BSD-2-Clause-FreeBSD", "BSD-3-Clause", "CC0-1.0", - "MPL-2.0", # XXX considered copyleft? "Unicode-DFS-2016", ] copyleft = "deny" From 5d03d2d9d41dcd8292ba0a0a658656bf5032835e Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 13 Jul 2023 17:23:35 +0200 Subject: [PATCH 188/253] clippy: fix warnings introduced by Rust 1.71.0 --- src/uu/csplit/src/csplit.rs | 206 +++++++++--------- src/uu/fmt/src/parasplit.rs | 2 +- src/uu/stdbuf/build.rs | 2 +- src/uucore/src/lib/features/fsext.rs | 15 +- .../tokenize/num_format/formatters/floatf.rs | 2 +- .../tokenize/num_format/formatters/scif.rs | 2 +- tests/by-util/test_cp.rs | 4 +- tests/by-util/test_stat.rs | 6 +- tests/by-util/test_tail.rs | 2 +- 9 files changed, 118 insertions(+), 123 deletions(-) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 1a94b4156..a5b6c06b0 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -552,6 +552,109 @@ where } } +#[uucore::main] +pub fn uumain(args: impl uucore::Args) -> UResult<()> { + let args = args.collect_ignore(); + + let matches = uu_app().try_get_matches_from(args)?; + + // get the file to split + let file_name = matches.get_one::(options::FILE).unwrap(); + + // get the patterns to split on + let patterns: Vec = matches + .get_many::(options::PATTERN) + .unwrap() + .map(|s| s.to_string()) + .collect(); + let patterns = patterns::get_patterns(&patterns[..])?; + let options = CsplitOptions::new(&matches); + if file_name == "-" { + let stdin = io::stdin(); + Ok(csplit(&options, patterns, stdin.lock())?) + } else { + let file = File::open(file_name) + .map_err_context(|| format!("cannot access {}", file_name.quote()))?; + let file_metadata = file + .metadata() + .map_err_context(|| format!("cannot access {}", file_name.quote()))?; + if !file_metadata.is_file() { + return Err(CsplitError::NotRegularFile(file_name.to_string()).into()); + } + Ok(csplit(&options, patterns, BufReader::new(file))?) + } +} + +pub fn uu_app() -> Command { + Command::new(uucore::util_name()) + .version(crate_version!()) + .about(ABOUT) + .override_usage(format_usage(USAGE)) + .infer_long_args(true) + .arg( + Arg::new(options::SUFFIX_FORMAT) + .short('b') + .long(options::SUFFIX_FORMAT) + .value_name("FORMAT") + .help("use sprintf FORMAT instead of %02d"), + ) + .arg( + Arg::new(options::PREFIX) + .short('f') + .long(options::PREFIX) + .value_name("PREFIX") + .help("use PREFIX instead of 'xx'"), + ) + .arg( + Arg::new(options::KEEP_FILES) + .short('k') + .long(options::KEEP_FILES) + .help("do not remove output files on errors") + .action(ArgAction::SetTrue), + ) + .arg( + Arg::new(options::SUPPRESS_MATCHED) + .long(options::SUPPRESS_MATCHED) + .help("suppress the lines matching PATTERN") + .action(ArgAction::SetTrue), + ) + .arg( + Arg::new(options::DIGITS) + .short('n') + .long(options::DIGITS) + .value_name("DIGITS") + .help("use specified number of digits instead of 2"), + ) + .arg( + Arg::new(options::QUIET) + .short('s') + .long(options::QUIET) + .visible_alias("silent") + .help("do not print counts of output file sizes") + .action(ArgAction::SetTrue), + ) + .arg( + Arg::new(options::ELIDE_EMPTY_FILES) + .short('z') + .long(options::ELIDE_EMPTY_FILES) + .help("remove empty output files") + .action(ArgAction::SetTrue), + ) + .arg( + Arg::new(options::FILE) + .hide(true) + .required(true) + .value_hint(clap::ValueHint::FilePath), + ) + .arg( + Arg::new(options::PATTERN) + .hide(true) + .action(clap::ArgAction::Append) + .required(true), + ) + .after_help(AFTER_HELP) +} + #[cfg(test)] mod tests { use super::*; @@ -714,106 +817,3 @@ mod tests { assert!(input_splitter.next().is_none()); } } - -#[uucore::main] -pub fn uumain(args: impl uucore::Args) -> UResult<()> { - let args = args.collect_ignore(); - - let matches = uu_app().try_get_matches_from(args)?; - - // get the file to split - let file_name = matches.get_one::(options::FILE).unwrap(); - - // get the patterns to split on - let patterns: Vec = matches - .get_many::(options::PATTERN) - .unwrap() - .map(|s| s.to_string()) - .collect(); - let patterns = patterns::get_patterns(&patterns[..])?; - let options = CsplitOptions::new(&matches); - if file_name == "-" { - let stdin = io::stdin(); - Ok(csplit(&options, patterns, stdin.lock())?) - } else { - let file = File::open(file_name) - .map_err_context(|| format!("cannot access {}", file_name.quote()))?; - let file_metadata = file - .metadata() - .map_err_context(|| format!("cannot access {}", file_name.quote()))?; - if !file_metadata.is_file() { - return Err(CsplitError::NotRegularFile(file_name.to_string()).into()); - } - Ok(csplit(&options, patterns, BufReader::new(file))?) - } -} - -pub fn uu_app() -> Command { - Command::new(uucore::util_name()) - .version(crate_version!()) - .about(ABOUT) - .override_usage(format_usage(USAGE)) - .infer_long_args(true) - .arg( - Arg::new(options::SUFFIX_FORMAT) - .short('b') - .long(options::SUFFIX_FORMAT) - .value_name("FORMAT") - .help("use sprintf FORMAT instead of %02d"), - ) - .arg( - Arg::new(options::PREFIX) - .short('f') - .long(options::PREFIX) - .value_name("PREFIX") - .help("use PREFIX instead of 'xx'"), - ) - .arg( - Arg::new(options::KEEP_FILES) - .short('k') - .long(options::KEEP_FILES) - .help("do not remove output files on errors") - .action(ArgAction::SetTrue), - ) - .arg( - Arg::new(options::SUPPRESS_MATCHED) - .long(options::SUPPRESS_MATCHED) - .help("suppress the lines matching PATTERN") - .action(ArgAction::SetTrue), - ) - .arg( - Arg::new(options::DIGITS) - .short('n') - .long(options::DIGITS) - .value_name("DIGITS") - .help("use specified number of digits instead of 2"), - ) - .arg( - Arg::new(options::QUIET) - .short('s') - .long(options::QUIET) - .visible_alias("silent") - .help("do not print counts of output file sizes") - .action(ArgAction::SetTrue), - ) - .arg( - Arg::new(options::ELIDE_EMPTY_FILES) - .short('z') - .long(options::ELIDE_EMPTY_FILES) - .help("remove empty output files") - .action(ArgAction::SetTrue), - ) - .arg( - Arg::new(options::FILE) - .hide(true) - .required(true) - .value_hint(clap::ValueHint::FilePath), - ) - .arg( - Arg::new(options::PATTERN) - .hide(true) - .action(clap::ArgAction::Append) - .required(true), - ) - .after_help(AFTER_HELP) -} diff --git a/src/uu/fmt/src/parasplit.rs b/src/uu/fmt/src/parasplit.rs index a2d70b088..c94c81974 100644 --- a/src/uu/fmt/src/parasplit.rs +++ b/src/uu/fmt/src/parasplit.rs @@ -598,7 +598,7 @@ impl<'a> Iterator for WordSplit<'a> { self.prev_punct && (before_tab.is_some() || word_start_relative > 1); // now record whether this word ends in punctuation - self.prev_punct = match self.string[..self.position].chars().rev().next() { + self.prev_punct = match self.string[..self.position].chars().next_back() { Some(ch) => WordSplit::is_punctuation(ch), _ => panic!("fatal: expected word not to be empty"), }; diff --git a/src/uu/stdbuf/build.rs b/src/uu/stdbuf/build.rs index 9ed9a6207..a8472243a 100644 --- a/src/uu/stdbuf/build.rs +++ b/src/uu/stdbuf/build.rs @@ -9,7 +9,7 @@ mod platform { pub const DYLIB_EXT: &str = ".so"; } -#[cfg(any(target_vendor = "apple"))] +#[cfg(target_vendor = "apple")] mod platform { pub const DYLIB_EXT: &str = ".dylib"; } diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 89f1d6e71..6f831fb92 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -194,15 +194,10 @@ impl MountInfo { } #[cfg(unix)] { - if self.dev_name.find(':').is_some() + self.remote = self.dev_name.find(':').is_some() || (self.dev_name.starts_with("//") && self.fs_type == "smbfs" || self.fs_type == "cifs") - || self.dev_name == "-hosts" - { - self.remote = true; - } else { - self.remote = false; - } + || self.dev_name == "-hosts"; } } @@ -371,9 +366,9 @@ extern "C" { fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; #[cfg(any( - all(target_os = "freebsd"), - all(target_os = "netbsd"), - all(target_os = "openbsd"), + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", all(target_vendor = "apple", target_arch = "aarch64") ))] #[link_name = "getmntinfo"] // spell-checker:disable-line diff --git a/src/uucore/src/lib/features/tokenize/num_format/formatters/floatf.rs b/src/uucore/src/lib/features/tokenize/num_format/formatters/floatf.rs index e13629af5..cca2750dc 100644 --- a/src/uucore/src/lib/features/tokenize/num_format/formatters/floatf.rs +++ b/src/uucore/src/lib/features/tokenize/num_format/formatters/floatf.rs @@ -10,7 +10,7 @@ use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnaly pub struct Floatf; impl Floatf { pub fn new() -> Self { - Self::default() + Self } } impl Formatter for Floatf { diff --git a/src/uucore/src/lib/features/tokenize/num_format/formatters/scif.rs b/src/uucore/src/lib/features/tokenize/num_format/formatters/scif.rs index c5b88b5a7..c871dc4e5 100644 --- a/src/uucore/src/lib/features/tokenize/num_format/formatters/scif.rs +++ b/src/uucore/src/lib/features/tokenize/num_format/formatters/scif.rs @@ -10,7 +10,7 @@ pub struct Scif; impl Scif { pub fn new() -> Self { - Self::default() + Self } } impl Formatter for Scif { diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 52f7e4430..18f3829a2 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1337,7 +1337,7 @@ fn test_cp_preserve_all_context_fails_on_non_selinux() { } #[test] -#[cfg(any(target_os = "android"))] +#[cfg(target_os = "android")] fn test_cp_preserve_xattr_fails_on_android() { // Because of the SELinux extended attributes used on Android, trying to copy extended // attributes has to fail in this case, since we specify `--preserve=xattr` and this puts it @@ -2768,7 +2768,7 @@ fn test_same_file_force() { } /// Test that copying file to itself with forced backup succeeds. -#[cfg(all(not(windows)))] +#[cfg(not(windows))] #[test] fn test_same_file_force_backup() { let (at, mut ucmd) = at_and_ucmd!(); diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 2527dc7cd..92a8bcd98 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -178,7 +178,7 @@ fn test_char() { DEV_FORMAT_STR, #[cfg(target_os = "linux")] "/dev/pts/ptmx", - #[cfg(any(target_vendor = "apple"))] + #[cfg(target_vendor = "apple")] "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s (/%T) %u %U %W %X %y %Y %z %Z", #[cfg(any(target_os = "android", target_vendor = "apple"))] "/dev/ptmx", @@ -198,7 +198,7 @@ fn test_date() { "%z", #[cfg(target_os = "linux")] "/bin/sh", - #[cfg(any(target_vendor = "apple"))] + #[cfg(target_vendor = "apple")] "%z", #[cfg(any(target_os = "android", target_vendor = "apple"))] "/bin/sh", @@ -213,7 +213,7 @@ fn test_date() { "%z", #[cfg(target_os = "linux")] "/dev/ptmx", - #[cfg(any(target_vendor = "apple"))] + #[cfg(target_vendor = "apple")] "%z", #[cfg(any(target_os = "android", target_vendor = "apple"))] "/dev/ptmx", diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index dba1df269..75abb8eb6 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -145,7 +145,7 @@ fn test_stdin_redirect_offset() { } #[test] -#[cfg(all(not(target_vendor = "apple")))] // FIXME: for currently not working platforms +#[cfg(not(target_vendor = "apple"))] // FIXME: for currently not working platforms fn test_stdin_redirect_offset2() { // like test_stdin_redirect_offset but with multiple files From 388f249716f6e036fc6bbe5c8ec317e2ff62c481 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 13 Jul 2023 15:31:15 +0200 Subject: [PATCH 189/253] nl: allow negative values for -i and -v --- src/uu/nl/src/helper.rs | 28 +++-------------- src/uu/nl/src/nl.rs | 14 +++++---- tests/by-util/test_nl.rs | 68 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 80 insertions(+), 30 deletions(-) diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 341f116c3..2a90cb130 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -79,18 +79,6 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> } } } - match opts.get_one::(options::LINE_INCREMENT) { - None => {} - Some(val) => { - let conv: Option = val.parse().ok(); - match conv { - None => { - errs.push(String::from("Illegal value for -i")); - } - Some(num) => settings.line_increment = num, - } - } - } match opts.get_one::(options::NUMBER_WIDTH) { None => {} Some(num) if *num > 0 => settings.number_width = *num, @@ -98,17 +86,11 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> "Invalid line number field width: ‘0’: Numerical result out of range", )), } - match opts.get_one::(options::STARTING_LINE_NUMBER) { - None => {} - Some(val) => { - let conv: Option = val.parse().ok(); - match conv { - None => { - errs.push(String::from("Illegal value for -v")); - } - Some(num) => settings.starting_line_number = num, - } - } + if let Some(num) = opts.get_one::(options::LINE_INCREMENT) { + settings.line_increment = *num; + } + if let Some(num) = opts.get_one::(options::STARTING_LINE_NUMBER) { + settings.starting_line_number = *num; } match opts.get_one::(options::JOIN_BLANK_LINES) { None => {} diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 8c0e89a44..b2edaa83b 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -29,8 +29,8 @@ pub struct Settings { // The variable corresponding to -d section_delimiter: [char; 2], // The variables corresponding to the options -v, -i, -l, -w. - starting_line_number: u64, - line_increment: u64, + starting_line_number: i64, + line_increment: i64, join_blank_lines: u64, number_width: usize, // Used with String::from_char, hence usize. // The format of the number and the (default value for) @@ -208,7 +208,8 @@ pub fn uu_app() -> Command { .short('i') .long(options::LINE_INCREMENT) .help("line number increment at each line") - .value_name("NUMBER"), + .value_name("NUMBER") + .value_parser(clap::value_parser!(i64)), ) .arg( Arg::new(options::JOIN_BLANK_LINES) @@ -244,7 +245,8 @@ pub fn uu_app() -> Command { .short('v') .long(options::STARTING_LINE_NUMBER) .help("first line number on each logical page") - .value_name("NUMBER"), + .value_name("NUMBER") + .value_parser(clap::value_parser!(i64)), ) .arg( Arg::new(options::NUMBER_WIDTH) @@ -267,7 +269,7 @@ fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { let line_no_width_initial = line_no_width; // Stores the smallest integer with one more digit than line_no, so that // when line_no >= line_no_threshold, we need to use one more digit. - let mut line_no_threshold = 10u64.pow(line_no_width as u32); + let mut line_no_threshold = 10i64.pow(line_no_width as u32); let mut empty_line_count: u64 = 0; let fill_char = match settings.number_format { NumberFormat::RightZero => '0', @@ -329,7 +331,7 @@ fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { if settings.renumber { line_no = settings.starting_line_number; line_no_width = line_no_width_initial; - line_no_threshold = 10u64.pow(line_no_width as u32); + line_no_threshold = 10i64.pow(line_no_width as u32); } &settings.header_numbering } diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index f75f3f483..7325dfe8c 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore ninvalid winvalid +// spell-checker:ignore iinvalid ninvalid vinvalid winvalid use crate::common::util::TestScenario; #[test] @@ -13,6 +13,7 @@ fn test_stdin_no_newline() { .run() .stdout_is(" 1\tNo Newline\n"); } + #[test] fn test_stdin_newline() { new_ucmd!() @@ -167,3 +168,68 @@ fn test_number_separator() { .stdout_is(" 1:-:test\n"); } } + +#[test] +fn test_starting_line_number() { + for arg in ["-v10", "--starting-line-number=10"] { + new_ucmd!() + .arg(arg) + .pipe_in("test") + .succeeds() + .stdout_is(" 10\ttest\n"); + } +} + +#[test] +fn test_negative_starting_line_number() { + for arg in ["-v-10", "--starting-line-number=-10"] { + new_ucmd!() + .arg(arg) + .pipe_in("test") + .succeeds() + .stdout_is(" -10\ttest\n"); + } +} + +#[test] +fn test_invalid_starting_line_number() { + for arg in ["-vinvalid", "--starting-line-number=invalid"] { + new_ucmd!() + .arg(arg) + .fails() + .stderr_contains("invalid value 'invalid'"); + } +} + +#[test] +fn test_line_increment() { + for arg in ["-i10", "--line-increment=10"] { + new_ucmd!() + .arg(arg) + .pipe_in("a\nb") + .succeeds() + .stdout_is(" 1\ta\n 11\tb\n"); + } +} + +#[test] +fn test_negative_line_increment() { + // TODO make this test work with -10 + for arg in ["-i-1", "--line-increment=-1"] { + new_ucmd!() + .arg(arg) + .pipe_in("a\nb") + .succeeds() + .stdout_is(" 1\ta\n 0\tb\n"); + } +} + +#[test] +fn test_invalid_line_increment() { + for arg in ["-iinvalid", "--line-increment=invalid"] { + new_ucmd!() + .arg(arg) + .fails() + .stderr_contains("invalid value 'invalid'"); + } +} From 74530c0f51f9d6e2685610ca7d237f34accd45f2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 14 Jul 2023 13:04:17 +0200 Subject: [PATCH 190/253] Update the version to 0.0.20 --- Cargo.lock | 216 ++++++++++++------------- Cargo.toml | 208 ++++++++++++------------ src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/basenc/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chcon/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/dd/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dir/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/pr/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/runcon/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 4 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/stty/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/vdir/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- src/uucore/Cargo.toml | 2 +- src/uucore_procs/Cargo.toml | 4 +- src/uuhelp_parser/Cargo.toml | 2 +- util/update-version.sh | 4 +- 110 files changed, 323 insertions(+), 323 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1187b2e11..68112a72b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -394,7 +394,7 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "coreutils" -version = "0.0.19" +version = "0.0.20" dependencies = [ "chrono", "clap", @@ -2298,7 +2298,7 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uu_arch" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "platform-info", @@ -2307,7 +2307,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2315,7 +2315,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.19" +version = "0.0.20" dependencies = [ "uu_base32", "uucore", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2331,7 +2331,7 @@ dependencies = [ [[package]] name = "uu_basenc" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uu_base32", @@ -2340,7 +2340,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "is-terminal", @@ -2351,7 +2351,7 @@ dependencies = [ [[package]] name = "uu_chcon" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "fts-sys", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2371,7 +2371,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2380,7 +2380,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2388,7 +2388,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2396,7 +2396,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "hex", @@ -2405,7 +2405,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2413,7 +2413,7 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "exacl", @@ -2429,7 +2429,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "regex", @@ -2439,7 +2439,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.19" +version = "0.0.20" dependencies = [ "bstr", "clap", @@ -2450,7 +2450,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.19" +version = "0.0.20" dependencies = [ "chrono", "clap", @@ -2462,7 +2462,7 @@ dependencies = [ [[package]] name = "uu_dd" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "gcd", @@ -2474,7 +2474,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "tempfile", @@ -2484,7 +2484,7 @@ dependencies = [ [[package]] name = "uu_dir" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uu_ls", @@ -2493,7 +2493,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2501,7 +2501,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2509,7 +2509,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.19" +version = "0.0.20" dependencies = [ "chrono", "clap", @@ -2520,7 +2520,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2528,7 +2528,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "nix", @@ -2538,7 +2538,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "unicode-width", @@ -2547,7 +2547,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "num-bigint", @@ -2558,7 +2558,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "coz", @@ -2571,7 +2571,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2579,7 +2579,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "unicode-width", @@ -2588,7 +2588,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2596,7 +2596,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2604,7 +2604,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "hex", @@ -2615,7 +2615,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "memchr", @@ -2624,7 +2624,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2633,7 +2633,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "hostname", @@ -2643,7 +2643,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "selinux", @@ -2652,7 +2652,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "file_diff", @@ -2663,7 +2663,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "memchr", @@ -2672,7 +2672,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "nix", @@ -2681,7 +2681,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2689,7 +2689,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2697,7 +2697,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2706,7 +2706,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.19" +version = "0.0.20" dependencies = [ "chrono", "clap", @@ -2724,7 +2724,7 @@ dependencies = [ [[package]] name = "uu_mkdir" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2732,7 +2732,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2741,7 +2741,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2750,7 +2750,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "rand", @@ -2760,7 +2760,7 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "crossterm", @@ -2773,7 +2773,7 @@ dependencies = [ [[package]] name = "uu_mv" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "fs_extra", @@ -2783,7 +2783,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2793,7 +2793,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "regex", @@ -2802,7 +2802,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "is-terminal", @@ -2812,7 +2812,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2821,7 +2821,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2829,7 +2829,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.19" +version = "0.0.20" dependencies = [ "byteorder", "clap", @@ -2839,7 +2839,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2847,7 +2847,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2856,7 +2856,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2864,7 +2864,7 @@ dependencies = [ [[package]] name = "uu_pr" -version = "0.0.19" +version = "0.0.20" dependencies = [ "chrono", "clap", @@ -2876,7 +2876,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2884,7 +2884,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2892,7 +2892,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "regex", @@ -2901,7 +2901,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2909,7 +2909,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2917,7 +2917,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2925,7 +2925,7 @@ dependencies = [ [[package]] name = "uu_relpath" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -2933,7 +2933,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2944,7 +2944,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2953,7 +2953,7 @@ dependencies = [ [[package]] name = "uu_runcon" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2964,7 +2964,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.19" +version = "0.0.20" dependencies = [ "bigdecimal", "clap", @@ -2975,7 +2975,7 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -2985,7 +2985,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "memchr", @@ -2996,7 +2996,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "fundu", @@ -3005,7 +3005,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.19" +version = "0.0.20" dependencies = [ "binary-heap-plus", "clap", @@ -3024,7 +3024,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "memchr", @@ -3033,7 +3033,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3041,7 +3041,7 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "tempfile", @@ -3051,7 +3051,7 @@ dependencies = [ [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.19" +version = "0.0.20" dependencies = [ "cpp", "cpp_build", @@ -3061,7 +3061,7 @@ dependencies = [ [[package]] name = "uu_stty" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "nix", @@ -3070,7 +3070,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3078,7 +3078,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -3089,7 +3089,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "memchr", @@ -3100,7 +3100,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "fundu", @@ -3117,7 +3117,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -3126,7 +3126,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -3136,7 +3136,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -3146,7 +3146,7 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "filetime", @@ -3158,7 +3158,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "nom", @@ -3167,7 +3167,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3175,7 +3175,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3183,7 +3183,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3191,7 +3191,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "is-terminal", @@ -3201,7 +3201,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "platform-info", @@ -3210,7 +3210,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "unicode-width", @@ -3219,7 +3219,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3227,7 +3227,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3235,7 +3235,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.19" +version = "0.0.20" dependencies = [ "chrono", "clap", @@ -3244,7 +3244,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3252,7 +3252,7 @@ dependencies = [ [[package]] name = "uu_vdir" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uu_ls", @@ -3261,7 +3261,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.19" +version = "0.0.20" dependencies = [ "bytecount", "clap", @@ -3274,7 +3274,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "uucore", @@ -3282,7 +3282,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "libc", @@ -3292,7 +3292,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.19" +version = "0.0.20" dependencies = [ "clap", "itertools", @@ -3302,7 +3302,7 @@ dependencies = [ [[package]] name = "uucore" -version = "0.0.19" +version = "0.0.20" dependencies = [ "blake2b_simd", "blake3", @@ -3338,7 +3338,7 @@ dependencies = [ [[package]] name = "uucore_procs" -version = "0.0.19" +version = "0.0.20" dependencies = [ "proc-macro2", "quote", @@ -3347,7 +3347,7 @@ dependencies = [ [[package]] name = "uuhelp_parser" -version = "0.0.19" +version = "0.0.20" [[package]] name = "uuid" diff --git a/Cargo.toml b/Cargo.toml index 2e70772e8..f2500daf2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ [package] name = "coreutils" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -362,110 +362,110 @@ zip = { workspace = true, optional = true } uuhelp_parser = { optional = true, version = ">=0.0.19", path = "src/uuhelp_parser" } # * uutils -uu_test = { optional = true, version = "0.0.19", package = "uu_test", path = "src/uu/test" } +uu_test = { optional = true, version = "0.0.20", package = "uu_test", path = "src/uu/test" } # -arch = { optional = true, version = "0.0.19", package = "uu_arch", path = "src/uu/arch" } -base32 = { optional = true, version = "0.0.19", package = "uu_base32", path = "src/uu/base32" } -base64 = { optional = true, version = "0.0.19", package = "uu_base64", path = "src/uu/base64" } -basename = { optional = true, version = "0.0.19", package = "uu_basename", path = "src/uu/basename" } -basenc = { optional = true, version = "0.0.19", package = "uu_basenc", path = "src/uu/basenc" } -cat = { optional = true, version = "0.0.19", package = "uu_cat", path = "src/uu/cat" } -chcon = { optional = true, version = "0.0.19", package = "uu_chcon", path = "src/uu/chcon" } -chgrp = { optional = true, version = "0.0.19", package = "uu_chgrp", path = "src/uu/chgrp" } -chmod = { optional = true, version = "0.0.19", package = "uu_chmod", path = "src/uu/chmod" } -chown = { optional = true, version = "0.0.19", package = "uu_chown", path = "src/uu/chown" } -chroot = { optional = true, version = "0.0.19", package = "uu_chroot", path = "src/uu/chroot" } -cksum = { optional = true, version = "0.0.19", package = "uu_cksum", path = "src/uu/cksum" } -comm = { optional = true, version = "0.0.19", package = "uu_comm", path = "src/uu/comm" } -cp = { optional = true, version = "0.0.19", package = "uu_cp", path = "src/uu/cp" } -csplit = { optional = true, version = "0.0.19", package = "uu_csplit", path = "src/uu/csplit" } -cut = { optional = true, version = "0.0.19", package = "uu_cut", path = "src/uu/cut" } -date = { optional = true, version = "0.0.19", package = "uu_date", path = "src/uu/date" } -dd = { optional = true, version = "0.0.19", package = "uu_dd", path = "src/uu/dd" } -df = { optional = true, version = "0.0.19", package = "uu_df", path = "src/uu/df" } -dir = { optional = true, version = "0.0.19", package = "uu_dir", path = "src/uu/dir" } -dircolors = { optional = true, version = "0.0.19", package = "uu_dircolors", path = "src/uu/dircolors" } -dirname = { optional = true, version = "0.0.19", package = "uu_dirname", path = "src/uu/dirname" } -du = { optional = true, version = "0.0.19", package = "uu_du", path = "src/uu/du" } -echo = { optional = true, version = "0.0.19", package = "uu_echo", path = "src/uu/echo" } -env = { optional = true, version = "0.0.19", package = "uu_env", path = "src/uu/env" } -expand = { optional = true, version = "0.0.19", package = "uu_expand", path = "src/uu/expand" } -expr = { optional = true, version = "0.0.19", package = "uu_expr", path = "src/uu/expr" } -factor = { optional = true, version = "0.0.19", package = "uu_factor", path = "src/uu/factor" } -false = { optional = true, version = "0.0.19", package = "uu_false", path = "src/uu/false" } -fmt = { optional = true, version = "0.0.19", package = "uu_fmt", path = "src/uu/fmt" } -fold = { optional = true, version = "0.0.19", package = "uu_fold", path = "src/uu/fold" } -groups = { optional = true, version = "0.0.19", package = "uu_groups", path = "src/uu/groups" } -hashsum = { optional = true, version = "0.0.19", package = "uu_hashsum", path = "src/uu/hashsum" } -head = { optional = true, version = "0.0.19", package = "uu_head", path = "src/uu/head" } -hostid = { optional = true, version = "0.0.19", package = "uu_hostid", path = "src/uu/hostid" } -hostname = { optional = true, version = "0.0.19", package = "uu_hostname", path = "src/uu/hostname" } -id = { optional = true, version = "0.0.19", package = "uu_id", path = "src/uu/id" } -install = { optional = true, version = "0.0.19", package = "uu_install", path = "src/uu/install" } -join = { optional = true, version = "0.0.19", package = "uu_join", path = "src/uu/join" } -kill = { optional = true, version = "0.0.19", package = "uu_kill", path = "src/uu/kill" } -link = { optional = true, version = "0.0.19", package = "uu_link", path = "src/uu/link" } -ln = { optional = true, version = "0.0.19", package = "uu_ln", path = "src/uu/ln" } -ls = { optional = true, version = "0.0.19", package = "uu_ls", path = "src/uu/ls" } -logname = { optional = true, version = "0.0.19", package = "uu_logname", path = "src/uu/logname" } -mkdir = { optional = true, version = "0.0.19", package = "uu_mkdir", path = "src/uu/mkdir" } -mkfifo = { optional = true, version = "0.0.19", package = "uu_mkfifo", path = "src/uu/mkfifo" } -mknod = { optional = true, version = "0.0.19", package = "uu_mknod", path = "src/uu/mknod" } -mktemp = { optional = true, version = "0.0.19", package = "uu_mktemp", path = "src/uu/mktemp" } -more = { optional = true, version = "0.0.19", package = "uu_more", path = "src/uu/more" } -mv = { optional = true, version = "0.0.19", package = "uu_mv", path = "src/uu/mv" } -nice = { optional = true, version = "0.0.19", package = "uu_nice", path = "src/uu/nice" } -nl = { optional = true, version = "0.0.19", package = "uu_nl", path = "src/uu/nl" } -nohup = { optional = true, version = "0.0.19", package = "uu_nohup", path = "src/uu/nohup" } -nproc = { optional = true, version = "0.0.19", package = "uu_nproc", path = "src/uu/nproc" } -numfmt = { optional = true, version = "0.0.19", package = "uu_numfmt", path = "src/uu/numfmt" } -od = { optional = true, version = "0.0.19", package = "uu_od", path = "src/uu/od" } -paste = { optional = true, version = "0.0.19", package = "uu_paste", path = "src/uu/paste" } -pathchk = { optional = true, version = "0.0.19", package = "uu_pathchk", path = "src/uu/pathchk" } -pinky = { optional = true, version = "0.0.19", package = "uu_pinky", path = "src/uu/pinky" } -pr = { optional = true, version = "0.0.19", package = "uu_pr", path = "src/uu/pr" } -printenv = { optional = true, version = "0.0.19", package = "uu_printenv", path = "src/uu/printenv" } -printf = { optional = true, version = "0.0.19", package = "uu_printf", path = "src/uu/printf" } -ptx = { optional = true, version = "0.0.19", package = "uu_ptx", path = "src/uu/ptx" } -pwd = { optional = true, version = "0.0.19", package = "uu_pwd", path = "src/uu/pwd" } -readlink = { optional = true, version = "0.0.19", package = "uu_readlink", path = "src/uu/readlink" } -realpath = { optional = true, version = "0.0.19", package = "uu_realpath", path = "src/uu/realpath" } -relpath = { optional = true, version = "0.0.19", package = "uu_relpath", path = "src/uu/relpath" } -rm = { optional = true, version = "0.0.19", package = "uu_rm", path = "src/uu/rm" } -rmdir = { optional = true, version = "0.0.19", package = "uu_rmdir", path = "src/uu/rmdir" } -runcon = { optional = true, version = "0.0.19", package = "uu_runcon", path = "src/uu/runcon" } -seq = { optional = true, version = "0.0.19", package = "uu_seq", path = "src/uu/seq" } -shred = { optional = true, version = "0.0.19", package = "uu_shred", path = "src/uu/shred" } -shuf = { optional = true, version = "0.0.19", package = "uu_shuf", path = "src/uu/shuf" } -sleep = { optional = true, version = "0.0.19", package = "uu_sleep", path = "src/uu/sleep" } -sort = { optional = true, version = "0.0.19", package = "uu_sort", path = "src/uu/sort" } -split = { optional = true, version = "0.0.19", package = "uu_split", path = "src/uu/split" } -stat = { optional = true, version = "0.0.19", package = "uu_stat", path = "src/uu/stat" } -stdbuf = { optional = true, version = "0.0.19", package = "uu_stdbuf", path = "src/uu/stdbuf" } -stty = { optional = true, version = "0.0.19", package = "uu_stty", path = "src/uu/stty" } -sum = { optional = true, version = "0.0.19", package = "uu_sum", path = "src/uu/sum" } -sync = { optional = true, version = "0.0.19", package = "uu_sync", path = "src/uu/sync" } -tac = { optional = true, version = "0.0.19", package = "uu_tac", path = "src/uu/tac" } -tail = { optional = true, version = "0.0.19", package = "uu_tail", path = "src/uu/tail" } -tee = { optional = true, version = "0.0.19", package = "uu_tee", path = "src/uu/tee" } -timeout = { optional = true, version = "0.0.19", package = "uu_timeout", path = "src/uu/timeout" } -touch = { optional = true, version = "0.0.19", package = "uu_touch", path = "src/uu/touch" } -tr = { optional = true, version = "0.0.19", package = "uu_tr", path = "src/uu/tr" } -true = { optional = true, version = "0.0.19", package = "uu_true", path = "src/uu/true" } -truncate = { optional = true, version = "0.0.19", package = "uu_truncate", path = "src/uu/truncate" } -tsort = { optional = true, version = "0.0.19", package = "uu_tsort", path = "src/uu/tsort" } -tty = { optional = true, version = "0.0.19", package = "uu_tty", path = "src/uu/tty" } -uname = { optional = true, version = "0.0.19", package = "uu_uname", path = "src/uu/uname" } -unexpand = { optional = true, version = "0.0.19", package = "uu_unexpand", path = "src/uu/unexpand" } -uniq = { optional = true, version = "0.0.19", package = "uu_uniq", path = "src/uu/uniq" } -unlink = { optional = true, version = "0.0.19", package = "uu_unlink", path = "src/uu/unlink" } -uptime = { optional = true, version = "0.0.19", package = "uu_uptime", path = "src/uu/uptime" } -users = { optional = true, version = "0.0.19", package = "uu_users", path = "src/uu/users" } -vdir = { optional = true, version = "0.0.19", package = "uu_vdir", path = "src/uu/vdir" } -wc = { optional = true, version = "0.0.19", package = "uu_wc", path = "src/uu/wc" } -who = { optional = true, version = "0.0.19", package = "uu_who", path = "src/uu/who" } -whoami = { optional = true, version = "0.0.19", package = "uu_whoami", path = "src/uu/whoami" } -yes = { optional = true, version = "0.0.19", package = "uu_yes", path = "src/uu/yes" } +arch = { optional = true, version = "0.0.20", package = "uu_arch", path = "src/uu/arch" } +base32 = { optional = true, version = "0.0.20", package = "uu_base32", path = "src/uu/base32" } +base64 = { optional = true, version = "0.0.20", package = "uu_base64", path = "src/uu/base64" } +basename = { optional = true, version = "0.0.20", package = "uu_basename", path = "src/uu/basename" } +basenc = { optional = true, version = "0.0.20", package = "uu_basenc", path = "src/uu/basenc" } +cat = { optional = true, version = "0.0.20", package = "uu_cat", path = "src/uu/cat" } +chcon = { optional = true, version = "0.0.20", package = "uu_chcon", path = "src/uu/chcon" } +chgrp = { optional = true, version = "0.0.20", package = "uu_chgrp", path = "src/uu/chgrp" } +chmod = { optional = true, version = "0.0.20", package = "uu_chmod", path = "src/uu/chmod" } +chown = { optional = true, version = "0.0.20", package = "uu_chown", path = "src/uu/chown" } +chroot = { optional = true, version = "0.0.20", package = "uu_chroot", path = "src/uu/chroot" } +cksum = { optional = true, version = "0.0.20", package = "uu_cksum", path = "src/uu/cksum" } +comm = { optional = true, version = "0.0.20", package = "uu_comm", path = "src/uu/comm" } +cp = { optional = true, version = "0.0.20", package = "uu_cp", path = "src/uu/cp" } +csplit = { optional = true, version = "0.0.20", package = "uu_csplit", path = "src/uu/csplit" } +cut = { optional = true, version = "0.0.20", package = "uu_cut", path = "src/uu/cut" } +date = { optional = true, version = "0.0.20", package = "uu_date", path = "src/uu/date" } +dd = { optional = true, version = "0.0.20", package = "uu_dd", path = "src/uu/dd" } +df = { optional = true, version = "0.0.20", package = "uu_df", path = "src/uu/df" } +dir = { optional = true, version = "0.0.20", package = "uu_dir", path = "src/uu/dir" } +dircolors = { optional = true, version = "0.0.20", package = "uu_dircolors", path = "src/uu/dircolors" } +dirname = { optional = true, version = "0.0.20", package = "uu_dirname", path = "src/uu/dirname" } +du = { optional = true, version = "0.0.20", package = "uu_du", path = "src/uu/du" } +echo = { optional = true, version = "0.0.20", package = "uu_echo", path = "src/uu/echo" } +env = { optional = true, version = "0.0.20", package = "uu_env", path = "src/uu/env" } +expand = { optional = true, version = "0.0.20", package = "uu_expand", path = "src/uu/expand" } +expr = { optional = true, version = "0.0.20", package = "uu_expr", path = "src/uu/expr" } +factor = { optional = true, version = "0.0.20", package = "uu_factor", path = "src/uu/factor" } +false = { optional = true, version = "0.0.20", package = "uu_false", path = "src/uu/false" } +fmt = { optional = true, version = "0.0.20", package = "uu_fmt", path = "src/uu/fmt" } +fold = { optional = true, version = "0.0.20", package = "uu_fold", path = "src/uu/fold" } +groups = { optional = true, version = "0.0.20", package = "uu_groups", path = "src/uu/groups" } +hashsum = { optional = true, version = "0.0.20", package = "uu_hashsum", path = "src/uu/hashsum" } +head = { optional = true, version = "0.0.20", package = "uu_head", path = "src/uu/head" } +hostid = { optional = true, version = "0.0.20", package = "uu_hostid", path = "src/uu/hostid" } +hostname = { optional = true, version = "0.0.20", package = "uu_hostname", path = "src/uu/hostname" } +id = { optional = true, version = "0.0.20", package = "uu_id", path = "src/uu/id" } +install = { optional = true, version = "0.0.20", package = "uu_install", path = "src/uu/install" } +join = { optional = true, version = "0.0.20", package = "uu_join", path = "src/uu/join" } +kill = { optional = true, version = "0.0.20", package = "uu_kill", path = "src/uu/kill" } +link = { optional = true, version = "0.0.20", package = "uu_link", path = "src/uu/link" } +ln = { optional = true, version = "0.0.20", package = "uu_ln", path = "src/uu/ln" } +ls = { optional = true, version = "0.0.20", package = "uu_ls", path = "src/uu/ls" } +logname = { optional = true, version = "0.0.20", package = "uu_logname", path = "src/uu/logname" } +mkdir = { optional = true, version = "0.0.20", package = "uu_mkdir", path = "src/uu/mkdir" } +mkfifo = { optional = true, version = "0.0.20", package = "uu_mkfifo", path = "src/uu/mkfifo" } +mknod = { optional = true, version = "0.0.20", package = "uu_mknod", path = "src/uu/mknod" } +mktemp = { optional = true, version = "0.0.20", package = "uu_mktemp", path = "src/uu/mktemp" } +more = { optional = true, version = "0.0.20", package = "uu_more", path = "src/uu/more" } +mv = { optional = true, version = "0.0.20", package = "uu_mv", path = "src/uu/mv" } +nice = { optional = true, version = "0.0.20", package = "uu_nice", path = "src/uu/nice" } +nl = { optional = true, version = "0.0.20", package = "uu_nl", path = "src/uu/nl" } +nohup = { optional = true, version = "0.0.20", package = "uu_nohup", path = "src/uu/nohup" } +nproc = { optional = true, version = "0.0.20", package = "uu_nproc", path = "src/uu/nproc" } +numfmt = { optional = true, version = "0.0.20", package = "uu_numfmt", path = "src/uu/numfmt" } +od = { optional = true, version = "0.0.20", package = "uu_od", path = "src/uu/od" } +paste = { optional = true, version = "0.0.20", package = "uu_paste", path = "src/uu/paste" } +pathchk = { optional = true, version = "0.0.20", package = "uu_pathchk", path = "src/uu/pathchk" } +pinky = { optional = true, version = "0.0.20", package = "uu_pinky", path = "src/uu/pinky" } +pr = { optional = true, version = "0.0.20", package = "uu_pr", path = "src/uu/pr" } +printenv = { optional = true, version = "0.0.20", package = "uu_printenv", path = "src/uu/printenv" } +printf = { optional = true, version = "0.0.20", package = "uu_printf", path = "src/uu/printf" } +ptx = { optional = true, version = "0.0.20", package = "uu_ptx", path = "src/uu/ptx" } +pwd = { optional = true, version = "0.0.20", package = "uu_pwd", path = "src/uu/pwd" } +readlink = { optional = true, version = "0.0.20", package = "uu_readlink", path = "src/uu/readlink" } +realpath = { optional = true, version = "0.0.20", package = "uu_realpath", path = "src/uu/realpath" } +relpath = { optional = true, version = "0.0.20", package = "uu_relpath", path = "src/uu/relpath" } +rm = { optional = true, version = "0.0.20", package = "uu_rm", path = "src/uu/rm" } +rmdir = { optional = true, version = "0.0.20", package = "uu_rmdir", path = "src/uu/rmdir" } +runcon = { optional = true, version = "0.0.20", package = "uu_runcon", path = "src/uu/runcon" } +seq = { optional = true, version = "0.0.20", package = "uu_seq", path = "src/uu/seq" } +shred = { optional = true, version = "0.0.20", package = "uu_shred", path = "src/uu/shred" } +shuf = { optional = true, version = "0.0.20", package = "uu_shuf", path = "src/uu/shuf" } +sleep = { optional = true, version = "0.0.20", package = "uu_sleep", path = "src/uu/sleep" } +sort = { optional = true, version = "0.0.20", package = "uu_sort", path = "src/uu/sort" } +split = { optional = true, version = "0.0.20", package = "uu_split", path = "src/uu/split" } +stat = { optional = true, version = "0.0.20", package = "uu_stat", path = "src/uu/stat" } +stdbuf = { optional = true, version = "0.0.20", package = "uu_stdbuf", path = "src/uu/stdbuf" } +stty = { optional = true, version = "0.0.20", package = "uu_stty", path = "src/uu/stty" } +sum = { optional = true, version = "0.0.20", package = "uu_sum", path = "src/uu/sum" } +sync = { optional = true, version = "0.0.20", package = "uu_sync", path = "src/uu/sync" } +tac = { optional = true, version = "0.0.20", package = "uu_tac", path = "src/uu/tac" } +tail = { optional = true, version = "0.0.20", package = "uu_tail", path = "src/uu/tail" } +tee = { optional = true, version = "0.0.20", package = "uu_tee", path = "src/uu/tee" } +timeout = { optional = true, version = "0.0.20", package = "uu_timeout", path = "src/uu/timeout" } +touch = { optional = true, version = "0.0.20", package = "uu_touch", path = "src/uu/touch" } +tr = { optional = true, version = "0.0.20", package = "uu_tr", path = "src/uu/tr" } +true = { optional = true, version = "0.0.20", package = "uu_true", path = "src/uu/true" } +truncate = { optional = true, version = "0.0.20", package = "uu_truncate", path = "src/uu/truncate" } +tsort = { optional = true, version = "0.0.20", package = "uu_tsort", path = "src/uu/tsort" } +tty = { optional = true, version = "0.0.20", package = "uu_tty", path = "src/uu/tty" } +uname = { optional = true, version = "0.0.20", package = "uu_uname", path = "src/uu/uname" } +unexpand = { optional = true, version = "0.0.20", package = "uu_unexpand", path = "src/uu/unexpand" } +uniq = { optional = true, version = "0.0.20", package = "uu_uniq", path = "src/uu/uniq" } +unlink = { optional = true, version = "0.0.20", package = "uu_unlink", path = "src/uu/unlink" } +uptime = { optional = true, version = "0.0.20", package = "uu_uptime", path = "src/uu/uptime" } +users = { optional = true, version = "0.0.20", package = "uu_users", path = "src/uu/users" } +vdir = { optional = true, version = "0.0.20", package = "uu_vdir", path = "src/uu/vdir" } +wc = { optional = true, version = "0.0.20", package = "uu_wc", path = "src/uu/wc" } +who = { optional = true, version = "0.0.20", package = "uu_who", path = "src/uu/who" } +whoami = { optional = true, version = "0.0.20", package = "uu_whoami", path = "src/uu/whoami" } +yes = { optional = true, version = "0.0.20", package = "uu_yes", path = "src/uu/yes" } # this breaks clippy linting with: "tests/by-util/test_factor_benches.rs: No such file or directory (os error 2)" # factor_benches = { optional = true, version = "0.0.0", package = "uu_factor_benches", path = "tests/benches/factor" } diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 42ac16b89..35e7e3892 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index ea718e8dc..97c853eb6 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index ba8229073..ef4a063fe 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index a1ea12c5e..4fd2b6f8c 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" diff --git a/src/uu/basenc/Cargo.toml b/src/uu/basenc/Cargo.toml index 20665402a..4676a6d8f 100644 --- a/src/uu/basenc/Cargo.toml +++ b/src/uu/basenc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basenc" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "basenc ~ (uutils) decode/encode input" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index e341fb535..636e3bfef 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" diff --git a/src/uu/chcon/Cargo.toml b/src/uu/chcon/Cargo.toml index 58d6b9b46..f621aa012 100644 --- a/src/uu/chcon/Cargo.toml +++ b/src/uu/chcon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chcon" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "chcon ~ (uutils) change file security context" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 97ffc09b7..9ca3dc26a 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index a4b4b799d..a788e83ca 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index cd1f881ee..3b92e288e 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 1256a96c8..d2f58320d 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 345dfb238..70886df05 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index e5947bb84..b86aa4902 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index ff8f21160..c768bde0c 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.19" +version = "0.0.20" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 023d97243..051f567b4 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 6e8c28d74..6f37aa336 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index e28762493..de5b5f2a2 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore datetime [package] name = "uu_date" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" diff --git a/src/uu/dd/Cargo.toml b/src/uu/dd/Cargo.toml index 0ac25657e..0a69ae374 100644 --- a/src/uu/dd/Cargo.toml +++ b/src/uu/dd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dd" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "dd ~ (uutils) copy and convert files" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 2be3967af..047fe9be0 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" diff --git a/src/uu/dir/Cargo.toml b/src/uu/dir/Cargo.toml index d61b041dc..7bd144f02 100644 --- a/src/uu/dir/Cargo.toml +++ b/src/uu/dir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dir" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "shortcut to ls -C -b" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 952e7ad3f..f490a4728 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 46dec707d..4ac789937 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 693e7c81c..041efeaad 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index e12460a51..a95bcbe82 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 2b05cd3e7..551249b77 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index dd0b76982..894a21be0 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 68224ee45..3ea796ee0 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index a0fc539e1..c97dbcba4 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 88b5751cb..9eb0ccbb1 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 0de6218b8..cabb144cf 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index f0377c5ab..a476e0f13 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index a33b34f76..989dc9c11 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 0a12254d0..cca2dbfe1 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 6b53b1526..6326fcd8b 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 175c31930..298a9da69 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index d94a703eb..d28f2511f 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 4d32f6e59..bd80a447c 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 14be22a97..8228e0d20 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.19" +version = "0.0.20" authors = ["Ben Eills ", "uutils developers"] license = "MIT" description = "install ~ (uutils) copy files from SOURCE to DESTINATION (with specified attributes)" diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 946056cc1..a06303c24 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 1f5515d03..8db333e4a 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index fae9d59d9..abac74b3f 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index c4260cb8f..7674129f3 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index a6bb6b0b7..85cfb766a 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 196e29795..6122460fc 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 9d1edc5c6..d971d4eaf 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 54a4a51b5..21b00ffe7 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index d73ea59b7..266c23629 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 001bf5411..9d4825559 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index ff677ad87..0b7eb0763 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 2e67ec151..ab90e4509 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 70d6f0f87..1f6a560ff 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 020eba829..376600703 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 74bdd89ae..b7e4c395a 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 239afef5e..7fad14274 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index e17b4e56e..6cf0f4320 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index f26006d7e..7bb597ab3 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index e9a78d828..7d6ed229e 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index f11d85b5c..b8f4f0310 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index ee17a46c5..8566faf68 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index bae1b251d..71e843a84 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pr" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "pr ~ (uutils) convert text files for printing" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 59dcee778..11666bd61 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 51812945f..eefcf33c0 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.19" +version = "0.0.20" authors = ["Nathan Ross", "uutils developers"] license = "MIT" description = "printf ~ (uutils) FORMAT and display ARGUMENTS" diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 358c640db..e9b11223c 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index 60cb9aae0..09989d079 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 4a0ad66e5..ba407d9cc 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 9b2b5352c..802941cd1 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 4108d612c..62d47e83a 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index ec46031d0..2807d2d5b 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 6c152a82a..4579cce0a 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" diff --git a/src/uu/runcon/Cargo.toml b/src/uu/runcon/Cargo.toml index 191d9f013..9ea9dc769 100644 --- a/src/uu/runcon/Cargo.toml +++ b/src/uu/runcon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_runcon" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "runcon ~ (uutils) run command with specified security context" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index e327b3eba..2646d3609 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore bigdecimal [package] name = "uu_seq" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 3da23ff2b..81e49dc00 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 974791ee1..281e51d9e 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 2cd38988e..f69678770 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 533b31831..eb9cb9b59 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 32cfd6fda..881e53e26 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 3f165c357..91b479118 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index bce2f8dba..66b74f9c5 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -20,7 +20,7 @@ tempfile = { workspace = true } uucore = { workspace = true } [build-dependencies] -libstdbuf = { version = "0.0.19", package = "uu_stdbuf_libstdbuf", path = "src/libstdbuf" } +libstdbuf = { version = "0.0.20", package = "uu_stdbuf_libstdbuf", path = "src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index b3f186118..25104db2b 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" diff --git a/src/uu/stty/Cargo.toml b/src/uu/stty/Cargo.toml index 220651003..aadae6c92 100644 --- a/src/uu/stty/Cargo.toml +++ b/src/uu/stty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stty" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "stty ~ (uutils) print or change terminal characteristics" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 37b4d21e0..0879dd68f 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 36d110046..0a0695ed5 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 32682facd..0decf6194 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "uu_tac" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 81213b588..a22b148fe 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore (libs) kqueue fundu [package] name = "uu_tail" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 21d64c0c2..10fa63768 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index 3c2f27401..4926bff32 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 43cadf3e5..452a5b04a 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 4e27027a2..cde016f82 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore datetime [package] name = "uu_touch" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index e3eba0a10..7bc942485 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index f7f7e1a6a..d70cc0d7a 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index bf36e8257..4d756f46c 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index b7df32a1d..1e2b72d2f 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index d3d16d22a..f94026831 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 7b5f455a3..1c0421c65 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index b3d5e1b40..483881368 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index dec4bf2a4..b70cc993a 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 10ec571d1..401e0d591 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index b92254cda..1835340ad 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 81af58629..40341cf77 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" diff --git a/src/uu/vdir/Cargo.toml b/src/uu/vdir/Cargo.toml index 68d0c34ae..55624dad8 100644 --- a/src/uu/vdir/Cargo.toml +++ b/src/uu/vdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_vdir" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "shortcut to ls -l -b" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 363483bf8..396a0f8dc 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index bfbd7909d..c727a3fc2 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index fe06a0a7e..774831a66 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 0e2b934f3..bd44c34f9 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 19054811c..7e2133a5e 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "uucore" -version = "0.0.19" +version = "0.0.20" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index a83baf1d4..976ea014d 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore uuhelp [package] name = "uucore_procs" -version = "0.0.19" +version = "0.0.20" authors = ["Roy Ivy III "] license = "MIT" description = "uutils ~ 'uucore' proc-macros" @@ -19,4 +19,4 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -uuhelp_parser = { path = "../uuhelp_parser", version = "0.0.19" } +uuhelp_parser = { path = "../uuhelp_parser", version = "0.0.20" } diff --git a/src/uuhelp_parser/Cargo.toml b/src/uuhelp_parser/Cargo.toml index 888d07534..6a7aecd80 100644 --- a/src/uuhelp_parser/Cargo.toml +++ b/src/uuhelp_parser/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore uuhelp [package] name = "uuhelp_parser" -version = "0.0.19" +version = "0.0.20" edition = "2021" license = "MIT" description = "A collection of functions to parse the markdown code of help files" diff --git a/util/update-version.sh b/util/update-version.sh index 0fd15422a..3c68dfcf0 100755 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -14,8 +14,8 @@ # 7) Run util/publish.sh --do-it # 8) In some cases, you might have to fix dependencies and run import -FROM="0.0.18" -TO="0.0.19" +FROM="0.0.19" +TO="0.0.20" PROGS=$(ls -1d src/uu/*/Cargo.toml src/uu/stdbuf/src/libstdbuf/Cargo.toml src/uucore/Cargo.toml Cargo.toml) From 424d51285c7a6ad04c0dd1facbe24c89ca6ef5c8 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 14 Jul 2023 10:27:35 +0200 Subject: [PATCH 191/253] clippy: fix default_trait_access lint warnings --- src/uu/dd/src/progress.rs | 18 +++++++++--------- src/uu/df/src/df.rs | 8 ++++---- src/uu/df/src/filesystem.rs | 10 +++++----- src/uu/df/src/table.rs | 2 +- src/uu/head/src/head.rs | 2 +- src/uu/sort/src/numeric_str_cmp.rs | 24 ++++++++++++------------ src/uu/tail/src/args.rs | 8 ++++---- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/uu/dd/src/progress.rs b/src/uu/dd/src/progress.rs index 65af053b8..a9d29ff63 100644 --- a/src/uu/dd/src/progress.rs +++ b/src/uu/dd/src/progress.rs @@ -498,7 +498,7 @@ mod tests { fn prog_update_write(n: u128) -> ProgUpdate { ProgUpdate { - read_stat: Default::default(), + read_stat: ReadStat::default(), write_stat: WriteStat { bytes_total: n, ..Default::default() @@ -510,8 +510,8 @@ mod tests { fn prog_update_duration(duration: Duration) -> ProgUpdate { ProgUpdate { - read_stat: Default::default(), - write_stat: Default::default(), + read_stat: ReadStat::default(), + write_stat: WriteStat::default(), duration, complete: false, } @@ -557,8 +557,8 @@ mod tests { #[test] fn test_prog_update_write_prog_line() { let prog_update = ProgUpdate { - read_stat: Default::default(), - write_stat: Default::default(), + read_stat: ReadStat::default(), + write_stat: WriteStat::default(), duration: Duration::new(1, 0), // one second complete: false, }; @@ -613,8 +613,8 @@ mod tests { #[test] fn write_transfer_stats() { let prog_update = ProgUpdate { - read_stat: Default::default(), - write_stat: Default::default(), + read_stat: ReadStat::default(), + write_stat: WriteStat::default(), duration: Duration::new(1, 0), // one second complete: false, }; @@ -634,8 +634,8 @@ mod tests { fn write_final_transfer_stats() { // Tests the formatting of the final statistics written after a progress line. let prog_update = ProgUpdate { - read_stat: Default::default(), - write_stat: Default::default(), + read_stat: ReadStat::default(), + write_stat: WriteStat::default(), duration: Duration::new(1, 0), // one second complete: false, }; diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 685ebe58a..ef1584323 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -746,7 +746,7 @@ mod tests { #[test] fn test_remote_included() { - let opt = Default::default(); + let opt = Options::default(); let m = mount_info("ext4", "/mnt/foo", true, false); assert!(is_included(&m, &opt)); } @@ -773,7 +773,7 @@ mod tests { #[test] fn test_dummy_excluded() { - let opt = Default::default(); + let opt = Options::default(); let m = mount_info("ext4", "/mnt/foo", false, true); assert!(!is_included(&m, &opt)); } @@ -864,11 +864,11 @@ mod tests { mod filter_mount_list { - use crate::filter_mount_list; + use crate::{filter_mount_list, Options}; #[test] fn test_empty() { - let opt = Default::default(); + let opt = Options::default(); let mount_infos = vec![]; assert!(filter_mount_list(mount_infos, &opt).is_empty()); } diff --git a/src/uu/df/src/filesystem.rs b/src/uu/df/src/filesystem.rs index 813846a6c..d50822e7f 100644 --- a/src/uu/df/src/filesystem.rs +++ b/src/uu/df/src/filesystem.rs @@ -158,12 +158,12 @@ mod tests { // Create a fake `MountInfo` with the given directory name. fn mount_info(mount_dir: &str) -> MountInfo { MountInfo { - dev_id: Default::default(), - dev_name: Default::default(), - fs_type: Default::default(), + dev_id: String::default(), + dev_name: String::default(), + fs_type: String::default(), mount_dir: String::from(mount_dir), - mount_option: Default::default(), - mount_root: Default::default(), + mount_option: String::default(), + mount_root: String::default(), remote: Default::default(), dummy: Default::default(), } diff --git a/src/uu/df/src/table.rs b/src/uu/df/src/table.rs index a1a58792d..06bfc3383 100644 --- a/src/uu/df/src/table.rs +++ b/src/uu/df/src/table.rs @@ -513,7 +513,7 @@ mod tests { #[test] fn test_default_header() { - let options = Default::default(); + let options = Options::default(); assert_eq!( Header::get_headers(&options), vec!( diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index a336c91d4..2517a98ea 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -575,7 +575,7 @@ mod tests { } #[test] fn test_options_correct_defaults() { - let opts: HeadOptions = Default::default(); + let opts = HeadOptions::default(); assert!(!opts.verbose); assert!(!opts.quiet); diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index 05f81c897..1a986ea76 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -269,7 +269,7 @@ mod tests { fn parses_exp() { let n = "1"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: 0, @@ -280,7 +280,7 @@ mod tests { ); let n = "100"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: 2, @@ -308,7 +308,7 @@ mod tests { ); let n = "1,000"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: 0, @@ -319,7 +319,7 @@ mod tests { ); let n = "1000.00"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: 3, @@ -333,7 +333,7 @@ mod tests { fn parses_negative_exp() { let n = "0.00005"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: -5, @@ -344,7 +344,7 @@ mod tests { ); let n = "00000.00005"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: -5, @@ -359,7 +359,7 @@ mod tests { fn parses_sign() { let n = "5"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: 0, @@ -370,7 +370,7 @@ mod tests { ); let n = "-5"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: 0, @@ -381,7 +381,7 @@ mod tests { ); let n = " -5"; assert_eq!( - NumInfo::parse(n, &Default::default()), + NumInfo::parse(n, &NumInfoParseSettings::default()), ( NumInfo { exponent: 0, @@ -393,8 +393,8 @@ mod tests { } fn test_helper(a: &str, b: &str, expected: Ordering) { - let (a_info, a_range) = NumInfo::parse(a, &Default::default()); - let (b_info, b_range) = NumInfo::parse(b, &Default::default()); + let (a_info, a_range) = NumInfo::parse(a, &NumInfoParseSettings::default()); + let (b_info, b_range) = NumInfo::parse(b, &NumInfoParseSettings::default()); let ordering = numeric_str_cmp( (&a[a_range.to_owned()], &a_info), (&b[b_range.to_owned()], &b_info), @@ -469,7 +469,7 @@ mod tests { } #[test] fn single_minus() { - let info = NumInfo::parse("-", &Default::default()); + let info = NumInfo::parse("-", &NumInfoParseSettings::default()); assert_eq!( info, ( diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index e5d6d83ba..3b4984819 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -149,21 +149,21 @@ impl Default for Settings { Self { max_unchanged_stats: 5, sleep_sec: Duration::from_secs_f32(1.0), - follow: Default::default(), - mode: Default::default(), + follow: Option::default(), + mode: FilterMode::default(), pid: Default::default(), retry: Default::default(), use_polling: Default::default(), verbose: Default::default(), presume_input_pipe: Default::default(), - inputs: Default::default(), + inputs: Vec::default(), } } } impl Settings { pub fn from_obsolete_args(args: &parse::ObsoleteArgs, name: Option<&OsString>) -> Self { - let mut settings: Self = Default::default(); + let mut settings = Self::default(); if args.follow { settings.follow = if name.is_some() { Some(FollowMode::Name) From a0f527c2aa85467a52679a4b626c8a648b171a8e Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 14 Jul 2023 13:41:16 +0200 Subject: [PATCH 192/253] ci: add default_trait_access lint to CICD.yml --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 47da567b2..b31c462e9 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -220,7 +220,7 @@ jobs: fault_type="${{ steps.vars.outputs.FAULT_TYPE }}" fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]') # * convert any warnings to GHA UI annotations; ref: - S=$(cargo clippy --all-targets ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_UTILITY_LIST_OPTIONS }} -- -W clippy::manual_string_new -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; } + S=$(cargo clippy --all-targets ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_UTILITY_LIST_OPTIONS }} -- -W clippy::default_trait_access -W clippy::manual_string_new -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; } if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi style_spellcheck: From 00e68876fce80f356ff9b3f52dae932299337a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Fri, 14 Jul 2023 20:15:27 +0200 Subject: [PATCH 193/253] docs: fix broken Arch package link --- docs/src/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/installation.md b/docs/src/installation.md index e3e5ccf16..e5fcb6220 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -37,7 +37,7 @@ apk update uutils-coreutils ### Arch -[![Arch package](https://repology.org/badge/version-for-repo/arch/uutils-coreutils.svg)](https://archlinux.org/packages/community/x86_64/uutils-coreutils/) +[![Arch package](https://repology.org/badge/version-for-repo/arch/uutils-coreutils.svg)](https://archlinux.org/packages/extra/x86_64/uutils-coreutils/) ```shell pacman -S uutils-coreutils From 7742e0f6033502f4e4d15d16987886593d26e284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Fri, 14 Jul 2023 20:25:12 +0200 Subject: [PATCH 194/253] docs: github repo link related to uutils/coreutils --- docs/book.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/book.toml b/docs/book.toml index f2da19338..ff91c4652 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -6,7 +6,7 @@ src = "src" title = "uutils Documentation" [output.html] -git-repository-url = "https://github.com/rust-lang/cargo/tree/master/src/doc/src" +git-repository-url = "https://github.com/uutils/coreutils/tree/main/docs/src" [preprocessor.toc] command = "mdbook-toc" From 3de48dcde87ac89748e09878cd2a179fbf75e7a1 Mon Sep 17 00:00:00 2001 From: John Shin Date: Fri, 14 Jul 2023 21:05:12 -0700 Subject: [PATCH 195/253] uucore: provide capacity for vectors --- tests/by-util/test_factor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 1c7541370..da776818b 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -233,7 +233,7 @@ fn test_random_big() { // to generate an even split of this range, generate n-1 random elements // in the range, add the desired total value to the end, sort this list, // and then compute the sequential differences. - let mut f_bits = Vec::new(); + let mut f_bits = Vec::with_capacity(n_factors); for _ in 0..n_factors { f_bits.push(extra_range.sample(&mut rng)); } @@ -256,7 +256,7 @@ fn test_random_big() { let mut n_bits = 0; let mut product = 1_u64; - let mut factors = Vec::new(); + let mut factors = Vec::with_capacity(f_bits.len()); for bit in f_bits { assert!(bit < 37); n_bits += 14 + bit; From 596fe4f66fd704f9c83484f98a0ddaa7c51ff879 Mon Sep 17 00:00:00 2001 From: John Shin Date: Fri, 14 Jul 2023 21:05:12 -0700 Subject: [PATCH 196/253] uucore: provide capacity for vectors --- tests/by-util/test_factor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 1c7541370..cf3744964 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -233,7 +233,7 @@ fn test_random_big() { // to generate an even split of this range, generate n-1 random elements // in the range, add the desired total value to the end, sort this list, // and then compute the sequential differences. - let mut f_bits = Vec::new(); + let mut f_bits = Vec::with_capacity(n_factors + 1); for _ in 0..n_factors { f_bits.push(extra_range.sample(&mut rng)); } @@ -256,7 +256,7 @@ fn test_random_big() { let mut n_bits = 0; let mut product = 1_u64; - let mut factors = Vec::new(); + let mut factors = Vec::with_capacity(f_bits.len()); for bit in f_bits { assert!(bit < 37); n_bits += 14 + bit; From 831404406c680e791783b43ff76e05a800d1478d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 15 Jul 2023 09:18:10 +0000 Subject: [PATCH 197/253] chore(deps): update rust crate signal-hook to 0.3.16 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68112a72b..ea86e2e5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2027,9 +2027,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" +checksum = "b824b6e687aff278cdbf3b36f07aa52d4bd4099699324d5da86a2ebce3aa00b3" dependencies = [ "libc", "signal-hook-registry", diff --git a/Cargo.toml b/Cargo.toml index f2500daf2..e91447b36 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -316,7 +316,7 @@ rust-ini = "0.19.0" same-file = "1.0.6" self_cell = "1.0.1" selinux = "0.4" -signal-hook = "0.3.15" +signal-hook = "0.3.16" smallvec = { version = "1.11", features = ["union"] } tempfile = "3.6.0" term_grid = "0.1.5" From 373035fa08793c10932db6626f6cfe58a9eee097 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 16 Jul 2023 16:48:01 +0200 Subject: [PATCH 198/253] cat: remove --t --- src/uu/cat/src/cat.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 4a5e7e0ad..2c4117a32 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -290,7 +290,6 @@ pub fn uu_app() -> Command { .arg( Arg::new(options::SHOW_NONPRINTING_TABS) .short('t') - .long(options::SHOW_NONPRINTING_TABS) .help("equivalent to -vT") .action(ArgAction::SetTrue), ) From 96dbd6d386dd37c2ae3c47f700a1e44a4992e103 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Sat, 8 Jul 2023 02:22:33 +0300 Subject: [PATCH 199/253] stty: Implement printing assignment of control chars Part of #3861. Code comments from sylvestre. Co-authored-by: Sylvestre Ledru --- src/uu/stty/src/flags.rs | 44 ++++++++++++++++++++++++++++++++- src/uu/stty/src/stty.rs | 53 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 93 insertions(+), 4 deletions(-) diff --git a/src/uu/stty/src/flags.rs b/src/uu/stty/src/flags.rs index 2c3f00eec..536c08d80 100644 --- a/src/uu/stty/src/flags.rs +++ b/src/uu/stty/src/flags.rs @@ -7,6 +7,8 @@ // spell-checker:ignore ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl ixoff ixon iuclc ixany imaxbel iutf // spell-checker:ignore opost olcuc ocrnl onlcr onocr onlret ofill ofdel nldly crdly tabdly bsdly vtdly ffdly // spell-checker:ignore isig icanon iexten echoe crterase echok echonl noflsh xcase tostop echoprt prterase echoctl ctlecho echoke crtkill flusho extproc +// spell-checker:ignore lnext rprnt susp swtch vdiscard veof veol verase vintr vkill vlnext vquit vreprint vstart vstop vsusp vswtc vwerase werase +// spell-checker:ignore sigquit sigtstp use crate::Flag; @@ -19,7 +21,10 @@ use crate::Flag; target_os = "openbsd" )))] use nix::sys::termios::BaudRate; -use nix::sys::termios::{ControlFlags as C, InputFlags as I, LocalFlags as L, OutputFlags as O}; +use nix::sys::termios::{ + ControlFlags as C, InputFlags as I, LocalFlags as L, OutputFlags as O, + SpecialCharacterIndices as S, +}; pub const CONTROL_FLAGS: &[Flag] = &[ Flag::new("parenb", C::PARENB), @@ -313,3 +318,40 @@ pub const BAUD_RATES: &[(&str, BaudRate)] = &[ ))] ("4000000", BaudRate::B4000000), ]; +/// Control characters for the stty command. +/// +/// This constant provides a mapping between the names of control characters +/// and their corresponding values in the `S` enum. +pub const CONTROL_CHARS: &[(&str, S)] = &[ + // Sends an interrupt signal (SIGINT). + ("intr", S::VINTR), + // Sends a quit signal (SIGQUIT). + ("quit", S::VQUIT), + // Deletes the last typed character. + ("erase", S::VERASE), + // Deletes the current line. + ("kill", S::VKILL), + // Signals the end of input. + ("eof", S::VEOF), + // Signals the end of line. + ("eol", S::VEOL), + // Alternate end-of-line character. + ("eol2", S::VEOL2), + // Switch character (only on Linux). + #[cfg(target_os = "linux")] + ("swtch", S::VSWTC), + // Starts output after it has been stopped. + ("start", S::VSTART), + // Stops output. + ("stop", S::VSTOP), + // Sends a suspend signal (SIGTSTP). + ("susp", S::VSUSP), + // Reprints the current line. + ("rprnt", S::VREPRINT), + // Deletes the last word typed. + ("werase", S::VWERASE), + // Enters literal mode (next character is taken literally). + ("lnext", S::VLNEXT), + // Discards the current line. + ("discard", S::VDISCARD), +]; diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index 819860a3b..c933e48ae 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -3,7 +3,7 @@ // * For the full copyright and license information, please view the LICENSE file // * that was distributed with this source code. -// spell-checker:ignore clocal tcgetattr tcsetattr tcsanow tiocgwinsz tiocswinsz cfgetospeed cfsetospeed ushort +// spell-checker:ignore clocal erange tcgetattr tcsetattr tcsanow tiocgwinsz tiocswinsz cfgetospeed cfsetospeed ushort vmin vtime mod flags; @@ -11,7 +11,7 @@ use clap::{crate_version, Arg, ArgAction, ArgMatches, Command}; use nix::libc::{c_ushort, O_NONBLOCK, TIOCGWINSZ, TIOCSWINSZ}; use nix::sys::termios::{ cfgetospeed, cfsetospeed, tcgetattr, tcsetattr, ControlFlags, InputFlags, LocalFlags, - OutputFlags, Termios, + OutputFlags, SpecialCharacterIndices, Termios, }; use nix::{ioctl_read_bad, ioctl_write_ptr_bad}; use std::io::{self, stdout}; @@ -30,7 +30,7 @@ use uucore::{format_usage, help_about, help_usage}; target_os = "openbsd" )))] use flags::BAUD_RATES; -use flags::{CONTROL_FLAGS, INPUT_FLAGS, LOCAL_FLAGS, OUTPUT_FLAGS}; +use flags::{CONTROL_CHARS, CONTROL_FLAGS, INPUT_FLAGS, LOCAL_FLAGS, OUTPUT_FLAGS}; const USAGE: &str = help_usage!("stty.md"); const SUMMARY: &str = help_about!("stty.md"); @@ -245,6 +245,52 @@ fn print_terminal_size(termios: &Termios, opts: &Options) -> nix::Result<()> { Ok(()) } +fn control_char_to_string(cc: nix::libc::cc_t) -> nix::Result { + if cc == 0 { + return Ok("".to_string()); + } + + let (meta_prefix, code) = if cc >= 0x80 { + ("M-", cc - 0x80) + } else { + ("", cc) + }; + + // Determine the '^'-prefix if applicable and character based on the code + let (ctrl_prefix, character) = match code { + // Control characters in ASCII range + 0..=0x1f => Ok(("^", (b'@' + code) as char)), + // Printable ASCII characters + 0x20..=0x7e => Ok(("", code as char)), + // DEL character + 0x7f => Ok(("^", '?')), + // Out of range (above 8 bits) + _ => Err(nix::errno::Errno::ERANGE), + }?; + + Ok(format!("{meta_prefix}{ctrl_prefix}{character}")) +} + +fn print_control_chars(termios: &Termios, opts: &Options) -> nix::Result<()> { + if !opts.all { + // TODO: this branch should print values that differ from defaults + return Ok(()); + } + + for (text, cc_index) in CONTROL_CHARS { + print!( + "{text} = {}; ", + control_char_to_string(termios.control_chars[*cc_index as usize])? + ); + } + println!( + "min = {}; time = {};", + termios.control_chars[SpecialCharacterIndices::VMIN as usize], + termios.control_chars[SpecialCharacterIndices::VTIME as usize] + ); + Ok(()) +} + fn print_in_save_format(termios: &Termios) { print!( "{:x}:{:x}:{:x}:{:x}", @@ -264,6 +310,7 @@ fn print_settings(termios: &Termios, opts: &Options) -> nix::Result<()> { print_in_save_format(termios); } else { print_terminal_size(termios, opts)?; + print_control_chars(termios, opts)?; print_flags(termios, opts, CONTROL_FLAGS); print_flags(termios, opts, INPUT_FLAGS); print_flags(termios, opts, OUTPUT_FLAGS); From b6ec498e0e926a05e61a8df15fd38e696b745a91 Mon Sep 17 00:00:00 2001 From: Starccy <452276725@qq.com> Date: Mon, 17 Jul 2023 10:53:44 +0800 Subject: [PATCH 200/253] "style: fix/format scripts to meet the `shellcheck`/`shfmt` rules" --- util/analyze-gnu-results.sh | 18 +++++++++++------- util/build-gnu.sh | 1 - util/run-gnu-test.sh | 6 +++--- util/update-version.sh | 1 - 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/util/analyze-gnu-results.sh b/util/analyze-gnu-results.sh index 2bc08a9a4..045e3b93d 100644 --- a/util/analyze-gnu-results.sh +++ b/util/analyze-gnu-results.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # spell-checker:ignore xpass XPASS testsuite set -e @@ -67,9 +67,13 @@ function get_error { echo $((NON_ROOT + AS_ROOT)) } -export TOTAL=$(get_total) -export PASS=$(get_pass) -export SKIP=$(get_skip) -export FAIL=$(get_fail) -export XPASS=$(get_xpass) -export ERROR=$(get_error) +# we don't need the return codes indeed, ignore them +# shellcheck disable=SC2155 +{ + export TOTAL=$(get_total) + export PASS=$(get_pass) + export SKIP=$(get_skip) + export FAIL=$(get_fail) + export XPASS=$(get_xpass) + export ERROR=$(get_error) +} diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 88f4eda98..b75242047 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -215,7 +215,6 @@ sed -i -e "s/provoked error./provoked error\ncat pat |sort -u > pat/" tests/misc # Update the GNU error message to match ours sed -i -e "s/link-to-dir: hard link not allowed for directory/failed to create hard link 'link-to-dir' =>/" -e "s|link-to-dir/: hard link not allowed for directory|failed to create hard link 'link-to-dir/' =>|" tests/ln/hard-to-sym.sh - # GNU sleep accepts some crazy string, not sure we should match this behavior sed -i -e "s/timeout 10 sleep 0x.002p1/#timeout 10 sleep 0x.002p1/" tests/misc/sleep.sh diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh index ac736abe1..55ba8cefc 100755 --- a/util/run-gnu-test.sh +++ b/util/run-gnu-test.sh @@ -36,7 +36,7 @@ if test $# -ge 1; then SPECIFIC_TESTS="$SPECIFIC_TESTS $t" done # trim it - SPECIFIC_TESTS=$(echo $SPECIFIC_TESTS| xargs) + SPECIFIC_TESTS=$(echo $SPECIFIC_TESTS | xargs) echo "Running specific tests: $SPECIFIC_TESTS" fi @@ -46,14 +46,14 @@ fi #shellcheck disable=SC2086 if test "$1" != "run-root"; then -# run the regular tests + # run the regular tests if test $# -ge 1; then timeout -sKILL 4h make -j "$(nproc)" check TESTS="$SPECIFIC_TESTS" SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no gl_public_submodule_commit="" srcdir="${path_GNU}" || : # Kill after 4 hours in case something gets stuck in make else timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no gl_public_submodule_commit="" srcdir="${path_GNU}" || : # Kill after 4 hours in case something gets stuck in make fi else -# in case we would like to run tests requiring root + # in case we would like to run tests requiring root if test -z "$1" -o "$1" == "run-root"; then if test -n "$CI"; then echo "Running check-root to run only root tests" diff --git a/util/update-version.sh b/util/update-version.sh index 3c68dfcf0..8b6168782 100755 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -47,4 +47,3 @@ sed -i -e "s|uucore = { version=\">=$FROM\",|uucore = { version=\">=$TO\",|" $PR # Update crates using uucore_procs #shellcheck disable=SC2086 sed -i -e "s|uucore_procs = { version=\">=$FROM\",|uucore_procs = { version=\">=$TO\",|" $PROGS - From 69f74433b54df51630c0c6a0a9bc2e90a5176088 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Jul 2023 18:58:35 +0200 Subject: [PATCH 201/253] make: split the manpage / completions generation into their target Thanks to this, it is easier to generate these files: * make manpages * make completions --- GNUmakefile | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 26d6de5ba..257f04a26 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,4 +1,4 @@ -# spell-checker:ignore (misc) testsuite runtest findstring (targets) busytest toybox distclean pkgs nextest ; (vars/env) BINDIR BUILDDIR CARGOFLAGS DESTDIR DOCSDIR INSTALLDIR INSTALLEES MULTICALL DATAROOTDIR TESTDIR +# spell-checker:ignore (misc) testsuite runtest findstring (targets) busytest toybox distclean pkgs nextest ; (vars/env) BINDIR BUILDDIR CARGOFLAGS DESTDIR DOCSDIR INSTALLDIR INSTALLEES MULTICALL DATAROOTDIR TESTDIR manpages # Config options PROFILE ?= debug @@ -337,7 +337,21 @@ clean: distclean: clean $(CARGO) clean $(CARGOFLAGS) && $(CARGO) update $(CARGOFLAGS) -install: build +manpages: build-coreutils + mkdir -p $(BUILDDIR)/man/ + $(foreach prog, $(INSTALLEES), \ + $(BUILDDIR)/coreutils manpage $(prog) > $(BUILDDIR)/man/$(PROG_PREFIX)$(prog).1; \ + ) + +completions: build-coreutils + mkdir -p $(BUILDDIR)/completions/zsh $(BUILDDIR)/completions/bash $(BUILDDIR)/completions/fish + $(foreach prog, $(INSTALLEES), \ + $(BUILDDIR)/coreutils completion $(prog) zsh > $(BUILDDIR)/completions/zsh/_$(PROG_PREFIX)$(prog); \ + $(BUILDDIR)/coreutils completion $(prog) bash > $(BUILDDIR)/completions/bash/$(PROG_PREFIX)$(prog); \ + $(BUILDDIR)/coreutils completion $(prog) fish > $(BUILDDIR)/completions/fish/$(PROG_PREFIX)$(prog).fish; \ + ) + +install: build manpages completions mkdir -p $(INSTALLDIR_BIN) ifeq (${MULTICALL}, y) $(INSTALL) $(BUILDDIR)/coreutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)coreutils @@ -349,15 +363,18 @@ else $(INSTALL) $(BUILDDIR)/$(prog) $(INSTALLDIR_BIN)/$(PROG_PREFIX)$(prog);) $(if $(findstring test,$(INSTALLEES)), $(INSTALL) $(BUILDDIR)/test $(INSTALLDIR_BIN)/$(PROG_PREFIX)[) endif + mkdir -p $(DESTDIR)$(DATAROOTDIR)/man/man1 + $(foreach prog, $(INSTALLEES), \ + $(INSTALL) $(BUILDDIR)/man/$(PROG_PREFIX)$(prog).1 $(DESTDIR)$(DATAROOTDIR)/man/man1/; \ + ) + mkdir -p $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions mkdir -p $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions mkdir -p $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d - mkdir -p $(DESTDIR)$(DATAROOTDIR)/man/man1 $(foreach prog, $(INSTALLEES), \ - $(BUILDDIR)/coreutils completion $(prog) zsh > $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions/_$(PROG_PREFIX)$(prog); \ - $(BUILDDIR)/coreutils completion $(prog) bash > $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions/$(PROG_PREFIX)$(prog); \ - $(BUILDDIR)/coreutils completion $(prog) fish > $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d/$(PROG_PREFIX)$(prog).fish; \ - $(BUILDDIR)/coreutils manpage $(prog) > $(DESTDIR)$(DATAROOTDIR)/man/man1/$(PROG_PREFIX)$(prog).1; \ + $(INSTALL) $(BUILDDIR)/completions/zsh/_$(PROG_PREFIX)$(prog) $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions/; \ + $(INSTALL) $(BUILDDIR)/completions/bash/$(PROG_PREFIX)$(prog) $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions/; \ + $(INSTALL) $(BUILDDIR)/completions/fish/$(PROG_PREFIX)$(prog).fish $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d/; \ ) uninstall: From 7d44e96713f9af779f2426bf38c6463262395102 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Jul 2023 22:34:03 +0200 Subject: [PATCH 202/253] coreutils multicall: Sort the command by alphabetic order (for the man) --- build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 04948c0d3..09b33fa91 100644 --- a/build.rs +++ b/build.rs @@ -38,14 +38,14 @@ pub fn main() { let mut mf = File::create(Path::new(&out_dir).join("uutils_map.rs")).unwrap(); mf.write_all( - "type UtilityMap = phf::Map<&'static str, (fn(T) -> i32, fn() -> Command)>;\n\ + "type UtilityMap = phf::OrderedMap<&'static str, (fn(T) -> i32, fn() -> Command)>;\n\ \n\ fn util_map() -> UtilityMap {\n" .as_bytes(), ) .unwrap(); - let mut phf_map = phf_codegen::Map::<&str>::new(); + let mut phf_map = phf_codegen::OrderedMap::<&str>::new(); for krate in &crates { let map_value = format!("({krate}::uumain, {krate}::uu_app)"); match krate.as_ref() { From 83c851714259939bd71c7743bec9f2190c67b06e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Jul 2023 22:40:54 +0200 Subject: [PATCH 203/253] coreutils multicall: the manpage subcommand doesn't display the right command see https://manpages.debian.org/unstable/rust-coreutils/rust-coreutils.1.en.html --- src/bin/coreutils.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index 8440689c6..d6487dc49 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -212,8 +212,15 @@ fn gen_manpage( fn gen_coreutils_app(util_map: &UtilityMap) -> Command { let mut command = Command::new("coreutils"); - for (_, (_, sub_app)) in util_map { - command = command.subcommand(sub_app()); + for (name, (_, sub_app)) in util_map { + // Recreate a small subcommand with only the relevant info + // (name & short description) + let about = sub_app() + .get_about() + .expect("Could not get the 'about'") + .to_string(); + let sub_app = Command::new(name).about(about); + command = command.subcommand(sub_app); } command } From 27ee279913f5ddebda7c4494182a9550e3e87940 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 17 Jul 2023 16:30:30 +0200 Subject: [PATCH 204/253] nl: fix calculation of line number lengths --- src/uu/nl/src/nl.rs | 50 ++++++++++++++++++++++++++++++---------- tests/by-util/test_nl.rs | 21 +++++++++++++---- 2 files changed, 54 insertions(+), 17 deletions(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index b2edaa83b..39090aea5 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -263,13 +263,8 @@ pub fn uu_app() -> Command { fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { let regexp: regex::Regex = regex::Regex::new(r".?").unwrap(); let mut line_no = settings.starting_line_number; - // The current line number's width as a string. Using to_string is inefficient - // but since we only do it once, it should not hurt. - let mut line_no_width = line_no.to_string().len(); + let mut line_no_width = line_no.len(); let line_no_width_initial = line_no_width; - // Stores the smallest integer with one more digit than line_no, so that - // when line_no >= line_no_threshold, we need to use one more digit. - let mut line_no_threshold = 10i64.pow(line_no_width as u32); let mut empty_line_count: u64 = 0; let fill_char = match settings.number_format { NumberFormat::RightZero => '0', @@ -331,7 +326,6 @@ fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { if settings.renumber { line_no = settings.starting_line_number; line_no_width = line_no_width_initial; - line_no_threshold = 10i64.pow(line_no_width as u32); } &settings.header_numbering } @@ -400,11 +394,7 @@ fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { // Now update the variables for the (potential) next // line. line_no += settings.line_increment; - while line_no >= line_no_threshold { - // The line number just got longer. - line_no_threshold *= 10; - line_no_width += 1; - } + line_no_width = line_no.len(); } Ok(()) } @@ -424,3 +414,39 @@ fn pass_none(_: &str, _: ®ex::Regex) -> bool { fn pass_all(_: &str, _: ®ex::Regex) -> bool { true } + +trait Length { + fn len(&self) -> usize; +} + +impl Length for i64 { + // Returns the length in `char`s. + fn len(&self) -> usize { + if *self == 0 { + return 1; + }; + + let sign_len = if *self < 0 { 1 } else { 0 }; + (0..).take_while(|i| 10i64.pow(*i) <= self.abs()).count() + sign_len + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_len() { + assert_eq!((-1).len(), 2); + assert_eq!((-10).len(), 3); + assert_eq!((-100).len(), 4); + assert_eq!((-1000).len(), 5); + + assert_eq!(0.len(), 1); + + assert_eq!(1.len(), 1); + assert_eq!(10.len(), 2); + assert_eq!(100.len(), 3); + assert_eq!(1000.len(), 4); + } +} diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index 7325dfe8c..bdb76da78 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -213,14 +213,25 @@ fn test_line_increment() { } #[test] -fn test_negative_line_increment() { - // TODO make this test work with -10 - for arg in ["-i-1", "--line-increment=-1"] { +fn test_line_increment_from_negative_starting_line() { + for arg in ["-i10", "--line-increment=10"] { new_ucmd!() .arg(arg) - .pipe_in("a\nb") + .arg("-v-19") + .pipe_in("a\nb\nc") .succeeds() - .stdout_is(" 1\ta\n 0\tb\n"); + .stdout_is(" -19\ta\n -9\tb\n 1\tc\n"); + } +} + +#[test] +fn test_negative_line_increment() { + for arg in ["-i-10", "--line-increment=-10"] { + new_ucmd!() + .arg(arg) + .pipe_in("a\nb\nc") + .succeeds() + .stdout_is(" 1\ta\n -9\tb\n -19\tc\n"); } } From b77a08c1342421dd5e4141632e963288e4c178ee Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Fri, 10 Feb 2023 23:31:28 -0700 Subject: [PATCH 205/253] Require = for --tmpdir in mktemp Fixes #3454 This implementation more closely matches the behavior of GNU mktemp. Specifically, if using the short-form `-p`, then DIR is required, and if using the long form `--tmpdir` then DIR is optional, but if provided, must use the `--tmpdir=DIR` form (not `--tempdir DIR`), so that there is no ambiguity with also passing a TEMPLATE. The downside to this implementation is we are now introducing a new workaround for https://github.com/clap-rs/clap/issues/4702 where we use separate calls to `.arg()` for the short `-p` and the long `--tmpdir`, which results in a less than ideal output for `--help`. --- src/uu/mktemp/src/mktemp.rs | 106 +++++++++++++----------------------- 1 file changed, 39 insertions(+), 67 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index fc360d0f5..9466f7c63 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -8,7 +8,7 @@ // spell-checker:ignore (paths) GPGHome findxs -use clap::{crate_version, Arg, ArgAction, ArgMatches, Command}; +use clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command}; use uucore::display::{println_verbatim, Quotable}; use uucore::error::{FromIo, UError, UResult, UUsageError}; use uucore::{format_usage, help_about, help_usage}; @@ -38,6 +38,7 @@ static OPT_DRY_RUN: &str = "dry-run"; static OPT_QUIET: &str = "quiet"; static OPT_SUFFIX: &str = "suffix"; static OPT_TMPDIR: &str = "tmpdir"; +static OPT_P: &str = "p"; static OPT_T: &str = "t"; static ARG_TEMPLATE: &str = "template"; @@ -130,7 +131,7 @@ struct Options { /// The directory in which to create the temporary file. /// /// If `None`, the file will be created in the current directory. - tmpdir: Option, + tmpdir: Option, /// The suffix to append to the temporary file, if any. suffix: Option, @@ -142,72 +143,32 @@ struct Options { template: String, } -/// Decide whether the argument to `--tmpdir` should actually be the template. -/// -/// This function is required to work around a limitation of `clap`, -/// the command-line argument parsing library. In case the command -/// line is -/// -/// ```sh -/// mktemp --tmpdir XXX -/// ``` -/// -/// the program should behave like -/// -/// ```sh -/// mktemp --tmpdir=${TMPDIR:-/tmp} XXX -/// ``` -/// -/// However, `clap` thinks that `XXX` is the value of the `--tmpdir` -/// option. This function returns `true` in this case and `false` -/// in all other cases. -fn is_tmpdir_argument_actually_the_template(matches: &ArgMatches) -> bool { - if !matches.contains_id(ARG_TEMPLATE) { - if let Some(tmpdir) = matches.get_one::(OPT_TMPDIR) { - if !Path::new(tmpdir).is_dir() && tmpdir.contains("XXX") { - return true; - } - } - } - false -} - impl Options { fn from(matches: &ArgMatches) -> Self { - // Special case to work around a limitation of `clap`; see - // `is_tmpdir_argument_actually_the_template()` for more - // information. - // - // Fixed in clap 3 - // See https://github.com/clap-rs/clap/pull/1587 - let (tmpdir, template) = if is_tmpdir_argument_actually_the_template(matches) { - let tmpdir = Some(env::temp_dir().display().to_string()); - let template = matches.get_one::(OPT_TMPDIR).unwrap().to_string(); - (tmpdir, template) - } else { + let tmpdir = matches + .get_one::(OPT_TMPDIR) + .or_else(|| matches.get_one::(OPT_P)) + .cloned(); + let (tmpdir, template) = match matches.get_one::(ARG_TEMPLATE) { // If no template argument is given, `--tmpdir` is implied. - match matches.get_one::(ARG_TEMPLATE) { - None => { - let tmpdir = match matches.get_one::(OPT_TMPDIR) { - None => Some(env::temp_dir().display().to_string()), - Some(tmpdir) => Some(tmpdir.to_string()), - }; - let template = DEFAULT_TEMPLATE; - (tmpdir, template.to_string()) - } - Some(template) => { - let tmpdir = if env::var(TMPDIR_ENV_VAR).is_ok() && matches.get_flag(OPT_T) { - env::var(TMPDIR_ENV_VAR).ok() - } else if matches.contains_id(OPT_TMPDIR) { - matches.get_one::(OPT_TMPDIR).map(String::from) - } else if matches.get_flag(OPT_T) { - // mktemp -t foo.xxx should export in TMPDIR - Some(env::temp_dir().display().to_string()) - } else { - matches.get_one::(OPT_TMPDIR).map(String::from) - }; - (tmpdir, template.to_string()) - } + None => { + let tmpdir = Some(tmpdir.unwrap_or_else(env::temp_dir)); + let template = DEFAULT_TEMPLATE; + (tmpdir, template.to_string()) + } + Some(template) => { + let tmpdir = if env::var(TMPDIR_ENV_VAR).is_ok() && matches.get_flag(OPT_T) { + env::var_os(TMPDIR_ENV_VAR).map(|t| t.into()) + } else if tmpdir.is_some() { + tmpdir + } else if matches.get_flag(OPT_T) || matches.contains_id(OPT_TMPDIR) { + // If --tmpdir is given without an argument, or -t is given + // export in TMPDIR + Some(env::temp_dir()) + } else { + None + }; + (tmpdir, template.to_string()) } }; Self { @@ -372,7 +333,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { if env::var("POSIXLY_CORRECT").is_ok() { // If POSIXLY_CORRECT was set, template MUST be the last argument. - if is_tmpdir_argument_actually_the_template(&matches) || matches.contains_id(ARG_TEMPLATE) { + if matches.contains_id(ARG_TEMPLATE) { // Template argument was provided, check if was the last one. if args.last().unwrap() != &options.template { return Err(Box::new(MkTempError::TooManyTemplates)); @@ -444,8 +405,16 @@ pub fn uu_app() -> Command { .value_name("SUFFIX"), ) .arg( - Arg::new(OPT_TMPDIR) + Arg::new(OPT_P) .short('p') + .help("short form of --tmpdir") + .value_name("DIR") + .num_args(1) + .value_parser(ValueParser::path_buf()) + .value_hint(clap::ValueHint::DirPath), + ) + .arg( + Arg::new(OPT_TMPDIR) .long(OPT_TMPDIR) .help( "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ @@ -457,6 +426,9 @@ pub fn uu_app() -> Command { // Allows use of default argument just by setting --tmpdir. Else, // use provided input to generate tmpdir .num_args(0..=1) + // Require an equals to avoid ambiguity if no tmpdir is supplied + .require_equals(true) + .value_parser(ValueParser::path_buf()) .value_hint(clap::ValueHint::DirPath), ) .arg( From 6262a3e9d94db33c83fbeac03fd574cff8d6c8f9 Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Mon, 13 Feb 2023 00:00:02 -0700 Subject: [PATCH 206/253] Add tests for mktemp tmpdir flags And set overrides_with for tmpdir flags. Tests were copied from #4275 Co-authored-by: David Matos --- src/uu/mktemp/src/mktemp.rs | 1 + tests/by-util/test_mktemp.rs | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 9466f7c63..9c0860d92 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -428,6 +428,7 @@ pub fn uu_app() -> Command { .num_args(0..=1) // Require an equals to avoid ambiguity if no tmpdir is supplied .require_equals(true) + .overrides_with(OPT_P) .value_parser(ValueParser::path_buf()) .value_hint(clap::ValueHint::DirPath), ) diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 6bcb37f45..db60d2453 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -901,3 +901,63 @@ fn test_t_ensure_tmpdir_has_higher_priority_than_p() { println!("stdout = {stdout}"); assert!(stdout.contains(&pathname)); } + +#[test] +fn test_missing_xs_tmpdir_template() { + let scene = TestScenario::new(util_name!()); + scene + .ucmd() + .arg("--tmpdir") + .arg(TEST_TEMPLATE3) + .fails() + .no_stdout() + .stderr_contains("too few X's in template"); + scene + .ucmd() + .arg("--tmpdir=foobar") + .fails() + .no_stdout() + .stderr_contains("failed to create file via template"); +} + +#[test] +fn test_both_tmpdir_flags_present() { + let scene = TestScenario::new(util_name!()); + scene + .ucmd() + .arg("-p") + .arg(".") + .arg("--tmpdir") + .arg("foobarXXXX") + .succeeds() + .no_stderr() + .stdout_contains("/tmp/foobar"); + scene + .ucmd() + .arg("-p") + .arg(".") + .arg("--tmpdir=foobarXXXX") + .fails() + .no_stdout() + .stderr_contains("failed to create file via template"); + scene + .ucmd() + .arg("--tmpdir") + .arg("foobarXXXX") + .arg("-p") + .arg(".") + .succeeds() + .no_stderr() + .stdout_contains("./foobar"); +} + +#[test] +fn test_missing_short_tmpdir_flag() { + let scene = TestScenario::new(util_name!()); + scene + .ucmd() + .arg("-p") + .fails() + .no_stdout() + .stderr_contains("a value is required for '-p ' but none was supplied"); +} From 536db164bf119ac4624abcd2dcaa5542b4c830cf Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Tue, 11 Apr 2023 00:43:15 -0600 Subject: [PATCH 207/253] Fix mktemp test for windows --- tests/by-util/test_mktemp.rs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index db60d2453..0810fc43a 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -923,32 +923,38 @@ fn test_missing_xs_tmpdir_template() { #[test] fn test_both_tmpdir_flags_present() { let scene = TestScenario::new(util_name!()); - scene - .ucmd() + let template = format!(".{MAIN_SEPARATOR}foobarXXXX"); + let (at, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .env(TMPDIR, ".") .arg("-p") - .arg(".") + .arg("nonsense") .arg("--tmpdir") .arg("foobarXXXX") - .succeeds() - .no_stderr() - .stdout_contains("/tmp/foobar"); + .succeeds(); + let filename = result.no_stderr().stdout_str().trim_end(); + assert_matches_template!(&template, filename); + assert!(at.file_exists(filename)); + scene .ucmd() .arg("-p") .arg(".") - .arg("--tmpdir=foobarXXXX") + .arg("--tmpdir=doesnotexist") .fails() .no_stdout() .stderr_contains("failed to create file via template"); - scene - .ucmd() + + let (at, mut ucmd) = at_and_ucmd!(); + let result = ucmd .arg("--tmpdir") .arg("foobarXXXX") .arg("-p") .arg(".") - .succeeds() - .no_stderr() - .stdout_contains("./foobar"); + .succeeds(); + let filename = result.no_stderr().stdout_str().trim_end(); + assert_matches_template!(&template, filename); + assert!(at.file_exists(filename)); } #[test] From 964b1d6e100e0b72846ac573a6ebedca44854d04 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 5 Jul 2023 12:51:56 +0200 Subject: [PATCH 208/253] mktemp: fix both_tmpdir_flags_present test on windows --- tests/by-util/test_mktemp.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 0810fc43a..4544b6b30 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -923,7 +923,10 @@ fn test_missing_xs_tmpdir_template() { #[test] fn test_both_tmpdir_flags_present() { let scene = TestScenario::new(util_name!()); + + #[cfg(not(windows))] let template = format!(".{MAIN_SEPARATOR}foobarXXXX"); + let (at, mut ucmd) = at_and_ucmd!(); let result = ucmd .env(TMPDIR, ".") @@ -933,14 +936,19 @@ fn test_both_tmpdir_flags_present() { .arg("foobarXXXX") .succeeds(); let filename = result.no_stderr().stdout_str().trim_end(); + + #[cfg(not(windows))] assert_matches_template!(&template, filename); + #[cfg(windows)] + assert_suffix_matches_template!("foobarXXXX", filename); + assert!(at.file_exists(filename)); scene .ucmd() .arg("-p") .arg(".") - .arg("--tmpdir=doesnotexist") + .arg("--tmpdir=does_not_exist") .fails() .no_stdout() .stderr_contains("failed to create file via template"); @@ -953,7 +961,12 @@ fn test_both_tmpdir_flags_present() { .arg(".") .succeeds(); let filename = result.no_stderr().stdout_str().trim_end(); + + #[cfg(not(windows))] assert_matches_template!(&template, filename); + #[cfg(windows)] + assert_suffix_matches_template!("foobarXXXX", filename); + assert!(at.file_exists(filename)); } From 427bec8b88166351c3529e40e414396e8f97a973 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 18 Jul 2023 17:13:29 +0000 Subject: [PATCH 209/253] chore(deps): update rust crate signal-hook to 0.3.17 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea86e2e5c..d70640c46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2027,9 +2027,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b824b6e687aff278cdbf3b36f07aa52d4bd4099699324d5da86a2ebce3aa00b3" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" dependencies = [ "libc", "signal-hook-registry", diff --git a/Cargo.toml b/Cargo.toml index e91447b36..1d81d0d70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -316,7 +316,7 @@ rust-ini = "0.19.0" same-file = "1.0.6" self_cell = "1.0.1" selinux = "0.4" -signal-hook = "0.3.16" +signal-hook = "0.3.17" smallvec = { version = "1.11", features = ["union"] } tempfile = "3.6.0" term_grid = "0.1.5" From d7d2ad52dbce35e9dd0d08e88f4e538a3c254bb6 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 19 Jul 2023 08:23:23 +0200 Subject: [PATCH 210/253] nl: fix zero padding of negative line numbers --- src/uu/nl/src/nl.rs | 89 ++++++++++++++++------------------------ tests/by-util/test_nl.rs | 12 ++++++ 2 files changed, 48 insertions(+), 53 deletions(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 39090aea5..69715d1a1 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -9,7 +9,6 @@ use clap::{crate_version, Arg, ArgAction, Command}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; -use std::iter::repeat; use std::path::Path; use uucore::error::{FromIo, UResult, USimpleError}; use uucore::{format_usage, help_about, help_section, help_usage}; @@ -95,6 +94,19 @@ impl> From for NumberFormat { } } +impl NumberFormat { + // Turns a line number into a `String` with at least `min_width` chars, + // formatted according to the `NumberFormat`s variant. + fn format(&self, number: i64, min_width: usize) -> String { + match self { + Self::Left => format!("{number: format!("{number:>min_width$}"), + Self::RightZero if number < 0 => format!("-{0:0>1$}", number.abs(), min_width - 1), + Self::RightZero => format!("{number:0>min_width$}"), + } + } +} + pub mod options { pub const HELP: &str = "help"; pub const FILE: &str = "file"; @@ -263,13 +275,7 @@ pub fn uu_app() -> Command { fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { let regexp: regex::Regex = regex::Regex::new(r".?").unwrap(); let mut line_no = settings.starting_line_number; - let mut line_no_width = line_no.len(); - let line_no_width_initial = line_no_width; let mut empty_line_count: u64 = 0; - let fill_char = match settings.number_format { - NumberFormat::RightZero => '0', - _ => ' ', - }; // Initially, we use the body's line counting settings let mut regex_filter = match settings.body_numbering { NumberingStyle::NumberForRegularExpression(ref re) => re, @@ -322,10 +328,9 @@ fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { match *match matched_groups { 3 => { // This is a header, so we may need to reset the - // line number and the line width + // line number if settings.renumber { line_no = settings.starting_line_number; - line_no_width = line_no_width_initial; } &settings.header_numbering } @@ -375,26 +380,17 @@ fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { // way, start counting empties from zero once more. empty_line_count = 0; // A line number is to be printed. - let w = if settings.number_width > line_no_width { - settings.number_width - line_no_width - } else { - 0 - }; - let fill: String = repeat(fill_char).take(w).collect(); - match settings.number_format { - NumberFormat::Left => println!( - "{1}{0}{2}{3}", - fill, line_no, settings.number_separator, line - ), - _ => println!( - "{0}{1}{2}{3}", - fill, line_no, settings.number_separator, line - ), - } - // Now update the variables for the (potential) next + println!( + "{}{}{}", + settings + .number_format + .format(line_no, settings.number_width), + settings.number_separator, + line + ); + // Now update the line number for the (potential) next // line. line_no += settings.line_increment; - line_no_width = line_no.len(); } Ok(()) } @@ -415,38 +411,25 @@ fn pass_all(_: &str, _: ®ex::Regex) -> bool { true } -trait Length { - fn len(&self) -> usize; -} - -impl Length for i64 { - // Returns the length in `char`s. - fn len(&self) -> usize { - if *self == 0 { - return 1; - }; - - let sign_len = if *self < 0 { 1 } else { 0 }; - (0..).take_while(|i| 10i64.pow(*i) <= self.abs()).count() + sign_len - } -} - #[cfg(test)] mod test { use super::*; #[test] - fn test_len() { - assert_eq!((-1).len(), 2); - assert_eq!((-10).len(), 3); - assert_eq!((-100).len(), 4); - assert_eq!((-1000).len(), 5); + fn test_format() { + assert_eq!(NumberFormat::Left.format(12, 1), "12"); + assert_eq!(NumberFormat::Left.format(-12, 1), "-12"); + assert_eq!(NumberFormat::Left.format(12, 4), "12 "); + assert_eq!(NumberFormat::Left.format(-12, 4), "-12 "); - assert_eq!(0.len(), 1); + assert_eq!(NumberFormat::Right.format(12, 1), "12"); + assert_eq!(NumberFormat::Right.format(-12, 1), "-12"); + assert_eq!(NumberFormat::Right.format(12, 4), " 12"); + assert_eq!(NumberFormat::Right.format(-12, 4), " -12"); - assert_eq!(1.len(), 1); - assert_eq!(10.len(), 2); - assert_eq!(100.len(), 3); - assert_eq!(1000.len(), 4); + assert_eq!(NumberFormat::RightZero.format(12, 1), "12"); + assert_eq!(NumberFormat::RightZero.format(-12, 1), "-12"); + assert_eq!(NumberFormat::RightZero.format(12, 4), "0012"); + assert_eq!(NumberFormat::RightZero.format(-12, 4), "-012"); } } diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index bdb76da78..7b3a199a7 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -114,6 +114,18 @@ fn test_number_format_rz() { } } +#[test] +fn test_number_format_rz_with_negative_line_number() { + for arg in ["-nrz", "--number-format=rz"] { + new_ucmd!() + .arg(arg) + .arg("-v-12") + .pipe_in("test") + .succeeds() + .stdout_is("-00012\ttest\n"); + } +} + #[test] fn test_invalid_number_format() { for arg in ["-ninvalid", "--number-format=invalid"] { From 15a95b46db25e9e651ac86d46e548c410c3dc7c6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 19 Jul 2023 22:20:31 +0000 Subject: [PATCH 211/253] chore(deps): update rust crate rlimit to 0.10.1 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d70640c46..cc3f52493 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1833,9 +1833,9 @@ checksum = "4bf2521270932c3c7bed1a59151222bd7643c79310f2916f01925e1e16255698" [[package]] name = "rlimit" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b5b8be0bc0ef630d24f8fa836b3a3463479b2343b29f9a8fa905c71a8c7b69b" +checksum = "3560f70f30a0f16d11d01ed078a07740fe6b489667abc7c7b029155d9f21c3d8" dependencies = [ "libc", ] diff --git a/Cargo.toml b/Cargo.toml index 1d81d0d70..1e35bce11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -496,7 +496,7 @@ rstest = { workspace = true } [target.'cfg(any(target_os = "linux", target_os = "android"))'.dev-dependencies] procfs = { version = "0.15", default-features = false } -rlimit = "0.10.0" +rlimit = "0.10.1" [target.'cfg(unix)'.dev-dependencies] nix = { workspace = true, features = ["process", "signal", "user"] } From 013e94522e56eaae5b916f89332441e5a9918475 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 20 Jul 2023 09:45:21 +0200 Subject: [PATCH 212/253] nl: shorten variants of NumberingStyle enum --- src/uu/nl/src/helper.rs | 10 ++++------ src/uu/nl/src/nl.rs | 25 ++++++++++++------------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 2a90cb130..5520931ee 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -5,17 +5,15 @@ use crate::options; // parse_style parses a style string into a NumberingStyle. fn parse_style(chars: &[char]) -> Result { if chars.len() == 1 && chars[0] == 'a' { - Ok(crate::NumberingStyle::NumberForAll) + Ok(crate::NumberingStyle::All) } else if chars.len() == 1 && chars[0] == 't' { - Ok(crate::NumberingStyle::NumberForNonEmpty) + Ok(crate::NumberingStyle::NonEmpty) } else if chars.len() == 1 && chars[0] == 'n' { - Ok(crate::NumberingStyle::NumberForNone) + Ok(crate::NumberingStyle::None) } else if chars.len() > 1 && chars[0] == 'p' { let s: String = chars[1..].iter().cloned().collect(); match regex::Regex::new(&s) { - Ok(re) => Ok(crate::NumberingStyle::NumberForRegularExpression(Box::new( - re, - ))), + Ok(re) => Ok(crate::NumberingStyle::Regex(Box::new(re))), Err(_) => Err(String::from("Illegal regular expression")), } } else { diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 39090aea5..4e0e1006e 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -44,9 +44,9 @@ pub struct Settings { impl Default for Settings { fn default() -> Self { Self { - header_numbering: NumberingStyle::NumberForNone, - body_numbering: NumberingStyle::NumberForAll, - footer_numbering: NumberingStyle::NumberForNone, + header_numbering: NumberingStyle::None, + body_numbering: NumberingStyle::All, + footer_numbering: NumberingStyle::None, section_delimiter: ['\\', ':'], starting_line_number: 1, line_increment: 1, @@ -65,12 +65,11 @@ impl Default for Settings { // 2. Number only nonempty lines // 3. Don't number any lines at all // 4. Number all lines that match a basic regular expression. -#[allow(clippy::enum_variant_names)] enum NumberingStyle { - NumberForAll, - NumberForNonEmpty, - NumberForNone, - NumberForRegularExpression(Box), + All, + NonEmpty, + None, + Regex(Box), } // NumberFormat specifies how line numbers are output within their allocated @@ -272,7 +271,7 @@ fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { }; // Initially, we use the body's line counting settings let mut regex_filter = match settings.body_numbering { - NumberingStyle::NumberForRegularExpression(ref re) => re, + NumberingStyle::Regex(ref re) => re, _ => ®exp, }; let mut line_filter: fn(&str, ®ex::Regex) -> bool = pass_regex; @@ -334,16 +333,16 @@ fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { // a catch-all here. _ => &settings.body_numbering, } { - NumberingStyle::NumberForAll => { + NumberingStyle::All => { line_filter = pass_all; } - NumberingStyle::NumberForNonEmpty => { + NumberingStyle::NonEmpty => { line_filter = pass_nonempty; } - NumberingStyle::NumberForNone => { + NumberingStyle::None => { line_filter = pass_none; } - NumberingStyle::NumberForRegularExpression(ref re) => { + NumberingStyle::Regex(ref re) => { line_filter = pass_regex; regex_filter = re; } From 749a2476f45a2303b22301368990d7b0cb4c3731 Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Thu, 20 Jul 2023 15:53:32 +0800 Subject: [PATCH 213/253] make: uninstall man pages --- .github/workflows/CICD.yml | 12 ++++++++++++ GNUmakefile | 1 + 2 files changed, 13 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index b31c462e9..589126b6f 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -452,8 +452,20 @@ jobs: test -f /tmp/usr/local/share/man/man1/whoami.1 # Check that the completion is present test -f /tmp/usr/local/share/zsh/site-functions/_install + test -f /tmp/usr/local/share/bash-completion/completions/head + test -f /tmp/usr/local/share/fish/vendor_completions.d/cat.fish env: RUST_BACKTRACE: "1" + - name: "`make uninstall`" + shell: bash + run: | + DESTDIR=/tmp/ make uninstall + # Check that the manpage is not present + ! test -f /tmp/usr/local/share/man/man1/whoami.1 + # Check that the completion is not present + ! test -f /tmp/usr/local/share/zsh/site-functions/_install + ! test -f /tmp/usr/local/share/bash-completion/completions/head + ! test -f /tmp/usr/local/share/fish/vendor_completions.d/cat.fish build_rust_stable: name: Build/stable diff --git a/GNUmakefile b/GNUmakefile index 257f04a26..c672458a1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -386,5 +386,6 @@ endif rm -f $(addprefix $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions/_$(PROG_PREFIX),$(PROGS)) rm -f $(addprefix $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions/$(PROG_PREFIX),$(PROGS)) rm -f $(addprefix $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d/$(PROG_PREFIX),$(addsuffix .fish,$(PROGS))) + rm -f $(addprefix $(DESTDIR)$(DATAROOTDIR)/man/man1/$(PROG_PREFIX),$(addsuffix .1,$(PROGS))) .PHONY: all build build-coreutils build-pkgs test distclean clean busytest install uninstall From aef130dae7840dec3c2234eb9416de34a9893e25 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 20 Jul 2023 15:26:46 +0200 Subject: [PATCH 214/253] nl: show error if --join-blank-lines is zero --- src/uu/nl/src/helper.rs | 19 +++++++------------ src/uu/nl/src/nl.rs | 3 ++- tests/by-util/test_nl.rs | 21 ++++++++++++++++++++- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 2a90cb130..29c75af69 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -86,23 +86,18 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> "Invalid line number field width: ‘0’: Numerical result out of range", )), } + match opts.get_one::(options::JOIN_BLANK_LINES) { + None => {} + Some(num) if *num > 0 => settings.join_blank_lines = *num, + Some(_) => errs.push(String::from( + "Invalid line number of blank lines: ‘0’: Numerical result out of range", + )), + } if let Some(num) = opts.get_one::(options::LINE_INCREMENT) { settings.line_increment = *num; } if let Some(num) = opts.get_one::(options::STARTING_LINE_NUMBER) { settings.starting_line_number = *num; } - match opts.get_one::(options::JOIN_BLANK_LINES) { - None => {} - Some(val) => { - let conv: Option = val.parse().ok(); - match conv { - None => { - errs.push(String::from("Illegal value for -l")); - } - Some(num) => settings.join_blank_lines = num, - } - } - } errs } diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 39090aea5..bc3817acc 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -216,7 +216,8 @@ pub fn uu_app() -> Command { .short('l') .long(options::JOIN_BLANK_LINES) .help("group of NUMBER empty lines counted as one") - .value_name("NUMBER"), + .value_name("NUMBER") + .value_parser(clap::value_parser!(u64)), ) .arg( Arg::new(options::NUMBER_FORMAT) diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index bdb76da78..c32e90ad5 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore iinvalid ninvalid vinvalid winvalid +// spell-checker:ignore iinvalid linvalid ninvalid vinvalid winvalid use crate::common::util::TestScenario; #[test] @@ -244,3 +244,22 @@ fn test_invalid_line_increment() { .stderr_contains("invalid value 'invalid'"); } } + +#[test] +fn test_join_blank_lines_zero() { + for arg in ["-l0", "--join-blank-lines=0"] { + new_ucmd!().arg(arg).fails().stderr_contains( + "Invalid line number of blank lines: ‘0’: Numerical result out of range", + ); + } +} + +#[test] +fn test_invalid_join_blank_lines() { + for arg in ["-linvalid", "--join-blank-lines=invalid"] { + new_ucmd!() + .arg(arg) + .fails() + .stderr_contains("invalid value 'invalid'"); + } +} From 6e28b3d8ade330b58e31c565c7ea915f36fb0962 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 20 Jul 2023 19:29:03 +0200 Subject: [PATCH 215/253] Add the Perl Power Tools impl Thanks Jarkko Hietaniemi --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7dc2565c1..bd87e2d05 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -356,6 +356,7 @@ The Coreutils have different implementations, with different levels of completio * [V lang](https://github.com/vlang/coreutils) * [SerenityOS](https://github.com/SerenityOS/serenity/tree/master/Userland/Utilities) * [Initial Unix](https://github.com/dspinellis/unix-history-repo) +* [Perl Power Tools](https://metacpan.org/pod/PerlPowerTools) However, when reimplementing the tools/options in Rust, don't read their source codes when they are using reciprocal licenses (ex: GNU GPL, GNU LGPL, etc). From 6b95aabaa216aa531c40c2022ffeb813a287052d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 01:07:21 +0000 Subject: [PATCH 216/253] chore(deps): update rust crate num-traits to 0.2.16 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc3f52493..ee58cd81a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1451,9 +1451,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] diff --git a/Cargo.toml b/Cargo.toml index 1e35bce11..a0c778e22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -297,7 +297,7 @@ nix = { version = "0.26", default-features = false } nom = "7.1.3" notify = { version = "=6.0.1", features = ["macos_kqueue"] } num-bigint = "0.4.3" -num-traits = "0.2.15" +num-traits = "0.2.16" number_prefix = "0.4" once_cell = "1.18.0" onig = { version = "~6.4", default-features = false } From d40a25db5d817140f160cd81d0d04578f1f91d18 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 21 Jul 2023 10:52:03 +0200 Subject: [PATCH 217/253] csplit: remove explicit "into_iter()" --- src/uu/csplit/src/csplit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index a5b6c06b0..d1925308e 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -127,7 +127,7 @@ where I: Iterator)>, { // split the file based on patterns - for pattern in patterns.into_iter() { + for pattern in patterns { let pattern_as_str = pattern.to_string(); let is_skip = matches!(pattern, patterns::Pattern::SkipToMatch(_, _, _)); match pattern { From fe9ec37141a67e9d305a6fde1003000df3404f4a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 22 Jul 2023 16:14:32 +0200 Subject: [PATCH 218/253] uucore: use "workspace=true" for some dependencies --- src/uucore/Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 7e2133a5e..d376e807a 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -23,9 +23,9 @@ uucore_procs = { workspace = true } dns-lookup = { version = "2.0.2", optional = true } dunce = "1.0.4" wild = "2.1" -glob = "0.3.1" +glob = { workspace = true } # * optional -itertools = { version = "0.11.0", optional = true } +itertools = { workspace = true, optional = true } thiserror = { workspace = true, optional = true } time = { workspace = true, optional = true, features = [ "formatting", @@ -36,7 +36,7 @@ time = { workspace = true, optional = true, features = [ data-encoding = { version = "2.4", optional = true } data-encoding-macro = { version = "0.1.13", optional = true } z85 = { version = "3.0.5", optional = true } -libc = { version = "0.2.147", optional = true } +libc = { workspace = true, optional = true } once_cell = { workspace = true } os_display = "0.1.3" @@ -61,8 +61,8 @@ once_cell = { workspace = true } tempfile = { workspace = true } [target.'cfg(target_os = "windows")'.dependencies] -winapi-util = { version = "0.1.5", optional = true } -windows-sys = { version = "0.48.0", optional = true, default-features = false, features = [ +winapi-util = { workspace = true, optional = true } +windows-sys = { workspace = true, optional = true, default-features = false, features = [ "Win32_Storage_FileSystem", "Win32_Foundation", "Win32_System_WindowsProgramming", From 781c915ba959a2d04731c65d23f29022d92533be Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 12:18:40 +0000 Subject: [PATCH 219/253] chore(deps): update rust crate lscolors to 0.15.0 --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee58cd81a..6b57f1b64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1306,9 +1306,9 @@ dependencies = [ [[package]] name = "lscolors" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a9df1d1fb6d9e92fa043e9eb9a3ecf6892c7b542bae5137cd1e419e40aa8bf" +checksum = "bf7015a04103ad78abb77e4b79ed151e767922d1cfde5f62640471c629a2320d" dependencies = [ "nu-ansi-term", ] @@ -1421,11 +1421,11 @@ dependencies = [ [[package]] name = "nu-ansi-term" -version = "0.47.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df031e117bca634c262e9bd3173776844b6c17a90b3741c9163663b4385af76" +checksum = "c073d3c1930d0751774acf49e66653acecb416c3a54c6ec095a9b11caddb5a68" dependencies = [ - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a0c778e22..f53dae6ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -288,7 +288,7 @@ indicatif = "0.17" is-terminal = "0.4.7" itertools = "0.11.0" libc = "0.2.147" -lscolors = { version = "0.14.0", default-features = false, features = [ +lscolors = { version = "0.15.0", default-features = false, features = [ "nu-ansi-term", ] } memchr = "2" From f50cde252b53433a63487f1bbb1de99af8072e20 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 24 Jul 2023 21:30:23 +0200 Subject: [PATCH 220/253] only set SELINUX_ENABLED=1 on Linux --- util/build-gnu.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 88f4eda98..74346f095 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -43,7 +43,14 @@ UU_BUILD_DIR="${path_UUTILS}/target/${UU_MAKE_PROFILE}" echo "UU_BUILD_DIR='${UU_BUILD_DIR}'" cd "${path_UUTILS}" && echo "[ pwd:'${PWD}' ]" -SELINUX_ENABLED=1 make PROFILE="${UU_MAKE_PROFILE}" + +if [ "$(uname)" == "Linux" ]; then +# only set on linux + export SELINUX_ENABLED=1 +fi + +make PROFILE="${UU_MAKE_PROFILE}" + cp "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target # Create *sum binaries for sum in b2sum b3sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum; do From 164250930235ac4b0bb94f5330f576c6865450b4 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 25 Jul 2023 14:20:48 +0200 Subject: [PATCH 221/253] Bump unicode-linebreak from 0.1.4 to 0.1.5 --- Cargo.lock | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b57f1b64..b7f1c6c3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,17 +8,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - [[package]] name = "aho-corasick" version = "0.7.19" @@ -1055,15 +1044,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash", -] - [[package]] name = "hashbrown" version = "0.13.2" @@ -1518,7 +1498,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ed8acf08e98e744e5384c8bc63ceb0364e68a6854187221c18df61c4797690e" dependencies = [ "dlv-list", - "hashbrown 0.13.2", + "hashbrown", ] [[package]] @@ -2258,13 +2238,9 @@ checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-linebreak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" -dependencies = [ - "hashbrown 0.12.3", - "regex", -] +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-segmentation" From 8a58b0ae74d7c9e893f1f31de1a3ebee318e2263 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 25 Jul 2023 14:22:19 +0200 Subject: [PATCH 222/253] deny.toml: remove hashbrown from skip list --- deny.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/deny.toml b/deny.toml index 34233952b..84dae2b98 100644 --- a/deny.toml +++ b/deny.toml @@ -84,8 +84,6 @@ skip = [ { name = "redox_syscall", version = "0.3.5" }, # cpp_macros { name = "aho-corasick", version = "0.7.19" }, - # ordered-multimap (via rust-ini) - { name = "hashbrown", version = "0.13.2" }, # various crates { name = "syn", version = "1.0.109" }, ] From c2997718cd99025e8577d39b1546588d52d53288 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 24 Mar 2023 11:51:38 +0100 Subject: [PATCH 223/253] touch: move from time to chrono This allows us to work with daylight savings time which is necessary to enable one of the tests. The leap second calculation and parsing are also ported over. A bump in the chrono version is necessary to use NaiveTime::MIN. --- Cargo.lock | 2 +- src/uu/touch/Cargo.toml | 7 +- src/uu/touch/src/touch.rs | 236 ++++++++++++------------------------ tests/by-util/test_touch.rs | 30 +---- 4 files changed, 85 insertions(+), 190 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7f1c6c3c..c6cd487f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3124,10 +3124,10 @@ dependencies = [ name = "uu_touch" version = "0.0.20" dependencies = [ + "chrono", "clap", "filetime", "parse_datetime", - "time", "uucore", "windows-sys 0.48.0", ] diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index cde016f82..ce0752093 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -18,13 +18,8 @@ path = "src/touch.rs" [dependencies] filetime = { workspace = true } clap = { workspace = true } +chrono = { workspace = true } parse_datetime = { workspace = true } -time = { workspace = true, features = [ - "parsing", - "formatting", - "local-offset", - "macros", -] } uucore = { workspace = true, features = ["libc"] } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 230a6bb70..baa28890c 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -6,16 +6,16 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -// spell-checker:ignore (ToDO) filetime datetime MMDDhhmm lpszfilepath mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond humantime +// spell-checker:ignore (ToDO) filetime datetime lpszfilepath mktime DATETIME subsecond datelike timelike +// spell-checker:ignore (FORMATS) MMDDhhmm YYYYMMDDHHMM YYMMDDHHMM YYYYMMDDHHMMS +use chrono::{DateTime, Datelike, Duration, Local, NaiveDate, NaiveTime, TimeZone, Timelike, Utc}; use clap::builder::ValueParser; use clap::{crate_version, Arg, ArgAction, ArgGroup, Command}; -use filetime::{set_symlink_file_times, FileTime}; +use filetime::{set_file_times, set_symlink_file_times, FileTime}; use std::ffi::OsString; use std::fs::{self, File}; use std::path::{Path, PathBuf}; -use time::macros::{format_description, offset, time}; -use time::Duration; use uucore::display::Quotable; use uucore::error::{FromIo, UError, UResult, USimpleError}; use uucore::{format_usage, help_about, help_usage, show}; @@ -41,27 +41,31 @@ pub mod options { static ARG_FILES: &str = "files"; -// Convert a date/time to a date with a TZ offset -fn to_local(tm: time::PrimitiveDateTime) -> time::OffsetDateTime { - let offset = match time::OffsetDateTime::now_local() { - Ok(lo) => lo.offset(), - Err(e) => { - panic!("error: {e}"); - } - }; - tm.assume_offset(offset) +mod format { + pub(crate) const POSIX_LOCALE: &str = "%a %b %e %H:%M:%S %Y"; + pub(crate) const ISO_8601: &str = "%Y-%m-%d"; + // "%Y%m%d%H%M.%S" 15 chars + pub(crate) const YYYYMMDDHHMM_DOT_SS: &str = "%Y%m%d%H%M.%S"; + // "%Y-%m-%d %H:%M:%S.%SS" 12 chars + pub(crate) const YYYYMMDDHHMMSS: &str = "%Y-%m-%d %H:%M:%S.%f"; + // "%Y-%m-%d %H:%M:%S" 12 chars + pub(crate) const YYYYMMDDHHMMS: &str = "%Y-%m-%d %H:%M:%S"; + // "%Y-%m-%d %H:%M" 12 chars + // Used for example in tests/touch/no-rights.sh + pub(crate) const YYYY_MM_DD_HH_MM: &str = "%Y-%m-%d %H:%M"; + // "%Y%m%d%H%M" 12 chars + pub(crate) const YYYYMMDDHHMM: &str = "%Y%m%d%H%M"; + // "%Y-%m-%d %H:%M +offset" + // Used for example in tests/touch/relative.sh + pub(crate) const YYYYMMDDHHMM_OFFSET: &str = "%Y-%m-%d %H:%M %z"; } -// Convert a date/time with a TZ offset into a FileTime -fn local_dt_to_filetime(dt: time::OffsetDateTime) -> FileTime { - FileTime::from_unix_time(dt.unix_timestamp(), dt.nanosecond()) -} - -// Convert a date/time, considering that the input is in UTC time -// Used for touch -d 1970-01-01 18:43:33.023456789 for example -fn dt_to_filename(tm: time::PrimitiveDateTime) -> FileTime { - let dt = tm.assume_offset(offset!(UTC)); - local_dt_to_filetime(dt) +/// Convert a DateTime with a TZ offset into a FileTime +/// +/// The DateTime is converted into a unix timestamp from which the FileTime is +/// constructed. +fn datetime_to_filetime(dt: &DateTime) -> FileTime { + FileTime::from_unix_time(dt.timestamp(), dt.timestamp_subsec_nanos()) } #[uucore::main] @@ -120,7 +124,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { { parse_timestamp(ts)? } else { - local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap()) + datetime_to_filetime(&Local::now()) }; (timestamp, timestamp) } @@ -212,7 +216,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } else if matches.get_flag(options::NO_DEREF) { set_symlink_file_times(path, atime, mtime) } else { - filetime::set_file_times(path, atime, mtime) + set_file_times(path, atime, mtime) } .map_err_context(|| format!("setting times of {}", path.quote()))?; } @@ -332,64 +336,6 @@ fn stat(path: &Path, follow: bool) -> UResult<(FileTime, FileTime)> { )) } -const POSIX_LOCALE_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[weekday repr:short] [month repr:short] [day padding:space] \ - [hour]:[minute]:[second] [year]" -); - -const ISO_8601_FORMAT: &[time::format_description::FormatItem] = - format_description!("[year]-[month]-[day]"); - -// "%Y%m%d%H%M.%S" 15 chars -const YYYYMMDDHHMM_DOT_SS_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[year repr:full][month repr:numerical padding:zero]\ - [day][hour][minute].[second]" -); - -// "%Y-%m-%d %H:%M:%S.%SS" 12 chars -const YYYYMMDDHHMMSS_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[year repr:full]-[month repr:numerical padding:zero]-\ - [day] [hour]:[minute]:[second].[subsecond]" -); - -// "%Y-%m-%d %H:%M:%S" 12 chars -const YYYYMMDDHHMMS_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[year repr:full]-[month repr:numerical padding:zero]-\ - [day] [hour]:[minute]:[second]" -); - -// "%Y-%m-%d %H:%M" 12 chars -// Used for example in tests/touch/no-rights.sh -const YYYY_MM_DD_HH_MM_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[year repr:full]-[month repr:numerical padding:zero]-\ - [day] [hour]:[minute]" -); - -// "%Y%m%d%H%M" 12 chars -const YYYYMMDDHHMM_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[year repr:full][month repr:numerical padding:zero]\ - [day][hour][minute]" -); - -// "%y%m%d%H%M.%S" 13 chars -const YYMMDDHHMM_DOT_SS_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[year repr:last_two padding:none][month][day]\ - [hour][minute].[second]" -); - -// "%y%m%d%H%M" 10 chars -const YYMMDDHHMM_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[year repr:last_two padding:none][month padding:zero][day padding:zero]\ - [hour repr:24 padding:zero][minute padding:zero]" -); - -// "%Y-%m-%d %H:%M +offset" -// Used for example in tests/touch/relative.sh -const YYYYMMDDHHMM_OFFSET_FORMAT: &[time::format_description::FormatItem] = format_description!( - "[year]-[month]-[day] [hour repr:24]:[minute] \ - [offset_hour sign:mandatory][offset_minute]" -); - fn parse_date(s: &str) -> UResult { // This isn't actually compatible with GNU touch, but there doesn't seem to // be any simple specification for what format this parameter allows and I'm @@ -405,66 +351,61 @@ fn parse_date(s: &str) -> UResult { // Tue Dec 3 ... // ("%c", POSIX_LOCALE_FORMAT), // - if let Ok(parsed) = time::PrimitiveDateTime::parse(s, &POSIX_LOCALE_FORMAT) { - return Ok(local_dt_to_filetime(to_local(parsed))); + if let Ok(parsed) = Local.datetime_from_str(s, format::POSIX_LOCALE) { + return Ok(datetime_to_filetime(&parsed)); } // Also support other formats found in the GNU tests like // in tests/misc/stat-nanoseconds.sh // or tests/touch/no-rights.sh for fmt in [ - YYYYMMDDHHMMS_FORMAT, - YYYYMMDDHHMMSS_FORMAT, - YYYY_MM_DD_HH_MM_FORMAT, - YYYYMMDDHHMM_OFFSET_FORMAT, + format::YYYYMMDDHHMMS, + format::YYYYMMDDHHMMSS, + format::YYYY_MM_DD_HH_MM, + format::YYYYMMDDHHMM_OFFSET, ] { - if let Ok(parsed) = time::PrimitiveDateTime::parse(s, &fmt) { - return Ok(dt_to_filename(parsed)); + if let Ok(parsed) = Utc.datetime_from_str(s, fmt) { + return Ok(datetime_to_filetime(&parsed)); } } // "Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99)" // ("%F", ISO_8601_FORMAT), - if let Ok(parsed) = time::Date::parse(s, &ISO_8601_FORMAT) { - return Ok(local_dt_to_filetime(to_local( - time::PrimitiveDateTime::new(parsed, time!(00:00)), - ))); + if let Ok(parsed_date) = NaiveDate::parse_from_str(s, format::ISO_8601) { + let parsed = Local + .from_local_datetime(&parsed_date.and_time(NaiveTime::MIN)) + .unwrap(); + return Ok(datetime_to_filetime(&parsed)); } // "@%s" is "The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). (TZ) (Calculated from mktime(tm).)" if s.bytes().next() == Some(b'@') { if let Ok(ts) = &s[1..].parse::() { - // Don't convert to local time in this case - seconds since epoch are not time-zone dependent - return Ok(local_dt_to_filetime( - time::OffsetDateTime::from_unix_timestamp(*ts).unwrap(), - )); + return Ok(FileTime::from_unix_time(*ts, 0)); } } if let Ok(duration) = parse_datetime::from_str(s) { - let now_local = time::OffsetDateTime::now_local().unwrap(); - let diff = now_local - .checked_add(time::Duration::nanoseconds( - duration.num_nanoseconds().unwrap(), - )) - .unwrap(); - return Ok(local_dt_to_filetime(diff)); + let dt = Local::now() + duration; + return Ok(datetime_to_filetime(&dt)); } Err(USimpleError::new(1, format!("Unable to parse date: {s}"))) } fn parse_timestamp(s: &str) -> UResult { - // TODO: handle error - let now = time::OffsetDateTime::now_utc(); + use format::*; - let (mut format, mut ts) = match s.chars().count() { - 15 => (YYYYMMDDHHMM_DOT_SS_FORMAT, s.to_owned()), - 12 => (YYYYMMDDHHMM_FORMAT, s.to_owned()), - 13 => (YYMMDDHHMM_DOT_SS_FORMAT, s.to_owned()), - 10 => (YYMMDDHHMM_FORMAT, s.to_owned()), - 11 => (YYYYMMDDHHMM_DOT_SS_FORMAT, format!("{}{}", now.year(), s)), - 8 => (YYYYMMDDHHMM_FORMAT, format!("{}{}", now.year(), s)), + let current_year = || Local::now().year(); + + let (format, ts) = match s.chars().count() { + 15 => (YYYYMMDDHHMM_DOT_SS, s.to_owned()), + 12 => (YYYYMMDDHHMM, s.to_owned()), + // If we don't add "20", we have insufficient information to parse + 13 => (YYYYMMDDHHMM_DOT_SS, format!("20{}", s)), + 10 => (YYYYMMDDHHMM, format!("20{}", s)), + 11 => (YYYYMMDDHHMM_DOT_SS, format!("{}{}", current_year(), s)), + 8 => (YYYYMMDDHHMM, format!("{}{}", current_year(), s)), _ => { return Err(USimpleError::new( 1, @@ -472,54 +413,33 @@ fn parse_timestamp(s: &str) -> UResult { )) } }; - // workaround time returning Err(TryFromParsed(InsufficientInformation)) for year w/ - // repr:last_two - // https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1ccfac7c07c5d1c7887a11decf0e1996 - if s.chars().count() == 10 { - format = YYYYMMDDHHMM_FORMAT; - ts = "20".to_owned() + &ts; - } else if s.chars().count() == 13 { - format = YYYYMMDDHHMM_DOT_SS_FORMAT; - ts = "20".to_owned() + &ts; - } - let leap_sec = if (format == YYYYMMDDHHMM_DOT_SS_FORMAT || format == YYMMDDHHMM_DOT_SS_FORMAT) - && ts.ends_with(".60") - { - // Work around to disable leap seconds - // Used in gnu/tests/touch/60-seconds - ts = ts.replace(".60", ".59"); - true - } else { - false - }; - - let tm = time::PrimitiveDateTime::parse(&ts, &format) + let mut local = chrono::Local + .datetime_from_str(&ts, format) .map_err(|_| USimpleError::new(1, format!("invalid date ts format {}", ts.quote())))?; - let mut local = to_local(tm); - if leap_sec { - // We are dealing with a leap second, add it - local = local.saturating_add(Duration::SECOND); + + // Chrono caps seconds at 59, but 60 is valid. It might be a leap second + // or wrap to the next minute. But that doesn't really matter, because we + // only care about the timestamp anyway. + // Tested in gnu/tests/touch/60-seconds + if local.second() == 59 && ts.ends_with(".60") { + local += Duration::seconds(1); } - let ft = local_dt_to_filetime(local); - // // We have to check that ft is valid time. Due to daylight saving - // // time switch, local time can jump from 1:59 AM to 3:00 AM, - // // in which case any time between 2:00 AM and 2:59 AM is not valid. - // // Convert back to local time and see if we got the same value back. - // let ts = time::Timespec { - // sec: ft.unix_seconds(), - // nsec: 0, - // }; - // let tm2 = time::at(ts); - // if tm.tm_hour != tm2.tm_hour { - // return Err(USimpleError::new( - // 1, - // format!("invalid date format {}", s.quote()), - // )); - // } + // Due to daylight saving time switch, local time can jump from 1:59 AM to + // 3:00 AM, in which case any time between 2:00 AM and 2:59 AM is not + // valid. If we are within this jump, chrono takes the offset from before + // the jump. If we then jump forward an hour, we get the new corrected + // offset. Jumping back will then now correctly take the jump into account. + let local2 = local + Duration::hours(1) - Duration::hours(1); + if local.hour() != local2.hour() { + return Err(USimpleError::new( + 1, + format!("invalid date format {}", s.quote()), + )); + } - Ok(ft) + Ok(datetime_to_filetime(&local)) } // TODO: this may be a good candidate to put in fsext.rs diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index cd2a70bdb..0ebbee1d7 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -1,16 +1,8 @@ // spell-checker:ignore (formats) cymdhm cymdhms mdhm mdhms ymdhm ymdhms datetime mktime -// This test relies on -// --cfg unsound_local_offset -// https://github.com/time-rs/time/blob/deb8161b84f355b31e39ce09e40c4d6ce3fea837/src/sys/local_offset_at/unix.rs#L112-L120= -// See https://github.com/time-rs/time/issues/293#issuecomment-946382614= -// Defined in .cargo/config - -use filetime::FileTime; - -use time::macros::format_description; - use crate::common::util::{AtPath, TestScenario}; +use chrono::TimeZone; +use filetime::{self, FileTime}; use std::fs::remove_file; use std::path::PathBuf; @@ -35,21 +27,9 @@ fn set_file_times(at: &AtPath, path: &str, atime: FileTime, mtime: FileTime) { filetime::set_file_times(at.plus_as_string(path), atime, mtime).unwrap(); } -// Adjusts for local timezone fn str_to_filetime(format: &str, s: &str) -> FileTime { - let format_description = match format { - "%y%m%d%H%M" => format_description!("[year repr:last_two][month][day][hour][minute]"), - "%y%m%d%H%M.%S" => { - format_description!("[year repr:last_two][month][day][hour][minute].[second]") - } - "%Y%m%d%H%M" => format_description!("[year][month][day][hour][minute]"), - "%Y%m%d%H%M.%S" => format_description!("[year][month][day][hour][minute].[second]"), - _ => panic!("unexpected dt format"), - }; - let tm = time::PrimitiveDateTime::parse(s, &format_description).unwrap(); - let d = time::OffsetDateTime::now_utc(); - let offset_dt = tm.assume_offset(d.offset()); - FileTime::from_unix_time(offset_dt.unix_timestamp(), tm.nanosecond()) + let tm = chrono::Utc.datetime_from_str(s, format).unwrap(); + FileTime::from_unix_time(tm.timestamp(), tm.timestamp_subsec_nanos()) } #[test] @@ -667,7 +647,7 @@ fn test_touch_mtime_dst_succeeds() { } #[test] -#[ignore = "not implemented"] +#[cfg(unix)] fn test_touch_mtime_dst_fails() { let (_at, mut ucmd) = at_and_ucmd!(); let file = "test_touch_set_mtime_dst_fails"; From e9f89c46e09c0b33ea5e64963e2a5034e19dda73 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 27 Jul 2023 23:41:25 -0600 Subject: [PATCH 224/253] Use `rotate_right` instead of explicit expansion. --- src/uu/sum/src/sum.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 0ea415b13..e9b5a8e07 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -34,7 +34,7 @@ fn bsd_sum(mut reader: Box) -> (usize, u16) { Ok(n) if n != 0 => { bytes_read += n; for &byte in buf[..n].iter() { - checksum = (checksum >> 1) + ((checksum & 1) << 15); + checksum = checksum.rotate_right(1); checksum = checksum.wrapping_add(u16::from(byte)); } } From 24319791ec60da10a8107b02fc1478ff305cff4e Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 28 Jul 2023 21:25:11 +0200 Subject: [PATCH 225/253] tsort: use Iterator.all --- src/uu/tsort/src/tsort.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index 6e11a7f58..68f51b213 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -171,11 +171,6 @@ impl Graph { } fn is_acyclic(&self) -> bool { - for edges in self.out_edges.values() { - if !edges.is_empty() { - return false; - } - } - true + self.out_edges.values().all(|edge| edge.is_empty()) } } From 0d56792c58a3f3fa81e312e4d14abe91a0ba1a42 Mon Sep 17 00:00:00 2001 From: John Shin Date: Fri, 28 Jul 2023 17:09:23 -0700 Subject: [PATCH 226/253] mv: use is_empty() --- src/uu/mv/src/mv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 32214b302..79245a427 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -400,7 +400,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UR } match rename(sourcepath, &targetpath, b, multi_progress.as_ref()) { - Err(e) if e.to_string() == "" => set_exit_code(1), + Err(e) if e.to_string().is_empty() => set_exit_code(1), Err(e) => { let e = e.map_err_context(|| { format!( From 426cce7df0b0ef00cefd1fd841096b698551df88 Mon Sep 17 00:00:00 2001 From: John Shin Date: Fri, 28 Jul 2023 17:10:36 -0700 Subject: [PATCH 227/253] rmdir: use is_empty() --- src/uu/rmdir/src/rmdir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index 9a864266a..d0123186f 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -100,7 +100,7 @@ fn remove(mut path: &Path, opts: Opts) -> Result<(), Error<'_>> { if opts.parents { while let Some(new) = path.parent() { path = new; - if path.as_os_str() == "" { + if path.as_os_str().is_empty() { break; } remove_single(path, opts)?; From 055a76728fdbdd8009f1872f2ebd3e79d4bdc1ae Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 29 Jul 2023 08:18:35 +0200 Subject: [PATCH 228/253] build-gnu.sh: indent comment --- util/build-gnu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 8a4b5eb69..d852ed66f 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -45,7 +45,7 @@ echo "UU_BUILD_DIR='${UU_BUILD_DIR}'" cd "${path_UUTILS}" && echo "[ pwd:'${PWD}' ]" if [ "$(uname)" == "Linux" ]; then -# only set on linux + # only set on linux export SELINUX_ENABLED=1 fi From bb9517dfc252fdc74fb6031ba01a5c8390aa939d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 30 Jul 2023 00:21:31 +0000 Subject: [PATCH 229/253] chore(deps): update rust crate xattr to 1.0.1 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c6cd487f9..2d316d0ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3593,9 +3593,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "xattr" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea263437ca03c1522846a4ddafbca2542d0ad5ed9b784909d4b27b76f62bc34a" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" dependencies = [ "libc", ] diff --git a/Cargo.toml b/Cargo.toml index f53dae6ae..accc027ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -330,7 +330,7 @@ utf-8 = "0.7.6" walkdir = "2.3" winapi-util = "0.1.5" windows-sys = { version = "0.48.0", default-features = false } -xattr = "1.0.0" +xattr = "1.0.1" zip = { version = "0.6.6", default_features = false, features = ["deflate"] } hex = "0.4.3" From ec27a074c03e9b7f65d370c790921ff68b69ecb6 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 1 Aug 2023 08:20:26 +0200 Subject: [PATCH 230/253] uucore: don't show error for ambiguous value that's a direct match in ShortcutValueParser --- .../src/lib/parser/shortcut_value_parser.rs | 68 +++++++++++++------ 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/src/uucore/src/lib/parser/shortcut_value_parser.rs b/src/uucore/src/lib/parser/shortcut_value_parser.rs index 0b0716158..07ed49cb3 100644 --- a/src/uucore/src/lib/parser/shortcut_value_parser.rs +++ b/src/uucore/src/lib/parser/shortcut_value_parser.rs @@ -1,3 +1,4 @@ +// spell-checker:ignore abcdefgh use clap::{ builder::{PossibleValue, TypedValueParser}, error::{ContextKind, ContextValue, ErrorKind}, @@ -15,6 +16,34 @@ impl ShortcutValueParser { pub fn new(values: impl Into) -> Self { values.into() } + + fn generate_clap_error( + &self, + cmd: &clap::Command, + arg: Option<&clap::Arg>, + value: &str, + ) -> clap::Error { + let mut err = clap::Error::new(ErrorKind::InvalidValue).with_cmd(cmd); + + if let Some(arg) = arg { + err.insert( + ContextKind::InvalidArg, + ContextValue::String(arg.to_string()), + ); + } + + err.insert( + ContextKind::InvalidValue, + ContextValue::String(value.to_string()), + ); + + err.insert( + ContextKind::ValidValue, + ContextValue::Strings(self.0.iter().map(|x| x.get_name().to_string()).collect()), + ); + + err + } } impl TypedValueParser for ShortcutValueParser { @@ -36,29 +65,16 @@ impl TypedValueParser for ShortcutValueParser { .filter(|x| x.get_name().starts_with(value)) .collect(); - if matched_values.len() == 1 { - Ok(matched_values[0].get_name().to_string()) - } else { - let mut err = clap::Error::new(ErrorKind::InvalidValue).with_cmd(cmd); - - if let Some(arg) = arg { - err.insert( - ContextKind::InvalidArg, - ContextValue::String(arg.to_string()), - ); + match matched_values.len() { + 0 => Err(self.generate_clap_error(cmd, arg, value)), + 1 => Ok(matched_values[0].get_name().to_string()), + _ => { + if let Some(direct_match) = matched_values.iter().find(|x| x.get_name() == value) { + Ok(direct_match.get_name().to_string()) + } else { + Err(self.generate_clap_error(cmd, arg, value)) + } } - - err.insert( - ContextKind::InvalidValue, - ContextValue::String(value.to_string()), - ); - - err.insert( - ContextKind::ValidValue, - ContextValue::Strings(self.0.iter().map(|x| x.get_name().to_string()).collect()), - ); - - Err(err) } } @@ -127,6 +143,14 @@ mod tests { assert_eq!("abef", result.unwrap()); } + #[test] + fn test_parse_ref_with_ambiguous_value_that_is_a_possible_value() { + let cmd = Command::new("cmd"); + let parser = ShortcutValueParser::new(["abcd", "abcdefgh"]); + let result = parser.parse_ref(&cmd, None, OsStr::new("abcd")); + assert_eq!("abcd", result.unwrap()); + } + #[test] #[cfg(unix)] fn test_parse_ref_with_invalid_utf8() { From 773e69078cd959c8d3e13dd8a7dbfaa51f315e6d Mon Sep 17 00:00:00 2001 From: Aneesh Date: Thu, 3 Aug 2023 13:39:38 +0530 Subject: [PATCH 231/253] docs(bin,has): add docstrings for macros bin and has --- src/uucore/src/lib/features/fs.rs | 3 +++ src/uucore/src/lib/lib.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index e92d0977f..5804a2235 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -31,6 +31,9 @@ use std::path::{Component, Path, PathBuf, MAIN_SEPARATOR}; #[cfg(target_os = "windows")] use winapi_util::AsHandleRef; +/// Used to check if the `mode` has its `perm` bit set. +/// +/// This macro expands to `mode & perm != 0`. #[cfg(unix)] #[macro_export] macro_rules! has { diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index ca9a48d25..02724e1bf 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -86,6 +86,10 @@ use std::sync::atomic::Ordering; use once_cell::sync::Lazy; +/// Execute utility code for `util`. +/// +/// This macro expands to a main function that invokes the `uumain` function in `util` +/// Exits with code returned by `uumain`. #[macro_export] macro_rules! bin { ($util:ident) => { From 271606ddfacbf46cf01187d486af2da56b1318cb Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 3 Aug 2023 16:12:29 +0200 Subject: [PATCH 232/253] nl: fix output of numbering styles --- src/uu/nl/src/nl.rs | 186 ++++++++++++--------------------------- tests/by-util/test_nl.rs | 159 +++++++++++++++++++++++++++++++-- 2 files changed, 208 insertions(+), 137 deletions(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 502e7d518..85ddb1b41 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -44,7 +44,7 @@ impl Default for Settings { fn default() -> Self { Self { header_numbering: NumberingStyle::None, - body_numbering: NumberingStyle::All, + body_numbering: NumberingStyle::NonEmpty, footer_numbering: NumberingStyle::None, section_delimiter: ['\\', ':'], starting_line_number: 1, @@ -271,146 +271,70 @@ pub fn uu_app() -> Command { } // nl implements the main functionality for an individual buffer. -#[allow(clippy::cognitive_complexity)] fn nl(reader: &mut BufReader, settings: &Settings) -> UResult<()> { - let regexp: regex::Regex = regex::Regex::new(r".?").unwrap(); + let mut current_numbering_style = &settings.body_numbering; let mut line_no = settings.starting_line_number; - let mut empty_line_count: u64 = 0; - // Initially, we use the body's line counting settings - let mut regex_filter = match settings.body_numbering { - NumberingStyle::Regex(ref re) => re, - _ => ®exp, - }; - let mut line_filter: fn(&str, ®ex::Regex) -> bool = pass_regex; - for l in reader.lines() { - let mut l = l.map_err_context(|| "could not read line".to_string())?; - // Sanitize the string. We want to print the newline ourselves. - if l.ends_with('\n') { - l.pop(); - } - // Next we iterate through the individual chars to see if this - // is one of the special lines starting a new "section" in the - // document. - let line = l; - let mut odd = false; - // matched_group counts how many copies of section_delimiter - // this string consists of (0 if there's anything else) - let mut matched_groups = 0u8; - for c in line.chars() { - // If this is a newline character, the loop should end. - if c == '\n' { - break; - } - // If we have already seen three groups (corresponding to - // a header) or the current char does not form part of - // a new group, then this line is not a segment indicator. - if matched_groups >= 3 || settings.section_delimiter[usize::from(odd)] != c { - matched_groups = 0; - break; - } - if odd { - // We have seen a new group and count it. - matched_groups += 1; - } - odd = !odd; - } + let mut consecutive_empty_lines = 0; + + for line in reader.lines() { + let line = line.map_err_context(|| "could not read line".to_string())?; - // See how many groups we matched. That will tell us if this is - // a line starting a new segment, and the number of groups - // indicates what type of segment. - if matched_groups > 0 { - // The current line is a section delimiter, so we output - // a blank line. - println!(); - // However the line does not count as a blank line, so we - // reset the counter used for --join-blank-lines. - empty_line_count = 0; - match *match matched_groups { - 3 => { - // This is a header, so we may need to reset the - // line number - if settings.renumber { - line_no = settings.starting_line_number; - } - &settings.header_numbering - } - 1 => &settings.footer_numbering, - // The only option left is 2, but rust wants - // a catch-all here. - _ => &settings.body_numbering, - } { - NumberingStyle::All => { - line_filter = pass_all; - } - NumberingStyle::NonEmpty => { - line_filter = pass_nonempty; - } - NumberingStyle::None => { - line_filter = pass_none; - } - NumberingStyle::Regex(ref re) => { - line_filter = pass_regex; - regex_filter = re; - } - } - continue; - } - // From this point on we format and print a "regular" line. if line.is_empty() { - // The line is empty, which means that we have to care - // about the --join-blank-lines parameter. - empty_line_count += 1; + consecutive_empty_lines += 1; } else { - // This saves us from having to check for an empty string - // in the next selector. - empty_line_count = 0; + consecutive_empty_lines = 0; + }; + + // FIXME section delimiters are hardcoded and settings.section_delimiter is ignored + // because --section-delimiter is not correctly implemented yet + let _ = settings.section_delimiter; // XXX suppress "field never read" warning + let new_numbering_style = match line.as_str() { + "\\:\\:\\:" => Some(&settings.header_numbering), + "\\:\\:" => Some(&settings.body_numbering), + "\\:" => Some(&settings.footer_numbering), + _ => None, + }; + + if let Some(new_style) = new_numbering_style { + current_numbering_style = new_style; + line_no = settings.starting_line_number; + println!(); + } else { + let is_line_numbered = match current_numbering_style { + // consider $join_blank_lines consecutive empty lines to be one logical line + // for numbering, and only number the last one + NumberingStyle::All + if line.is_empty() + && consecutive_empty_lines % settings.join_blank_lines != 0 => + { + false + } + NumberingStyle::All => true, + NumberingStyle::NonEmpty => !line.is_empty(), + NumberingStyle::None => false, + NumberingStyle::Regex(re) => re.is_match(&line), + }; + + if is_line_numbered { + println!( + "{}{}{}", + settings + .number_format + .format(line_no, settings.number_width), + settings.number_separator, + line + ); + // update line number for the potential next line + line_no += settings.line_increment; + } else { + let spaces = " ".repeat(settings.number_width + 1); + println!("{spaces}{line}"); + } } - if !line_filter(&line, regex_filter) - || (empty_line_count > 0 && empty_line_count < settings.join_blank_lines) - { - // No number is printed for this line. Either we did not - // want to print one in the first place, or it is a blank - // line but we are still collecting more blank lines via - // the option --join-blank-lines. - println!("{line}"); - continue; - } - // If we make it here, then either we are printing a non-empty - // line or assigning a line number to an empty line. Either - // way, start counting empties from zero once more. - empty_line_count = 0; - // A line number is to be printed. - println!( - "{}{}{}", - settings - .number_format - .format(line_no, settings.number_width), - settings.number_separator, - line - ); - // Now update the line number for the (potential) next - // line. - line_no += settings.line_increment; } Ok(()) } -fn pass_regex(line: &str, re: ®ex::Regex) -> bool { - re.is_match(line) -} - -fn pass_nonempty(line: &str, _: ®ex::Regex) -> bool { - !line.is_empty() -} - -fn pass_none(_: &str, _: ®ex::Regex) -> bool { - false -} - -fn pass_all(_: &str, _: ®ex::Regex) -> bool { - true -} - #[cfg(test)] mod test { use super::*; diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index 08f009765..ab27fe148 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -52,15 +52,15 @@ fn test_sections_and_styles() { for (fixture, output) in [ ( "section.txt", - "\nHEADER1\nHEADER2\n\n1 |BODY1\n2 \ - |BODY2\n\nFOOTER1\nFOOTER2\n\nNEXTHEADER1\nNEXTHEADER2\n\n1 \ - |NEXTBODY1\n2 |NEXTBODY2\n\nNEXTFOOTER1\nNEXTFOOTER2\n", + "\n HEADER1\n HEADER2\n\n1 |BODY1\n2 \ + |BODY2\n\n FOOTER1\n FOOTER2\n\n NEXTHEADER1\n NEXTHEADER2\n\n1 \ + |NEXTBODY1\n2 |NEXTBODY2\n\n NEXTFOOTER1\n NEXTFOOTER2\n", ), ( "joinblanklines.txt", - "1 |Nonempty\n2 |Nonempty\n3 |Followed by 10x empty\n\n\n\n\n4 \ - |\n\n\n\n\n5 |\n6 |Followed by 5x empty\n\n\n\n\n7 |\n8 \ - |Followed by 4x empty\n\n\n\n\n9 |Nonempty\n10 |Nonempty\n11 \ + "1 |Nonempty\n2 |Nonempty\n3 |Followed by 10x empty\n \n \n \n \n4 \ + |\n \n \n \n \n5 |\n6 |Followed by 5x empty\n \n \n \n \n7 |\n8 \ + |Followed by 4x empty\n \n \n \n \n9 |Nonempty\n10 |Nonempty\n11 \ |Nonempty.\n", ), ] { @@ -257,6 +257,25 @@ fn test_invalid_line_increment() { } } +#[test] +fn test_join_blank_lines() { + for arg in ["-l3", "--join-blank-lines=3"] { + new_ucmd!() + .arg(arg) + .arg("--body-numbering=a") + .pipe_in("\n\n\n\n\n\n") + .succeeds() + .stdout_is(concat!( + " \n", + " \n", + " 1\t\n", + " \n", + " \n", + " 2\t\n", + )); + } +} + #[test] fn test_join_blank_lines_zero() { for arg in ["-l0", "--join-blank-lines=0"] { @@ -275,3 +294,131 @@ fn test_invalid_join_blank_lines() { .stderr_contains("invalid value 'invalid'"); } } + +#[test] +fn test_default_body_numbering() { + new_ucmd!() + .pipe_in("a\n\nb") + .succeeds() + .stdout_is(" 1\ta\n \n 2\tb\n"); +} + +#[test] +fn test_body_numbering_all_lines_without_delimiter() { + for arg in ["-ba", "--body-numbering=a"] { + new_ucmd!() + .arg(arg) + .pipe_in("a\n\nb") + .succeeds() + .stdout_is(" 1\ta\n 2\t\n 3\tb\n"); + } +} + +#[test] +fn test_body_numbering_no_lines_without_delimiter() { + for arg in ["-bn", "--body-numbering=n"] { + new_ucmd!() + .arg(arg) + .pipe_in("a\n\nb") + .succeeds() + .stdout_is(" a\n \n b\n"); + } +} + +#[test] +fn test_body_numbering_non_empty_lines_without_delimiter() { + for arg in ["-bt", "--body-numbering=t"] { + new_ucmd!() + .arg(arg) + .pipe_in("a\n\nb") + .succeeds() + .stdout_is(" 1\ta\n \n 2\tb\n"); + } +} + +#[test] +fn test_body_numbering_matched_lines_without_delimiter() { + for arg in ["-bp^[ac]", "--body-numbering=p^[ac]"] { + new_ucmd!() + .arg(arg) + .pipe_in("a\nb\nc") + .succeeds() + .stdout_is(" 1\ta\n b\n 2\tc\n"); + } +} + +#[test] +fn test_numbering_all_lines() { + let delimiters_and_args = [ + ("\\:\\:\\:\n", ["-ha", "--header-numbering=a"]), + ("\\:\\:\n", ["-ba", "--body-numbering=a"]), + ("\\:\n", ["-fa", "--footer-numbering=a"]), + ]; + + for (delimiter, args) in delimiters_and_args { + for arg in args { + new_ucmd!() + .arg(arg) + .pipe_in(format!("{delimiter}a\n\nb")) + .succeeds() + .stdout_is("\n 1\ta\n 2\t\n 3\tb\n"); + } + } +} + +#[test] +fn test_numbering_no_lines() { + let delimiters_and_args = [ + ("\\:\\:\\:\n", ["-hn", "--header-numbering=n"]), + ("\\:\\:\n", ["-bn", "--body-numbering=n"]), + ("\\:\n", ["-fn", "--footer-numbering=n"]), + ]; + + for (delimiter, args) in delimiters_and_args { + for arg in args { + new_ucmd!() + .arg(arg) + .pipe_in(format!("{delimiter}a\n\nb")) + .succeeds() + .stdout_is("\n a\n \n b\n"); + } + } +} + +#[test] +fn test_numbering_non_empty_lines() { + let delimiters_and_args = [ + ("\\:\\:\\:\n", ["-ht", "--header-numbering=t"]), + ("\\:\\:\n", ["-bt", "--body-numbering=t"]), + ("\\:\n", ["-ft", "--footer-numbering=t"]), + ]; + + for (delimiter, args) in delimiters_and_args { + for arg in args { + new_ucmd!() + .arg(arg) + .pipe_in(format!("{delimiter}a\n\nb")) + .succeeds() + .stdout_is("\n 1\ta\n \n 2\tb\n"); + } + } +} + +#[test] +fn test_numbering_matched_lines() { + let delimiters_and_args = [ + ("\\:\\:\\:\n", ["-hp^[ac]", "--header-numbering=p^[ac]"]), + ("\\:\\:\n", ["-bp^[ac]", "--body-numbering=p^[ac]"]), + ("\\:\n", ["-fp^[ac]", "--footer-numbering=p^[ac]"]), + ]; + + for (delimiter, args) in delimiters_and_args { + for arg in args { + new_ucmd!() + .arg(arg) + .pipe_in(format!("{delimiter}a\nb\nc")) + .succeeds() + .stdout_is("\n 1\ta\n b\n 2\tc\n"); + } + } +} From 745110ccbf17c196254eea0e8ce28d2e81e568cd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 6 Aug 2023 01:03:34 +0000 Subject: [PATCH 233/253] chore(deps): update rust crate regex to 1.9.3 --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d316d0ff..433c1becf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1778,9 +1778,9 @@ checksum = "f1bfbf25d7eb88ddcbb1ec3d755d0634da8f7657b2cb8b74089121409ab8228f" [[package]] name = "regex" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ "aho-corasick 1.0.1", "memchr", @@ -1790,9 +1790,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.1" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9aaecc05d5c4b5f7da074b9a0d1a0867e71fd36e7fc0482d8bcfe8e8fc56290" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ "aho-corasick 1.0.1", "memchr", @@ -1801,9 +1801,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "relative-path" diff --git a/Cargo.toml b/Cargo.toml index accc027ab..2d03e1f05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -310,7 +310,7 @@ rand = { version = "0.8", features = ["small_rng"] } rand_core = "0.6" rayon = "1.7" redox_syscall = "0.3" -regex = "1.9.1" +regex = "1.9.3" rstest = "0.18.1" rust-ini = "0.19.0" same-file = "1.0.6" From 0f5b6e897859eb2e0f6f20ea5c63c29ad35d9e26 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 6 Aug 2023 15:10:10 +0200 Subject: [PATCH 234/253] deny.toml: add bitflags to skip list --- deny.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deny.toml b/deny.toml index 84dae2b98..e101c89fd 100644 --- a/deny.toml +++ b/deny.toml @@ -86,6 +86,8 @@ skip = [ { name = "aho-corasick", version = "0.7.19" }, # various crates { name = "syn", version = "1.0.109" }, + # various crates + { name = "bitflags", version = "1.3.2" }, ] # spell-checker: enable From f03f18c3e865b05cbc37331808444442b3df8b66 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 6 Aug 2023 16:10:01 +0200 Subject: [PATCH 235/253] Bump filetime from 0.2.20 to 0.2.22 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 433c1becf..829f875b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -841,14 +841,14 @@ checksum = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" [[package]] name = "filetime" -version = "0.2.20" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", - "windows-sys 0.45.0", + "redox_syscall 0.3.5", + "windows-sys 0.48.0", ] [[package]] From d9921e48cafadda9ed7df770941c265a28682d4a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 6 Aug 2023 16:12:32 +0200 Subject: [PATCH 236/253] Bump parking_lot_core from 0.9.7 to 0.9.8 --- Cargo.lock | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 829f875b7..82bf12892 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -847,7 +847,7 @@ checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "windows-sys 0.48.0", ] @@ -1522,15 +1522,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.0", ] [[package]] @@ -1752,15 +1752,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -2130,7 +2121,7 @@ dependencies = [ "autocfg", "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall", "rustix 0.37.19", "windows-sys 0.48.0", ] @@ -3106,7 +3097,7 @@ version = "0.0.20" dependencies = [ "clap", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "uucore", ] From 5c3fb3c53b250ba5a88f4dc161e12ec971de78a6 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 6 Aug 2023 16:15:00 +0200 Subject: [PATCH 237/253] deny.toml: remove redox_syscall from skip list --- deny.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/deny.toml b/deny.toml index 84dae2b98..2db037826 100644 --- a/deny.toml +++ b/deny.toml @@ -80,8 +80,6 @@ skip = [ { name = "windows_x86_64_gnullvm", version = "0.42.2" }, # windows-targets { name = "windows_x86_64_msvc", version = "0.42.2" }, - # tempfile - { name = "redox_syscall", version = "0.3.5" }, # cpp_macros { name = "aho-corasick", version = "0.7.19" }, # various crates From a4f5145445b8452c3969716875ee642e86ad4ce9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 05:03:04 +0000 Subject: [PATCH 238/253] chore(deps): update rust crate crossterm to >=0.27.0 --- Cargo.lock | 42 ++++++++++++++++++++++++------------------ Cargo.toml | 2 +- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 82bf12892..68f28a1c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -135,7 +135,7 @@ version = "0.63.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -157,6 +157,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "blake2b_simd" version = "1.0.1" @@ -281,7 +287,7 @@ checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" dependencies = [ "anstream", "anstyle", - "bitflags", + "bitflags 1.3.2", "clap_lex", "once_cell", "strsim", @@ -644,11 +650,11 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.26.1" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" +checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags", + "bitflags 2.3.3", "crossterm_winapi", "libc", "mio", @@ -660,9 +666,9 @@ dependencies = [ [[package]] name = "crossterm_winapi" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ "winapi", ] @@ -818,7 +824,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cfeb22a59deb24c3262c43ffcafd1eb807180f371f9fcc99098d181b5d639be" dependencies = [ - "bitflags", + "bitflags 1.3.2", "log", "scopeguard", "uuid", @@ -1120,7 +1126,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" dependencies = [ - "bitflags", + "bitflags 1.3.2", "inotify-sys", "libc", ] @@ -1215,7 +1221,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", ] @@ -1365,7 +1371,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "static_assertions", @@ -1387,7 +1393,7 @@ version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5738a2795d57ea20abec2d6d76c6081186709c0024187cd5977265eda6598b51" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crossbeam-channel", "filetime", "fsevent-sys", @@ -1475,7 +1481,7 @@ version = "6.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "once_cell", "onig_sys", @@ -1658,7 +1664,7 @@ version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "943ca7f9f29bab5844ecd8fdb3992c5969b6622bb9609b9502fef9b4310e3f1f" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "hex", "lazy_static", @@ -1758,7 +1764,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1877,7 +1883,7 @@ version = "0.36.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -1891,7 +1897,7 @@ version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -1926,7 +1932,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a00576725d21b588213fbd4af84cd7e4cc4304e8e9bd6c0f5a1498a3e2ca6a51" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "once_cell", "reference-counted-singleton", diff --git a/Cargo.toml b/Cargo.toml index 2d03e1f05..2cefec1ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -272,7 +272,7 @@ clap_complete = "4.3" clap_mangen = "0.2" compare = "0.1.0" coz = { version = "0.1.3" } -crossterm = ">=0.26.1" +crossterm = ">=0.27.0" ctrlc = { version = "3.4", features = ["termination"] } exacl = "0.10.0" file_diff = "1.0.0" From 0aa29682d0e079e4e92b6b9eb75413ab30522237 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 7 Aug 2023 00:09:14 -0700 Subject: [PATCH 239/253] seq: display -0 --- src/uu/seq/src/extendedbigint.rs | 12 ++---------- src/uu/seq/src/seq.rs | 9 +++------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/uu/seq/src/extendedbigint.rs b/src/uu/seq/src/extendedbigint.rs index bbe64300a..46153bb7d 100644 --- a/src/uu/seq/src/extendedbigint.rs +++ b/src/uu/seq/src/extendedbigint.rs @@ -65,11 +65,7 @@ impl Display for ExtendedBigInt { Self::BigInt(n) => n.fmt(f), Self::Infinity => f32::INFINITY.fmt(f), Self::MinusInfinity => f32::NEG_INFINITY.fmt(f), - Self::MinusZero => { - // FIXME Come up with a way of formatting this with a - // "-" prefix. - 0.fmt(f) - } + Self::MinusZero => "-0".fmt(f), Self::Nan => "nan".fmt(f), } } @@ -206,13 +202,9 @@ mod tests { #[test] fn test_display() { assert_eq!(format!("{}", ExtendedBigInt::BigInt(BigInt::zero())), "0"); + assert_eq!(format!("{}", ExtendedBigInt::MinusZero), "-0"); assert_eq!(format!("{}", ExtendedBigInt::Infinity), "inf"); assert_eq!(format!("{}", ExtendedBigInt::MinusInfinity), "-inf"); assert_eq!(format!("{}", ExtendedBigInt::Nan), "nan"); - // FIXME Come up with a way of displaying negative zero as - // "-0". Currently it displays as just "0". - // - // assert_eq!(format!("{}", ExtendedBigInt::MinusZero), "-0"); - // } } diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 2e55efa4a..de883fe8a 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -223,16 +223,13 @@ fn write_value_int( value: &ExtendedBigInt, width: usize, pad: bool, - is_first_iteration: bool, ) -> std::io::Result<()> { let value_as_str = if pad { - if *value == ExtendedBigInt::MinusZero && is_first_iteration { - format!("-{value:>0width$}", width = width - 1) + if *value == ExtendedBigInt::MinusZero { + format!("{value:00width$}") } - } else if *value == ExtendedBigInt::MinusZero && is_first_iteration { - format!("-{value}") } else { format!("{value}") }; @@ -347,7 +344,7 @@ fn print_seq_integers( exit(1); } } - None => write_value_int(&mut stdout, &value, padding, pad, is_first_iteration)?, + None => write_value_int(&mut stdout, &value, padding, pad)?, } // TODO Implement augmenting addition. value = value + increment.clone(); From 6b1c4d1fa9c4663ec6f33cb59e2e3f6a8d77abf6 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 7 Aug 2023 15:22:06 +0200 Subject: [PATCH 240/253] seq: remove unused param from write_value_float() --- src/uu/seq/src/seq.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index de883fe8a..dec66a7b1 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -206,7 +206,6 @@ fn write_value_float( value: &ExtendedBigDecimal, width: usize, precision: usize, - _is_first_iteration: bool, ) -> std::io::Result<()> { let value_as_str = if *value == ExtendedBigDecimal::Infinity || *value == ExtendedBigDecimal::MinusInfinity { @@ -279,13 +278,7 @@ fn print_seq( exit(1); } } - None => write_value_float( - &mut stdout, - &value, - padding, - largest_dec, - is_first_iteration, - )?, + None => write_value_float(&mut stdout, &value, padding, largest_dec)?, } // TODO Implement augmenting addition. value = value + increment.clone(); From 5b33670f96a50ebcdf39d5255d433109651c37f5 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 8 Aug 2023 09:05:53 +0200 Subject: [PATCH 241/253] Bump fundu from 1.2.0 to 2.0.0 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68f28a1c7..6c5f8d556 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -900,18 +900,18 @@ dependencies = [ [[package]] name = "fundu" -version = "1.2.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34804ed59f10b3a630c79822ebf7370b562b7281028369e9baa40547c17f8bdc" +checksum = "6c04cb831a8dccadfe3774b07cba4574a1ec24974d761510e65d8a543c2d7cb4" dependencies = [ "fundu-core", ] [[package]] name = "fundu-core" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71a99190954ca83bade03ba054799b17a158ea948a6855c6bb8121adb6b49d9f" +checksum = "76a889e633afd839fb5b04fe53adfd588cefe518e71ec8d3c929698c6daf2acd" [[package]] name = "futures" diff --git a/Cargo.toml b/Cargo.toml index 2cefec1ea..365b160dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -280,7 +280,7 @@ filetime = "0.2" fnv = "1.0.7" fs_extra = "1.3.0" fts-sys = "0.2" -fundu = "1.2.0" +fundu = "2.0.0" gcd = "2.3" glob = "0.3.1" half = "2.2" From cef9ab10c38c036994275009636a78c95f483c13 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 8 Aug 2023 09:10:33 +0200 Subject: [PATCH 242/253] sleep: adapt two tests to fundu 2.0.0 --- tests/by-util/test_sleep.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_sleep.rs b/tests/by-util/test_sleep.rs index 13aa882b9..76e98e012 100644 --- a/tests/by-util/test_sleep.rs +++ b/tests/by-util/test_sleep.rs @@ -10,7 +10,7 @@ fn test_invalid_time_interval() { new_ucmd!() .arg("xyz") .fails() - .usage_error("invalid time interval 'xyz': Invalid input: 'xyz' at position 1"); + .usage_error("invalid time interval 'xyz': Invalid input: xyz"); new_ucmd!() .args(&["--", "-1"]) .fails() @@ -211,7 +211,7 @@ fn test_sleep_when_input_has_only_whitespace_then_error(#[case] input: &str) { #[test] fn test_sleep_when_multiple_input_some_with_error_then_shows_all_errors() { - let expected = "invalid time interval 'abc': Invalid input: 'abc' at position 1\n\ + let expected = "invalid time interval 'abc': Invalid input: abc\n\ sleep: invalid time interval '1years': Invalid time unit: 'years' at position 2\n\ sleep: invalid time interval ' ': Found only whitespace in input"; From 256b6bbb23b4145d4fc896d7958027254090c832 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 9 Aug 2023 07:36:03 +0200 Subject: [PATCH 243/253] Bump aho-corasick crates From 0.7.19 to 0.7.20 and from 1.0.1 to 1.0.2 --- Cargo.lock | 14 +++++++------- deny.toml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c5f8d556..e27a6f894 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,18 +10,18 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -578,7 +578,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fdaa01904c12a8989dbfa110b41ef27efc432ac9934f691b9732f01cb64dc01" dependencies = [ - "aho-corasick 0.7.19", + "aho-corasick 0.7.20", "byteorder", "cpp_common", "lazy_static", @@ -1779,7 +1779,7 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick 1.0.2", "memchr", "regex-automata", "regex-syntax", @@ -1791,7 +1791,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick 1.0.2", "memchr", "regex-syntax", ] diff --git a/deny.toml b/deny.toml index 215b65529..6703a6a07 100644 --- a/deny.toml +++ b/deny.toml @@ -81,7 +81,7 @@ skip = [ # windows-targets { name = "windows_x86_64_msvc", version = "0.42.2" }, # cpp_macros - { name = "aho-corasick", version = "0.7.19" }, + { name = "aho-corasick", version = "0.7.20" }, # various crates { name = "syn", version = "1.0.109" }, # various crates From 492c9a459127625b72920b57575a590df7dd6037 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 9 Aug 2023 07:47:30 +0200 Subject: [PATCH 244/253] Bump rustix crates From 0.36.14 to 0.36.15 and from 0.37.19 to 0.37.23 --- Cargo.lock | 16 ++++++++-------- deny.toml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c5f8d556..d956dd697 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1168,7 +1168,7 @@ checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi", "io-lifetimes", - "rustix 0.37.19", + "rustix 0.37.23", "windows-sys 0.48.0", ] @@ -1668,7 +1668,7 @@ dependencies = [ "byteorder", "hex", "lazy_static", - "rustix 0.36.14", + "rustix 0.36.15", ] [[package]] @@ -1879,9 +1879,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.14" +version = "0.36.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" +checksum = "c37f1bd5ef1b5422177b7646cba67430579cfe2ace80f284fee876bca52ad941" dependencies = [ "bitflags 1.3.2", "errno", @@ -1893,9 +1893,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ "bitflags 1.3.2", "errno", @@ -2128,7 +2128,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall", - "rustix 0.37.19", + "rustix 0.37.23", "windows-sys 0.48.0", ] @@ -2147,7 +2147,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ - "rustix 0.37.19", + "rustix 0.37.23", "windows-sys 0.48.0", ] diff --git a/deny.toml b/deny.toml index 215b65529..75ea567bc 100644 --- a/deny.toml +++ b/deny.toml @@ -59,7 +59,7 @@ highlight = "all" # spell-checker: disable skip = [ # procfs - { name = "rustix", version = "0.36.14" }, + { name = "rustix", version = "0.36.15" }, # rustix { name = "linux-raw-sys", version = "0.1.4" }, # various crates From 09360e6796d1f4c757c9beb53166b2e8b8940b9a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 9 Aug 2023 16:15:30 +0200 Subject: [PATCH 245/253] mv: remove unnecessary OR in condition --- src/uu/mv/src/mv.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 79245a427..03d3881b1 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -433,9 +433,7 @@ fn rename( let mut backup_path = None; if to.exists() { - if (b.update == UpdateMode::ReplaceIfOlder || b.update == UpdateMode::ReplaceNone) - && b.overwrite == OverwriteMode::Interactive - { + if b.update == UpdateMode::ReplaceIfOlder && b.overwrite == OverwriteMode::Interactive { // `mv -i --update old new` when `new` exists doesn't move anything // and exit with 0 return Ok(()); From e3ea6144cbb11376a4cf84862af200176d281456 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Thu, 10 Aug 2023 08:33:53 +0530 Subject: [PATCH 246/253] stat: Output error when - and -f are used together. --- src/uu/stat/src/stat.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 69f3c2760..9ffa064b8 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -614,6 +614,10 @@ impl Stater { fn do_stat(&self, file: &OsStr, stdin_is_fifo: bool) -> i32 { let display_name = file.to_string_lossy(); let file = if cfg!(unix) && display_name == "-" { + if self.show_fs { + show_error!("using '-' to denote standard input does not work in file system mode"); + return 1; + } if let Ok(p) = Path::new("/dev/stdin").canonicalize() { p.into_os_string() } else { @@ -622,7 +626,6 @@ impl Stater { } else { OsString::from(file) }; - if self.show_fs { #[cfg(unix)] let p = file.as_bytes(); From 414385926653fc14d1f692e638059b36b5c566ae Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Thu, 10 Aug 2023 08:41:19 +0530 Subject: [PATCH 247/253] tests/stat: Test case for using - and -f together --- tests/by-util/test_stat.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 92a8bcd98..d932b35d6 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -304,6 +304,19 @@ fn test_stdin_pipe_fifo2() { .succeeded(); } +#[test] +#[cfg(all(unix, not(target_os = "android")))] +fn test_stdin_with_fs_option() { + // $ stat -f - + new_ucmd!() + .arg("-f") + .arg("-") + .set_stdin(std::process::Stdio::null()) + .fails() + .code_is(1) + .stderr_contains("using '-' to denote standard input does not work in file system mode"); +} + #[test] #[cfg(all( unix, From 122c8c5b80abec7815240c20c54b9d4d9c4de3a3 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 10 Aug 2023 10:38:15 +0200 Subject: [PATCH 248/253] Bump futures from 0.3.25 to 0.3.28 --- Cargo.lock | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d6f09b6cb..878fa09f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -915,9 +915,9 @@ checksum = "76a889e633afd839fb5b04fe53adfd588cefe518e71ec8d3c929698c6daf2acd" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -930,9 +930,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -940,15 +940,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -957,32 +957,32 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.23", ] [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-timer" @@ -992,9 +992,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", From 677df5cb1a1b0ac241ba6d707fa0da18521264a7 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 10 Aug 2023 10:50:49 +0200 Subject: [PATCH 249/253] Bump cpp from 0.5.7 to 0.5.8 --- Cargo.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d6f09b6cb..1b40f6a5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -539,44 +539,44 @@ dependencies = [ [[package]] name = "cpp" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec5e86d4f6547f0218ad923d9508244a71ef83b763196e6698b4f70f3595185" +checksum = "43b6a1d47f376a62bbea281408fe331879b9822c1edb8f67320c7cb8d96a02eb" dependencies = [ "cpp_macros", ] [[package]] name = "cpp_build" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f4d303b8ec35fb3afd7e963e2c898117f1e49930becb703e4a7ac528ad2dd0" +checksum = "5b8f839b67a3deba30b58b281b5fca61477a90830beb084c58bdb9bebd227a1a" dependencies = [ "cc", "cpp_common", "lazy_static", "proc-macro2", "regex", - "syn 1.0.109", + "syn 2.0.23", "unicode-xid", ] [[package]] name = "cpp_common" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76071bb9c8c4dd2b5eb209907deab7b031323cf1be3dfdc6ec5d37f4f187d8a1" +checksum = "42d2b968b7b2ac412836e8ce1dfc3dfd5648ae7e8a42fcbbf5bc1d33bb795b0d" dependencies = [ "lazy_static", "proc-macro2", - "syn 1.0.109", + "syn 2.0.23", ] [[package]] name = "cpp_macros" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdaa01904c12a8989dbfa110b41ef27efc432ac9934f691b9732f01cb64dc01" +checksum = "5d36d9acb58020380e756d56a8dfc84d0f6ace423bbd4fedf83992b257b7f147" dependencies = [ "aho-corasick 0.7.20", "byteorder", @@ -584,7 +584,7 @@ dependencies = [ "lazy_static", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.23", ] [[package]] From bdd25c37cfdf5a0c513e4dbfd6f5f5d59f742b7f Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 10 Aug 2023 15:27:20 +0200 Subject: [PATCH 250/253] rm: split prompt_file() into two functions --- src/uu/rm/src/rm.rs | 93 ++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index f2e2050d9..dde1e8595 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -370,7 +370,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool { } fn remove_dir(path: &Path, options: &Options) -> bool { - if prompt_file(path, options, true) { + if prompt_dir(path, options) { if let Ok(mut read_dir) = fs::read_dir(path) { if options.dir || options.recursive { if read_dir.next().is_none() { @@ -415,7 +415,7 @@ fn remove_dir(path: &Path, options: &Options) -> bool { } fn remove_file(path: &Path, options: &Options) -> bool { - if prompt_file(path, options, false) { + if prompt_file(path, options) { match fs::remove_file(path) { Ok(_) => { if options.verbose { @@ -437,8 +437,23 @@ fn remove_file(path: &Path, options: &Options) -> bool { false } +fn prompt_dir(path: &Path, options: &Options) -> bool { + // If interactive is Never we never want to send prompts + if options.interactive == InteractiveMode::Never { + return true; + } + + // We can't use metadata.permissions.readonly for directories because it only works on files + // So we have to handle whether a directory is writable manually + if let Ok(metadata) = fs::metadata(path) { + handle_writable_directory(path, options, &metadata) + } else { + true + } +} + #[allow(clippy::cognitive_complexity)] -fn prompt_file(path: &Path, options: &Options, is_dir: bool) -> bool { +fn prompt_file(path: &Path, options: &Options) -> bool { // If interactive is Never we never want to send prompts if options.interactive == InteractiveMode::Never { return true; @@ -451,58 +466,48 @@ fn prompt_file(path: &Path, options: &Options, is_dir: bool) -> bool { } } } - if is_dir { - // We can't use metadata.permissions.readonly for directories because it only works on files - // So we have to handle whether a directory is writable on not manually - if let Ok(metadata) = fs::metadata(path) { - handle_writable_directory(path, options, &metadata) - } else { - true - } - } else { - // File::open(path) doesn't open the file in write mode so we need to use file options to open it in also write mode to check if it can written too - match File::options().read(true).write(true).open(path) { - Ok(file) => { - if let Ok(metadata) = file.metadata() { - if metadata.permissions().readonly() { - if metadata.len() == 0 { - prompt_yes!( - "remove write-protected regular empty file {}?", - path.quote() - ) - } else { - prompt_yes!("remove write-protected regular file {}?", path.quote()) - } - } else if options.interactive == InteractiveMode::Always { - if metadata.len() == 0 { - prompt_yes!("remove regular empty file {}?", path.quote()) - } else { - prompt_yes!("remove file {}?", path.quote()) - } + // File::open(path) doesn't open the file in write mode so we need to use file options to open it in also write mode to check if it can written too + match File::options().read(true).write(true).open(path) { + Ok(file) => { + if let Ok(metadata) = file.metadata() { + if metadata.permissions().readonly() { + if metadata.len() == 0 { + prompt_yes!( + "remove write-protected regular empty file {}?", + path.quote() + ) } else { - true + prompt_yes!("remove write-protected regular file {}?", path.quote()) + } + } else if options.interactive == InteractiveMode::Always { + if metadata.len() == 0 { + prompt_yes!("remove regular empty file {}?", path.quote()) + } else { + prompt_yes!("remove file {}?", path.quote()) } } else { true } + } else { + true } - Err(err) => { - if err.kind() == ErrorKind::PermissionDenied { - if let Ok(metadata) = fs::metadata(path) { - if metadata.len() == 0 { - prompt_yes!( - "remove write-protected regular empty file {}?", - path.quote() - ) - } else { - prompt_yes!("remove write-protected regular file {}?", path.quote()) - } + } + Err(err) => { + if err.kind() == ErrorKind::PermissionDenied { + if let Ok(metadata) = fs::metadata(path) { + if metadata.len() == 0 { + prompt_yes!( + "remove write-protected regular empty file {}?", + path.quote() + ) } else { prompt_yes!("remove write-protected regular file {}?", path.quote()) } } else { - true + prompt_yes!("remove write-protected regular file {}?", path.quote()) } + } else { + true } } } From 113972aa44482b4636fc4c259425a4211aaf3da2 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 10 Aug 2023 15:38:59 +0200 Subject: [PATCH 251/253] rm: replace "if" with "match" in prompt_file() --- src/uu/rm/src/rm.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index dde1e8595..fb4a2149e 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -494,17 +494,14 @@ fn prompt_file(path: &Path, options: &Options) -> bool { } Err(err) => { if err.kind() == ErrorKind::PermissionDenied { - if let Ok(metadata) = fs::metadata(path) { - if metadata.len() == 0 { + match fs::metadata(path) { + Ok(metadata) if metadata.len() == 0 => { prompt_yes!( "remove write-protected regular empty file {}?", path.quote() ) - } else { - prompt_yes!("remove write-protected regular file {}?", path.quote()) } - } else { - prompt_yes!("remove write-protected regular file {}?", path.quote()) + _ => prompt_yes!("remove write-protected regular file {}?", path.quote()), } } else { true From 7c58ec081dd31485639fa72ff1ed713dac35b651 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 10 Aug 2023 23:29:25 +0200 Subject: [PATCH 252/253] chore(deps): update clap, tempfile & is_terminal (all are rustix-based) --- Cargo.lock | 58 +++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db5604f7f..161949e8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,22 +272,21 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.0" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.3.0" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" dependencies = [ "anstream", "anstyle", - "bitflags 1.3.2", "clap_lex", "once_cell", "strsim", @@ -832,12 +831,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.8.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "file_diff" @@ -1140,15 +1136,6 @@ dependencies = [ "libc", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - [[package]] name = "io-lifetimes" version = "1.0.11" @@ -1162,13 +1149,12 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "io-lifetimes", - "rustix 0.37.23", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -1271,6 +1257,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + [[package]] name = "lock_api" version = "0.4.9" @@ -1905,6 +1897,19 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustix" +version = "0.38.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.5", + "windows-sys 0.48.0", +] + [[package]] name = "same-file" version = "1.0.6" @@ -2120,15 +2125,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ - "autocfg", "cfg-if", "fastrand", "redox_syscall", - "rustix 0.37.23", + "rustix 0.38.8", "windows-sys 0.48.0", ] From a4e8be445652be5d79dcfb3bc485b3bbf8a39299 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 10 Aug 2023 23:29:43 +0200 Subject: [PATCH 253/253] chore(deps): update deny.toml --- deny.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deny.toml b/deny.toml index 0df03fb2d..f587f0720 100644 --- a/deny.toml +++ b/deny.toml @@ -62,6 +62,9 @@ skip = [ { name = "rustix", version = "0.36.15" }, # rustix { name = "linux-raw-sys", version = "0.1.4" }, + { name = "linux-raw-sys", version = "0.3.8" }, + # tempfile + { name = "rustix", version = "0.37.23" }, # various crates { name = "windows-sys", version = "0.45.0" }, # windows-sys