Skip to content

Commit 044bb60

Browse files
oech3oech3
authored andcommitted
Merge branch 'main' into cksum-ln
2 parents 39d9dad + 666c6df commit 044bb60

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,12 @@ workspace = true
617617
# This is the linting configuration for all crates.
618618
# In order to use these, all crates have `[lints] workspace = true` section.
619619
[workspace.lints.rust]
620-
# Allow "fuzzing" as a "cfg" condition name
620+
# Allow "fuzzing" as a "cfg" condition name and "cygwin" as a value for "target_os"
621621
# https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html
622-
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
622+
unexpected_cfgs = { level = "warn", check-cfg = [
623+
'cfg(fuzzing)',
624+
'cfg(target_os, values("cygwin"))',
625+
] }
623626
#unused_qualifications = "warn" // TODO: fix warnings in uucore, then re-enable this lint
624627

625628
[workspace.lints.clippy]

src/uu/cksum/src/cksum.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ fn maybe_sanitize_length(
101101
#[uucore::main]
102102
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
103103
let binary_name = uucore::util_name();
104+
// Put --\nuntagged to make logic simpler
105+
let mut args: Vec<OsString> = args.collect();
106+
if !binary_name.ends_with("cksum") && !args.is_empty() {
107+
args.insert(1, OsString::from("--\nuntagged"));
108+
}
109+
104110
let matches = uucore::clap_localization::handle_clap_result(uu_app(), args)?;
105111

106112
let check = matches.get_flag(options::CHECK);
@@ -180,7 +186,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
180186
// --untagged is cksum specific. So we use this form...
181187
let is_cksum = binary_name.ends_with("cksum");
182188
// clap cannot overrides_with --binary by --tag unilaterally...
183-
let tag = (!is_cksum && std::env::args().any(|a| a == "--tag" || a == "-t"))
189+
let tag = (!is_cksum && std::env::args().any(|a| a == "--tag"))
184190
|| (is_cksum && !matches.get_flag(options::UNTAGGED));
185191
let binary = matches.get_flag(options::BINARY);
186192

@@ -225,8 +231,9 @@ pub fn uu_app() -> Command {
225231
.long(options::TAG)
226232
.help(translate!("cksum-help-tag"))
227233
.action(ArgAction::SetTrue)
228-
.overrides_with(options::BINARY)
229-
.overrides_with(options::TEXT),
234+
.overrides_with(options::TEXT)
235+
.overrides_with(options::UNTAGGED)
236+
.overrides_with(options::BINARY),
230237
)
231238
.arg(
232239
Arg::new(options::RAW)
@@ -262,13 +269,15 @@ pub fn uu_app() -> Command {
262269
.long(options::TEXT)
263270
.short('t')
264271
.hide(true)
272+
.requires(options::UNTAGGED)
265273
.action(ArgAction::SetTrue),
266274
)
267275
.arg(
268276
Arg::new(options::BINARY)
269277
.long(options::BINARY)
270278
.short('b')
271279
.hide(true)
280+
.overrides_with(options::TEXT)
272281
.action(ArgAction::SetTrue),
273282
)
274283
.arg(
@@ -327,7 +336,6 @@ pub fn uu_app() -> Command {
327336
}
328337
if binary_name.ends_with("cksum") {
329338
app = app
330-
.mut_arg(options::TEXT, |a: Arg| a.requires(options::UNTAGGED))
331339
.arg(
332340
Arg::new(options::ALGORITHM)
333341
.long(options::ALGORITHM)
@@ -340,9 +348,15 @@ pub fn uu_app() -> Command {
340348
Arg::new(options::UNTAGGED)
341349
.long(options::UNTAGGED)
342350
.help(translate!("cksum-help-untagged"))
343-
.action(ArgAction::SetTrue)
344-
.overrides_with(options::TAG),
351+
.action(ArgAction::SetTrue),
345352
);
353+
} else {
354+
app = app.arg(
355+
Arg::new(options::UNTAGGED)
356+
.long("\nuntagged")
357+
.hide(true)
358+
.action(ArgAction::SetTrue),
359+
);
346360
}
347361
app.after_help(translate!("cksum-after-help"))
348362
}

src/uu/stdbuf/src/libstdbuf/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
categories.workspace = true
1111
edition.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[lib]
1417
name = "stdbuf"
1518
path = "src/libstdbuf.rs"

0 commit comments

Comments
 (0)