1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 12:37:49 +00:00

Merge branch 'main' into zhitkoff/issue5193

This commit is contained in:
Yury Zhytkou 2023-08-30 11:12:04 -04:00 committed by GitHub
commit 009ed90cd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
181 changed files with 1046 additions and 934 deletions

View file

@ -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: |

View file

@ -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:

View file

@ -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

22
Cargo.lock generated
View file

@ -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"

View file

@ -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"

View file

@ -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;

View file

@ -6,7 +6,9 @@
"path_prefix": "coreutils"
},
"components": {
"changelog": true
"changelog": {
"read_changelog_file": false
}
},
"styles": {
"theme": "light",

View file

@ -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};

View file

@ -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};

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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<File>),
@ -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);

View file

@ -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<Path> {
// 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()

View file

@ -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());

View file

@ -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;

View file

@ -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};

View file

@ -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")]

View file

@ -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;

View file

@ -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

View file

@ -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.

View file

@ -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<Num, ParseError> {
fn parse_n(val: &str) -> Result<Num, ParseError> {
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<usize, ParseError> {
fn parse_bytes(arg: &str, val: &str) -> Result<usize, ParseError> {
parse_bytes_with_opt_multiplier(val)?
.try_into()
.map_err(|_| ParseError::BsOutOfRange(arg.to_string()))
}
fn parse_status_level(&self, val: &str) -> Result<StatusLevel, ParseError> {
fn parse_status_level(val: &str) -> Result<StatusLevel, ParseError> {
match val {
"none" => Ok(StatusLevel::None),
"noxfer" => Ok(StatusLevel::Noxfer),

View file

@ -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.
//!

View file

@ -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;

View file

@ -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};

View file

@ -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;

View file

@ -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

View file

@ -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.
//!

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) gmnsii <gmnsii@protonmail.com>
// *
// * 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;

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Derek Chiang <derekchiang93@gmail.com>
// *
// * 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;

View file

@ -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.

View file

@ -1,9 +1,7 @@
//* This file is part of the uutils coreutils package.
//*
//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
//*
//* 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::{

View file

@ -1,9 +1,7 @@
//* This file is part of the uutils coreutils package.
//*
//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
//*
//* 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.

View file

@ -1,9 +1,7 @@
//* This file is part of the uutils coreutils package.
//*
//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
//*
//* 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:

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) kwantam <kwantam@gmail.com>
// *
// * 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 <kwantam@gmail.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) kwantam <kwantam@gmail.com>
// *
// * 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

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2014 T. Jameson Little <t.jameson.little@gmail.com>
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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;

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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<Exponent> 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);
}

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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<A: Arithmetic + Basis>(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;

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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;

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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;

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2020 Alex Lyon <arcterus@mail.com>
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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::*;

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2020 Alex Lyon <arcterus@mail.com>
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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},

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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;

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2015 kwantam <kwantam@gmail.com>
// * (c) 2020 nicoo <nicoo@debian.org>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Jordi Boggiano <j.boggiano@seld.be>
// *
// * 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};

View file

@ -1,9 +1,7 @@
// * This file is part of `fmt` from the uutils coreutils package.
// *
// * (c) kwantam <kwantam@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of `fmt` from the uutils coreutils package.
// *
// * (c) kwantam <kwantam@gmail.com>
// *
// * 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<Item = &'a WordInfo<'a>>>(
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

View file

@ -1,9 +1,7 @@
// * This file is part of `fmt` from the uutils coreutils package.
// *
// * (c) kwantam <kwantam@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon <arcterus@mail.com>
// *
// * 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

View file

@ -1,11 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon <arcterus@mail.com>
// * (c) Vsevolod Velichko <torkvemada@sorokdva.net>
// * (c) Gil Cottle <gcottle@redtown.org>
// *
// * 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 {

View file

@ -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

View file

@ -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};

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Maciej Dziardziel <fiedzia@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alan Andrade <alan.andradec@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Ben Eills <ben@beneills.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Konstantin Pospelov <kupospelov@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Maciej Dziardziel <fiedzia@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Gehring <mg@ebfe.org>
// *
// * 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;

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Joseph Crail <jbcrail@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Benoit Benedetti <benoit.benedetti@gmail.com>
// *
// * 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 */

View file

@ -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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Nicholas Juszczak <juszczakn@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Gehring <mg@ebfe.org>
// *
// * 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;

View file

@ -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',

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Martin Kysel <code@martinkysel.com>
// *
// * 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

View file

@ -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};

View file

@ -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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon <arcterus@mail.com>
// *
// * 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

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Tobias Bohumir Schottdorf <tobias.schottdorf@gmail.com>
// *
// * 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;

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Gehring <mg@ebfe.org>
// *
// * 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

View file

@ -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,

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Yury Krivopalov <ykrivopalov@yandex.ru>
// *
// * 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;

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Ben Hirsch <benhirsch24@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon <arcterus@mail.com>
// *
// * 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

View file

@ -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 <inokentiy.babushkin@googlemail.com>
// *
// * 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;

View file

@ -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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Jordi Boggiano <j.boggiano@seld.be>
// *
// * 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 */

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Dorota Kapturkiewicz <dokaptur@gmail.com>
// *
// * 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<WordRef> = 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");

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Derek Chiang <derekchiang93@gmail.com>
// *
// * 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};

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Haitao Li <lihaitao@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
// *
// * 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

61
src/uu/rm/BENCHMARKING.md Normal file
View file

@ -0,0 +1,61 @@
<!-- spell-checker:ignore samply flamegraph flamegraphs -->
# 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]
```

8
src/uu/rm/benchmark.sh Executable file
View file

@ -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"

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon <arcterus@mail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon <arcterus@mail.com>
// *
// * 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

View file

@ -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;

View file

@ -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;

View file

@ -1,10 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Rosenberg <42micro@gmail.com>
// * (c) Fort <forticulous@gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon <arcterus@mail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon <arcterus@mail.com>
// *
// * 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;

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Debertol <michael.debertol..AT..gmail.com>
// *
// * 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

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Debertol <michael.debertol..AT..gmail.com>
// *
// * 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.

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Debertol <michael.debertol..AT..gmail.com>
// *
// * 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.
//!

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Debertol <michael.debertol..AT..gmail.com>
// *
// * 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.
//!

View file

@ -1,9 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Debertol <michael.debertol..AT..gmail.com>
// *
// * 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.
//!

View file

@ -1,11 +1,7 @@
// * This file is part of the uutils coreutils package.
// *
// * (c) Michael Yin <mikeyin@mikeyin.org>
// * (c) Robert Swinford <robert.swinford..AT..gmail.com>
// * (c) Michael Debertol <michael.debertol..AT..gmail.com>
// *
// * 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

Some files were not shown because too many files have changed in this diff Show more