Skip to content

Commit 154945e

Browse files
author
oech3
committed
cksum: Backport --text --tag error from GNU's main
1 parent 0b0968a commit 154945e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/uu/cksum/src/cksum.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ pub fn uu_app() -> Command {
214214
.long(options::TAG)
215215
.help(translate!("cksum-help-tag"))
216216
.action(ArgAction::SetTrue)
217-
.overrides_with(options::UNTAGGED)
218-
.overrides_with(options::BINARY)
219-
.overrides_with(options::TEXT),
217+
.conflicts_with(options::TEXT),
220218
)
221219
.arg(
222220
Arg::new(options::LENGTH)

tests/by-util/test_cksum.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,13 +1010,13 @@ fn test_reset_binary() {
10101010

10111011
scene
10121012
.ucmd()
1013-
.arg("--binary") // should disappear because of the following option
1013+
.arg("--binary")
10141014
.arg("--tag")
10151015
.arg("--untagged")
10161016
.arg("--algorithm=md5")
10171017
.arg(at.subdir.join("f"))
10181018
.succeeds()
1019-
.stdout_contains("d41d8cd98f00b204e9800998ecf8427e ");
1019+
.stdout_contains("d41d8cd98f00b204e9800998ecf8427e *");
10201020
}
10211021

10221022
#[test]
@@ -1047,13 +1047,11 @@ mod output_format {
10471047
let (at, mut ucmd) = at_and_ucmd!();
10481048
at.touch("f");
10491049

1050-
ucmd.arg("--text") // should disappear because of the following option
1050+
ucmd.arg("--text")
10511051
.arg("--tag")
10521052
.args(&["-a", "md5"])
10531053
.arg(at.subdir.join("f"))
1054-
.succeeds()
1055-
// Tagged output is used
1056-
.stdout_contains("f) = d41d8cd98f00b204e9800998ecf8427e");
1054+
.fails_with_code(1); // with clap generated message
10571055
}
10581056

10591057
#[test]
@@ -1179,7 +1177,7 @@ fn test_binary_file() {
11791177
.arg("--untagged")
11801178
.arg("lorem_ipsum.txt")
11811179
.succeeds()
1182-
.stdout_is("cd724690f7dc61775dfac400a71f2caa lorem_ipsum.txt\n");
1180+
.stdout_is("cd724690f7dc61775dfac400a71f2caa *lorem_ipsum.txt\n");
11831181
}
11841182

11851183
#[test]

util/build-gnu.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ test \$n_stat1 -ge \$n_stat2 \\' tests/ls/stat-free-color.sh
323323
# clap changes the error message. Check exit code only.
324324
"${SED}" -i -e "s|Try 'md5sum --help' for more information.\\\n||" tests/cksum/md5sum.pl
325325
"${SED}" -i '/check-ignore-missing-4/,/EXIT/c \ ['\''check-ignore-missing-4'\'', '\''--ignore-missing'\'', {IN=> {f=> '\'''\''}}, {ERR_SUBST=>"s/.*//s"}, {EXIT=> 1}],' tests/cksum/md5sum.pl
326+
"${SED}" -i "/^.*the --tag option is meaningless/d" tests/cksum/cksum-c.sh
326327
# Our ls command always outputs ANSI color codes prepended with a zero. However,
327328
# in the case of GNU, it seems inconsistent. Nevertheless, it looks like it
328329
# doesn't matter whether we prepend a zero or not.

util/fetch-gnu.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ ver="9.9"
33
repo=https://github.com/coreutils/coreutils
44
curl -L "${repo}/releases/download/v${ver}/coreutils-${ver}.tar.xz" | tar --strip-components=1 -xJf -
55

6+
# Accurate error on *sum
7+
curl -L ${repo}/raw/refs/heads/master/tests/cksum/cksum-a.sh > tests/cksum/cksum-a.sh
8+
curl -L ${repo}/raw/refs/heads/master/tests/cksum/cksum-c.sh > tests/cksum/cksum-c.sh
69
# TODO stop backporting tests from master at GNU coreutils > 9.9
710
curl -L ${repo}/raw/refs/heads/master/tests/mv/hardlink-case.sh > tests/mv/hardlink-case.sh
811
curl -L ${repo}/raw/refs/heads/master/tests/mkdir/writable-under-readonly.sh > tests/mkdir/writable-under-readonly.sh

0 commit comments

Comments
 (0)