From c4580df2a4cbb4f1cb4e3124779bde43d7b027f8 Mon Sep 17 00:00:00 2001 From: cswn Date: Tue, 14 Nov 2023 18:07:35 +0100 Subject: [PATCH 1/6] split: remove crash macro --- src/uu/split/src/platform/unix.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/uu/split/src/platform/unix.rs b/src/uu/split/src/platform/unix.rs index f4adb818834..c2bf7216b57 100644 --- a/src/uu/split/src/platform/unix.rs +++ b/src/uu/split/src/platform/unix.rs @@ -7,9 +7,10 @@ use std::io::Write; use std::io::{BufWriter, Error, ErrorKind, Result}; use std::path::Path; use std::process::{Child, Command, Stdio}; -use uucore::crash; +use uucore::error::USimpleError; use uucore::fs; use uucore::fs::FileInformation; +use uucore::show; /// A writer that writes to a shell_process' stdin /// @@ -101,10 +102,13 @@ impl Drop for FilterWriter { .expect("Couldn't wait for child process"); if let Some(return_code) = exit_status.code() { if return_code != 0 { - crash!(1, "Shell process returned {}", return_code); + show!(USimpleError::new( + 1, + format!("Shell process returned {}", return_code) + )); } } else { - crash!(1, "Shell process terminated by signal") + show!(USimpleError::new(1, "Shell process terminated by signal")); } } } From e2e5ec60cde2a407a2c8a467c1d0057f312e2276 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:05:36 +0000 Subject: [PATCH 2/6] chore(deps): update rust crate itertools to 0.12.0 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d83adfee600..c89c87df41c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1122,9 +1122,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" dependencies = [ "either", ] diff --git a/Cargo.toml b/Cargo.toml index f313e2b03e4..2f3af2c83d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -285,7 +285,7 @@ gcd = "2.3" glob = "0.3.1" half = "2.3" indicatif = "0.17" -itertools = "0.11.0" +itertools = "0.12.0" libc = "0.2.150" lscolors = { version = "0.15.0", default-features = false, features = [ "nu-ansi-term", From 3f86bc59de6f8c6dbb73faaa81d3ad3fa40c01e7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 15 Nov 2023 08:31:47 +0100 Subject: [PATCH 3/6] add missing features to uucore --- src/uu/dd/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/dd/Cargo.toml b/src/uu/dd/Cargo.toml index 7db05b422f3..d654d829736 100644 --- a/src/uu/dd/Cargo.toml +++ b/src/uu/dd/Cargo.toml @@ -18,7 +18,7 @@ path = "src/dd.rs" clap = { workspace = true } gcd = { workspace = true } libc = { workspace = true } -uucore = { workspace = true, features = ["memo"] } +uucore = { workspace = true, features = ["memo", "quoting-style"] } [target.'cfg(any(target_os = "linux"))'.dependencies] nix = { workspace = true, features = ["fs"] } diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 1cb05ec09b0..f36eff35e8c 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -16,7 +16,7 @@ path = "src/printf.rs" [dependencies] clap = { workspace = true } -uucore = { workspace = true, features = ["memo"] } +uucore = { workspace = true, features = ["memo", "quoting-style"] } [[bin]] name = "printf" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 95f761696c2..d4e7cd316c6 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -20,7 +20,7 @@ bigdecimal = { workspace = true } clap = { workspace = true } num-bigint = { workspace = true } num-traits = { workspace = true } -uucore = { workspace = true, features = ["memo"] } +uucore = { workspace = true, features = ["memo", "quoting-style"] } [[bin]] name = "seq" From 3f177ef97fc4e6f7a17f7565761732d89847fe72 Mon Sep 17 00:00:00 2001 From: "Y.D.X" <73375426+YDX-2147483647@users.noreply.github.com> Date: Wed, 15 Nov 2023 19:09:46 +0800 Subject: [PATCH 4/6] doc: Fix the markdown highlighting syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There should be a new line after `[!WARNING]`, according to [community ยท Discussion #16925](https://github.com/orgs/community/discussions/16925). --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 255ed2c53e3..b10d3d11472 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,8 @@ check out these documents: Now follows a very important warning: -> [!WARNING] uutils is original code and cannot contain any code from GNU or +> [!WARNING] +> uutils is original code and cannot contain any code from GNU or > other implementations. This means that **we cannot accept any changes based on > the GNU source code**. To make sure that cannot happen, **you cannot link to > the GNU source code** either. From b3eae16faddf03e5ce83047f244a510932970565 Mon Sep 17 00:00:00 2001 From: ALXD Date: Wed, 15 Nov 2023 17:40:54 +0100 Subject: [PATCH 5/6] printf: intf: change warning and exit code --- .../features/tokenize/num_format/formatters/intf.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/uucore/src/lib/features/tokenize/num_format/formatters/intf.rs b/src/uucore/src/lib/features/tokenize/num_format/formatters/intf.rs index 11070113c26..767c0c4bb67 100644 --- a/src/uucore/src/lib/features/tokenize/num_format/formatters/intf.rs +++ b/src/uucore/src/lib/features/tokenize/num_format/formatters/intf.rs @@ -8,10 +8,11 @@ //! formatter for unsigned and signed int subs //! unsigned int: %X %x (hex u64) %o (octal u64) %u (base ten u64) //! signed int: %i %d (both base ten i64) +use crate::error::set_exit_code; +use crate::features::tokenize::num_format::num_format::warn_expected_numeric; + use super::super::format_field::FormatField; -use super::super::formatter::{ - get_it_at, warn_incomplete_conv, Base, FormatPrimitive, Formatter, InitialPrefix, -}; +use super::super::formatter::{get_it_at, Base, FormatPrimitive, Formatter, InitialPrefix}; use std::i64; use std::u64; @@ -112,7 +113,8 @@ impl Intf { } } _ => { - warn_incomplete_conv(str_in); + warn_expected_numeric(str_in); + set_exit_code(1); break; } } From 3cdb0966ae1b86724be8f7b6db2b6f41472169fc Mon Sep 17 00:00:00 2001 From: ALXD Date: Wed, 15 Nov 2023 17:46:58 +0100 Subject: [PATCH 6/6] printf: add a test for %x with invalid value --- tests/by-util/test_printf.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_printf.rs b/tests/by-util/test_printf.rs index a297dbf6833..ab3505a327b 100644 --- a/tests/by-util/test_printf.rs +++ b/tests/by-util/test_printf.rs @@ -258,6 +258,14 @@ fn sub_num_hex_upper() { .stdout_only("thirty in hex is 1E"); } +#[test] +fn sub_num_hex_non_numerical() { + new_ucmd!() + .args(&["parameters need to be numbers %X", "%194"]) + .fails() + .code_is(1); +} + #[test] fn sub_num_float() { new_ucmd!()