1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Merge pull request #7079 from Felle33/cksum_--tag_meaningless_with_--check

cksum: the --tag is meaningless with --check
This commit is contained in:
Daniel Hofstetter 2025-01-05 14:43:38 +01:00 committed by GitHub
commit d9936ca583
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View file

@ -301,8 +301,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let warn = matches.get_flag(options::WARN);
let ignore_missing = matches.get_flag(options::IGNORE_MISSING);
let quiet = matches.get_flag(options::QUIET);
let tag = matches.get_flag(options::TAG);
if binary_flag || text_flag {
if tag || binary_flag || text_flag {
return Err(ChecksumError::BinaryTextConflict.into());
}
// Determine the appropriate algorithm option to pass
@ -426,8 +427,7 @@ pub fn uu_app() -> Command {
.short('c')
.long(options::CHECK)
.help("read hashsums from the FILEs and check them")
.action(ArgAction::SetTrue)
.conflicts_with("tag"),
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::BASE64)

View file

@ -748,6 +748,19 @@ fn test_conflicting_options() {
"cksum: the --binary and --text options are meaningless when verifying checksums",
)
.code_is(1);
scene
.ucmd()
.arg("--tag")
.arg("-c")
.arg("-a")
.arg("md5")
.fails()
.no_stdout()
.stderr_contains(
"cksum: the --binary and --text options are meaningless when verifying checksums",
)
.code_is(1);
}
#[test]