Skip to content

Commit

Permalink
Merge pull request #7079 from Felle33/cksum_--tag_meaningless_with_--…
Browse files Browse the repository at this point in the history
…check

cksum: the --tag is meaningless with --check
  • Loading branch information
cakebaker authored Jan 5, 2025
2 parents 4ff48c3 + 61290fd commit d9936ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/uu/cksum/src/cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions tests/by-util/test_cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit d9936ca

Please sign in to comment.