Remove mentions to hashsum

This commit is contained in:
Dorian Peron
2026-01-30 16:17:31 +01:00
parent 12193c52c6
commit ade6e8c632
22 changed files with 4 additions and 1861 deletions
Generated
-10
View File
@@ -588,7 +588,6 @@ dependencies = [
"uu_fmt",
"uu_fold",
"uu_groups",
"uu_hashsum",
"uu_head",
"uu_hostid",
"uu_hostname",
@@ -3570,15 +3569,6 @@ dependencies = [
"uucore",
]
[[package]]
name = "uu_hashsum"
version = "0.6.0"
dependencies = [
"clap",
"fluent",
"uucore",
]
[[package]]
name = "uu_head"
version = "0.6.0"
-2
View File
@@ -112,7 +112,6 @@ feat_common_core = [
"false",
"fmt",
"fold",
"hashsum",
"head",
"join",
"link",
@@ -472,7 +471,6 @@ false = { optional = true, version = "0.6.0", package = "uu_false", path = "src/
fmt = { optional = true, version = "0.6.0", package = "uu_fmt", path = "src/uu/fmt" }
fold = { optional = true, version = "0.6.0", package = "uu_fold", path = "src/uu/fold" }
groups = { optional = true, version = "0.6.0", package = "uu_groups", path = "src/uu/groups" }
hashsum = { optional = true, version = "0.6.0", package = "uu_hashsum", path = "src/uu/hashsum" }
head = { optional = true, version = "0.6.0", package = "uu_head", path = "src/uu/head" }
hostid = { optional = true, version = "0.6.0", package = "uu_hostid", path = "src/uu/hostid" }
hostname = { optional = true, version = "0.6.0", package = "uu_hostname", path = "src/uu/hostname" }
-6
View File
@@ -105,9 +105,6 @@ ifeq ($(SELINUX_ENABLED),1)
endif
UTILS ?= $(filter-out $(SKIP_UTILS),$(PROGS))
ifneq ($(filter hashsum,$(UTILS)),hashsum)
HASHSUM_PROGS :=
endif
ifneq ($(findstring stdbuf,$(UTILS)),)
# Use external libstdbuf per default. It is more robust than embedding libstdbuf.
@@ -306,9 +303,6 @@ else
$(foreach prog, $(INSTALLEES), \
$(INSTALL) -m 755 $(BUILDDIR)/$(prog) $(INSTALLDIR_BIN)/$(PROG_PREFIX)$(prog) $(newline) \
)
$(foreach prog, $(HASHSUM_PROGS), \
cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)hashsum $(PROG_PREFIX)$(prog) $(newline) \
)
$(if $(findstring test,$(INSTALLEES)), $(INSTALL) -m 755 $(BUILDDIR)/test $(INSTALLDIR_BIN)/$(PROG_PREFIX)[)
endif
-3
View File
@@ -87,9 +87,6 @@ pub fn main() {
"false" | "true" => {
phf_map.entry(krate, format!("(r#{krate}::uumain, r#{krate}::uu_app)"));
}
"hashsum" => {
phf_map.entry(krate, format!("({krate}::uumain, {krate}::uu_app_custom)"));
}
_ => {
phf_map.entry(krate, map_value.clone());
}
-7
View File
@@ -53,13 +53,6 @@ packages.
`rm` can display a progress bar when the `-g`/`--progress` flag is set.
## `hashsum` (deprecated)
This utility does not exist in GNU coreutils. `hashsum` is a utility that
supports computing the checksums with several algorithms. The flags and options
are identical to the `*sum` family of utils (`sha1sum`, `sha256sum`, `b2sum`,
etc.). This utility will be removed in the future and it is advised to use `cksum --untagged` instead.
## `more`
We provide a simple implementation of `more`, which is not part of GNU
-7
View File
@@ -83,7 +83,6 @@ static PATH_PROGRAMS: &[&str] = &[
"vdir",
"mkfifo",
"mknod",
"hashsum",
// File I/O utilities
"dd",
"sync",
@@ -252,12 +251,6 @@ fn test_program_with_non_utf8_path(program: &str, path: &Path) -> CommandResult
OsString::from("bs=1"),
OsString::from("count=1"),
],
// Hashsum needs algorithm
"hashsum" => vec![
OsString::from(program),
OsString::from("--md5"),
path_os.to_owned(),
],
// Encoding/decoding programs
"base32" | "base64" | "basenc" => vec![OsString::from(program), path_os.to_owned()],
"df" => vec![OsString::from(program), path_os.to_owned()],
-30
View File
@@ -1,30 +0,0 @@
[package]
name = "uu_hashsum"
description = "hashsum ~ (uutils) display or check input digests"
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/hashsum"
version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
edition.workspace = true
readme.workspace = true
[lints]
workspace = true
[lib]
path = "src/hashsum.rs"
[dependencies]
clap = { workspace = true }
uucore = { workspace = true, features = ["checksum", "encoding", "sum"] }
fluent = { workspace = true }
[[bin]]
name = "hashsum"
path = "src/main.rs"
[dev-dependencies]
uucore = { workspace = true, features = ["benchmark"] }
-1
View File
@@ -1 +0,0 @@
../../../LICENSE
-39
View File
@@ -1,39 +0,0 @@
hashsum-about = Compute and check message digests.
hashsum-usage = hashsum --<digest> [OPTIONS]... [FILE]...
# Utility-specific usage template
hashsum-usage-specific = {$utility_name} [OPTION]... [FILE]...
# Help messages
hashsum-help-binary-windows = read or check in binary mode (default)
hashsum-help-binary-other = read in binary mode
hashsum-help-text-windows = read or check in text mode
hashsum-help-text-other = read in text mode (default)
hashsum-help-check = read hashsums from the FILEs and check them
hashsum-help-tag = create a BSD-style checksum
hashsum-help-quiet = don't print OK for each successfully verified file
hashsum-help-status = don't output anything, status code shows success
hashsum-help-strict = exit non-zero for improperly formatted checksum lines
hashsum-help-ignore-missing = don't fail or report status for missing files
hashsum-help-warn = warn about improperly formatted checksum lines
hashsum-help-zero = end each output line with NUL, not newline
hashsum-help-length = digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8
# Algorithm help messages
hashsum-help-md5 = work with MD5
hashsum-help-sha1 = work with SHA1
hashsum-help-sha224 = work with SHA224
hashsum-help-sha256 = work with SHA256
hashsum-help-sha384 = work with SHA384
hashsum-help-sha512 = work with SHA512
hashsum-help-sha3 = work with SHA3
hashsum-help-sha3-224 = work with SHA3-224
hashsum-help-sha3-256 = work with SHA3-256
hashsum-help-sha3-384 = work with SHA3-384
hashsum-help-sha3-512 = work with SHA3-512
hashsum-help-shake128 = work with SHAKE128 using BITS for the output size
hashsum-help-shake256 = work with SHAKE256 using BITS for the output size
hashsum-help-b2sum = work with BLAKE2
hashsum-help-b3sum = work with BLAKE3
# Error messages
hashsum-error-failed-to-read-input = failed to read input
-37
View File
@@ -1,37 +0,0 @@
hashsum-about = Calculer et vérifier les empreintes de messages.
hashsum-usage = hashsum --<empreinte> [OPTION]... [FICHIER]...
# Messages d'aide
hashsum-help-binary-windows = lire ou vérifier en mode binaire (par défaut)
hashsum-help-binary-other = lire en mode binaire
hashsum-help-text-windows = lire ou vérifier en mode texte
hashsum-help-text-other = lire en mode texte (par défaut)
hashsum-help-check = lire les empreintes depuis les FICHIERs et les vérifier
hashsum-help-tag = créer une somme de contrôle de style BSD
hashsum-help-quiet = ne pas afficher OK pour chaque fichier vérifié avec succès
hashsum-help-status = ne rien afficher, le code de statut indique le succès
hashsum-help-strict = sortir avec un code non-zéro pour les lignes de somme de contrôle mal formatées
hashsum-help-ignore-missing = ne pas échouer ou rapporter le statut pour les fichiers manquants
hashsum-help-warn = avertir des lignes de somme de contrôle mal formatées
hashsum-help-zero = terminer chaque ligne de sortie avec NUL, pas de retour à la ligne
hashsum-help-length = longueur de l'empreinte en bits ; ne doit pas dépasser le maximum pour l'algorithme blake2 et doit être un multiple de 8
# Messages d'aide des algorithmes
hashsum-help-md5 = travailler avec MD5
hashsum-help-sha1 = travailler avec SHA1
hashsum-help-sha224 = travailler avec SHA224
hashsum-help-sha256 = travailler avec SHA256
hashsum-help-sha384 = travailler avec SHA384
hashsum-help-sha512 = travailler avec SHA512
hashsum-help-sha3 = travailler avec SHA3
hashsum-help-sha3-224 = travailler avec SHA3-224
hashsum-help-sha3-256 = travailler avec SHA3-256
hashsum-help-sha3-384 = travailler avec SHA3-384
hashsum-help-sha3-512 = travailler avec SHA3-512
hashsum-help-shake128 = travailler avec SHAKE128 en utilisant BITS pour la taille de sortie
hashsum-help-shake256 = travailler avec SHAKE256 en utilisant BITS pour la taille de sortie
hashsum-help-b2sum = travailler avec BLAKE2
hashsum-help-b3sum = travailler avec BLAKE3
# Messages d'erreur
hashsum-error-failed-to-read-input = échec de la lecture de l'entrée
-408
View File
@@ -1,408 +0,0 @@
// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore (ToDO) algo, algoname, bitlen, regexes, nread
use std::ffi::{OsStr, OsString};
use std::iter;
use std::path::Path;
use clap::builder::ValueParser;
use clap::{Arg, ArgAction, ArgMatches, Command};
use uucore::checksum::compute::{
ChecksumComputeOptions, OutputFormat, perform_checksum_computation,
};
use uucore::checksum::validate::{
ChecksumValidateOptions, ChecksumVerbose, perform_checksum_validation,
};
use uucore::checksum::{
AlgoKind, ChecksumError, SizedAlgoKind, calculate_blake2b_length_str,
sanitize_sha2_sha3_length_str,
};
use uucore::error::UResult;
use uucore::line_ending::LineEnding;
use uucore::{format_usage, translate};
const NAME: &str = "hashsum";
/// Creates a hasher instance based on the command-line flags.
///
/// # Arguments
///
/// * `matches` - A reference to the `ArgMatches` object containing the command-line arguments.
///
/// # Returns
///
/// Returns a [`UResult`] of a tuple containing the algorithm name, the hasher instance, and
/// the output length in bits or an Err if multiple hash algorithms are specified or if a
/// required flag is missing.
#[allow(clippy::cognitive_complexity)]
fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult<(AlgoKind, Option<usize>)> {
let mut alg: Option<(AlgoKind, Option<usize>)> = None;
let mut set_or_err = |new_alg: (AlgoKind, Option<usize>)| -> UResult<()> {
if alg.is_some() {
return Err(ChecksumError::CombineMultipleAlgorithms.into());
}
alg = Some(new_alg);
Ok(())
};
if matches.get_flag("md5") {
set_or_err((AlgoKind::Md5, None))?;
}
if matches.get_flag("sha1") {
set_or_err((AlgoKind::Sha1, None))?;
}
if matches.get_flag("sha224") {
set_or_err((AlgoKind::Sha224, None))?;
}
if matches.get_flag("sha256") {
set_or_err((AlgoKind::Sha256, None))?;
}
if matches.get_flag("sha384") {
set_or_err((AlgoKind::Sha384, None))?;
}
if matches.get_flag("sha512") {
set_or_err((AlgoKind::Sha512, None))?;
}
if matches.get_flag("b2sum") {
set_or_err((AlgoKind::Blake2b, None))?;
}
if matches.get_flag("b3sum") {
set_or_err((AlgoKind::Blake3, None))?;
}
if matches.get_flag("sha3") {
match matches.get_one::<String>(options::LENGTH) {
Some(len) => set_or_err((
AlgoKind::Sha3,
Some(sanitize_sha2_sha3_length_str(AlgoKind::Sha3, len)?),
))?,
None => return Err(ChecksumError::LengthRequired("SHA3".into()).into()),
}
}
if matches.get_flag("sha3-224") {
set_or_err((AlgoKind::Sha3, Some(224)))?;
}
if matches.get_flag("sha3-256") {
set_or_err((AlgoKind::Sha3, Some(256)))?;
}
if matches.get_flag("sha3-384") {
set_or_err((AlgoKind::Sha3, Some(384)))?;
}
if matches.get_flag("sha3-512") {
set_or_err((AlgoKind::Sha3, Some(512)))?;
}
if matches.get_flag("shake128") {
set_or_err((AlgoKind::Shake128, Some(128)))?;
}
if matches.get_flag("shake256") {
set_or_err((AlgoKind::Shake256, Some(256)))?;
}
if alg.is_none() {
return Err(ChecksumError::NeedAlgorithmToHash.into());
}
Ok(alg.unwrap())
}
#[uucore::main]
pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
// if there is no program name for some reason, default to "hashsum"
let program = args.next().unwrap_or_else(|| OsString::from(NAME));
let binary_name = Path::new(&program)
.file_stem()
.unwrap_or_else(|| OsStr::new(NAME))
.to_string_lossy();
let args = iter::once(program.clone()).chain(args);
let (command, is_hashsum_bin) = uu_app(&binary_name);
// FIXME: this should use try_get_matches_from() and crash!(), but at the moment that just
// causes "error: " to be printed twice (once from crash!() and once from clap). With
// the current setup, the name of the utility is not printed, but I think this is at
// least somewhat better from a user's perspective.
let matches = uucore::clap_localization::handle_clap_result(command, args)?;
let length: Option<usize> = if binary_name == "b2sum" {
if let Some(len) = matches.get_one::<String>(options::LENGTH) {
calculate_blake2b_length_str(len)?
} else {
None
}
} else {
None
};
let (algo_kind, length) = if is_hashsum_bin {
create_algorithm_from_flags(&matches)?
} else {
(AlgoKind::from_bin_name(&binary_name)?, length)
};
let check = matches.get_flag("check");
let check_flag = |flag| match (check, matches.get_flag(flag)) {
(_, false) => Ok(false),
(true, true) => Ok(true),
(false, true) => Err(ChecksumError::CheckOnlyFlag(flag.into())),
};
// Each of the following flags are only expected in --check mode.
// If we encounter them otherwise, end with an error.
let ignore_missing = check_flag("ignore-missing")?;
let warn = check_flag("warn")?;
let quiet = check_flag("quiet")?;
let strict = check_flag("strict")?;
let status = check_flag("status")?;
// clap provides the default value -. So we unwrap() safety.
let files = matches
.get_many::<OsString>(options::FILE)
.unwrap()
.map(|s| s.as_os_str());
if check {
// on Windows, allow --binary/--text to be used with --check
// and keep the behavior of defaulting to binary
#[cfg(not(windows))]
{
let text_flag = matches.get_flag("text");
let binary_flag = matches.get_flag("binary");
if binary_flag || text_flag {
return Err(ChecksumError::BinaryTextConflict.into());
}
}
let verbose = ChecksumVerbose::new(status, quiet, warn);
let opts = ChecksumValidateOptions {
ignore_missing,
strict,
verbose,
};
// Execute the checksum validation
return perform_checksum_validation(files, Some(algo_kind), length, opts);
}
let algo = SizedAlgoKind::from_unsized(algo_kind, length)?;
let line_ending = LineEnding::from_zero_flag(matches.get_flag("zero"));
let output_format = OutputFormat::from_standalone(std::env::args_os())?;
let opts = ChecksumComputeOptions {
algo_kind: algo,
output_format,
line_ending,
};
// Show the hashsum of the input
perform_checksum_computation(opts, files)
}
mod options {
//pub const ALGORITHM: &str = "algorithm";
pub const FILE: &str = "file";
//pub const UNTAGGED: &str = "untagged";
pub const TAG: &str = "tag";
pub const LENGTH: &str = "length";
//pub const RAW: &str = "raw";
//pub const BASE64: &str = "base64";
pub const CHECK: &str = "check";
pub const STRICT: &str = "strict";
pub const TEXT: &str = "text";
pub const BINARY: &str = "binary";
pub const STATUS: &str = "status";
pub const WARN: &str = "warn";
pub const QUIET: &str = "quiet";
}
pub fn uu_app_common() -> Command {
Command::new(uucore::util_name())
.version(uucore::crate_version!())
.help_template(uucore::localized_help_template(uucore::util_name()))
.about(translate!("hashsum-about"))
.override_usage(format_usage(&translate!("hashsum-usage")))
.infer_long_args(true)
.args_override_self(true)
.arg(
Arg::new(options::BINARY)
.short('b')
.long("binary")
.help({
#[cfg(windows)]
{
translate!("hashsum-help-binary-windows")
}
#[cfg(not(windows))]
{
translate!("hashsum-help-binary-other")
}
})
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::CHECK)
.short('c')
.long("check")
.help(translate!("hashsum-help-check"))
.action(ArgAction::SetTrue)
.conflicts_with("tag"),
)
.arg(
Arg::new(options::TAG)
.long("tag")
.help(translate!("hashsum-help-tag"))
.action(ArgAction::SetTrue)
.conflicts_with("text"),
)
.arg(
Arg::new(options::TEXT)
.short('t')
.long("text")
.help({
#[cfg(windows)]
{
translate!("hashsum-help-text-windows")
}
#[cfg(not(windows))]
{
translate!("hashsum-help-text-other")
}
})
.conflicts_with("binary")
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::QUIET)
.short('q')
.long(options::QUIET)
.help(translate!("hashsum-help-quiet"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::STATUS, options::WARN]),
)
.arg(
Arg::new(options::STATUS)
.short('s')
.long("status")
.help(translate!("hashsum-help-status"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::QUIET, options::WARN]),
)
.arg(
Arg::new(options::STRICT)
.long("strict")
.help(translate!("hashsum-help-strict"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("ignore-missing")
.long("ignore-missing")
.help(translate!("hashsum-help-ignore-missing"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::WARN)
.short('w')
.long("warn")
.help(translate!("hashsum-help-warn"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::QUIET, options::STATUS]),
)
.arg(
Arg::new("zero")
.short('z')
.long("zero")
.help(translate!("hashsum-help-zero"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::FILE)
.index(1)
.action(ArgAction::Append)
.value_name(options::FILE)
.default_value("-")
.hide_default_value(true)
.value_hint(clap::ValueHint::FilePath)
.value_parser(ValueParser::os_string()),
)
}
pub fn uu_app_length() -> Command {
uu_app_opt_length(uu_app_common())
}
fn uu_app_opt_length(command: Command) -> Command {
command.arg(
Arg::new(options::LENGTH)
.long(options::LENGTH)
.short('l')
.help(translate!("hashsum-help-length"))
.overrides_with(options::LENGTH)
.action(ArgAction::Set),
)
}
pub fn uu_app_custom() -> Command {
let mut command = uu_app_opt_length(uu_app_common());
let algorithms = &[
("md5", translate!("hashsum-help-md5")),
("sha1", translate!("hashsum-help-sha1")),
("sha224", translate!("hashsum-help-sha224")),
("sha256", translate!("hashsum-help-sha256")),
("sha384", translate!("hashsum-help-sha384")),
("sha512", translate!("hashsum-help-sha512")),
("sha3", translate!("hashsum-help-sha3")),
("sha3-224", translate!("hashsum-help-sha3-224")),
("sha3-256", translate!("hashsum-help-sha3-256")),
("sha3-384", translate!("hashsum-help-sha3-384")),
("sha3-512", translate!("hashsum-help-sha3-512")),
("shake128", translate!("hashsum-help-shake128")),
("shake256", translate!("hashsum-help-shake256")),
("b2sum", translate!("hashsum-help-b2sum")),
("b3sum", translate!("hashsum-help-b3sum")),
];
for (name, desc) in algorithms {
command = command.arg(
Arg::new(*name)
.long(name)
.help(desc)
.action(ArgAction::SetTrue),
);
}
command
}
/// hashsum is handled differently in build.rs
/// therefore, this is different from other utilities.
fn uu_app(binary_name: &str) -> (Command, bool) {
let (command, is_hashsum_bin) = match binary_name {
// These all support the same options.
"md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum" => {
(uu_app_common(), false)
}
// b2sum supports the md5sum options plus -l/--length.
"b2sum" => (uu_app_length(), false),
// We're probably just being called as `hashsum`, so give them everything.
_ => (uu_app_custom(), true),
};
// If not called as generic hashsum, override the command name and usage
let command = if is_hashsum_bin {
command
} else {
let usage = translate!("hashsum-usage-specific", "utility_name" => binary_name);
command
.help_template(uucore::localized_help_template(binary_name))
.override_usage(format_usage(&usage))
};
(command, is_hashsum_bin)
}
-1
View File
@@ -1 +0,0 @@
uucore::bin!(uu_hashsum);
+1 -6
View File
@@ -286,12 +286,7 @@ fn test_check_b2sum_strict_check() {
#[test]
fn test_help_shows_correct_utility_name() {
// Test that help output shows the actual utility name instead of "hashsum"
let scene = TestScenario::new(util_name!());
// Test b2sum
scene
.ccmd("b2sum")
new_ucmd!()
.arg("--help")
.succeeds()
.stdout_contains("Usage: b2sum")
File diff suppressed because it is too large Load Diff
-2
View File
@@ -155,8 +155,6 @@ fn test_conflicting_arg() {
#[test]
fn test_help_shows_correct_utility_name() {
// Test that help output shows the actual utility name instead of "hashsum"
new_ucmd!()
.arg("--help")
.succeeds()
-1
View File
@@ -172,7 +172,6 @@ fn test_check_sha256_binary() {
#[test]
fn test_help_shows_correct_utility_name() {
// Test that help output shows the actual utility name instead of "hashsum"
new_ucmd!()
.arg("--help")
.succeeds()
-1
View File
@@ -113,7 +113,6 @@ fn test_conflicting_arg() {
#[test]
fn test_help_shows_correct_utility_name() {
// Test that help output shows the actual utility name instead of "hashsum"
new_ucmd!()
.arg("--help")
.succeeds()
-1
View File
@@ -113,7 +113,6 @@ fn test_conflicting_arg() {
#[test]
fn test_help_shows_correct_utility_name() {
// Test that help output shows the actual utility name instead of "hashsum"
new_ucmd!()
.arg("--help")
.succeeds()
-27
View File
@@ -132,15 +132,6 @@ fn test_error_messages_have_colors() {
println!("Testing error colors for {utility}");
let mut cmd = create_utility_command(utility);
let uu_name = format!("uu_{utility}");
let binary_name = uucore::get_canonical_util_name(&uu_name);
// For hashsum aliases, we need to pass the hash algorithm as a subcommand
if binary_name == "hashsum" && utility != "hashsum" {
// Extract the hash algorithm from the utility name
let algo = utility.trim_end_matches("sum");
cmd.arg(algo);
}
let output = cmd
.arg("--invalid-option-that-should-not-exist")
@@ -232,15 +223,6 @@ fn test_error_messages_french_translation() {
println!("Testing French error translation for {utility}");
let mut cmd = create_utility_command(utility);
let uu_name = format!("uu_{utility}");
let binary_name = uucore::get_canonical_util_name(&uu_name);
// For hashsum aliases, we need to pass the hash algorithm as a subcommand
if binary_name == "hashsum" && utility != "hashsum" {
// Extract the hash algorithm from the utility name
let algo = utility.trim_end_matches("sum");
cmd.arg(algo);
}
let output = cmd
.arg("--invalid-option-that-should-not-exist")
@@ -285,15 +267,6 @@ fn test_french_colored_error_messages() {
println!("Testing French colored errors for {utility}");
let mut cmd = create_utility_command(utility);
let uu_name = format!("uu_{utility}");
let binary_name = uucore::get_canonical_util_name(&uu_name);
// For hashsum aliases, we need to pass the hash algorithm as a subcommand
if binary_name == "hashsum" && utility != "hashsum" {
// Extract the hash algorithm from the utility name
let algo = utility.trim_end_matches("sum");
cmd.arg(algo);
}
let output = cmd
.arg("--invalid-option-that-should-not-exist")
-4
View File
@@ -172,10 +172,6 @@ mod test_fold;
#[path = "by-util/test_groups.rs"]
mod test_groups;
#[cfg(feature = "hashsum")]
#[path = "by-util/test_hashsum.rs"]
mod test_hashsum;
#[cfg(feature = "head")]
#[path = "by-util/test_head.rs"]
mod test_head;
+2 -2
View File
@@ -2,7 +2,7 @@
@echo off
@rem ::# spell-checker:ignore (CMD) ERRORLEVEL
@rem ::# spell-checker:ignore (utils) cksum coreutils dircolors hashsum mkdir mktemp printenv printf readlink realpath rmdir shuf tsort unexpand
@rem ::# spell-checker:ignore (utils) cksum coreutils dircolors mkdir mktemp printenv printf readlink realpath rmdir shuf tsort unexpand
@rem ::# spell-checker:ignore (jq) deps startswith
set "ME=%~0"
@@ -12,7 +12,7 @@ set "ME_parent_dir=%~dp0.\.."
@rem refs: <https://forge.rust-lang.org/release/platform-support.html> , <https://docs.rs/platforms/0.2.1/platforms/platform/tier1/index.html>
@rem :: default ("Tier 1" cross-platform) utility list
set "default_utils=base32 base64 basename cat cksum comm cp cut date dircolors dirname echo env expand expr factor false fmt fold hashsum head join link ln ls mkdir mktemp more mv nl od paste printenv printf ptx pwd readlink realpath rm rmdir seq shred shuf sleep sort split sum tac tail tee test tr true truncate tsort unexpand uniq wc yes"
set "default_utils=base32 base64 basename cat cksum comm cp cut date dircolors dirname echo env expand expr factor false fmt fold head join link ln ls mkdir mktemp more mv nl od paste printenv printf ptx pwd readlink realpath rm rmdir seq shred shuf sleep sort split sum tac tail tee test tr true truncate tsort unexpand uniq wc yes"
set "project_dir=%ME_parent_dir%"
cd "%project_dir%"
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# spell-checker:ignore (shell) OSTYPE
# spell-checker:ignore (utils) cksum coreutils dircolors hashsum mkdir mktemp printenv printf readlink realpath grealpath rmdir shuf tsort unexpand
# spell-checker:ignore (utils) cksum coreutils dircolors mkdir mktemp printenv printf readlink realpath grealpath rmdir shuf tsort unexpand
# spell-checker:ignore (jq) deps startswith
# Use GNU version for realpath on *BSD