diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 78b1faa55..fe72de110 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -326,7 +326,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@v11 + - uses: DavidAnson/markdownlint-cli2-action@v12 with: command: fix globs: | diff --git a/.github/workflows/GnuTests.yml b/.github/workflows/GnuTests.yml index eb3e22a80..ccb5a6f74 100644 --- a/.github/workflows/GnuTests.yml +++ b/.github/workflows/GnuTests.yml @@ -42,7 +42,7 @@ jobs: outputs path_GNU path_GNU_tests path_reference path_UUTILS # repo_default_branch="${{ github.event.repository.default_branch }}" - repo_GNU_ref="v9.3" + repo_GNU_ref="v9.4" repo_reference_branch="${{ github.event.repository.default_branch }}" outputs repo_default_branch repo_GNU_ref repo_reference_branch # @@ -315,7 +315,7 @@ jobs: with: repository: 'coreutils/coreutils' path: 'gnu' - ref: 'v9.3' + ref: 'v9.4' submodules: recursive - uses: dtolnay/rust-toolchain@master with: diff --git a/.vscode/cspell.dictionaries/shell.wordlist.txt b/.vscode/cspell.dictionaries/shell.wordlist.txt index 16d7b25e9..95dea94a7 100644 --- a/.vscode/cspell.dictionaries/shell.wordlist.txt +++ b/.vscode/cspell.dictionaries/shell.wordlist.txt @@ -83,6 +83,8 @@ codespell commitlint dprint dtrace +flamegraph +flamegraphs gcov gmake grcov @@ -90,6 +92,7 @@ grep markdownlint rerast rollup +samply sed selinuxenabled sestatus diff --git a/Cargo.lock b/Cargo.lock index f25b7c20c..9b1b3ade3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -240,14 +240,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "f56b4c72906975ca04becb8a30e102dfecddd0c06181e3e95ddc444be28881f8" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "winapi", + "windows-targets 0.48.0", ] [[package]] @@ -1399,9 +1399,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -1758,9 +1758,9 @@ checksum = "f1bfbf25d7eb88ddcbb1ec3d755d0634da8f7657b2cb8b74089121409ab8228f" [[package]] name = "regex" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" dependencies = [ "aho-corasick", "memchr", @@ -1770,9 +1770,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" dependencies = [ "aho-corasick", "memchr", @@ -1781,9 +1781,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "relative-path" diff --git a/Cargo.toml b/Cargo.toml index 71c04d355..6b381cccb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -263,7 +263,7 @@ binary-heap-plus = "0.5.0" bstr = "1.6" bytecount = "0.6.3" byteorder = "1.4.3" -chrono = { version = "^0.4.26", default-features = false, features = [ +chrono = { version = "^0.4.27", default-features = false, features = [ "std", "alloc", "clock", @@ -297,7 +297,7 @@ memmap2 = "0.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-bigint = "0.4.4" num-traits = "0.2.16" number_prefix = "0.4" once_cell = "1.18.0" @@ -311,7 +311,7 @@ rand = { version = "0.8", features = ["small_rng"] } rand_core = "0.6" rayon = "1.7" redox_syscall = "0.3" -regex = "1.9.3" +regex = "1.9.4" rstest = "0.18.2" rust-ini = "0.19.0" same-file = "1.0.6" diff --git a/build.rs b/build.rs index d210e2a2e..bb4e2b536 100644 --- a/build.rs +++ b/build.rs @@ -1,3 +1,8 @@ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + // spell-checker:ignore (vars) krate use std::env; diff --git a/oranda.json b/oranda.json index 7c52ddc27..0a6856a88 100644 --- a/oranda.json +++ b/oranda.json @@ -6,7 +6,9 @@ "path_prefix": "coreutils" }, "components": { - "changelog": true + "changelog": { + "read_changelog_file": false + } }, "styles": { "theme": "light", diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index 2ef63fbc0..09250421c 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::io::{stdin, Read}; diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index ba2ef9229..4a30705af 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::io::{stdout, Read, Write}; diff --git a/src/uu/base64/src/base64.rs b/src/uu/base64/src/base64.rs index 4e4a3c293..6544638bd 100644 --- a/src/uu/base64/src/base64.rs +++ b/src/uu/base64/src/base64.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use uu_base32::base_common; pub use uu_base32::uu_app; diff --git a/src/uu/basenc/src/basenc.rs b/src/uu/basenc/src/basenc.rs index 0ee8a816b..ff512b176 100644 --- a/src/uu/basenc/src/basenc.rs +++ b/src/uu/basenc/src/basenc.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //spell-checker:ignore (args) lsbf msbf diff --git a/src/uu/chroot/src/error.rs b/src/uu/chroot/src/error.rs index 43ef98595..526f1a75a 100644 --- a/src/uu/chroot/src/error.rs +++ b/src/uu/chroot/src/error.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore NEWROOT Userspec userspec //! Errors returned by chroot. use std::fmt::Display; diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index 83d48ec1a..6c9c79582 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -1,6 +1,6 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE +// For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (ToDO) fname, algo diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 1bb0020d5..e6977142e 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -30,14 +30,6 @@ mod options { pub const ZERO_TERMINATED: &str = "zero-terminated"; } -fn column_width(col: &str, opts: &ArgMatches) -> usize { - if opts.get_flag(col) { - 0 - } else { - 1 - } -} - enum Input { Stdin(Stdin), FileIn(BufReader), @@ -75,8 +67,8 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &ArgMatches) { delim => delim, }; - let width_col_1 = column_width(options::COLUMN_1, opts); - let width_col_2 = column_width(options::COLUMN_2, opts); + let width_col_1 = usize::from(!opts.get_flag(options::COLUMN_1)); + let width_col_2 = usize::from(!opts.get_flag(options::COLUMN_2)); let delim_col_2 = delim.repeat(width_col_1); let delim_col_3 = delim.repeat(width_col_1 + width_col_2); diff --git a/src/uu/cp/src/copydir.rs b/src/uu/cp/src/copydir.rs index 818b0d222..430548d0c 100644 --- a/src/uu/cp/src/copydir.rs +++ b/src/uu/cp/src/copydir.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore TODO canonicalizes direntry pathbuf symlinked //! Recursively copy the contents of a directory. //! @@ -33,8 +33,8 @@ use crate::{ fn adjust_canonicalization(p: &Path) -> Cow { // In some cases, \\? can be missing on some Windows paths. Add it at the // beginning unless the path is prefixed with a device namespace. - const VERBATIM_PREFIX: &str = r#"\\?"#; - const DEVICE_NS_PREFIX: &str = r#"\\."#; + const VERBATIM_PREFIX: &str = r"\\?"; + const DEVICE_NS_PREFIX: &str = r"\\."; let has_prefix = p .components() diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index ce16357c6..5be613ec6 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1,12 +1,10 @@ -#![allow(clippy::missing_safety_doc)] -#![allow(clippy::extra_unused_lifetimes)] - // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. - +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) copydir ficlone fiemap ftruncate linkgs lstat nlink nlinks pathbuf pwrite reflink strs xattrs symlinked deduplicated advcpmv nushell +#![allow(clippy::missing_safety_doc)] +#![allow(clippy::extra_unused_lifetimes)] use quick_error::quick_error; use std::borrow::Cow; @@ -32,14 +30,16 @@ use libc::mkfifo; use quick_error::ResultExt; use platform::copy_on_write; -use uucore::backup_control::{self, BackupMode}; use uucore::display::Quotable; use uucore::error::{set_exit_code, UClapError, UError, UResult, UUsageError}; use uucore::fs::{ canonicalize, is_symlink_loop, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode, }; -use uucore::update_control::{self, UpdateMode}; +use uucore::{backup_control, update_control}; +// These are exposed for projects (e.g. nushell) that want to create an `Options` value, which +// requires these enum. +pub use uucore::{backup_control::BackupMode, update_control::UpdateMode}; use uucore::{ crash, format_usage, help_about, help_section, help_usage, prompt_yes, show_error, show_warning, util_name, @@ -1135,6 +1135,7 @@ fn preserve_hardlinks( let inode = get_inode(&info); let nlinks = info.number_of_links(); let mut found_hard_link = false; + #[allow(clippy::explicit_iter_loop)] for (link, link_inode) in hard_links.iter() { if *link_inode == inode { // Consider the following files: @@ -1214,7 +1215,7 @@ pub fn copy(sources: &[PathBuf], target: &Path, options: &Options) -> CopyResult None }; - for source in sources.iter() { + for source in sources { if seen_sources.contains(source) { // FIXME: compare sources by the actual file they point to, not their path. (e.g. dir/file == dir/../dir/file in most cases) show_warning!("source {} specified more than once", source.quote()); diff --git a/src/uu/cp/src/platform/linux.rs b/src/uu/cp/src/platform/linux.rs index 18f2520a2..674e66ea5 100644 --- a/src/uu/cp/src/platform/linux.rs +++ b/src/uu/cp/src/platform/linux.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore ficlone reflink ftruncate pwrite fiemap use std::fs::{File, OpenOptions}; use std::io::Read; diff --git a/src/uu/cp/src/platform/macos.rs b/src/uu/cp/src/platform/macos.rs index b173aa959..8c62c78d9 100644 --- a/src/uu/cp/src/platform/macos.rs +++ b/src/uu/cp/src/platform/macos.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore reflink use std::ffi::CString; use std::fs::{self, File}; diff --git a/src/uu/cp/src/platform/mod.rs b/src/uu/cp/src/platform/mod.rs index 9dbcefa80..c79427068 100644 --- a/src/uu/cp/src/platform/mod.rs +++ b/src/uu/cp/src/platform/mod.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. #[cfg(target_os = "macos")] mod macos; #[cfg(target_os = "macos")] diff --git a/src/uu/cp/src/platform/other.rs b/src/uu/cp/src/platform/other.rs index f5882f75e..7ca1a5ded 100644 --- a/src/uu/cp/src/platform/other.rs +++ b/src/uu/cp/src/platform/other.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore reflink use std::fs; use std::path::Path; diff --git a/src/uu/dd/src/blocks.rs b/src/uu/dd/src/blocks.rs index a8d2c1408..8e5557a2c 100644 --- a/src/uu/dd/src/blocks.rs +++ b/src/uu/dd/src/blocks.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore datastructures rstat rposition cflags ctable diff --git a/src/uu/dd/src/numbers.rs b/src/uu/dd/src/numbers.rs index 0cab572b4..2911f7e58 100644 --- a/src/uu/dd/src/numbers.rs +++ b/src/uu/dd/src/numbers.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. /// Functions for formatting a number as a magnitude and a unit suffix. /// The first ten powers of 1024. diff --git a/src/uu/dd/src/parseargs.rs b/src/uu/dd/src/parseargs.rs index bccf98f82..53fae1b4b 100644 --- a/src/uu/dd/src/parseargs.rs +++ b/src/uu/dd/src/parseargs.rs @@ -245,29 +245,29 @@ impl Parser { None => return Err(ParseError::UnrecognizedOperand(operand.to_string())), Some((k, v)) => match k { "bs" => { - let bs = self.parse_bytes(k, v)?; + let bs = Self::parse_bytes(k, v)?; self.ibs = bs; self.obs = bs; } - "cbs" => self.cbs = Some(self.parse_bytes(k, v)?), + "cbs" => self.cbs = Some(Self::parse_bytes(k, v)?), "conv" => self.parse_conv_flags(v)?, - "count" => self.count = Some(self.parse_n(v)?), - "ibs" => self.ibs = self.parse_bytes(k, v)?, + "count" => self.count = Some(Self::parse_n(v)?), + "ibs" => self.ibs = Self::parse_bytes(k, v)?, "if" => self.infile = Some(v.to_string()), "iflag" => self.parse_input_flags(v)?, - "obs" => self.obs = self.parse_bytes(k, v)?, + "obs" => self.obs = Self::parse_bytes(k, v)?, "of" => self.outfile = Some(v.to_string()), "oflag" => self.parse_output_flags(v)?, - "seek" | "oseek" => self.seek = self.parse_n(v)?, - "skip" | "iseek" => self.skip = self.parse_n(v)?, - "status" => self.status = Some(self.parse_status_level(v)?), + "seek" | "oseek" => self.seek = Self::parse_n(v)?, + "skip" | "iseek" => self.skip = Self::parse_n(v)?, + "status" => self.status = Some(Self::parse_status_level(v)?), _ => return Err(ParseError::UnrecognizedOperand(operand.to_string())), }, } Ok(()) } - fn parse_n(&self, val: &str) -> Result { + fn parse_n(val: &str) -> Result { let n = parse_bytes_with_opt_multiplier(val)?; Ok(if val.ends_with('B') { Num::Bytes(n) @@ -276,13 +276,13 @@ impl Parser { }) } - fn parse_bytes(&self, arg: &str, val: &str) -> Result { + fn parse_bytes(arg: &str, val: &str) -> Result { parse_bytes_with_opt_multiplier(val)? .try_into() .map_err(|_| ParseError::BsOutOfRange(arg.to_string())) } - fn parse_status_level(&self, val: &str) -> Result { + fn parse_status_level(val: &str) -> Result { match val { "none" => Ok(StatusLevel::None), "noxfer" => Ok(StatusLevel::Noxfer), diff --git a/src/uu/dd/src/progress.rs b/src/uu/dd/src/progress.rs index a9d29ff63..4fe04cb0e 100644 --- a/src/uu/dd/src/progress.rs +++ b/src/uu/dd/src/progress.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore btotal sigval //! Read and write progress tracking for dd. //! diff --git a/src/uu/df/src/blocks.rs b/src/uu/df/src/blocks.rs index f48d2ffd2..9bc16b782 100644 --- a/src/uu/df/src/blocks.rs +++ b/src/uu/df/src/blocks.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Types for representing and displaying block sizes. use crate::{OPT_BLOCKSIZE, OPT_PORTABILITY}; use clap::ArgMatches; diff --git a/src/uu/df/src/columns.rs b/src/uu/df/src/columns.rs index f9515d791..0659d7f7d 100644 --- a/src/uu/df/src/columns.rs +++ b/src/uu/df/src/columns.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore itotal iused iavail ipcent pcent squashfs use crate::{OPT_INODES, OPT_OUTPUT, OPT_PRINT_TYPE}; use clap::{parser::ValueSource, ArgMatches}; diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 9a3eeac65..78325f3d2 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore itotal iused iavail ipcent pcent tmpfs squashfs lofs mod blocks; mod columns; diff --git a/src/uu/df/src/filesystem.rs b/src/uu/df/src/filesystem.rs index d50822e7f..ef5107958 100644 --- a/src/uu/df/src/filesystem.rs +++ b/src/uu/df/src/filesystem.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Provides a summary representation of a filesystem. //! //! A [`Filesystem`] struct represents a device containing a diff --git a/src/uu/df/src/table.rs b/src/uu/df/src/table.rs index 06bfc3383..4c3d08f45 100644 --- a/src/uu/df/src/table.rs +++ b/src/uu/df/src/table.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore tmpfs Pcent Itotal Iused Iavail Ipcent //! The filesystem usage data table. //! diff --git a/src/uu/dir/src/dir.rs b/src/uu/dir/src/dir.rs index 6caf7bbe8..e25529511 100644 --- a/src/uu/dir/src/dir.rs +++ b/src/uu/dir/src/dir.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) gmnsii -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::Command; use std::ffi::OsString; diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 14bda4967..5be2a8a2b 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Derek Chiang -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use chrono::prelude::DateTime; use chrono::Local; diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index fb73ce4b5..9294d1a8f 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -1,6 +1,5 @@ // This file is part of the uutils coreutils package. // -// // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index 97cfa32f3..ea559090c 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -1,9 +1,7 @@ -//* This file is part of the uutils coreutils package. -//* -//* (c) Roman Gafiyatullin -//* -//* For the full copyright and license information, please view the LICENSE -//* file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::{crate_version, Arg, ArgAction, Command}; use uucore::{ diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index 1d2ddbced..0e0795bd4 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -1,9 +1,7 @@ -//* This file is part of the uutils coreutils package. -//* -//* (c) Roman Gafiyatullin -//* -//* For the full copyright and license information, please view the LICENSE -//* file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! //! Here we employ shunting-yard algorithm for building AST from tokens according to operators' precedence and associative-ness. diff --git a/src/uu/expr/src/tokens.rs b/src/uu/expr/src/tokens.rs index 21220d7dc..b4e4c7da5 100644 --- a/src/uu/expr/src/tokens.rs +++ b/src/uu/expr/src/tokens.rs @@ -1,9 +1,7 @@ -//* This file is part of the uutils coreutils package. -//* -//* (c) Roman Gafiyatullin -//* -//* For the full copyright and license information, please view the LICENSE -//* file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! //! The following tokens are present in the expr grammar: diff --git a/src/uu/factor/build.rs b/src/uu/factor/build.rs index bdd132094..8de0605a2 100644 --- a/src/uu/factor/build.rs +++ b/src/uu/factor/build.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) kwantam -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Generate a table of the multiplicative inverses of p_i mod 2^64 //! for the first 1027 odd primes (all 13 bit and smaller primes). @@ -92,8 +90,6 @@ const MAX_WIDTH: usize = 102; const PREAMBLE: &str = r##"/* * This file is part of the uutils coreutils package. * -* (c) kwantam -* * For the full copyright and license information, please view the LICENSE file * that was distributed with this source code. */ diff --git a/src/uu/factor/sieve.rs b/src/uu/factor/sieve.rs index 2c637fad1..e2211ce05 100644 --- a/src/uu/factor/sieve.rs +++ b/src/uu/factor/sieve.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) kwantam -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) filts, minidx, minkey paridx diff --git a/src/uu/factor/src/cli.rs b/src/uu/factor/src/cli.rs index 714b38e5e..bfc4ede15 100644 --- a/src/uu/factor/src/cli.rs +++ b/src/uu/factor/src/cli.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2014 T. Jameson Little -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::error::Error; use std::fmt::Write as FmtWrite; diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index a87f4219e..a7e848bb8 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use smallvec::SmallVec; use std::cell::RefCell; @@ -98,7 +96,7 @@ impl fmt::Display for Factors { v.sort_unstable(); let include_exponents = f.alternate(); - for (p, exp) in v.iter() { + for (p, exp) in v { if include_exponents && *exp > 1 { write!(f, " {p}^{exp}")?; } else { @@ -294,6 +292,7 @@ impl std::ops::BitXor for Factors { fn bitxor(self, rhs: Exponent) -> Self { debug_assert_ne!(rhs, 0); let mut r = Self::one(); + #[allow(clippy::explicit_iter_loop)] for (p, e) in self.0.borrow().0.iter() { r.add(*p, rhs * e); } diff --git a/src/uu/factor/src/miller_rabin.rs b/src/uu/factor/src/miller_rabin.rs index de2f8a924..a06b20cd3 100644 --- a/src/uu/factor/src/miller_rabin.rs +++ b/src/uu/factor/src/miller_rabin.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (URL) appspot @@ -63,7 +61,7 @@ pub(crate) fn test(m: A) -> Result { let one = m.one(); let minus_one = m.minus_one(); - 'witness: for _a in A::BASIS.iter() { + 'witness: for _a in A::BASIS { let _a = _a % n; if _a == 0 { continue; diff --git a/src/uu/factor/src/numeric/gcd.rs b/src/uu/factor/src/numeric/gcd.rs index 05eb20cb0..43c6ce9b7 100644 --- a/src/uu/factor/src/numeric/gcd.rs +++ b/src/uu/factor/src/numeric/gcd.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2015 Wiktor Kuropatwa -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (vars) kgcdab gcdac gcdbc diff --git a/src/uu/factor/src/numeric/mod.rs b/src/uu/factor/src/numeric/mod.rs index d086027b8..d4c0b5dc7 100644 --- a/src/uu/factor/src/numeric/mod.rs +++ b/src/uu/factor/src/numeric/mod.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. mod gcd; pub use gcd::gcd; diff --git a/src/uu/factor/src/numeric/modular_inverse.rs b/src/uu/factor/src/numeric/modular_inverse.rs index 992253a43..bacf57d9c 100644 --- a/src/uu/factor/src/numeric/modular_inverse.rs +++ b/src/uu/factor/src/numeric/modular_inverse.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2015 Wiktor Kuropatwa -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use super::traits::Int; diff --git a/src/uu/factor/src/numeric/montgomery.rs b/src/uu/factor/src/numeric/montgomery.rs index d411d0d41..10c6dd2d9 100644 --- a/src/uu/factor/src/numeric/montgomery.rs +++ b/src/uu/factor/src/numeric/montgomery.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2020 Alex Lyon -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use super::*; diff --git a/src/uu/factor/src/numeric/traits.rs b/src/uu/factor/src/numeric/traits.rs index 1dc681976..c3528a4ad 100644 --- a/src/uu/factor/src/numeric/traits.rs +++ b/src/uu/factor/src/numeric/traits.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2020 Alex Lyon -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. pub(crate) use num_traits::{ identities::{One, Zero}, diff --git a/src/uu/factor/src/rho.rs b/src/uu/factor/src/rho.rs index e7aa00b4d..2af0f6855 100644 --- a/src/uu/factor/src/rho.rs +++ b/src/uu/factor/src/rho.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2015 Wiktor Kuropatwa -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use rand::distributions::{Distribution, Uniform}; use rand::rngs::SmallRng; diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index 0fb338d9d..e9b525a3a 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2015 kwantam -// * (c) 2020 nicoo -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker: ignore (ToDO) INVS diff --git a/src/uu/false/src/false.rs b/src/uu/false/src/false.rs index 27b6be291..3ae25e569 100644 --- a/src/uu/false/src/false.rs +++ b/src/uu/false/src/false.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Jordi Boggiano -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::{Arg, ArgAction, Command}; use std::{ffi::OsString, io::Write}; use uucore::error::{set_exit_code, UResult}; diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index bf08fbc3e..c5eac7073 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -1,9 +1,7 @@ -// * This file is part of `fmt` from the uutils coreutils package. -// * -// * (c) kwantam -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) PSKIP linebreak ostream parasplit tabwidth xanti xprefix diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index e86623c88..fbd990fff 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -1,9 +1,7 @@ -// * This file is part of `fmt` from the uutils coreutils package. -// * -// * (c) kwantam -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) INFTY MULT accum breakwords linebreak linebreaking linebreaks linelen maxlength minlength nchars ostream overlen parasplit plass posn powf punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen @@ -275,6 +273,7 @@ fn find_kp_breakpoints<'a, T: Iterator>>( next_active_breaks.clear(); // go through each active break, extending it and possibly adding a new active // break if we are above the minimum required length + #[allow(clippy::explicit_iter_loop)] for &i in active_breaks.iter() { let active = &mut linebreaks[i]; // normalize demerits to avoid overflow, and record if this is the least diff --git a/src/uu/fmt/src/parasplit.rs b/src/uu/fmt/src/parasplit.rs index c94c81974..68c8f78fa 100644 --- a/src/uu/fmt/src/parasplit.rs +++ b/src/uu/fmt/src/parasplit.rs @@ -1,9 +1,7 @@ -// * This file is part of `fmt` from the uutils coreutils package. -// * -// * (c) kwantam -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) INFTY MULT PSKIP accum aftertab beforetab breakwords fmt's formatline linebreak linebreaking linebreaks linelen maxlength minlength nchars noformat noformatline ostream overlen parasplit pfxind plass pmatch poffset posn powf prefixindent punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen wordsplits xanti xprefix diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index d53573d82..95b6d9a82 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDOs) ncount routput diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index cc1b050fd..f8f00f011 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -1,11 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * (c) Vsevolod Velichko -// * (c) Gil Cottle -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) algo, algoname, regexes, nread, nonames @@ -748,7 +744,7 @@ where ) .map_err_context(|| "failed to read input".to_string())?; if options.tag { - println!("{} ({:?}) = {}", options.algoname, filename.display(), sum); + println!("{} ({}) = {}", options.algoname, filename.display(), sum); } else if options.nonames { println!("{sum}"); } else if options.zero { diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 931f8a652..c60bbfe99 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (vars) zlines BUFWRITER seekable diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 56c359a0c..90e1f2ce0 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::ffi::OsString; use uucore::parse_size::{parse_size, ParseSizeError}; diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index 3657d137a..a5c18d075 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Maciej Dziardziel -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) gethostid diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index 83a22a82f..6a318cb8c 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alan Andrade -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) MAKEWORD addrs hashset diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 8aca020af..02cf8345d 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Ben Eills -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) rwxr sourcepath targetpath Isnt uioerror diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index afcb4d7d2..71720f2cc 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Konstantin Pospelov -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) autoformat FILENUM whitespaces pairable unpairable nocheck diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index d18a483fd..b0e18a798 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Maciej Dziardziel -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) signalname pids killpg diff --git a/src/uu/link/src/link.rs b/src/uu/link/src/link.rs index 6688003a9..806e89828 100644 --- a/src/uu/link/src/link.rs +++ b/src/uu/link/src/link.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Gehring -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::builder::ValueParser; use clap::{crate_version, Arg, Command}; use std::ffi::OsString; diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index c2bf25c5c..8b76aa73c 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Joseph Crail -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) srcpath targetpath EEXIST @@ -299,7 +297,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) } let mut all_successful = true; - for srcpath in files.iter() { + for srcpath in files { let targetpath = if settings.no_dereference && matches!(settings.overwrite, OverwriteMode::Force) { // In that case, we don't want to do link resolution diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index b3cd06243..52505d98d 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Benoit Benedetti -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. /* last synced with: logname (GNU coreutils) 8.22 */ diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 792768153..1f5165e83 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf tabsize dired diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index a94439af5..2044855e4 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Nicholas Juszczak -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) ugoa cmode diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index dc338cf12..dc1f876fc 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Gehring -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::{crate_version, Arg, ArgAction, Command}; use libc::mkfifo; diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index f99136810..77ef5fcbe 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -451,7 +451,7 @@ pub fn dry_exec(tmpdir: &str, prefix: &str, rand: usize, suffix: &str) -> UResul // Randomize. let bytes = &mut buf[prefix.len()..prefix.len() + rand]; rand::thread_rng().fill(bytes); - for byte in bytes.iter_mut() { + for byte in bytes { *byte = match *byte % 62 { v @ 0..=9 => v + b'0', v @ 10..=35 => v - 10 + b'a', diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index c488ba8af..75cf79c07 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Martin Kysel -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (methods) isnt diff --git a/src/uu/mv/src/error.rs b/src/uu/mv/src/error.rs index 7810c3a95..a6605e232 100644 --- a/src/uu/mv/src/error.rs +++ b/src/uu/mv/src/error.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::error::Error; use std::fmt::{Display, Formatter, Result}; diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 6f6415789..9f7a96618 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) sourcepath targetpath diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index b23608ff6..3eaeba956 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) getpriority execvp setpriority nstr PRIO cstrs ENOENT diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 5bb1eb9e4..61a0a9f35 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Tobias Bohumir Schottdorf -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. -// * +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::{crate_version, Arg, ArgAction, Command}; use std::fs::File; diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 8247cdb3e..fdbed9395 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2014 Vsevolod Velichko -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) execvp SIGHUP cproc vprocmgr cstrs homeout diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 2b6cae04e..d0bd3083d 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Gehring -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf diff --git a/src/uu/numfmt/src/errors.rs b/src/uu/numfmt/src/errors.rs index 22c6962d6..77dd6f0aa 100644 --- a/src/uu/numfmt/src/errors.rs +++ b/src/uu/numfmt/src/errors.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::{ error::Error, diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index b0a5670d4..4afe56555 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Yury Krivopalov -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use crate::errors::*; use crate::format::format_and_print; diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 09765ed2b..769dae98e 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Ben Hirsch -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (clap) dont // spell-checker:ignore (ToDO) formatteriteminfo inputdecoder inputoffset mockstream nrofbytes partialreader odfunc multifile exitcode diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index 45ba2d8dc..89bba034c 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) delim diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 598b9718b..3510a3327 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -1,12 +1,9 @@ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. #![allow(unused_must_use)] // because we of writeln! -// * This file is part of the uutils coreutils package. -// * -// * (c) Inokentiy Babushkin -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. - // spell-checker:ignore (ToDO) lstat use clap::{crate_version, Arg, ArgAction, Command}; use std::fs; diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 37674bad7..ef178a888 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // // spell-checker:ignore (ToDO) adFfmprt, kmerge diff --git a/src/uu/printenv/src/printenv.rs b/src/uu/printenv/src/printenv.rs index beeb7285b..cab24336f 100644 --- a/src/uu/printenv/src/printenv.rs +++ b/src/uu/printenv/src/printenv.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Jordi Boggiano -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. /* last synced with: printenv (GNU coreutils) 8.13 */ diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index ecfd67ce8..1e9532a3a 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Dorota Kapturkiewicz -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDOs) corasick memchr Roff trunc oset iset CHARCLASS @@ -324,7 +322,7 @@ fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> let reg = Regex::new(&filter.word_regex).unwrap(); let ref_reg = Regex::new(&config.context_regex).unwrap(); let mut word_set: BTreeSet = BTreeSet::new(); - for (file, lines) in file_map.iter() { + for (file, lines) in file_map { let mut count: usize = 0; let offs = lines.offset; for line in &lines.lines { @@ -656,7 +654,7 @@ fn write_traditional_output( let context_reg = Regex::new(&config.context_regex).unwrap(); - for word_ref in words.iter() { + for word_ref in words { let file_map_value: &FileContent = file_map .get(&(word_ref.filename)) .expect("Missing file in file map"); diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index 9e04dd38b..fde2357e2 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Derek Chiang -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::ArgAction; use clap::{crate_version, Arg, Command}; diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 7e9f7be15..2febe51af 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Haitao Li -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) errno diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index e2b7d7557..64806fbab 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2014 Vsevolod Velichko -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) retcode diff --git a/src/uu/relpath/src/relpath.rs b/src/uu/relpath/src/relpath.rs index ef7c43474..46dd0d663 100644 --- a/src/uu/relpath/src/relpath.rs +++ b/src/uu/relpath/src/relpath.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) 2014 Vsevolod Velichko -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) subpath absto absfrom absbase diff --git a/src/uu/rm/BENCHMARKING.md b/src/uu/rm/BENCHMARKING.md new file mode 100644 index 000000000..507906d49 --- /dev/null +++ b/src/uu/rm/BENCHMARKING.md @@ -0,0 +1,61 @@ + +# Benchmarking rm + +Run `cargo build --release` before benchmarking after you make a change! + +## Simple recursive rm + +- Get a large tree, for example linux kernel source tree. +- We'll need to pass a `--prepare` argument, since `rm` deletes the dir each time. +- Benchmark simple recursive rm with hyperfine: `hyperfine --prepare "cp -r tree tree-tmp" "target/release/coreutils rm -r tree-tmp"`. + +## Comparing with GNU rm + +Hyperfine accepts multiple commands to run and will compare them. To compare performance with GNU rm +duplicate the string you passed to hyperfine but remove the `target/release/coreutils` bit from it. + +Example: `hyperfine --prepare "cp -r tree tree-tmp" "target/release/coreutils rm -rf tree-tmp"` becomes +`hyperfine --prepare "cp -r tree tree-tmp" "target/release/coreutils rm -rf tree-tmp" "rm -rf tree-tmp"` +(This assumes GNU rm is installed as `rm`) + +This can also be used to compare with version of rm built before your changes to ensure your change does not regress this. + +Here is a `bash` script for doing this comparison: + +```shell +#!/bin/bash +cargo build --no-default-features --features rm --release +test_dir="$1" +hyperfine --prepare "cp -r $test_dir tmp_d" "rm -rf tmp_d" "target/release/coreutils rm -rf tmp_d" +``` + +## Checking system call count + +- Another thing to look at would be system calls count using strace (on linux) or equivalent on other operating systems. +- Example: `strace -c target/release/coreutils rm -rf tree` + +## Flamegraph + +### samply + +[samply](https://github.com/mstange/samply) is one option for simply creating flamegraphs. It uses the Firefox profiler as a UI. + +To install: +```bash +cargo install samply +``` + +To run: + +```bash +samply record target/release/coreutils rm -rf ../linux +``` + +### Cargo Flamegraph + +With Cargo Flamegraph you can easily make a flamegraph of `rm`: + +```shell +cargo flamegraph --cmd coreutils -- rm [additional parameters] +``` + diff --git a/src/uu/rm/benchmark.sh b/src/uu/rm/benchmark.sh new file mode 100755 index 000000000..5feaea4e8 --- /dev/null +++ b/src/uu/rm/benchmark.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Exit on any failures +set +x + +cargo build --no-default-features --features rm --release +test_dir="$1" +hyperfine --prepare "cp -r $test_dir tmp_d" "rm -rf tmp_d" "target/release/coreutils rm -rf tmp_d" diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index fb4a2149e..d9421d0ae 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (path) eacces diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index d0123186f..ef152f01a 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) ENOTDIR diff --git a/src/uu/seq/src/error.rs b/src/uu/seq/src/error.rs index fc8452e13..e81c30fe6 100644 --- a/src/uu/seq/src/error.rs +++ b/src/uu/seq/src/error.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore numberparse //! Errors returned by seq. use std::error::Error; diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index dec66a7b1..4f04b377e 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) istr chiter argptr ilen extendedbigdecimal extendedbigint numberparse use std::io::{stdout, ErrorKind, Write}; use std::process::exit; diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index fd14a3245..9b1f7fc98 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Rosenberg <42micro@gmail.com> -// * (c) Fort -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (words) wipesync prefill diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index 2481baf3d..1b21b9532 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) cmdline evec seps rvec fdata diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index 8acb7724f..b1d6bd899 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::thread; use std::time::Duration; diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs index cc687aafc..763b6deb7 100644 --- a/src/uu/sort/src/check.rs +++ b/src/uu/sort/src/check.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Debertol -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Check if a file is ordered diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index ffee7e453..525a9f66b 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Debertol -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Utilities for reading files as chunks. diff --git a/src/uu/sort/src/custom_str_cmp.rs b/src/uu/sort/src/custom_str_cmp.rs index 089d33bc4..fb128d9af 100644 --- a/src/uu/sort/src/custom_str_cmp.rs +++ b/src/uu/sort/src/custom_str_cmp.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Debertol -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Custom string comparisons. //! diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index a8f4b2590..08de4e33e 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Debertol -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Sort big files by using auxiliary files for storing intermediate chunks. //! diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index 1a986ea76..661f536a3 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Debertol -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Fast comparison for strings representing a base 10 number without precision loss. //! diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index b40eb05c1..4e6e84187 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1,11 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Michael Yin -// * (c) Robert Swinford -// * (c) Michael Debertol -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // Although these links don't always seem to describe reality, check out the POSIX and GNU specs: // https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html diff --git a/src/uu/split/src/filenames.rs b/src/uu/split/src/filenames.rs index 6bec4105f..08f08e293 100644 --- a/src/uu/split/src/filenames.rs +++ b/src/uu/split/src/filenames.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore zaaa zaab //! Compute filenames from a given index. //! diff --git a/src/uu/split/src/number.rs b/src/uu/split/src/number.rs index 567526538..39d64f927 100644 --- a/src/uu/split/src/number.rs +++ b/src/uu/split/src/number.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore zaaa zaab //! A number in arbitrary radix expressed in a positional notation. //! diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index f1be0c47d..517031791 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -1,11 +1,9 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Akira Hayakawa -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. -// spell-checker:ignore nbbbb ncccc +// spell-checker:ignore nbbbb ncccc hexdigit mod filenames; mod number; @@ -13,8 +11,7 @@ mod platform; use crate::filenames::FilenameIterator; use crate::filenames::SuffixType; -use clap::ArgAction; -use clap::{crate_version, parser::ValueSource, Arg, ArgMatches, Command}; +use clap::{crate_version, parser::ValueSource, Arg, ArgAction, ArgMatches, Command}; use std::env; use std::fmt; use std::fs::{metadata, File}; @@ -34,7 +31,9 @@ static OPT_ADDITIONAL_SUFFIX: &str = "additional-suffix"; static OPT_FILTER: &str = "filter"; static OPT_NUMBER: &str = "number"; static OPT_NUMERIC_SUFFIXES: &str = "numeric-suffixes"; +static OPT_NUMERIC_SUFFIXES_SHORT: &str = "-d"; static OPT_HEX_SUFFIXES: &str = "hex-suffixes"; +static OPT_HEX_SUFFIXES_SHORT: &str = "-x"; static OPT_SUFFIX_LENGTH: &str = "suffix-length"; static OPT_DEFAULT_SUFFIX_LENGTH: &str = "0"; static OPT_VERBOSE: &str = "verbose"; @@ -124,12 +123,56 @@ pub fn uu_app() -> Command { .action(ArgAction::SetTrue), ) .arg( - Arg::new(OPT_NUMERIC_SUFFIXES) + Arg::new(OPT_NUMERIC_SUFFIXES_SHORT) .short('d') + .action(clap::ArgAction::SetTrue) + .overrides_with_all([ + OPT_NUMERIC_SUFFIXES, + OPT_NUMERIC_SUFFIXES_SHORT, + OPT_HEX_SUFFIXES, + OPT_HEX_SUFFIXES_SHORT + ]) + .help("use numeric suffixes starting at 0, not alphabetic"), + ) + .arg( + Arg::new(OPT_NUMERIC_SUFFIXES) .long(OPT_NUMERIC_SUFFIXES) + .require_equals(true) .default_missing_value("0") .num_args(0..=1) - .help("use numeric suffixes instead of alphabetic"), + .overrides_with_all([ + OPT_NUMERIC_SUFFIXES, + OPT_NUMERIC_SUFFIXES_SHORT, + OPT_HEX_SUFFIXES, + OPT_HEX_SUFFIXES_SHORT + ]) + .help("same as -d, but allow setting the start value"), + ) + .arg( + Arg::new(OPT_HEX_SUFFIXES_SHORT) + .short('x') + .action(clap::ArgAction::SetTrue) + .overrides_with_all([ + OPT_NUMERIC_SUFFIXES, + OPT_NUMERIC_SUFFIXES_SHORT, + OPT_HEX_SUFFIXES, + OPT_HEX_SUFFIXES_SHORT + ]) + .help("use hex suffixes starting at 0, not alphabetic"), + ) + .arg( + Arg::new(OPT_HEX_SUFFIXES) + .long(OPT_HEX_SUFFIXES) + .default_missing_value("0") + .require_equals(true) + .num_args(0..=1) + .overrides_with_all([ + OPT_NUMERIC_SUFFIXES, + OPT_NUMERIC_SUFFIXES_SHORT, + OPT_HEX_SUFFIXES, + OPT_HEX_SUFFIXES_SHORT + ]) + .help("same as -x, but allow setting the start value"), ) .arg( Arg::new(OPT_SUFFIX_LENGTH) @@ -139,14 +182,6 @@ pub fn uu_app() -> Command { .default_value(OPT_DEFAULT_SUFFIX_LENGTH) .help("use suffixes of fixed length N. 0 implies dynamic length."), ) - .arg( - Arg::new(OPT_HEX_SUFFIXES) - .short('x') - .long(OPT_HEX_SUFFIXES) - .default_missing_value("0") - .num_args(0..=1) - .help("use hex suffixes instead of alphabetic"), - ) .arg( Arg::new(OPT_VERBOSE) .long(OPT_VERBOSE) @@ -411,22 +446,32 @@ impl Strategy { /// Parse the suffix type from the command-line arguments. fn suffix_type_from(matches: &ArgMatches) -> Result<(SuffixType, usize), SettingsError> { - if matches.value_source(OPT_NUMERIC_SUFFIXES) == Some(ValueSource::CommandLine) { - let suffix_start = matches.get_one::(OPT_NUMERIC_SUFFIXES); - let suffix_start = suffix_start.ok_or(SettingsError::SuffixNotParsable(String::new()))?; - let suffix_start = suffix_start - .parse() - .map_err(|_| SettingsError::SuffixNotParsable(suffix_start.to_string()))?; - Ok((SuffixType::Decimal, suffix_start)) - } else if matches.value_source(OPT_HEX_SUFFIXES) == Some(ValueSource::CommandLine) { - let suffix_start = matches.get_one::(OPT_HEX_SUFFIXES); - let suffix_start = suffix_start.ok_or(SettingsError::SuffixNotParsable(String::new()))?; - let suffix_start = usize::from_str_radix(suffix_start, 16) - .map_err(|_| SettingsError::SuffixNotParsable(suffix_start.to_string()))?; - Ok((SuffixType::Hexadecimal, suffix_start)) - } else { - // no numeric/hex suffix - Ok((SuffixType::Alphabetic, 0)) + // Check if the user is specifying one or more than one suffix + // Any combination of suffixes is allowed + // Since all suffixes are setup with 'overrides_with_all()' against themselves and each other, + // last one wins, all others are ignored + match ( + matches.get_one::(OPT_NUMERIC_SUFFIXES), + matches.get_one::(OPT_HEX_SUFFIXES), + matches.get_flag(OPT_NUMERIC_SUFFIXES_SHORT), + matches.get_flag(OPT_HEX_SUFFIXES_SHORT), + ) { + (Some(v), _, _, _) => { + let suffix_start = v; + let suffix_start = suffix_start + .parse::() + .map_err(|_| SettingsError::SuffixNotParsable(suffix_start.to_string()))?; + Ok((SuffixType::Decimal, suffix_start)) + } + (_, Some(v), _, _) => { + let suffix_start = v; + let suffix_start = usize::from_str_radix(suffix_start, 16) + .map_err(|_| SettingsError::SuffixNotParsable(suffix_start.to_string()))?; + Ok((SuffixType::Hexadecimal, suffix_start)) + } + (_, _, true, _) => Ok((SuffixType::Decimal, 0)), // short numeric suffix '-d', default start 0 + (_, _, _, true) => Ok((SuffixType::Hexadecimal, 0)), // short hex suffix '-x', default start 0 + _ => Ok((SuffixType::Alphabetic, 0)), // no numeric/hex suffix, using default alphabetic } } diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index b3c9dc513..c36b45006 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::builder::ValueParser; use uucore::display::Quotable; @@ -633,7 +633,7 @@ impl Stater { Ok(meta) => { let tokens = &self.default_tokens; - for t in tokens.iter() { + for t in tokens { match *t { Token::Char(c) => print!("{c}"), Token::Directive { @@ -701,7 +701,7 @@ impl Stater { &self.default_dev_tokens }; - for t in tokens.iter() { + for t in tokens { match *t { Token::Char(c) => print!("{c}"), Token::Directive { diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 85dddbddd..6e522aa3d 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Dorota Kapturkiewicz -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) tempdir dyld dylib dragonflybsd optgrps libstdbuf diff --git a/src/uu/stty/src/flags.rs b/src/uu/stty/src/flags.rs index 536c08d80..2c8e154e8 100644 --- a/src/uu/stty/src/flags.rs +++ b/src/uu/stty/src/flags.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore parenb parodd cmspar hupcl cstopb cread clocal crtscts CSIZE // spell-checker:ignore ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl ixoff ixon iuclc ixany imaxbel iutf diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index c933e48ae..d55870730 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore clocal erange tcgetattr tcsetattr tcsanow tiocgwinsz tiocswinsz cfgetospeed cfsetospeed ushort vmin vtime diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 6a17a630d..4616274d0 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) T. Jameson Little -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) sysv diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index e135fbe7f..c0b8f3d00 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alexander Fomin -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. /* Last synced with: sync (GNU coreutils) 8.13 */ diff --git a/src/uu/tac/src/error.rs b/src/uu/tac/src/error.rs index 43b03b970..7a737ad9b 100644 --- a/src/uu/tac/src/error.rs +++ b/src/uu/tac/src/error.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Errors returned by tac during processing of a file. use std::error::Error; use std::fmt::Display; diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 96bb82f1e..b8cb61029 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) sbytes slen dlen memmem memmap Mmap mmap SIGBUS mod error; diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index 3b4984819..795652f26 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) kqueue Signum fundu diff --git a/src/uu/tail/src/chunks.rs b/src/uu/tail/src/chunks.rs index 7a1e5bc34..6582bd251 100644 --- a/src/uu/tail/src/chunks.rs +++ b/src/uu/tail/src/chunks.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Iterating over a file by chunks, either starting at the end of the file with [`ReverseChunks`] //! or at the end of piped stdin with [`LinesChunk`] or [`BytesChunk`]. diff --git a/src/uu/tail/src/follow/files.rs b/src/uu/tail/src/follow/files.rs index 8686e73f4..e4f980267 100644 --- a/src/uu/tail/src/follow/files.rs +++ b/src/uu/tail/src/follow/files.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore tailable seekable stdlib (stdlib) diff --git a/src/uu/tail/src/follow/mod.rs b/src/uu/tail/src/follow/mod.rs index e31eb54d1..52eef318f 100644 --- a/src/uu/tail/src/follow/mod.rs +++ b/src/uu/tail/src/follow/mod.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. mod files; mod watch; diff --git a/src/uu/tail/src/follow/watch.rs b/src/uu/tail/src/follow/watch.rs index 9569e6e21..3ecb47f67 100644 --- a/src/uu/tail/src/follow/watch.rs +++ b/src/uu/tail/src/follow/watch.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) tailable untailable stdlib kqueue Uncategorized unwatch diff --git a/src/uu/tail/src/parse.rs b/src/uu/tail/src/parse.rs index 96cf1e918..3d6b2697e 100644 --- a/src/uu/tail/src/parse.rs +++ b/src/uu/tail/src/parse.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::ffi::OsString; diff --git a/src/uu/tail/src/paths.rs b/src/uu/tail/src/paths.rs index 5ed654037..117cab8b0 100644 --- a/src/uu/tail/src/paths.rs +++ b/src/uu/tail/src/paths.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore tailable seekable stdlib (stdlib) diff --git a/src/uu/tail/src/platform/mod.rs b/src/uu/tail/src/platform/mod.rs index e5ae8b8d8..cd2953ffd 100644 --- a/src/uu/tail/src/platform/mod.rs +++ b/src/uu/tail/src/platform/mod.rs @@ -1,12 +1,7 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Alexander Batischev - * (c) Thomas Queiroz - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. #[cfg(unix)] pub use self::unix::{ diff --git a/src/uu/tail/src/platform/unix.rs b/src/uu/tail/src/platform/unix.rs index ed34b2cf9..a04582a2c 100644 --- a/src/uu/tail/src/platform/unix.rs +++ b/src/uu/tail/src/platform/unix.rs @@ -1,12 +1,7 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Alexander Batischev - * (c) Thomas Queiroz - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) stdlib, ISCHR, GETFD // spell-checker:ignore (options) EPERM, ENOSYS diff --git a/src/uu/tail/src/platform/windows.rs b/src/uu/tail/src/platform/windows.rs index 3e4cc7edc..592516162 100644 --- a/src/uu/tail/src/platform/windows.rs +++ b/src/uu/tail/src/platform/windows.rs @@ -1,11 +1,8 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Alexander Batischev - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + use windows_sys::Win32::Foundation::{CloseHandle, BOOL, HANDLE, WAIT_FAILED, WAIT_OBJECT_0}; use windows_sys::Win32::System::Threading::{ OpenProcess, WaitForSingleObject, PROCESS_SYNCHRONIZE, diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index e07616c6f..0488e0808 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -1,11 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Morten Olsen Lysgaard -// * (c) Alexander Batischev -// * (c) Thomas Queiroz -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) seekable seek'd tail'ing ringbuffer ringbuf unwatch Uncategorized filehandle Signum // spell-checker:ignore (libs) kqueue diff --git a/src/uu/tail/src/text.rs b/src/uu/tail/src/text.rs index e7686d301..e7aa6c253 100644 --- a/src/uu/tail/src/text.rs +++ b/src/uu/tail/src/text.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) kqueue diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index 5c388dd0e..ca6e8a7c6 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Aleksander Bielawski -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::{builder::PossibleValue, crate_version, Arg, ArgAction, Command}; use std::fs::OpenOptions; diff --git a/src/uu/timeout/src/status.rs b/src/uu/timeout/src/status.rs index 9a8558954..10103ab9b 100644 --- a/src/uu/timeout/src/status.rs +++ b/src/uu/timeout/src/status.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Exit status codes produced by `timeout`. use std::convert::From; use uucore::error::UError; diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 531f29e82..5e73fe2ab 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) tstr sigstr cmdname setpgid sigchld getpid mod status; diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 135d119bd..e9970cb24 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// 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 lpszfilepath mktime DATETIME subsecond datelike timelike // spell-checker:ignore (FORMATS) MMDDhhmm YYYYMMDDHHMM YYMMDDHHMM YYYYMMDDHHMMS diff --git a/src/uu/tr/src/convert.rs b/src/uu/tr/src/convert.rs index 00656ca49..28a80e9f5 100644 --- a/src/uu/tr/src/convert.rs +++ b/src/uu/tr/src/convert.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (strings) anychar combinator diff --git a/src/uu/tr/src/operation.rs b/src/uu/tr/src/operation.rs index f27ccc0b9..b7d74427a 100644 --- a/src/uu/tr/src/operation.rs +++ b/src/uu/tr/src/operation.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (strings) anychar combinator Alnum Punct Xdigit alnum punct xdigit cntrl diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 9abbca631..9c6e7a7da 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) allocs bset dflag cflag sflag tflag diff --git a/src/uu/tr/src/unicode_table.rs b/src/uu/tr/src/unicode_table.rs index 43d9fd6f4..a00a30b8b 100644 --- a/src/uu/tr/src/unicode_table.rs +++ b/src/uu/tr/src/unicode_table.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. pub static BEL: char = '\u{0007}'; pub static BS: char = '\u{0008}'; diff --git a/src/uu/true/src/true.rs b/src/uu/true/src/true.rs index 334652ce8..637758625 100644 --- a/src/uu/true/src/true.rs +++ b/src/uu/true/src/true.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Jordi Boggiano -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::{Arg, ArgAction, Command}; use std::{ffi::OsString, io::Write}; use uucore::error::{set_exit_code, UResult}; diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index f050b52b4..3b1e9bd09 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alex Lyon -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) RFILE refsize rfilename fsize tsize use clap::{crate_version, Arg, ArgAction, Command}; diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index 68f51b213..e71710847 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Ben Eggers -// * (c) Akira Hayakawa -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// 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::{BTreeMap, BTreeSet}; use std::fs::File; @@ -157,6 +154,7 @@ impl Graph { self.result.push(n.clone()); let n_out_edges = self.out_edges.get_mut(&n).unwrap(); + #[allow(clippy::explicit_iter_loop)] for m in n_out_edges.iter() { let m_in_edges = self.in_edges.get_mut(m).unwrap(); m_in_edges.remove(&n); diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index e2d9d1847..96d851d37 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Jordi Boggiano -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // * // * Synced with http://lingrok.org/xref/coreutils/src/tty.c diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index dd4471e2d..11ad43060 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -1,11 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Virgile Andreani -// * (c) kwantam -// * * 2015-04-28 ~ updated to work with both UTF-8 and non-UTF-8 encodings -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) nums aflag uflag scol prevtab amode ctype cwidth nbytes lastcol pctype Preprocess diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index 89141f35f..3aac7b834 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Chirag B Jadwani -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command}; use std::ffi::{OsStr, OsString}; diff --git a/src/uu/unlink/src/unlink.rs b/src/uu/unlink/src/unlink.rs index 5d1594a05..85e1ab4f5 100644 --- a/src/uu/unlink/src/unlink.rs +++ b/src/uu/unlink/src/unlink.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Colin Warren -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. /* last synced with: unlink (GNU coreutils) 8.21 */ diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 6f4e62084..778fbc920 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Jordi Boggiano -// * (c) Jian Zeng -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) getloadavg upsecs updays nusers loadavg boottime uphours upmins diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 6a5e54f99..199882b7e 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -1,10 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) KokaKiwi -// * (c) Jian Zeng -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (paths) wtmp diff --git a/src/uu/vdir/src/vdir.rs b/src/uu/vdir/src/vdir.rs index c49a3f1b3..b9d80c401 100644 --- a/src/uu/vdir/src/vdir.rs +++ b/src/uu/vdir/src/vdir.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) gmnsii -// * -// * For the full copyright and license information, please view the LICENSE file -// * that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use clap::Command; use std::ffi::OsString; diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index b79559b29..6d5894db0 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Boden Garman -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // cSpell:ignore ilog wc wc's diff --git a/src/uu/whoami/src/platform/mod.rs b/src/uu/whoami/src/platform/mod.rs index b5064a8d2..bc6b2888c 100644 --- a/src/uu/whoami/src/platform/mod.rs +++ b/src/uu/whoami/src/platform/mod.rs @@ -1,11 +1,7 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) getusername diff --git a/src/uu/whoami/src/platform/unix.rs b/src/uu/whoami/src/platform/unix.rs index 1c0ea15d5..31ab16fba 100644 --- a/src/uu/whoami/src/platform/unix.rs +++ b/src/uu/whoami/src/platform/unix.rs @@ -1,12 +1,7 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * (c) Jian Zeng - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::ffi::OsString; use std::io; diff --git a/src/uu/whoami/src/platform/windows.rs b/src/uu/whoami/src/platform/windows.rs index 3bad1eb21..aad2eed3d 100644 --- a/src/uu/whoami/src/platform/windows.rs +++ b/src/uu/whoami/src/platform/windows.rs @@ -1,11 +1,7 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::ffi::OsString; use std::io; diff --git a/src/uu/whoami/src/whoami.rs b/src/uu/whoami/src/whoami.rs index 04360fe7a..cb8bcd9c7 100644 --- a/src/uu/whoami/src/whoami.rs +++ b/src/uu/whoami/src/whoami.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Jordi Boggiano -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. /* last synced with: whoami (GNU coreutils) 8.21 */ diff --git a/src/uu/yes/src/yes.rs b/src/uu/yes/src/yes.rs index 72c19b872..e6868d9d8 100644 --- a/src/uu/yes/src/yes.rs +++ b/src/uu/yes/src/yes.rs @@ -1,9 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Jordi Boggiano -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. /* last synced with: yes (GNU coreutils) 8.13 */ diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index f526e7fde..52c079e2e 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //! Set of functions to manage file systems diff --git a/src/uucore/src/lib/features/lines.rs b/src/uucore/src/lib/features/lines.rs index a7f4df76d..3e3c82b3a 100644 --- a/src/uucore/src/lib/features/lines.rs +++ b/src/uucore/src/lib/features/lines.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (vars) //! Iterate over lines, including the line ending character(s). //! diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index 8e7e46479..c7dff1f05 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (vars) cvar exitstatus // spell-checker:ignore (sys/unix) WIFSIGNALED diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index 423eb19c9..61482024d 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (vars/api) fcntl setrlimit setitimer // spell-checker:ignore (vars/signals) ABRT ALRM CHLD SEGV SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGEMT SIGFPE SIGHUP SIGILL SIGINFO SIGINT SIGIO SIGIOT SIGKILL SIGPIPE SIGPROF SIGPWR SIGQUIT SIGSEGV SIGSTOP SIGSYS SIGTERM SIGTRAP SIGTSTP SIGTHR SIGTTIN SIGTTOU SIGURG SIGUSR SIGVTALRM SIGWINCH SIGXCPU SIGXFSZ STKFLT PWR THR TSTP TTIN TTOU VTALRM XCPU XFSZ diff --git a/src/uucore/src/lib/features/sum.rs b/src/uucore/src/lib/features/sum.rs index d4945421e..e079d7a30 100644 --- a/src/uucore/src/lib/features/sum.rs +++ b/src/uucore/src/lib/features/sum.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore memmem algo @@ -176,7 +176,7 @@ impl Digest for CRC { } fn hash_update(&mut self, input: &[u8]) { - for &elt in input.iter() { + for &elt in input { self.update(elt); } self.size += input.len(); @@ -223,7 +223,7 @@ impl Digest for BSD { } fn hash_update(&mut self, input: &[u8]) { - for &byte in input.iter() { + for &byte in input { self.state = (self.state >> 1) + ((self.state & 1) << 15); self.state = self.state.wrapping_add(u16::from(byte)); } @@ -257,7 +257,7 @@ impl Digest for SYSV { } fn hash_update(&mut self, input: &[u8]) { - for &byte in input.iter() { + for &byte in input { self.state = self.state.wrapping_add(u32::from(byte)); } } diff --git a/src/uucore/src/lib/features/tokenize/num_format/formatters/base_conv/mod.rs b/src/uucore/src/lib/features/tokenize/num_format/formatters/base_conv/mod.rs index f8b5da86c..7c041fec8 100644 --- a/src/uucore/src/lib/features/tokenize/num_format/formatters/base_conv/mod.rs +++ b/src/uucore/src/lib/features/tokenize/num_format/formatters/base_conv/mod.rs @@ -195,7 +195,7 @@ pub fn str_to_arrnum(src: &str, radix_def_src: &dyn RadixDef) -> Vec { pub fn arrnum_to_str(src: &[u8], radix_def_dest: &dyn RadixDef) -> String { let mut str_out = String::new(); - for u in src.iter() { + for u in src { #[allow(clippy::single_match)] match radix_def_dest.format_u8(*u) { Some(c) => { diff --git a/src/uucore/src/lib/features/tokenize/sub.rs b/src/uucore/src/lib/features/tokenize/sub.rs index 4651dc8d8..447616ae6 100644 --- a/src/uucore/src/lib/features/tokenize/sub.rs +++ b/src/uucore/src/lib/features/tokenize/sub.rs @@ -188,11 +188,11 @@ impl SubParser { // though, as we want to mimic the original behavior of printing // the field as interpreted up until the error in the field. - let mut legal_fields = vec![ + let mut legal_fields = [ // 'a', 'A', //c99 hex float implementation not yet complete 'b', 'c', 'd', 'e', 'E', 'f', 'F', 'g', 'G', 'i', 'o', 's', 'u', 'x', 'X', ]; - let mut specifiers = vec!['h', 'j', 'l', 'L', 't', 'z']; + let mut specifiers = ['h', 'j', 'l', 'L', 't', 'z']; legal_fields.sort_unstable(); specifiers.sort_unstable(); diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 1d97522c7..49505438f 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -4,9 +4,6 @@ // file that was distributed with this source code. // library ~ (core/bundler file) -// Copyright (C) ~ Alex Lyon -// Copyright (C) ~ Roy Ivy III ; MIT license - // * feature-gated external crates (re-shared as public internal modules) #[cfg(feature = "libc")] pub extern crate libc; @@ -133,8 +130,8 @@ pub fn set_utility_is_second_arg() { static ARGV: Lazy> = Lazy::new(|| wild::args_os().collect()); static UTIL_NAME: Lazy = Lazy::new(|| { - let base_index = if get_utility_is_second_arg() { 1 } else { 0 }; - let is_man = if ARGV[base_index].eq("manpage") { 1 } else { 0 }; + let base_index = usize::from(get_utility_is_second_arg()); + let is_man = usize::from(ARGV[base_index].eq("manpage")); let argv_index = base_index + is_man; ARGV[argv_index].to_string_lossy().into_owned() diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index d1893dd9a..ad86d5308 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -1,3 +1,8 @@ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + // TODO fix broken links #![allow(rustdoc::broken_intra_doc_links)] //! Macros for the uucore utilities. diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 2ea84e389..5f64afcd8 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// 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 ACDBK hexdigit @@ -75,7 +75,7 @@ impl<'parser> Parser<'parser> { return Err(ParseSizeError::parse_failure(size)); } - let number_system: NumberSystem = self.determine_number_system(size); + let number_system = 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 @@ -156,16 +156,16 @@ impl<'parser> Parser<'parser> { if numeric_string.is_empty() { 1 } else { - self.parse_number(&numeric_string, 10, size)? + Self::parse_number(&numeric_string, 10, size)? } } NumberSystem::Octal => { let trimmed_string = numeric_string.trim_start_matches('0'); - self.parse_number(trimmed_string, 8, size)? + Self::parse_number(trimmed_string, 8, size)? } NumberSystem::Hexadecimal => { let trimmed_string = numeric_string.trim_start_matches("0x"); - self.parse_number(trimmed_string, 16, size)? + Self::parse_number(trimmed_string, 16, size)? } }; @@ -174,7 +174,7 @@ impl<'parser> Parser<'parser> { .ok_or_else(|| ParseSizeError::size_too_big(size)) } - fn determine_number_system(&self, size: &str) -> NumberSystem { + fn determine_number_system(size: &str) -> NumberSystem { if size.len() <= 1 { return NumberSystem::Decimal; } @@ -197,7 +197,6 @@ impl<'parser> Parser<'parser> { } fn parse_number( - &self, numeric_string: &str, radix: u32, original_size: &str, diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index ef1ba87cf..cbe915936 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -2,7 +2,7 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// Copyright (C) ~ Roy Ivy III ; MIT license +// // spell-checker:ignore backticks uuhelp use std::{fs::File, io::Read, path::PathBuf}; diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index b8e72cb04..8bb5bda54 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // use crate::common::util::TestScenario; diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index d365bd87e..9a508da25 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (paths) sublink subwords azerty azeaze xcwww azeaz amaz azea qzerty tazerty tsublink #[cfg(not(windows))] diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index a14a673a8..2a11363b7 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -1,7 +1,7 @@ // This file is part of the uutils coreutils package. // -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. #![allow(clippy::unreadable_literal)] // spell-checker:ignore (methods) hexdigest diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index 4f6bb7f1b..47cb89249 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //spell-checker: ignore coreutil diff --git a/tests/by-util/test_hashsum.rs b/tests/by-util/test_hashsum.rs index 4bf06308d..31471495b 100644 --- a/tests/by-util/test_hashsum.rs +++ b/tests/by-util/test_hashsum.rs @@ -355,3 +355,19 @@ fn test_check_md5sum_mixed_format() { fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails().code_is(1); } + +#[test] +fn test_tag() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.write("foobar", "foo bar\n"); + scene + .ccmd("sha256sum") + .arg("--tag") + .arg("foobar") + .succeeds() + .stdout_is( + "SHA256 (foobar) = 1f2ec52b774368781bed1d1fb140a92e0eb6348090619c9291f9a5a3c8e8d151\n", + ); +} diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 0e1eafc86..65aeca437 100644 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (words) bogusfile emptyfile abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstu diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 4174bdde6..5c2a67199 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) coreutil diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index 54ac06384..78c4e1b04 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -1,8 +1,9 @@ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + // spell-checker:ignore abcdefghijklmnopqrstuvwxyz -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. use crate::common::util::TestScenario; use std::env; diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index f266175f5..57413c4c9 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use crate::common::util::{expected_result, TestScenario}; use pinky::Capitalize; diff --git a/tests/by-util/test_runcon.rs b/tests/by-util/test_runcon.rs index 7635fea49..8e8b9b6b5 100644 --- a/tests/by-util/test_runcon.rs +++ b/tests/by-util/test_runcon.rs @@ -137,7 +137,7 @@ fn custom_context() { } fn get_sestatus_context(output: &[u8]) -> &str { - let re = regex::bytes::Regex::new(r#"Current context:\s*(\S+)\s*"#) + let re = regex::bytes::Regex::new(r"Current context:\s*(\S+)\s*") .expect("Invalid regular expression"); output diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 0c8af8969..690623c1c 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (words) ints diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index de1bb9cdf..f3317d4c7 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -1,8 +1,8 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. -// spell-checker:ignore xzaaa sixhundredfiftyonebytes ninetyonebytes threebytes asciilowercase fghij klmno pqrst uvwxyz fivelines twohundredfortyonebytes onehundredlines nbbbb +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. +// spell-checker:ignore xzaaa sixhundredfiftyonebytes ninetyonebytes threebytes asciilowercase fghij klmno pqrst uvwxyz fivelines twohundredfortyonebytes onehundredlines nbbbb dxen use crate::common::util::{AtPath, TestScenario}; use rand::{thread_rng, Rng, SeedableRng}; @@ -715,7 +715,7 @@ fn test_multiple_of_input_chunk() { #[test] fn test_numeric_suffix() { let (at, mut ucmd) = at_and_ucmd!(); - ucmd.args(&["-n", "4", "--numeric-suffixes", "9", "threebytes.txt"]) + ucmd.args(&["-n", "4", "--numeric-suffixes=9", "threebytes.txt"]) .succeeds() .no_stdout() .no_stderr(); @@ -728,7 +728,7 @@ fn test_numeric_suffix() { #[test] fn test_hex_suffix() { let (at, mut ucmd) = at_and_ucmd!(); - ucmd.args(&["-n", "4", "--hex-suffixes", "9", "threebytes.txt"]) + ucmd.args(&["-n", "4", "--hex-suffixes=9", "threebytes.txt"]) .succeeds() .no_stdout() .no_stderr(); @@ -738,6 +738,190 @@ fn test_hex_suffix() { assert_eq!(at.read("x0c"), ""); } +#[test] +fn test_numeric_suffix_no_equal() { + new_ucmd!() + .args(&["-n", "4", "--numeric-suffixes", "9", "threebytes.txt"]) + .fails() + .stderr_contains("split: cannot open '9' for reading: No such file or directory"); +} + +#[test] +fn test_hex_suffix_no_equal() { + new_ucmd!() + .args(&["-n", "4", "--hex-suffixes", "9", "threebytes.txt"]) + .fails() + .stderr_contains("split: cannot open '9' for reading: No such file or directory"); +} + +/// Test for short numeric suffix not having any value +#[test] +fn test_short_numeric_suffix_no_value() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-l", "9", "-d", "onehundredlines.txt"]) + .succeeds() + .no_stdout() + .no_stderr(); + assert_eq!(at.read("x00"), "00\n01\n02\n03\n04\n05\n06\n07\n08\n"); + assert_eq!(at.read("x01"), "09\n10\n11\n12\n13\n14\n15\n16\n17\n"); + assert_eq!(at.read("x02"), "18\n19\n20\n21\n22\n23\n24\n25\n26\n"); + assert_eq!(at.read("x03"), "27\n28\n29\n30\n31\n32\n33\n34\n35\n"); + assert_eq!(at.read("x04"), "36\n37\n38\n39\n40\n41\n42\n43\n44\n"); + assert_eq!(at.read("x05"), "45\n46\n47\n48\n49\n50\n51\n52\n53\n"); + assert_eq!(at.read("x06"), "54\n55\n56\n57\n58\n59\n60\n61\n62\n"); + assert_eq!(at.read("x07"), "63\n64\n65\n66\n67\n68\n69\n70\n71\n"); + assert_eq!(at.read("x08"), "72\n73\n74\n75\n76\n77\n78\n79\n80\n"); + assert_eq!(at.read("x09"), "81\n82\n83\n84\n85\n86\n87\n88\n89\n"); + assert_eq!(at.read("x10"), "90\n91\n92\n93\n94\n95\n96\n97\n98\n"); + assert_eq!(at.read("x11"), "99\n"); +} + +/// Test for long numeric suffix not having any value +#[test] +fn test_numeric_suffix_no_value() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-l", "9", "--numeric-suffixes", "onehundredlines.txt"]) + .succeeds() + .no_stdout() + .no_stderr(); + assert_eq!(at.read("x00"), "00\n01\n02\n03\n04\n05\n06\n07\n08\n"); + assert_eq!(at.read("x01"), "09\n10\n11\n12\n13\n14\n15\n16\n17\n"); + assert_eq!(at.read("x02"), "18\n19\n20\n21\n22\n23\n24\n25\n26\n"); + assert_eq!(at.read("x03"), "27\n28\n29\n30\n31\n32\n33\n34\n35\n"); + assert_eq!(at.read("x04"), "36\n37\n38\n39\n40\n41\n42\n43\n44\n"); + assert_eq!(at.read("x05"), "45\n46\n47\n48\n49\n50\n51\n52\n53\n"); + assert_eq!(at.read("x06"), "54\n55\n56\n57\n58\n59\n60\n61\n62\n"); + assert_eq!(at.read("x07"), "63\n64\n65\n66\n67\n68\n69\n70\n71\n"); + assert_eq!(at.read("x08"), "72\n73\n74\n75\n76\n77\n78\n79\n80\n"); + assert_eq!(at.read("x09"), "81\n82\n83\n84\n85\n86\n87\n88\n89\n"); + assert_eq!(at.read("x10"), "90\n91\n92\n93\n94\n95\n96\n97\n98\n"); + assert_eq!(at.read("x11"), "99\n"); +} + +/// Test for short hex suffix not having any value +#[test] +fn test_short_hex_suffix_no_value() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-l", "9", "-x", "onehundredlines.txt"]) + .succeeds() + .no_stdout() + .no_stderr(); + assert_eq!(at.read("x00"), "00\n01\n02\n03\n04\n05\n06\n07\n08\n"); + assert_eq!(at.read("x01"), "09\n10\n11\n12\n13\n14\n15\n16\n17\n"); + assert_eq!(at.read("x02"), "18\n19\n20\n21\n22\n23\n24\n25\n26\n"); + assert_eq!(at.read("x03"), "27\n28\n29\n30\n31\n32\n33\n34\n35\n"); + assert_eq!(at.read("x04"), "36\n37\n38\n39\n40\n41\n42\n43\n44\n"); + assert_eq!(at.read("x05"), "45\n46\n47\n48\n49\n50\n51\n52\n53\n"); + assert_eq!(at.read("x06"), "54\n55\n56\n57\n58\n59\n60\n61\n62\n"); + assert_eq!(at.read("x07"), "63\n64\n65\n66\n67\n68\n69\n70\n71\n"); + assert_eq!(at.read("x08"), "72\n73\n74\n75\n76\n77\n78\n79\n80\n"); + assert_eq!(at.read("x09"), "81\n82\n83\n84\n85\n86\n87\n88\n89\n"); + assert_eq!(at.read("x0a"), "90\n91\n92\n93\n94\n95\n96\n97\n98\n"); + assert_eq!(at.read("x0b"), "99\n"); +} + +/// Test for long hex suffix not having any value +#[test] +fn test_hex_suffix_no_value() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-l", "9", "--hex-suffixes", "onehundredlines.txt"]) + .succeeds() + .no_stdout() + .no_stderr(); + assert_eq!(at.read("x00"), "00\n01\n02\n03\n04\n05\n06\n07\n08\n"); + assert_eq!(at.read("x01"), "09\n10\n11\n12\n13\n14\n15\n16\n17\n"); + assert_eq!(at.read("x02"), "18\n19\n20\n21\n22\n23\n24\n25\n26\n"); + assert_eq!(at.read("x03"), "27\n28\n29\n30\n31\n32\n33\n34\n35\n"); + assert_eq!(at.read("x04"), "36\n37\n38\n39\n40\n41\n42\n43\n44\n"); + assert_eq!(at.read("x05"), "45\n46\n47\n48\n49\n50\n51\n52\n53\n"); + assert_eq!(at.read("x06"), "54\n55\n56\n57\n58\n59\n60\n61\n62\n"); + assert_eq!(at.read("x07"), "63\n64\n65\n66\n67\n68\n69\n70\n71\n"); + assert_eq!(at.read("x08"), "72\n73\n74\n75\n76\n77\n78\n79\n80\n"); + assert_eq!(at.read("x09"), "81\n82\n83\n84\n85\n86\n87\n88\n89\n"); + assert_eq!(at.read("x0a"), "90\n91\n92\n93\n94\n95\n96\n97\n98\n"); + assert_eq!(at.read("x0b"), "99\n"); +} + +/// Test for short numeric suffix having value provided after space - should fail +#[test] +fn test_short_numeric_suffix_with_value_spaced() { + new_ucmd!() + .args(&["-n", "4", "-d", "9", "threebytes.txt"]) + .fails() + .stderr_contains("split: cannot open '9' for reading: No such file or directory"); +} + +/// Test for short numeric suffix having value provided after space - should fail +#[test] +fn test_short_hex_suffix_with_value_spaced() { + new_ucmd!() + .args(&["-n", "4", "-x", "9", "threebytes.txt"]) + .fails() + .stderr_contains("split: cannot open '9' for reading: No such file or directory"); +} + +/// Test for some combined short options +#[test] +fn test_short_combination() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-dxen", "4", "threebytes.txt"]) + .succeeds() + .no_stdout() + .no_stderr(); + assert_eq!(at.read("x00"), "a"); + assert_eq!(at.read("x01"), "b"); + assert_eq!(at.read("x02"), "c"); + assert_eq!(at.file_exists("x03"), false); +} + +/// Test for the last effective suffix, ignoring all others - numeric long last +/// Any combination of short and long (as well as duplicates) should be allowed +#[test] +fn test_effective_suffix_numeric_last() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&[ + "-n", + "4", + "--numeric-suffixes=7", + "--hex-suffixes=4", + "-d", + "-x", + "--numeric-suffixes=9", + "threebytes.txt", + ]) + .succeeds() + .no_stdout() + .no_stderr(); + assert_eq!(at.read("x09"), "a"); + assert_eq!(at.read("x10"), "b"); + assert_eq!(at.read("x11"), "c"); + assert_eq!(at.read("x12"), ""); +} + +/// Test for the last effective suffix, ignoring all others - hex long last +/// Any combination of short and long (as well as duplicates) should be allowed +#[test] +fn test_effective_suffix_hex_last() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&[ + "-n", + "4", + "--hex-suffixes=7", + "--numeric-suffixes=4", + "-x", + "-d", + "--hex-suffixes=9", + "threebytes.txt", + ]) + .succeeds() + .no_stdout() + .no_stderr(); + assert_eq!(at.read("x09"), "a"); + assert_eq!(at.read("x0a"), "b"); + assert_eq!(at.read("x0b"), "c"); + assert_eq!(at.read("x0c"), ""); +} + #[test] fn test_round_robin() { let (at, mut ucmd) = at_and_ucmd!(); diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index d932b35d6..e918d54e9 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use crate::common::util::{expected_result, TestScenario}; diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 75abb8eb6..bc89f56a0 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) abcdefghijklmnopqrstuvwxyz efghijklmnopqrstuvwxyz vwxyz emptyfile file siette ocho nueve diez MULT // spell-checker:ignore (libs) kqueue diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 91af9033a..2f36a805c 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -1,9 +1,7 @@ -// // This file is part of the uutils coreutils package. // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// // spell-checker:ignore (words) egid euid pseudofloat diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 7a0bac6e9..972b4fc5b 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (words) RFILE diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 31b46c3bf..3bacc38c1 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (flags) runlevel mesg diff --git a/tests/by-util/test_whoami.rs b/tests/by-util/test_whoami.rs index 9e6c35be6..d32c4ec24 100644 --- a/tests/by-util/test_whoami.rs +++ b/tests/by-util/test_whoami.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. #[cfg(unix)] use crate::common::util::expected_result; diff --git a/tests/common/macros.rs b/tests/common/macros.rs index 4f5965d5a..4902ca49b 100644 --- a/tests/common/macros.rs +++ b/tests/common/macros.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. /// Platform-independent helper for constructing a `PathBuf` from individual elements #[macro_export] diff --git a/tests/common/random.rs b/tests/common/random.rs index bf1e6a907..42b6eaa77 100644 --- a/tests/common/random.rs +++ b/tests/common/random.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use rand::distributions::{Distribution, Uniform}; use rand::{thread_rng, Rng}; diff --git a/tests/common/util.rs b/tests/common/util.rs index 8ef5f517a..0fbc58cd5 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,7 +1,7 @@ -// * This file is part of the uutils coreutils package. -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. //spell-checker: ignore (linux) rlimit prlimit coreutil ggroups uchild uncaptured scmd SHLVL canonicalized diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 57764ed50..a6d8de29e 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -150,33 +150,33 @@ grep -rl 'path_prepend_' tests/* | xargs sed -i 's| path_prepend_ ./src||' # Remove tests checking for --version & --help # Not really interesting for us and logs are too big sed -i -e '/tests\/misc\/invalid-opt.pl/ D' \ - -e '/tests\/misc\/help-version.sh/ D' \ - -e '/tests\/misc\/help-version-getopt.sh/ D' \ + -e '/tests\/help\/help-version.sh/ D' \ + -e '/tests\/help\/help-version-getopt.sh/ D' \ Makefile # logs are clotted because of this test -sed -i -e '/tests\/misc\/seq-precision.sh/ D' \ +sed -i -e '/tests\/seq\/seq-precision.sh/ D' \ Makefile # printf doesn't limit the values used in its arg, so this produced ~2GB of output -sed -i '/INT_OFLOW/ D' tests/misc/printf.sh +sed -i '/INT_OFLOW/ D' tests/printf/printf.sh # Use the system coreutils where the test fails due to error in a util that is not the one being tested -sed -i 's|stat|/usr/bin/stat|' tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh +sed -i 's|stat|/usr/bin/stat|' tests/touch/60-seconds.sh tests/sort/sort-compress-proc.sh sed -i 's|ls -|/usr/bin/ls -|' tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh -sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/mv/i-2.sh tests/misc/shuf.sh -sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh -sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh -sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh +sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/tail/tail-n0f.sh tests/cp/fail-perm.sh tests/mv/i-2.sh tests/shuf/shuf.sh +sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/test/test-N.sh +sed -i 's|split |/usr/bin/split |' tests/factor/factor-parallel.sh +sed -i 's|id -|/usr/bin/id -|' tests/runcon/runcon-no-reorder.sh # tests/ls/abmon-align.sh - https://github.com/uutils/coreutils/issues/3505 -sed -i 's|touch |/usr/bin/touch |' tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh tests/ls/abmon-align.sh +sed -i 's|touch |/usr/bin/touch |' tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/mv/update.sh tests/ls/ls-time.sh tests/stat/stat-nanoseconds.sh tests/misc/time-style.sh tests/test/test-N.sh tests/ls/abmon-align.sh sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh sed -i 's|cp |/usr/bin/cp |' tests/mv/hard-2.sh -sed -i 's|paste |/usr/bin/paste |' tests/misc/od-endian.sh -sed -i 's|timeout |'"${SYSTEM_TIMEOUT}"' |' tests/tail-2/follow-stdin.sh +sed -i 's|paste |/usr/bin/paste |' tests/od/od-endian.sh +sed -i 's|timeout |'"${SYSTEM_TIMEOUT}"' |' tests/tail/follow-stdin.sh # Add specific timeout to tests that currently hang to limit time spent waiting -sed -i 's|\(^\s*\)seq \$|\1'"${SYSTEM_TIMEOUT}"' 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh +sed -i 's|\(^\s*\)seq \$|\1'"${SYSTEM_TIMEOUT}"' 0.1 seq \$|' tests/seq/seq-precision.sh tests/seq/seq-long-double.sh # Remove dup of /usr/bin/ and /usr/local/bin/ when executed several times grep -rlE '/usr/bin/\s?/usr/bin' init.cfg tests/* | xargs --no-run-if-empty sed -Ei 's|/usr/bin/\s?/usr/bin/|/usr/bin/|g' @@ -202,7 +202,7 @@ sed -i -e "s|rm: cannot remove 'rel': Permission denied|rm: cannot remove 'rel': # overlay-headers.sh test intends to check for inotify events, # however there's a bug because `---dis` is an alias for: `---disable-inotify` -sed -i -e "s|---dis ||g" tests/tail-2/overlay-headers.sh +sed -i -e "s|---dis ||g" tests/tail/overlay-headers.sh test -f "${UU_BUILD_DIR}/getlimits" || cp src/getlimits "${UU_BUILD_DIR}" @@ -259,11 +259,11 @@ sed -i -e "s/Try 'mv --help' for more information/For more information, try '--h # GNU doesn't support width > INT_MAX # disable these test cases -sed -i -E "s|^([^#]*2_31.*)$|#\1|g" tests/misc/printf-cov.pl +sed -i -E "s|^([^#]*2_31.*)$|#\1|g" tests/printf/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/misc/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/help/help-version-getopt.sh