From ce377760bac5d8c2421d2f9a2c344f0f33bb1d46 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 27 Apr 2024 00:55:22 +0000 Subject: [PATCH 01/29] chore(deps): update rust crate unicode-width to 0.1.12 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e77169a2327..b0d6db60997 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2292,9 +2292,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "unicode-xid" diff --git a/Cargo.toml b/Cargo.toml index a36581c449b..3e83d86485d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -327,7 +327,7 @@ textwrap = { version = "0.16.1", features = ["terminal_size"] } thiserror = "1.0" time = { version = "0.3" } unicode-segmentation = "1.11.0" -unicode-width = "0.1.11" +unicode-width = "0.1.12" utf-8 = "0.7.6" walkdir = "2.5" winapi-util = "0.1.8" From d5b79329ad8fccf618c20ddfcba523ad651f05b2 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 27 Apr 2024 16:12:01 +0200 Subject: [PATCH 02/29] tests: fix multi-call test precondition This bug was introduced in de37baaf839bb41e2d388d4eb42a3e486458df1c. --- tests/test_util_name.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_util_name.rs b/tests/test_util_name.rs index 9fcd2e5710f..db4537e2ad8 100644 --- a/tests/test_util_name.rs +++ b/tests/test_util_name.rs @@ -194,6 +194,7 @@ fn util_invalid_name_invalid_command() { } #[test] +#[cfg(feature = "true")] fn util_completion() { use std::{ io::Write, @@ -222,6 +223,7 @@ fn util_completion() { } #[test] +#[cfg(feature = "true")] fn util_manpage() { use std::{ io::Write, From 5ee9c69f59e7bb345e93dec58c37b8feb24d7126 Mon Sep 17 00:00:00 2001 From: Darius Carrier Date: Sat, 27 Apr 2024 08:33:45 -0700 Subject: [PATCH 03/29] kill: adding support for handling SIGEXIT (#6269) kill: convert SIGEXT (0) to None so nix takes correct action --- src/uu/kill/src/kill.rs | 20 +++++++++++++++----- tests/by-util/test_kill.rs | 10 ++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 632055b8003..5446a7f1826 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -11,7 +11,7 @@ use nix::unistd::Pid; use std::io::Error; use uucore::display::Quotable; use uucore::error::{FromIo, UResult, USimpleError}; -use uucore::signals::{signal_by_name_or_value, ALL_SIGNALS}; +use uucore::signals::{signal_by_name_or_value, signal_name_by_value, ALL_SIGNALS}; use uucore::{format_usage, help_about, help_usage, show}; static ABOUT: &str = help_about!("kill.md"); @@ -60,9 +60,19 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } else { 15_usize //SIGTERM }; - let sig: Signal = (sig as i32) - .try_into() - .map_err(|e| std::io::Error::from_raw_os_error(e as i32))?; + + let sig_name = signal_name_by_value(sig); + // Signal does not support converting from EXIT + // Instead, nix::signal::kill expects Option::None to properly handle EXIT + let sig: Option = if sig_name.is_some_and(|name| name == "EXIT") { + None + } else { + let sig = (sig as i32) + .try_into() + .map_err(|e| std::io::Error::from_raw_os_error(e as i32))?; + Some(sig) + }; + let pids = parse_pids(&pids_or_signals)?; if pids.is_empty() { Err(USimpleError::new( @@ -211,7 +221,7 @@ fn parse_pids(pids: &[String]) -> UResult> { .collect() } -fn kill(sig: Signal, pids: &[i32]) { +fn kill(sig: Option, pids: &[i32]) { for &pid in pids { if let Err(e) = signal::kill(Pid::from_raw(pid), sig) { show!(Error::from_raw_os_error(e as i32) diff --git a/tests/by-util/test_kill.rs b/tests/by-util/test_kill.rs index a664ff00979..90adf5f2995 100644 --- a/tests/by-util/test_kill.rs +++ b/tests/by-util/test_kill.rs @@ -288,3 +288,13 @@ fn test_kill_no_pid_provided() { .fails() .stderr_contains("no process ID specified"); } + +#[test] +fn test_kill_with_signal_exit_new_form() { + let target = Target::new(); + new_ucmd!() + .arg("-s") + .arg("EXIT") + .arg(format!("{}", target.pid())) + .succeeds(); +} From dcf7a50392d25e77d26fe572026f5d39da58b727 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 28 Apr 2024 09:21:27 +0000 Subject: [PATCH 04/29] fix(deps): update rust crate data-encoding to 2.6 --- Cargo.lock | 4 ++-- src/uucore/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0d6db60997..4a5c186271b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -710,9 +710,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "data-encoding-macro" diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index b13903bc6af..ed2b66fe5f0 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -34,7 +34,7 @@ time = { workspace = true, optional = true, features = [ "macros", ] } # * "problem" dependencies (pinned) -data-encoding = { version = "2.5", optional = true } +data-encoding = { version = "2.6", optional = true } data-encoding-macro = { version = "0.1.14", optional = true } z85 = { version = "3.0.5", optional = true } libc = { workspace = true, optional = true } From 9e52aa0cb185646dcb66ce31bb93434321122ee2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 28 Apr 2024 10:39:08 +0000 Subject: [PATCH 05/29] fix(deps): update rust crate data-encoding-macro to 0.1.15 --- Cargo.lock | 8 ++++---- src/uucore/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a5c186271b..035e3f03ccf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -716,9 +716,9 @@ checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "data-encoding-macro" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c01c06f5f429efdf2bae21eb67c28b3df3cf85b7dd2d8ef09c0838dac5d33e" +checksum = "f1559b6cba622276d6d63706db152618eeb15b89b3e4041446b05876e352e639" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -726,9 +726,9 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0047d07f2c89b17dd631c80450d69841a6b5d7fb17278cbc43d7e4cfcf2576f3" +checksum = "332d754c0af53bc87c108fed664d121ecf59207ec4196041f04d6ab9002ad33f" dependencies = [ "data-encoding", "syn 1.0.109", diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index ed2b66fe5f0..2caf3ce4289 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -35,7 +35,7 @@ time = { workspace = true, optional = true, features = [ ] } # * "problem" dependencies (pinned) data-encoding = { version = "2.6", optional = true } -data-encoding-macro = { version = "0.1.14", optional = true } +data-encoding-macro = { version = "0.1.15", optional = true } z85 = { version = "3.0.5", optional = true } libc = { workspace = true, optional = true } once_cell = { workspace = true } From 3637e0897cde3d081d3ec8de5a7a96dd313a1d92 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 28 Apr 2024 17:04:27 +0200 Subject: [PATCH 06/29] Bump bigdecimal from 0.4.0 to 0.4.2 --- Cargo.lock | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 035e3f03ccf..37f1fe2e6c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,10 +120,11 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bigdecimal" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5274a6b6e0ee020148397245b973e30163b7bffbc6d473613f850cb99888581e" +checksum = "c06619be423ea5bb86c95f087d5707942791a08a85530df0db2209a3ecfb8bc9" dependencies = [ + "autocfg", "libm", "num-bigint", "num-integer", From 73db512ab5b3fd26ad74947967b148faab8d32b6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 28 Apr 2024 18:19:14 +0000 Subject: [PATCH 07/29] chore(deps): update rust crate zip to 1.1.2 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 37f1fe2e6c1..18eeea0553f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3751,9 +3751,9 @@ checksum = "2a599daf1b507819c1121f0bf87fa37eb19daac6aff3aefefd4e6e2e0f2020fc" [[package]] name = "zip" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2655979068a1f8fa91cb9e8e5b9d3ee54d18e0ddc358f2f4a395afc0929a84b" +checksum = "2a23468b4a7a4e9e1e62812f8d1dd614f67f148e2b3faa72f4843bf00b573fd7" dependencies = [ "arbitrary", "byteorder", diff --git a/Cargo.toml b/Cargo.toml index 3e83d86485d..8eea36bd3c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -333,7 +333,7 @@ walkdir = "2.5" winapi-util = "0.1.8" windows-sys = { version = "0.48.0", default-features = false } xattr = "1.3.1" -zip = { version = "1.1.1", default-features = false, features = ["deflate"] } +zip = { version = "1.1.2", default-features = false, features = ["deflate"] } hex = "0.4.3" md-5 = "0.10.6" From ebb21d0bdf8e7bf1c35191ca968ad083beab3373 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sun, 28 Apr 2024 21:42:32 +0200 Subject: [PATCH 08/29] od+tests: use TestScenario, avoid spamming /tmp on failure --- tests/by-util/test_od.rs | 116 ++++++++++----------------------------- 1 file changed, 30 insertions(+), 86 deletions(-) diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index 569d096c172..9b2fefd042e 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -6,23 +6,15 @@ // spell-checker:ignore abcdefghijklmnopqrstuvwxyz use crate::common::util::TestScenario; -use std::env; -use std::fs::remove_file; -use std::fs::File; -use std::io::Write; -use std::path::Path; use unindent::unindent; -// octal dump of 'abcdefghijklmnopqrstuvwxyz\n' // spell-checker:disable-line +// octal dump of 'abcdefghijklmnopqrstuvwxyz\n' static ALPHA_OUT: &str = " 0000000 061141 062143 063145 064147 065151 066153 067155 070157 0000020 071161 072163 073165 074167 075171 000012 0000033 "; -// XXX We could do a better job of ensuring that we have a fresh temp dir to ourselves, -// not a general one full of other process leftovers. - #[test] fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails().code_is(1); @@ -31,96 +23,58 @@ fn test_invalid_arg() { // Test that od can read one file and dump with default format #[test] fn test_file() { - // TODO: Can this be replaced by AtPath? - use std::env; - let temp = env::temp_dir(); - let tmpdir = Path::new(&temp); - let file = tmpdir.join("test"); - - { - let mut f = File::create(&file).unwrap(); - // spell-checker:disable-next-line - assert!( - f.write_all(b"abcdefghijklmnopqrstuvwxyz\n").is_ok(), - "Test setup failed - could not write file" - ); - } - - new_ucmd!() + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.write("test", "abcdefghijklmnopqrstuvwxyz\n"); + scene + .ucmd() .arg("--endian=little") - .arg(file.as_os_str()) + .arg("test") .succeeds() .no_stderr() .stdout_is(unindent(ALPHA_OUT)); - - new_ucmd!() + scene + .ucmd() .arg("--endian=littl") // spell-checker:disable-line - .arg(file.as_os_str()) + .arg("test") .succeeds() .no_stderr() .stdout_is(unindent(ALPHA_OUT)); - - new_ucmd!() + scene + .ucmd() .arg("--endian=l") - .arg(file.as_os_str()) + .arg("test") .succeeds() .no_stderr() .stdout_is(unindent(ALPHA_OUT)); - // Ensure that default format matches `-t o2`, and that `-t` does not absorb file argument - new_ucmd!() + scene + .ucmd() .arg("--endian=little") .arg("-t") .arg("o2") - .arg(file.as_os_str()) - .succeeds() - .no_stderr() - .stdout_is(unindent(ALPHA_OUT)); - - let _ = remove_file(file); + .arg("test"); } // Test that od can read 2 files and concatenate the contents #[test] fn test_2files() { - let temp = env::temp_dir(); - let tmpdir = Path::new(&temp); - let file1 = tmpdir.join("test1"); - let file2 = tmpdir.join("test2"); - - for (n, a) in [(1, "a"), (2, "b")] { - println!("number: {n} letter:{a}"); - } - - // spell-checker:disable-next-line - for (path, data) in [(&file1, "abcdefghijklmnop"), (&file2, "qrstuvwxyz\n")] { - let mut f = File::create(path).unwrap(); - assert!( - f.write_all(data.as_bytes()).is_ok(), - "Test setup failed - could not write file" - ); - } - - new_ucmd!() - .arg("--endian=little") - .arg(file1.as_os_str()) - .arg(file2.as_os_str()) + let (at, mut ucmd) = at_and_ucmd!(); + at.write("test1", "abcdefghijklmnop"); // spell-checker:disable-line + at.write("test2", "qrstuvwxyz\n"); // spell-checker:disable-line + ucmd.arg("--endian=little") + .arg("test1") + .arg("test2") .succeeds() .no_stderr() .stdout_is(unindent(ALPHA_OUT)); - // TODO: Handle errors? - let _ = remove_file(file1); - let _ = remove_file(file2); } // Test that od gives non-0 exit val for filename that doesn't exist. #[test] fn test_no_file() { - let temp = env::temp_dir(); - let tmpdir = Path::new(&temp); - let file = tmpdir.join("}surely'none'would'thus'a'file'name"); // spell-checker:disable-line - - new_ucmd!().arg(file.as_os_str()).fails(); + let (_at, mut ucmd) = at_and_ucmd!(); + ucmd.arg("}surely'none'would'thus'a'file'name").fails(); // spell-checker:disable-line } // Test that od reads from stdin instead of a file @@ -138,26 +92,16 @@ fn test_from_stdin() { // Test that od reads from stdin and also from files #[test] fn test_from_mixed() { - let temp = env::temp_dir(); - let tmpdir = Path::new(&temp); - let file1 = tmpdir.join("test-1"); - let file3 = tmpdir.join("test-3"); - + let (at, mut ucmd) = at_and_ucmd!(); // spell-checker:disable-next-line let (data1, data2, data3) = ("abcdefg", "hijklmnop", "qrstuvwxyz\n"); - for (path, data) in [(&file1, data1), (&file3, data3)] { - let mut f = File::create(path).unwrap(); - assert!( - f.write_all(data.as_bytes()).is_ok(), - "Test setup failed - could not write file" - ); - } + at.write("test-1", data1); + at.write("test-3", data3); - new_ucmd!() - .arg("--endian=little") - .arg(file1.as_os_str()) + ucmd.arg("--endian=little") + .arg("test-1") .arg("-") - .arg(file3.as_os_str()) + .arg("test-3") .run_piped_stdin(data2.as_bytes()) .success() .no_stderr() From e978fe538276ffcf4b7a10dafc47d01fd3c9e29d Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sun, 28 Apr 2024 22:39:14 +0200 Subject: [PATCH 09/29] id: permit repeated flags --- src/uu/id/src/id.rs | 1 + tests/by-util/test_id.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index b8fb51d79db..fe605a33c4e 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -324,6 +324,7 @@ pub fn uu_app() -> Command { .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .args_override_self(true) .arg( Arg::new(options::OPT_AUDIT) .short('A') diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 5c2a67199c6..e51f3e5427e 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -327,6 +327,11 @@ fn test_id_default_format() { .args(&args) .succeeds() .stdout_only(unwrap_or_return!(expected_result(&ts, &args)).stdout_str()); + let args = [opt2, opt2]; + ts.ucmd() + .args(&args) + .succeeds() + .stdout_only(unwrap_or_return!(expected_result(&ts, &args)).stdout_str()); } } From 4f5a3b47161df72546c7cf8d5e0f5ef60bfdb294 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sun, 28 Apr 2024 23:05:43 +0200 Subject: [PATCH 10/29] id: mark passwd-format and pretty-print as conflicting These are non-sensical to combine, and didn't work reasonably anyway. Also, passwd-formatting is our own extension, so there is no need for compatibility anyway. --- src/uu/id/src/id.rs | 1 + tests/by-util/test_id.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index fe605a33c4e..e803708bdce 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -397,6 +397,7 @@ pub fn uu_app() -> Command { Arg::new(options::OPT_PASSWORD) .short('P') .help("Display the id as a password file entry.") + .conflicts_with(options::OPT_HUMAN_READABLE) .action(ArgAction::SetTrue), ) .arg( diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index e51f3e5427e..070ed011e26 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -461,3 +461,16 @@ fn test_id_no_specified_user_posixly() { } } } + +#[test] +#[cfg(all(unix, not(target_os = "android")))] +fn test_id_pretty_print_password_record() { + // `-p` is BSD only and not supported on GNU's `id`. + // `-P` is our own extension, and not supported by either GNU nor BSD. + // These must conflict, because they both set the output format. + new_ucmd!() + .arg("-p") + .arg("-P") + .fails() + .stderr_contains("the argument '-p' cannot be used with '-P'"); +} From 174c842337e617b1a9434504a6a609e742f5f1f7 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 29 Apr 2024 10:38:18 +0200 Subject: [PATCH 11/29] docs: describe extensions of id (#6289) --- docs/src/extensions.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/src/extensions.md b/docs/src/extensions.md index 2319b2a6f1a..61c25ba48be 100644 --- a/docs/src/extensions.md +++ b/docs/src/extensions.md @@ -82,3 +82,10 @@ We support `--sort=name`, which makes it possible to override an earlier value. `du` allows `birth` and `creation` as values for the `--time` argument to show the creation time. It also provides a `-v`/`--verbose` flag. + +## `id` + +`id` has three additional flags: +* `-P` displays the id as a password file entry +* `-p` makes the output human-readable +* `-A` displays the process audit user ID From 19262aabe56df05f17bfd510d26d59f866dea9c5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:05:14 +0000 Subject: [PATCH 12/29] chore(deps): update rust crate libc to 0.2.154 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18eeea0553f..deb3e003a88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1245,9 +1245,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libloading" diff --git a/Cargo.toml b/Cargo.toml index 8eea36bd3c9..365c7d946ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -288,7 +288,7 @@ half = "2.4" hostname = "0.4" indicatif = "0.17" itertools = "0.12.1" -libc = "0.2.153" +libc = "0.2.154" lscolors = { version = "0.16.0", default-features = false, features = [ "gnu_legacy", ] } From ee4392e30cfdcd4c464b0faa0af1ed79d8c0a752 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Tue, 30 Apr 2024 10:04:14 +0200 Subject: [PATCH 13/29] sort: disable clippy::suspicious_open_options on OpenBSD - Avoid error on OpenBSD stable/7.5 with clippy (lint) - suspicious_open_options added in Rust 1.77.0 (1.76 used on OpenBSD 7.5) https://rust-lang.github.io/rust-clippy/master/index.html#/suspicious_open_options Fix uutils/coreutils#6290 Signed-off-by: Laurent Cheylus --- src/uu/sort/src/sort.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 1bc413aaac2..1aaa6442495 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -252,7 +252,9 @@ impl Output { let file = if let Some(name) = name { // This is different from `File::create()` because we don't truncate the output yet. // This allows using the output file as an input file. - #[allow(clippy::suspicious_open_options)] + // clippy::suspicious_open_options supported only for Rust >= 1.77.0 + // Rust version = 1.76 on OpenBSD stable/7.5 + #[cfg_attr(not(target_os = "openbsd"), allow(clippy::suspicious_open_options))] let file = OpenOptions::new() .write(true) .create(true) From 96ed764fdad4e10b587fad4d8ed5b24df8f1cb43 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 30 Apr 2024 16:22:49 +0200 Subject: [PATCH 14/29] cp: remove panics in tests --- tests/by-util/test_cp.rs | 559 +++++++++++++-------------------------- 1 file changed, 186 insertions(+), 373 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 7bed1072298..c9bb003bc28 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -3402,29 +3402,23 @@ fn test_cp_archive_on_directory_ending_dot() { #[test] #[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))] fn test_cp_debug_default() { + #[cfg(target_os = "macos")] + let expected = "copy offload: unknown, reflink: unsupported, sparse detection: unsupported"; + #[cfg(target_os = "linux")] + let expected = "copy offload: unknown, reflink: unsupported, sparse detection: no"; + #[cfg(windows)] + let expected = "copy offload: unsupported, reflink: unsupported, sparse detection: unsupported"; + let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts.ucmd().arg("--debug").arg("a").arg("b").succeeds(); - let stdout_str = result.stdout_str(); - #[cfg(target_os = "macos")] - if !stdout_str - .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") - { - panic!("Failure: stdout was \n{stdout_str}"); - } - #[cfg(target_os = "linux")] - if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } - - #[cfg(windows)] - if !stdout_str - .contains("copy offload: unsupported, reflink: unsupported, sparse detection: unsupported") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + ts.ucmd() + .arg("--debug") + .arg("a") + .arg("b") + .succeeds() + .stdout_contains(expected); } #[test] @@ -3436,6 +3430,7 @@ fn test_cp_debug_multiple_default() { at.touch("a"); at.touch("b"); at.mkdir(dir); + let result = ts .ucmd() .arg("--debug") @@ -3444,62 +3439,15 @@ fn test_cp_debug_multiple_default() { .arg(dir) .succeeds(); - let stdout_str = result.stdout_str(); - #[cfg(target_os = "macos")] - { - if !stdout_str - .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") - { - panic!("Failure: stdout was \n{stdout_str}"); - } - - // two files, two occurrences - assert_eq!( - result - .stdout_str() - .matches( - "copy offload: unknown, reflink: unsupported, sparse detection: unsupported" - ) - .count(), - 2 - ); - } - + let expected = "copy offload: unknown, reflink: unsupported, sparse detection: unsupported"; #[cfg(target_os = "linux")] - { - if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") - { - panic!("Failure: stdout was \n{stdout_str}"); - } - - // two files, two occurrences - assert_eq!( - result - .stdout_str() - .matches("copy offload: unknown, reflink: unsupported, sparse detection: no") - .count(), - 2 - ); - } - - #[cfg(target_os = "windows")] - { - if !stdout_str.contains( - "copy offload: unsupported, reflink: unsupported, sparse detection: unsupported", - ) { - panic!("Failure: stdout was \n{stdout_str}"); - } + let expected = "copy offload: unknown, reflink: unsupported, sparse detection: no"; + #[cfg(windows)] + let expected = "copy offload: unsupported, reflink: unsupported, sparse detection: unsupported"; - // two files, two occurrences - assert_eq!( - result - .stdout_str() - .matches("copy offload: unsupported, reflink: unsupported, sparse detection: unsupported") - .count(), - 2 - ); - } + // two files, two occurrences + assert_eq!(result.stdout_str().matches(expected).count(), 2); } #[test] @@ -3508,19 +3456,15 @@ fn test_cp_debug_sparse_reflink() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--sparse=always") .arg("--reflink=never") .arg("a") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: zeros") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: zeros"); } #[test] @@ -3544,18 +3488,14 @@ fn test_cp_debug_sparse_always() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--sparse=always") .arg("a") .arg("b") - .succeeds(); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros"); } #[test] @@ -3564,17 +3504,14 @@ fn test_cp_debug_sparse_never() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--sparse=never") .arg("a") .arg("b") - .succeeds(); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: no"); } #[test] @@ -3593,63 +3530,40 @@ fn test_cp_debug_sparse_auto() { #[cfg(any(target_os = "linux", target_os = "macos"))] { - let result = ts - .ucmd() + #[cfg(target_os = "macos")] + let expected = "copy offload: unknown, reflink: unsupported, sparse detection: unsupported"; + #[cfg(target_os = "linux")] + let expected = "copy offload: unknown, reflink: unsupported, sparse detection: no"; + + ts.ucmd() .arg("--debug") .arg("--sparse=auto") .arg("a") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - - #[cfg(target_os = "macos")] - if !stdout_str - .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") - { - panic!("Failure: stdout was \n{stdout_str}"); - } - - #[cfg(target_os = "linux")] - if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains(expected); } } #[test] #[cfg(any(target_os = "linux", target_os = "macos"))] fn test_cp_debug_reflink_auto() { + #[cfg(target_os = "macos")] + let expected = "copy offload: unknown, reflink: unsupported, sparse detection: unsupported"; + #[cfg(target_os = "linux")] + let expected = "copy offload: unknown, reflink: unsupported, sparse detection: no"; + let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--reflink=auto") .arg("a") .arg("b") - .succeeds(); - - #[cfg(target_os = "linux")] - { - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") - { - panic!("Failure: stdout was \n{stdout_str}"); - } - } - - #[cfg(target_os = "macos")] - { - let stdout_str = result.stdout_str(); - if !stdout_str - .contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported") - { - panic!("Failure: stdout was \n{stdout_str}"); - } - } + .succeeds() + .stdout_contains(expected); } #[test] @@ -3658,19 +3572,14 @@ fn test_cp_debug_sparse_always_reflink_auto() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--sparse=always") .arg("--reflink=auto") .arg("a") .arg("b") - .succeeds(); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros"); } #[test] @@ -3678,11 +3587,10 @@ fn test_cp_only_source_no_target() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts.ucmd().arg("a").fails(); - let stderr_str = result.stderr_str(); - if !stderr_str.contains("missing destination file operand after \"a\"") { - panic!("Failure: stderr was \n{stderr_str}"); - } + ts.ucmd() + .arg("a") + .fails() + .stderr_contains("missing destination file operand after \"a\""); } #[test] @@ -3822,6 +3730,7 @@ fn test_acl_preserve() { assert!(compare_xattrs(&file, &file_target)); } + #[test] #[cfg(any(target_os = "linux", target_os = "android"))] fn test_cp_debug_reflink_never_with_hole() { @@ -3834,24 +3743,19 @@ fn test_cp_debug_reflink_never_with_hole() { .unwrap(); f.set_len(10000).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("a") .arg("b") - .succeeds(); - let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); - let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); - if dst_file_metadata.blocks() != src_file_metadata.blocks() { - panic!("File not sparsely copied"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE"); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE") { - panic!("Failure: stdout was \n{stdout_str}"); - } + let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); + let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); + assert_eq!(src_file_metadata.blocks(), dst_file_metadata.blocks()); } + #[test] #[cfg(any(target_os = "linux", target_os = "android"))] fn test_cp_debug_reflink_never_empty_file_with_hole() { @@ -3864,23 +3768,17 @@ fn test_cp_debug_reflink_never_empty_file_with_hole() { .unwrap(); f.set_len(10000).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("a") .arg("b") - .succeeds(); - let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); - let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); - if dst_file_metadata.blocks() != src_file_metadata.blocks() { - panic!("File not sparsely copied"); - } + .succeeds() + .stdout_contains("copy offload: unknown, reflink: no, sparse detection: SEEK_HOLE"); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: unknown, reflink: no, sparse detection: SEEK_HOLE") { - panic!("Failure: stdout was \n{stdout_str}"); - } + let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); + let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); + assert_eq!(src_file_metadata.blocks(), dst_file_metadata.blocks()); } #[test] @@ -3896,18 +3794,17 @@ fn test_cp_debug_default_with_hole() { f.set_len(10000).unwrap(); at.append_bytes("a", "hello".as_bytes()); - let result = ts.ucmd().arg("--debug").arg("a").arg("b").succeeds(); - let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); - let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); - if dst_file_metadata.blocks() != src_file_metadata.blocks() { - panic!("File not sparsely copied"); - } - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: yes, reflink: unsupported, sparse detection: SEEK_HOLE") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + ts.ucmd() + .arg("--debug") + .arg("a") + .arg("b") + .succeeds() + .stdout_contains("copy offload: yes, reflink: unsupported, sparse detection: SEEK_HOLE"); + + let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); + let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); + assert_eq!(src_file_metadata.blocks(), dst_file_metadata.blocks()); } #[test] @@ -3923,19 +3820,14 @@ fn test_cp_debug_default_less_than_512_bytes() { .unwrap(); f.set_len(400).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=auto") .arg("--sparse=auto") .arg("a") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: yes, reflink: unsupported, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: yes, reflink: unsupported, sparse detection: no"); } #[test] @@ -3950,13 +3842,14 @@ fn test_cp_debug_default_without_hole() { at.append_bytes("a", &filler_bytes); - let result = ts.ucmd().arg("--debug").arg("a").arg("b").succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: yes, reflink: unsupported, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + ts.ucmd() + .arg("--debug") + .arg("a") + .arg("b") + .succeeds() + .stdout_contains("copy offload: yes, reflink: unsupported, sparse detection: no"); } + #[test] #[cfg(any(target_os = "linux", target_os = "android"))] fn test_cp_debug_default_empty_file_with_hole() { @@ -3969,19 +3862,18 @@ fn test_cp_debug_default_empty_file_with_hole() { .unwrap(); f.set_len(10000).unwrap(); - let result = ts.ucmd().arg("--debug").arg("a").arg("b").succeeds(); - let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); - let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); - if dst_file_metadata.blocks() != src_file_metadata.blocks() { - panic!("File not sparsely copied"); - } + ts.ucmd() + .arg("--debug") + .arg("a") + .arg("b") + .succeeds() + .stdout_contains( + "copy offload: unknown, reflink: unsupported, sparse detection: SEEK_HOLE", + ); - let stdout_str = result.stdout_str(); - if !stdout_str - .contains("copy offload: unknown, reflink: unsupported, sparse detection: SEEK_HOLE") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); + let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); + assert_eq!(src_file_metadata.blocks(), dst_file_metadata.blocks()); } #[test] @@ -3996,25 +3888,18 @@ fn test_cp_debug_reflink_never_sparse_always_with_hole() { .unwrap(); f.set_len(10000).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("--sparse=always") .arg("a") .arg("b") - .succeeds(); - let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE + zeros"); + let src_file_metadata = std::fs::metadata(at.plus("a")).unwrap(); - if dst_file_metadata.blocks() != src_file_metadata.blocks() { - panic!("File not sparsely copied"); - } - let stdout_str = result.stdout_str(); - if !stdout_str - .contains("copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE + zeros") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); + assert_eq!(src_file_metadata.blocks(), dst_file_metadata.blocks()); } #[test] @@ -4026,23 +3911,20 @@ fn test_cp_debug_reflink_never_sparse_always_without_hole() { at.write("a", "hello"); at.append_bytes("a", &empty_bytes); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("--sparse=always") .arg("a") .arg("b") - .succeeds(); - let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: zeros"); - if dst_file_metadata.blocks() != dst_file_metadata.blksize() / 512 { - panic!("Zero sequenced blocks not removed"); - } - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: zeros") { - panic!("Failure: stdout was \n{stdout_str}"); - } + let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); + assert_eq!( + dst_file_metadata.blocks(), + dst_file_metadata.blksize() / 512 + ); } #[test] @@ -4057,19 +3939,14 @@ fn test_cp_debug_reflink_never_sparse_always_empty_file_with_hole() { .unwrap(); f.set_len(10000).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("--sparse=always") .arg("a") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: unknown, reflink: no, sparse detection: SEEK_HOLE") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: unknown, reflink: no, sparse detection: SEEK_HOLE"); } #[test] @@ -4086,9 +3963,7 @@ fn test_cp_default_virtual_file() { let dest_size = std::fs::metadata(at.plus("b")) .expect("Metadata of copied file cannot be read") .size(); - if dest_size == 0 { - panic!("Copy unsuccessful"); - } + assert!(dest_size > 0); } #[test] #[cfg(any(target_os = "linux", target_os = "android"))] @@ -4100,25 +3975,20 @@ fn test_cp_debug_reflink_auto_sparse_always_non_sparse_file_with_long_zero_seque at.touch("a"); at.append_bytes("a", &buf); at.append_bytes("a", "hello".as_bytes()); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--sparse=always") .arg("a") .arg("b") - .succeeds(); + .succeeds() + .stdout_contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros"); let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); - - if dst_file_metadata.blocks() != dst_file_metadata.blksize() / 512 { - panic!("Zero sequenced blocks not removed"); - } - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: unsupported, sparse detection: zeros") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + assert_eq!( + dst_file_metadata.blocks(), + dst_file_metadata.blksize() / 512 + ); } #[test] @@ -4127,17 +3997,14 @@ fn test_cp_debug_sparse_never_empty_sparse_file() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("a"); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--sparse=never") .arg("a") .arg("b") - .succeeds(); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: no"); } #[test] @@ -4150,46 +4017,38 @@ fn test_cp_debug_reflink_never_sparse_always_non_sparse_file_with_long_zero_sequ at.touch("a"); at.append_bytes("a", &buf); at.append_bytes("a", "hello".as_bytes()); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("--sparse=always") .arg("a") .arg("b") - .succeeds(); + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: zeros"); let dst_file_metadata = std::fs::metadata(at.plus("b")).unwrap(); - - if dst_file_metadata.blocks() != dst_file_metadata.blksize() / 512 { - panic!("Zero sequenced blocks not removed"); - } - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: zeros") { - panic!("Failure: stdout was \n{stdout_str}"); - } + assert_eq!( + dst_file_metadata.blocks(), + dst_file_metadata.blksize() / 512 + ); } #[test] #[cfg(target_os = "linux")] fn test_cp_debug_sparse_always_sparse_virtual_file() { let ts = TestScenario::new(util_name!()); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--sparse=always") .arg("/sys/kernel/address_bits") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains( - "copy offload: avoided, reflink: unsupported, sparse detection: SEEK_HOLE + zeros", - ) { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains( + "copy offload: avoided, reflink: unsupported, sparse detection: SEEK_HOLE + zeros", + ); } + #[test] #[cfg(any(target_os = "linux", target_os = "android"))] fn test_cp_debug_reflink_never_less_than_512_bytes() { @@ -4203,18 +4062,13 @@ fn test_cp_debug_reflink_never_less_than_512_bytes() { .unwrap(); f.set_len(400).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("a") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: no"); } #[test] @@ -4229,19 +4083,16 @@ fn test_cp_debug_reflink_never_sparse_never_empty_file_with_hole() { .unwrap(); f.set_len(10000).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("--sparse=never") .arg("a") .arg("b") - .succeeds(); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: unknown, reflink: no, sparse detection: SEEK_HOLE") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: unknown, reflink: no, sparse detection: SEEK_HOLE"); } + #[test] #[cfg(any(target_os = "linux", target_os = "android"))] fn test_cp_debug_reflink_never_file_with_hole() { @@ -4254,18 +4105,15 @@ fn test_cp_debug_reflink_never_file_with_hole() { .unwrap(); f.set_len(10000).unwrap(); at.append_bytes("a", "hello".as_bytes()); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("--sparse=never") .arg("a") .arg("b") - .succeeds(); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE"); } #[test] @@ -4281,19 +4129,14 @@ fn test_cp_debug_sparse_never_less_than_512_bytes() { .unwrap(); f.set_len(400).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=auto") .arg("--sparse=never") .arg("a") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: no"); } #[test] @@ -4308,20 +4151,16 @@ fn test_cp_debug_sparse_never_without_hole() { at.append_bytes("a", &filler_bytes); - let result = ts - .ucmd() + ts.ucmd() .arg("--reflink=auto") .arg("--sparse=never") .arg("--debug") .arg("a") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: no"); } + #[test] #[cfg(any(target_os = "linux", target_os = "android"))] fn test_cp_debug_sparse_never_empty_file_with_hole() { @@ -4334,19 +4173,16 @@ fn test_cp_debug_sparse_never_empty_file_with_hole() { .unwrap(); f.set_len(10000).unwrap(); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--reflink=auto") .arg("--sparse=never") .arg("a") .arg("b") - .succeeds(); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: unknown, reflink: no, sparse detection: SEEK_HOLE") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: unknown, reflink: no, sparse detection: SEEK_HOLE"); } + #[test] #[cfg(any(target_os = "linux", target_os = "android"))] fn test_cp_debug_sparse_never_file_with_hole() { @@ -4359,73 +4195,54 @@ fn test_cp_debug_sparse_never_file_with_hole() { .unwrap(); f.set_len(10000).unwrap(); at.append_bytes("a", "hello".as_bytes()); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--reflink=auto") .arg("--sparse=never") .arg("a") .arg("b") - .succeeds(); - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE"); } #[test] #[cfg(target_os = "linux")] fn test_cp_debug_default_sparse_virtual_file() { let ts = TestScenario::new(util_name!()); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("/sys/kernel/address_bits") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str - .contains("copy offload: unsupported, reflink: unsupported, sparse detection: SEEK_HOLE") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains( + "copy offload: unsupported, reflink: unsupported, sparse detection: SEEK_HOLE", + ); } #[test] #[cfg(target_os = "linux")] fn test_cp_debug_sparse_never_zero_sized_virtual_file() { let ts = TestScenario::new(util_name!()); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("--sparse=never") .arg("/proc/version") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: no"); } #[test] #[cfg(target_os = "linux")] fn test_cp_debug_default_zero_sized_virtual_file() { let ts = TestScenario::new(util_name!()); - let result = ts - .ucmd() + ts.ucmd() .arg("--debug") .arg("/proc/version") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: unsupported, reflink: unsupported, sparse detection: no") - { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: unsupported, reflink: unsupported, sparse detection: no"); } #[test] @@ -4436,18 +4253,14 @@ fn test_cp_debug_reflink_never_without_hole() { let at = &ts.fixtures; at.write("a", "hello"); at.append_bytes("a", &filler_bytes); - let result = ts - .ucmd() + + ts.ucmd() .arg("--debug") .arg("--reflink=never") .arg("a") .arg("b") - .succeeds(); - - let stdout_str = result.stdout_str(); - if !stdout_str.contains("copy offload: avoided, reflink: no, sparse detection: no") { - panic!("Failure: stdout was \n{stdout_str}"); - } + .succeeds() + .stdout_contains("copy offload: avoided, reflink: no, sparse detection: no"); } #[test] From 34da5029df7cd37367360ccdc643d6a8e20f944f Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 17:27:41 +0200 Subject: [PATCH 15/29] cat+tests: simplify spell-checker exceptions --- tests/by-util/test_cat.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index b7b19fd3228..b11c0ec0ce1 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -2,7 +2,7 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore NOFILE +// spell-checker:ignore NOFILE nonewline #[cfg(not(windows))] use crate::common::util::vec_of_size; @@ -23,7 +23,6 @@ fn test_output_simple() { #[test] fn test_no_options() { - // spell-checker:disable-next-line for fixture in ["empty.txt", "alpha.txt", "nonewline.txt"] { // Give fixture through command line file argument new_ucmd!() @@ -196,7 +195,6 @@ fn test_directory() { fn test_directory_and_file() { let s = TestScenario::new(util_name!()); s.fixtures.mkdir("test_directory2"); - // spell-checker:disable-next-line for fixture in ["empty.txt", "alpha.txt", "nonewline.txt"] { s.ucmd() .args(&["test_directory2", fixture]) @@ -219,7 +217,7 @@ fn test_three_directories_and_file_and_stdin() { "alpha.txt", "-", "file_which_does_not_exist.txt", - "nonewline.txt", // spell-checker:disable-line + "nonewline.txt", "test_directory3/test_directory5", "test_directory3/../test_directory3/test_directory5", "test_directory3", From 95b36f2d4f7a7eee3f731c9c736f7b36707039c1 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:21:24 +0200 Subject: [PATCH 16/29] uucore: remove unused spell-checker:disable --- src/uucore/src/lib/features/fsext.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 99db194f8de..db235b116c2 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -359,7 +359,7 @@ use libc::c_int; ))] extern "C" { #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] - #[link_name = "getmntinfo$INODE64"] // spell-checker:disable-line + #[link_name = "getmntinfo$INODE64"] fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; #[cfg(any( @@ -367,14 +367,14 @@ extern "C" { target_os = "openbsd", all(target_vendor = "apple", target_arch = "aarch64") ))] - #[link_name = "getmntinfo"] // spell-checker:disable-line + #[link_name = "getmntinfo"] fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; // Rust on FreeBSD uses 11.x ABI for filesystem metadata syscalls. // Call the right version of the symbol for getmntinfo() result to // match libc StatFS layout. #[cfg(target_os = "freebsd")] - #[link_name = "getmntinfo@FBSD_1.0"] // spell-checker:disable-line + #[link_name = "getmntinfo@FBSD_1.0"] fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; } From db61684bc0ba3243b2f00c509fdb6e3db31dd90d Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:21:56 +0200 Subject: [PATCH 17/29] basename+tests: remove unused spell-checker:disable --- tests/by-util/test_basename.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index b9cee2863ac..23e4a2eb455 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -70,7 +70,7 @@ fn test_multiple_param() { new_ucmd!() .args(&[multiple_param, path, path]) .succeeds() - .stdout_only("baz\nbaz\n"); // spell-checker:disable-line + .stdout_only("baz\nbaz\n"); } } @@ -81,7 +81,7 @@ fn test_suffix_param() { new_ucmd!() .args(&[suffix_param, ".exe", path, path]) .succeeds() - .stdout_only("baz\nbaz\n"); // spell-checker:disable-line + .stdout_only("baz\nbaz\n"); } } From b39b4058268bbb87807394aea7ecf6a03113575c Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:22:20 +0200 Subject: [PATCH 18/29] basenc+tests: remove unused spell-checker:disable --- tests/by-util/test_basenc.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_basenc.rs b/tests/by-util/test_basenc.rs index 2976d609974..18f0502a1da 100644 --- a/tests/by-util/test_basenc.rs +++ b/tests/by-util/test_basenc.rs @@ -41,14 +41,14 @@ fn test_base64() { .pipe_in("to>be?") .succeeds() .no_stderr() - .stdout_only("dG8+YmU/\n"); // spell-checker:disable-line + .stdout_only("dG8+YmU/\n"); } #[test] fn test_base64_decode() { new_ucmd!() .args(&["--base64", "-d"]) - .pipe_in("dG8+YmU/") // spell-checker:disable-line + .pipe_in("dG8+YmU/") .succeeds() .no_stderr() .stdout_only("to>be?"); @@ -61,14 +61,14 @@ fn test_base64url() { .pipe_in("to>be?") .succeeds() .no_stderr() - .stdout_only("dG8-YmU_\n"); // spell-checker:disable-line + .stdout_only("dG8-YmU_\n"); } #[test] fn test_base64url_decode() { new_ucmd!() .args(&["--base64url", "-d"]) - .pipe_in("dG8-YmU_") // spell-checker:disable-line + .pipe_in("dG8-YmU_") .succeeds() .no_stderr() .stdout_only("to>be?"); From 63699a41d6d239edd11708c0c73df149d360e88c Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 17:26:32 +0200 Subject: [PATCH 19/29] kill+tests: remove unused spell-checker:disable --- tests/by-util/test_kill.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_kill.rs b/tests/by-util/test_kill.rs index 90adf5f2995..3915a70908d 100644 --- a/tests/by-util/test_kill.rs +++ b/tests/by-util/test_kill.rs @@ -130,9 +130,9 @@ fn test_kill_list_one_signal_ignore_case() { fn test_kill_list_unknown_must_match_input_case() { new_ucmd!() .arg("-l") - .arg("IaMnOtAsIgNaL") // spell-checker:disable-line + .arg("IaMnOtAsIgNaL") .fails() - .stderr_contains("IaMnOtAsIgNaL"); // spell-checker:disable-line + .stderr_contains("IaMnOtAsIgNaL"); } #[test] @@ -169,7 +169,6 @@ fn test_kill_list_three_signal_first_unknown() { #[test] fn test_kill_set_bad_signal_name() { - // spell-checker:disable-line new_ucmd!() .arg("-s") .arg("IAMNOTASIGNAL") // spell-checker:disable-line @@ -274,16 +273,15 @@ fn test_kill_with_signal_name_new_form_unknown_must_match_input_case() { let target = Target::new(); new_ucmd!() .arg("-s") - .arg("IaMnOtAsIgNaL") // spell-checker:disable-line + .arg("IaMnOtAsIgNaL") .arg(format!("{}", target.pid())) .fails() .stderr_contains("unknown signal") - .stderr_contains("IaMnOtAsIgNaL"); // spell-checker:disable-line + .stderr_contains("IaMnOtAsIgNaL"); } #[test] fn test_kill_no_pid_provided() { - // spell-checker:disable-line new_ucmd!() .fails() .stderr_contains("no process ID specified"); From 9266b4a7fa822214b423fc93c97a661dce50c817 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:22:57 +0200 Subject: [PATCH 20/29] ls+tests: remove unused spell-checker:disable --- tests/by-util/test_ls.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 099f18fb807..d828d1a64be 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2283,7 +2283,7 @@ fn test_ls_indicator_style() { "--ind=slash", "--classify", "--classify=always", - "--classify=alway", // spell-checker:disable-line + "--classify=alway", "--classify=al", "--classify=yes", "--classify=force", @@ -4327,7 +4327,7 @@ fn test_ls_hyperlink() { for argument in [ "--hyperlink=never", "--hyperlink=neve", // spell-checker:disable-line - "--hyperlink=ne", // spell-checker:disable-line + "--hyperlink=ne", "--hyperlink=n", ] { scene From f1a683d45f51c3232d139ae4c24a86aebefa4db0 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:23:05 +0200 Subject: [PATCH 21/29] mktemp+tests: remove unused spell-checker:disable --- tests/by-util/test_mktemp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 8a919948cec..272769ad979 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -21,8 +21,8 @@ static TEST_TEMPLATE2: &str = "temp"; static TEST_TEMPLATE3: &str = "tempX"; static TEST_TEMPLATE4: &str = "tempXX"; static TEST_TEMPLATE5: &str = "tempXXX"; -static TEST_TEMPLATE6: &str = "tempXXXlate"; // spell-checker:disable-line -static TEST_TEMPLATE7: &str = "XXXtemplate"; // spell-checker:disable-line +static TEST_TEMPLATE6: &str = "tempXXXlate"; +static TEST_TEMPLATE7: &str = "XXXtemplate"; #[cfg(unix)] static TEST_TEMPLATE8: &str = "tempXXXl/ate"; #[cfg(windows)] From a53ec17b6796247564dae20ec05db43477fb828d Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:23:16 +0200 Subject: [PATCH 22/29] numfmt+tests: remove unused spell-checker:disable --- tests/by-util/test_numfmt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index 1dddedfddeb..1ef588f26a9 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -550,7 +550,7 @@ fn test_delimiter_with_padding_and_fields() { fn test_round() { for (method, exp) in [ ("from-zero", ["9.1K", "-9.1K", "9.1K", "-9.1K"]), - ("from-zer", ["9.1K", "-9.1K", "9.1K", "-9.1K"]), // spell-checker:disable-line + ("from-zer", ["9.1K", "-9.1K", "9.1K", "-9.1K"]), ("f", ["9.1K", "-9.1K", "9.1K", "-9.1K"]), ("towards-zero", ["9.0K", "-9.0K", "9.0K", "-9.0K"]), ("up", ["9.1K", "-9.0K", "9.1K", "-9.0K"]), From bebddc6ad40302ad0eb7a99e5c6aa230b49dd5ca Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 17:31:30 +0200 Subject: [PATCH 23/29] od+tests: remove unused spell-checker:disable --- tests/by-util/test_od.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index 9b2fefd042e..67f2322c8b9 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -60,7 +60,7 @@ fn test_file() { #[test] fn test_2files() { let (at, mut ucmd) = at_and_ucmd!(); - at.write("test1", "abcdefghijklmnop"); // spell-checker:disable-line + at.write("test1", "abcdefghijklmnop"); at.write("test2", "qrstuvwxyz\n"); // spell-checker:disable-line ucmd.arg("--endian=little") .arg("test1") @@ -74,13 +74,13 @@ fn test_2files() { #[test] fn test_no_file() { let (_at, mut ucmd) = at_and_ucmd!(); - ucmd.arg("}surely'none'would'thus'a'file'name").fails(); // spell-checker:disable-line + ucmd.arg("}surely'none'would'thus'a'file'name").fails(); } // Test that od reads from stdin instead of a file #[test] fn test_from_stdin() { - let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line + let input = "abcdefghijklmnopqrstuvwxyz\n"; new_ucmd!() .arg("--endian=little") .run_piped_stdin(input.as_bytes()) @@ -110,7 +110,7 @@ fn test_from_mixed() { #[test] fn test_multiple_formats() { - let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line + let input = "abcdefghijklmnopqrstuvwxyz\n"; new_ucmd!() .arg("-c") .arg("-b") @@ -581,7 +581,7 @@ fn test_invalid_offset() { #[test] fn test_skip_bytes() { - let input = "abcdefghijklmnopq"; // spell-checker:disable-line + let input = "abcdefghijklmnopq"; new_ucmd!() .arg("-c") .arg("--skip-bytes=5") @@ -598,7 +598,7 @@ fn test_skip_bytes() { #[test] fn test_skip_bytes_hex() { - let input = "abcdefghijklmnopq"; // spell-checker:disable-line + let input = "abcdefghijklmnopq"; new_ucmd!() .arg("-c") .arg("--skip-bytes=0xB") @@ -636,7 +636,7 @@ fn test_skip_bytes_error() { #[test] fn test_read_bytes() { - let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; // spell-checker:disable-line + let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; new_ucmd!() .arg("--endian=little") .arg("--read-bytes=27") @@ -695,7 +695,7 @@ fn test_filename_parsing() { #[test] fn test_stdin_offset() { - let input = "abcdefghijklmnopq"; // spell-checker:disable-line + let input = "abcdefghijklmnopq"; new_ucmd!() .arg("-c") .arg("+5") @@ -730,7 +730,7 @@ fn test_file_offset() { #[test] fn test_traditional() { // note gnu od does not align both lines - let input = "abcdefghijklmnopq"; // spell-checker:disable-line + let input = "abcdefghijklmnopq"; new_ucmd!() .arg("--traditional") .arg("-a") @@ -753,7 +753,7 @@ fn test_traditional() { #[test] fn test_traditional_with_skip_bytes_override() { // --skip-bytes is ignored in this case - let input = "abcdefghijklmnop"; // spell-checker:disable-line + let input = "abcdefghijklmnop"; new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") @@ -773,7 +773,7 @@ fn test_traditional_with_skip_bytes_override() { #[test] fn test_traditional_with_skip_bytes_non_override() { // no offset specified in the traditional way, so --skip-bytes is used - let input = "abcdefghijklmnop"; // spell-checker:disable-line + let input = "abcdefghijklmnop"; new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") @@ -803,7 +803,7 @@ fn test_traditional_error() { #[test] fn test_traditional_only_label() { - let input = "abcdefghijklmnopqrstuvwxyz"; // spell-checker:disable-line + let input = "abcdefghijklmnopqrstuvwxyz"; new_ucmd!() .arg("-An") .arg("--traditional") From 289346a4ba949ab2ac7f98a07139ff58ab4b1a5f Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 17:35:32 +0200 Subject: [PATCH 24/29] printf+tests: remove unused spell-checker:disable --- tests/by-util/test_printf.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_printf.rs b/tests/by-util/test_printf.rs index 0cb603da4a4..7bf1fcfe5bf 100644 --- a/tests/by-util/test_printf.rs +++ b/tests/by-util/test_printf.rs @@ -521,10 +521,7 @@ fn sub_any_specifiers_after_period() { #[test] fn unspecified_left_justify_is_1_width() { - new_ucmd!() - .args(&["%-o"]) //spell-checker:disable-line - .succeeds() - .stdout_only("0"); + new_ucmd!().args(&["%-o"]).succeeds().stdout_only("0"); } #[test] @@ -538,7 +535,7 @@ fn sub_any_specifiers_after_second_param() { #[test] fn stop_after_additional_escape() { new_ucmd!() - .args(&["A%sC\\cD%sF", "B", "E"]) //spell-checker:disable-line + .args(&["A%sC\\cD%sF", "B", "E"]) .succeeds() .stdout_only("ABC"); } From e4b66871962592cdcd0a2bc83a0fb6c089a170c2 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 17:36:20 +0200 Subject: [PATCH 25/29] realpath+tests: remove unused spell-checker:disable --- tests/by-util/test_realpath.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_realpath.rs b/tests/by-util/test_realpath.rs index c3a15fba40e..02ee76c6f40 100644 --- a/tests/by-util/test_realpath.rs +++ b/tests/by-util/test_realpath.rs @@ -353,7 +353,7 @@ fn test_relative() { new_ucmd!() .args(&["-sm", "--relative-base=/", "--relative-to=/", "/", "/usr"]) .succeeds() - .stdout_is(".\nusr\n"); // spell-checker:disable-line + .stdout_is(".\nusr\n"); let result = new_ucmd!() .args(&["-sm", "--relative-base=/usr", "/tmp", "/usr"]) @@ -366,7 +366,7 @@ fn test_relative() { new_ucmd!() .args(&["-sm", "--relative-base=/", "/", "/usr"]) .succeeds() - .stdout_is(".\nusr\n"); // spell-checker:disable-line + .stdout_is(".\nusr\n"); } #[test] From 48a483c319b76a03b57d8336ef1c7c5d8dc1d9ca Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:23:42 +0200 Subject: [PATCH 26/29] sort+tests: remove unused spell-checker:disable --- tests/by-util/test_sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 83c925af917..4842e910555 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -132,7 +132,7 @@ fn test_months_whitespace() { "-M", "--month-sort", "--sort=month", - "--sort=mont", // spell-checker:disable-line + "--sort=mont", "--sort=m", ], ); From 900c3916d5bd77e68f310adc5d7c5e8d22ed7a30 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:20:48 +0200 Subject: [PATCH 27/29] tail: remove unused spell-checker:disable --- src/uu/tail/src/parse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/tail/src/parse.rs b/src/uu/tail/src/parse.rs index 3d6b2697e36..6d6826077f8 100644 --- a/src/uu/tail/src/parse.rs +++ b/src/uu/tail/src/parse.rs @@ -32,7 +32,7 @@ pub enum ParseError { InvalidEncoding, } /// Parses obsolete syntax -/// tail -\[NUM\]\[bcl\]\[f\] and tail +\[NUM\]\[bcl\]\[f\] // spell-checker:disable-line +/// tail -\[NUM\]\[bcl\]\[f\] and tail +\[NUM\]\[bcl\]\[f\] pub fn parse_obsolete(src: &OsString) -> Option> { let mut rest = match src.to_str() { Some(src) => src, From 909c47886a9dd7999ae9b5a69372cdb988a5ec1e Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 30 Apr 2024 18:23:49 +0200 Subject: [PATCH 28/29] tr+tests: remove unused spell-checker:disable --- tests/by-util/test_tr.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 2502031b130..c8ed0a7fb0d 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -124,10 +124,10 @@ fn test_complement2() { #[test] fn test_complement3() { new_ucmd!() - .args(&["-c", "abcdefgh", "123"]) // spell-checker:disable-line + .args(&["-c", "abcdefgh", "123"]) .pipe_in("the cat and the bat") .run() - .stdout_is("3he3ca33a3d33he3ba3"); // spell-checker:disable-line + .stdout_is("3he3ca33a3d33he3ba3"); } #[test] @@ -291,7 +291,7 @@ fn test_set1_shorter_than_set2() { .args(&["ab", "xyz"]) .pipe_in("abcde") .run() - .stdout_is("xycde"); // spell-checker:disable-line + .stdout_is("xycde"); } #[test] @@ -301,7 +301,7 @@ fn test_truncate() { .args(&["-t", "abc", "xy"]) .pipe_in("abcde") .succeeds() - .stdout_is("xycde"); // spell-checker:disable-line + .stdout_is("xycde"); } #[test] @@ -310,7 +310,7 @@ fn test_truncate_multi() { .args(&["-tt", "-t", "abc", "xy"]) .pipe_in("abcde") .succeeds() - .stdout_is("xycde"); // spell-checker:disable-line + .stdout_is("xycde"); } #[test] @@ -319,7 +319,7 @@ fn test_truncate_with_set1_shorter_than_set2() { .args(&["-t", "ab", "xyz"]) .pipe_in("abcde") .run() - .stdout_is("xycde"); // spell-checker:disable-line + .stdout_is("xycde"); } #[test] From 12d9e47ff51f8e50a9050cb1e951b5dcb72ba1e3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:49:57 +0000 Subject: [PATCH 29/29] chore(deps): update rust crate zip to 1.1.3 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index deb3e003a88..5beb5881faf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3751,9 +3751,9 @@ checksum = "2a599daf1b507819c1121f0bf87fa37eb19daac6aff3aefefd4e6e2e0f2020fc" [[package]] name = "zip" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a23468b4a7a4e9e1e62812f8d1dd614f67f148e2b3faa72f4843bf00b573fd7" +checksum = "2e6cb8909b2e8e6733c9ef67d35be1a27105644d362aafb5f8b2ba395727adf6" dependencies = [ "arbitrary", "byteorder", diff --git a/Cargo.toml b/Cargo.toml index 365c7d946ea..d21ae02e520 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -333,7 +333,7 @@ walkdir = "2.5" winapi-util = "0.1.8" windows-sys = { version = "0.48.0", default-features = false } xattr = "1.3.1" -zip = { version = "1.1.2", default-features = false, features = ["deflate"] } +zip = { version = "1.1.3", default-features = false, features = ["deflate"] } hex = "0.4.3" md-5 = "0.10.6"