From 4cf9f553024dfda0efae18b217c35b307bfb8d80 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2024 13:59:42 +0000 Subject: [PATCH 01/16] chore(deps): update rust crate clap to v4.5.11 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6102ba1..f6ea7e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,18 +85,18 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "clap" -version = "4.5.10" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6b81fb3c84f5563d509c59b5a48d935f689e993afa90fe39047f05adef9142" +checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.10" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca6706fd5224857d9ac5eb9355f6683563cc0541c7cd9d014043b57cbec78ac" +checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" dependencies = [ "anstream", "anstyle", From 08b1e9651e2bbcd291fb7c4c45ff57543cc586ff Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2024 13:59:48 +0000 Subject: [PATCH 02/16] chore(deps): update rust crate clap_mangen to v0.2.23 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6102ba1..66075a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -122,9 +122,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "clap_mangen" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50dde5bc0c853d6248de457e5eb6e5a674a54b93810a34ded88d882ca1fe2de" +checksum = "f17415fd4dfbea46e3274fcd8d368284519b358654772afb700dc2e8d2b24eeb" dependencies = [ "clap", "roff", From 652f9230b62279551d910422ec1bdec1946260cf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:08:04 +0000 Subject: [PATCH 03/16] chore(deps): update rust crate clap_complete to v4.5.10 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6ea7e3..c661b38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.9" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa2032320fd6f50d22af510d204b2994eef49600dfbd0e771a166213844e4cd" +checksum = "dbeb5ae3a578b7f639911ed31e98a48e16ef6f44e62d275184bb755a093fea55" dependencies = [ "clap", ] From eed86957f5789e3198f74bf310f07a279d5e0d7c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:34:51 +0000 Subject: [PATCH 04/16] chore(deps): update rust crate clap_complete to v4.5.11 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index adaecbf..2eb3f24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.10" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbeb5ae3a578b7f639911ed31e98a48e16ef6f44e62d275184bb755a093fea55" +checksum = "c6ae69fbb0833c6fcd5a8d4b8609f108c7ad95fc11e248d853ff2c42a90df26a" dependencies = [ "clap", ] From 5091640b74595ae3a89c263952d6b7f184a2be1b Mon Sep 17 00:00:00 2001 From: Yang Hau Date: Fri, 26 Jul 2024 00:18:09 +0800 Subject: [PATCH 05/16] lsmem: Add lsmem --- Cargo.lock | 9 +++++++++ Cargo.toml | 2 ++ src/uu/lsmem/Cargo.toml | 15 +++++++++++++++ src/uu/lsmem/lsmem.md | 7 +++++++ src/uu/lsmem/src/lsmem.rs | 24 ++++++++++++++++++++++++ src/uu/lsmem/src/main.rs | 1 + tests/by-util/test_lsmem.rs | 4 ++++ 7 files changed, 62 insertions(+) create mode 100644 src/uu/lsmem/Cargo.toml create mode 100644 src/uu/lsmem/lsmem.md create mode 100644 src/uu/lsmem/src/lsmem.rs create mode 100644 src/uu/lsmem/src/main.rs create mode 100644 tests/by-util/test_lsmem.rs diff --git a/Cargo.lock b/Cargo.lock index 6102ba1..6eced03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -643,6 +643,7 @@ dependencies = [ "textwrap", "uu_ctrlaltdel", "uu_lscpu", + "uu_lsmem", "uu_mountpoint", "uu_rev", "uucore", @@ -667,6 +668,14 @@ dependencies = [ "uucore", ] +[[package]] +name = "uu_lsmem" +version = "0.0.1" +dependencies = [ + "clap", + "uucore", +] + [[package]] name = "uu_mountpoint" version = "0.0.1" diff --git a/Cargo.toml b/Cargo.toml index 95d2a31..dc1c989 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ default = ["feat_common_core"] feat_common_core = [ "mountpoint", "lscpu", + "lsmem", "ctrlaltdel", "rev", ] @@ -57,6 +58,7 @@ textwrap = { workspace = true } # lscpu = { optional = true, version = "0.0.1", package = "uu_lscpu", path = "src/uu/lscpu" } +lsmem = { optional = true, version = "0.0.1", package = "uu_lsmem", path = "src/uu/lsmem" } mountpoint = { optional = true, version = "0.0.1", package = "uu_mountpoint", path = "src/uu/mountpoint" } ctrlaltdel = { optional = true, version = "0.0.1", package = "uu_ctrlaltdel", path = "src/uu/ctrlaltdel" } rev = { optional = true, version = "0.0.1", package = "uu_rev", path = "src/uu/rev" } diff --git a/src/uu/lsmem/Cargo.toml b/src/uu/lsmem/Cargo.toml new file mode 100644 index 0000000..a76660a --- /dev/null +++ b/src/uu/lsmem/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "uu_lsmem" +version = "0.0.1" +edition = "2021" + +[lib] +path = "src/lsmem.rs" + +[[bin]] +name = "lsmem" +path = "src/main.rs" + +[dependencies] +uucore = { workspace = true } +clap = { workspace = true } diff --git a/src/uu/lsmem/lsmem.md b/src/uu/lsmem/lsmem.md new file mode 100644 index 0000000..7903bbd --- /dev/null +++ b/src/uu/lsmem/lsmem.md @@ -0,0 +1,7 @@ +# lsmem + +``` +lsmem [OPTION]... +``` + +List the ranges of available memory with their online status. diff --git a/src/uu/lsmem/src/lsmem.rs b/src/uu/lsmem/src/lsmem.rs new file mode 100644 index 0000000..d8f3388 --- /dev/null +++ b/src/uu/lsmem/src/lsmem.rs @@ -0,0 +1,24 @@ +// This file is part of the uutils util-linux package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +use clap::{crate_version, Command}; +use uucore::{error::UResult, format_usage, help_about, help_usage}; + +const ABOUT: &str = help_about!("lsmem.md"); +const USAGE: &str = help_usage!("lsmem.md"); + +#[uucore::main] +pub fn uumain(args: impl uucore::Args) -> UResult<()> { + let _matches: clap::ArgMatches = uu_app().try_get_matches_from(args)?; + Ok(()) +} + +pub fn uu_app() -> Command { + Command::new(uucore::util_name()) + .version(crate_version!()) + .about(ABOUT) + .override_usage(format_usage(USAGE)) + .infer_long_args(true) +} diff --git a/src/uu/lsmem/src/main.rs b/src/uu/lsmem/src/main.rs new file mode 100644 index 0000000..33561cd --- /dev/null +++ b/src/uu/lsmem/src/main.rs @@ -0,0 +1 @@ +uucore::bin!(uu_lsmem); diff --git a/tests/by-util/test_lsmem.rs b/tests/by-util/test_lsmem.rs new file mode 100644 index 0000000..33c603c --- /dev/null +++ b/tests/by-util/test_lsmem.rs @@ -0,0 +1,4 @@ +// This file is part of the uutils util-linux package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. From 565f65c787abeeebb21510ef0a8079bfaa8e5650 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 27 Jul 2024 15:43:01 +0200 Subject: [PATCH 06/16] rev: add some tests --- tests/by-util/test_rev.rs | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/by-util/test_rev.rs b/tests/by-util/test_rev.rs index ac8f594..b1ad67a 100644 --- a/tests/by-util/test_rev.rs +++ b/tests/by-util/test_rev.rs @@ -9,3 +9,62 @@ use crate::common::util::TestScenario; fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails().code_is(1); } + +#[test] +fn test_piped_in_data() { + new_ucmd!().pipe_in("a test").succeeds().stdout_is("tset a"); +} + +#[test] +fn test_existing_file() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.write("a.txt", "line A\nline B"); + + ucmd.arg("a.txt").succeeds().stdout_is("A enil\nB enil"); +} + +#[test] +fn test_multiple_files() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.write("a.txt", "file A\n"); + at.write("b.txt", "file B\n"); + + ucmd.args(&["a.txt", "b.txt"]) + .succeeds() + .stdout_is("A elif\nB elif\n"); +} + +#[test] +fn test_empty_file() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.touch("empty.txt"); + + ucmd.arg("empty.txt").succeeds().no_output(); +} + +#[test] +fn test_non_existing_file() { + new_ucmd!() + .arg("non_existing_file") + .fails() + .code_is(1) + .no_stdout() + .stderr_contains("cannot open non_existing_file: No such file or directory"); +} + +#[test] +fn test_non_existing_and_existing_file() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.write("a.txt", "file A"); + + ucmd.arg("non_existing_file") + .arg("a.txt") + .fails() + .code_is(1) + .stderr_contains("cannot open non_existing_file: No such file or directory") + .stdout_is("A elif"); +} From 04ccbe32aba3c65c388775412ec2a6256f08cd93 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 27 Jul 2024 16:09:11 +0200 Subject: [PATCH 07/16] rev: adapt error msg, replace match with let/else --- src/uu/rev/src/rev.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/uu/rev/src/rev.rs b/src/uu/rev/src/rev.rs index 75e56fe..db1a907 100644 --- a/src/uu/rev/src/rev.rs +++ b/src/uu/rev/src/rev.rs @@ -20,17 +20,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { match files { Some(files) => { for path in files { - let file = match std::fs::File::open(path) { - Ok(val) => val, - Err(err) => { - uucore::error::set_exit_code(1); - uucore::show_error!("cannot open {}: {}", path, err); - continue; - } + let Ok(file) = std::fs::File::open(path) else { + uucore::error::set_exit_code(1); + uucore::show_error!("cannot open {path}: No such file or directory"); + continue; }; if let Err(err) = rev_stream(file) { uucore::error::set_exit_code(1); - uucore::show_error!("cannot read {}: {}", path, err); + uucore::show_error!("cannot read {path}: {err}"); } } } From 7d114bf4d594e2016a882312aa687b2d5132af91 Mon Sep 17 00:00:00 2001 From: Yang Hau Date: Sun, 28 Jul 2024 01:55:07 +0800 Subject: [PATCH 08/16] rev: add option --zero closes #74 --- src/uu/rev/src/rev.rs | 30 ++++++++++++++++++++++-------- tests/by-util/test_rev.rs | 12 ++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/uu/rev/src/rev.rs b/src/uu/rev/src/rev.rs index db1a907..b06d377 100644 --- a/src/uu/rev/src/rev.rs +++ b/src/uu/rev/src/rev.rs @@ -12,11 +12,18 @@ use uucore::{error::UResult, format_usage, help_about, help_usage}; const ABOUT: &str = help_about!("rev.md"); const USAGE: &str = help_usage!("rev.md"); +mod options { + pub const FILE: &str = "file"; + pub const ZERO: &str = "zero"; +} + #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches: clap::ArgMatches = uu_app().try_get_matches_from(args)?; - let files = matches.get_many::("file"); + let files = matches.get_many::(options::FILE); + let zero = matches.get_flag(options::ZERO); + let sep = if zero { b'\0' } else { b'\n' }; match files { Some(files) => { for path in files { @@ -25,7 +32,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { uucore::show_error!("cannot open {path}: No such file or directory"); continue; }; - if let Err(err) = rev_stream(file) { + if let Err(err) = rev_stream(file, sep) { uucore::error::set_exit_code(1); uucore::show_error!("cannot read {path}: {err}"); } @@ -33,28 +40,28 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } None => { let stdin = std::io::stdin().lock(); - let _ = rev_stream(stdin); + let _ = rev_stream(stdin, sep); } } Ok(()) } -fn rev_stream(stream: impl Read) -> std::io::Result<()> { +fn rev_stream(stream: impl Read, sep: u8) -> std::io::Result<()> { let mut stdout = std::io::stdout().lock(); let mut stream = BufReader::new(stream); let mut buf = Vec::with_capacity(4096); loop { buf.clear(); - stream.read_until(b'\n', &mut buf)?; - if buf.last().copied() != Some(b'\n') { + stream.read_until(sep, &mut buf)?; + if buf.last().copied() != Some(sep) { buf.reverse(); stdout.write_all(&buf)?; break; } else { buf.pop(); buf.reverse(); - buf.push(b'\n'); + buf.push(sep); stdout.write_all(&buf)?; } } @@ -68,11 +75,18 @@ pub fn uu_app() -> Command { .override_usage(format_usage(USAGE)) .infer_long_args(true) .arg( - Arg::new("file") + Arg::new(options::FILE) .value_name("FILE") .help("Paths of files to reverse") .index(1) .action(ArgAction::Set) .num_args(1..), ) + .arg( + Arg::new(options::ZERO) + .short('0') + .long("zero") + .help("Zero termination. Use the byte '\\0' as line separator.") + .action(ArgAction::SetTrue), + ) } diff --git a/tests/by-util/test_rev.rs b/tests/by-util/test_rev.rs index b1ad67a..6fe7335 100644 --- a/tests/by-util/test_rev.rs +++ b/tests/by-util/test_rev.rs @@ -24,6 +24,18 @@ fn test_existing_file() { ucmd.arg("a.txt").succeeds().stdout_is("A enil\nB enil"); } +#[test] +fn test_zero() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.write("a.txt", "line A\0line B"); + + ucmd.arg("a.txt") + .arg("--zero") + .succeeds() + .stdout_is("A enil\0B enil"); +} + #[test] fn test_multiple_files() { let (at, mut ucmd) = at_and_ucmd!(); From 1b5d8f3efebe0920ff73f1c335b2d338877ee4cb Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 30 Jul 2024 09:17:19 +0200 Subject: [PATCH 09/16] rev: use "==" instead of "!=" --- src/uu/rev/src/rev.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/rev/src/rev.rs b/src/uu/rev/src/rev.rs index b06d377..9cf1f37 100644 --- a/src/uu/rev/src/rev.rs +++ b/src/uu/rev/src/rev.rs @@ -54,15 +54,15 @@ fn rev_stream(stream: impl Read, sep: u8) -> std::io::Result<()> { loop { buf.clear(); stream.read_until(sep, &mut buf)?; - if buf.last().copied() != Some(sep) { + if buf.last().copied() == Some(sep) { + buf.pop(); buf.reverse(); + buf.push(sep); stdout.write_all(&buf)?; - break; } else { - buf.pop(); buf.reverse(); - buf.push(sep); stdout.write_all(&buf)?; + break; } } Ok(()) From ecd3cdba8095ce2aba002cfbd3428c7c55c720e4 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 30 Jul 2024 09:22:24 +0200 Subject: [PATCH 10/16] rev: use "if let" instead of match --- src/uu/rev/src/rev.rs | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/uu/rev/src/rev.rs b/src/uu/rev/src/rev.rs index 9cf1f37..b980d16 100644 --- a/src/uu/rev/src/rev.rs +++ b/src/uu/rev/src/rev.rs @@ -24,24 +24,22 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let zero = matches.get_flag(options::ZERO); let sep = if zero { b'\0' } else { b'\n' }; - match files { - Some(files) => { - for path in files { - let Ok(file) = std::fs::File::open(path) else { - uucore::error::set_exit_code(1); - uucore::show_error!("cannot open {path}: No such file or directory"); - continue; - }; - if let Err(err) = rev_stream(file, sep) { - uucore::error::set_exit_code(1); - uucore::show_error!("cannot read {path}: {err}"); - } + + if let Some(files) = files { + for path in files { + let Ok(file) = std::fs::File::open(path) else { + uucore::error::set_exit_code(1); + uucore::show_error!("cannot open {path}: No such file or directory"); + continue; + }; + if let Err(err) = rev_stream(file, sep) { + uucore::error::set_exit_code(1); + uucore::show_error!("cannot read {path}: {err}"); } } - None => { - let stdin = std::io::stdin().lock(); - let _ = rev_stream(stdin, sep); - } + } else { + let stdin = std::io::stdin().lock(); + let _ = rev_stream(stdin, sep); } Ok(()) From d5cdfdd949edaea989846ec98a65ae3d76e2292e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:27:56 +0000 Subject: [PATCH 11/16] chore(deps): update rust crate clap_complete to v4.5.12 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a9cff08..27fecec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.11" +version = "4.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ae69fbb0833c6fcd5a8d4b8609f108c7ad95fc11e248d853ff2c42a90df26a" +checksum = "a8670053e87c316345e384ca1f3eba3006fc6355ed8b8a1140d104e109e3df34" dependencies = [ "clap", ] From 8ec2abfcf059369612b49acaa0d7bc90056b72c1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 22:39:23 +0000 Subject: [PATCH 12/16] chore(deps): update rust crate clap to v4.5.13 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a9cff08..5c0f9e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,18 +85,18 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "clap" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" +checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" +checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" dependencies = [ "anstream", "anstyle", From 33a1e4608d8e6a424676a7a3a11aea7b009c6776 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 1 Aug 2024 09:47:33 +0200 Subject: [PATCH 13/16] Bump sysinfo from 0.30 to 0.31 --- Cargo.lock | 151 +++++++++++++++++++++++++++++++++++++++++------------ Cargo.toml | 2 +- 2 files changed, 118 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 980a754..37ae4b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,6 +71,17 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -523,6 +534,26 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "siphasher" version = "0.3.11" @@ -541,17 +572,28 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "syn" +version = "2.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "sysinfo" -version = "0.30.13" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3" +checksum = "29a6b037e3af4ae9a9d6214198e4df53091363b2c96c88fc416a6c1bd92a2799" dependencies = [ - "cfg-if", + "bstr", "core-foundation-sys", "libc", + "memchr", "ntapi", - "once_cell", "rayon", "windows", ] @@ -765,21 +807,55 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.52.0" +version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" dependencies = [ "windows-core", - "windows-targets 0.52.0", + "windows-targets 0.52.6", ] [[package]] name = "windows-core" -version = "0.52.0" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ - "windows-targets 0.52.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -797,7 +873,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", ] [[package]] @@ -817,17 +893,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -838,9 +915,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -850,9 +927,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -862,9 +939,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -874,9 +957,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -886,9 +969,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -898,9 +981,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -910,9 +993,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "xattr" diff --git a/Cargo.toml b/Cargo.toml index 7b90d01..0e685f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ clap = { version = "4.4", features = ["wrap_help", "cargo"] } clap_complete = "4.4" clap_mangen = "0.2" regex = "1.10.2" -sysinfo = "0.30" +sysinfo = "0.31" libc = "0.2.152" phf = "0.11.2" phf_codegen = "0.11.2" From 921c99c6e73461bf7c731f3f875bbe994007cd52 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 1 Aug 2024 09:53:26 +0200 Subject: [PATCH 14/16] lscpu: remove unused line causing compile error --- src/uu/lscpu/src/lscpu.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uu/lscpu/src/lscpu.rs b/src/uu/lscpu/src/lscpu.rs index 2faacf9..001ae36 100644 --- a/src/uu/lscpu/src/lscpu.rs +++ b/src/uu/lscpu/src/lscpu.rs @@ -16,7 +16,6 @@ const USAGE: &str = help_usage!("lscpu.md"); pub fn uumain(args: impl uucore::Args) -> UResult<()> { let _matches: clap::ArgMatches = uu_app().try_get_matches_from(args)?; let system = System::new_all(); - let _cpu = system.global_cpu_info(); println!("Architecture: {}", get_architecture()); println!("CPU(s): {}", system.cpus().len()); From 801292a6e43098bc1dfdc7f6b05d957f5faa4aff Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 1 Aug 2024 14:34:15 +0200 Subject: [PATCH 15/16] lscpu: fix bin name in Cargo.toml --- src/uu/lscpu/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/lscpu/Cargo.toml b/src/uu/lscpu/Cargo.toml index c59e07e..60b38f1 100644 --- a/src/uu/lscpu/Cargo.toml +++ b/src/uu/lscpu/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" path = "src/lscpu.rs" [[bin]] -name = "mountpoint" +name = "lscpu" path = "src/main.rs" [dependencies] From 6c383c3afe2b39b6bb50757ae5f6cfcaf2ad3f11 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 1 Aug 2024 17:55:05 +0200 Subject: [PATCH 16/16] ci: remove -Clink-dead-code from coverage job --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8532279..56188b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,7 @@ jobs: env: CARGO_INCREMENTAL: "0" RUSTC_WRAPPER: "" - RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" + RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" RUSTDOCFLAGS: "-Cpanic=abort" - name: "`grcov` ~ install" id: build_grcov