Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/find/matchers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,9 @@ fn build_matcher_tree(
i += 1;
let matcher = UserMatcher::from_user_name(user)
.or_else(|| Some(UserMatcher::from_uid(user.parse::<u32>().ok()?)))
.ok_or_else(|| format!("{user} is not the name of a known user"))?;
.ok_or_else(|| {
format!("invalid user name or UID argument to -user: '{user}'")
})?;
Some(matcher.into_box())
}
"-nouser" => Some(NoUserMatcher {}.into_box()),
Expand Down Expand Up @@ -749,7 +751,9 @@ fn build_matcher_tree(
i += 1;
let matcher = GroupMatcher::from_group_name(group)
.or_else(|| Some(GroupMatcher::from_gid(group.parse::<u32>().ok()?)))
.ok_or_else(|| format!("{group} is not the name of an existing group"))?;
.ok_or_else(|| {
format!("invalid group name or GID argument to -group: '{group}'")
})?;
Some(matcher.into_box())
}
"-nogroup" => Some(NoGroupMatcher {}.into_box()),
Expand Down
2 changes: 1 addition & 1 deletion src/find/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub fn find_main(args: &[&str], deps: &dyn Dependencies) -> i32 {
match do_find(&args[1..], deps) {
Ok(ret) => ret,
Err(e) => {
writeln!(&mut stderr(), "Error: {e}").unwrap();
writeln!(&mut stderr(), "find: {e}").unwrap();
1
}
}
Expand Down
8 changes: 5 additions & 3 deletions tests/find_cmd_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,9 @@ fn find_with_user_predicate() {
.args(["test_data", "-user", " "])
.assert()
.failure()
.stderr(predicate::str::contains("is not the name of a known user"))
.stderr(predicate::str::contains(
"invalid user name or UID argument to -user",
))
.stdout(predicate::str::is_empty());
}

Expand Down Expand Up @@ -921,7 +923,7 @@ fn find_with_group_predicate() {
.assert()
.failure()
.stderr(predicate::str::contains(
"is not the name of an existing group",
"invalid group name or GID argument to -group:",
))
.stdout(predicate::str::is_empty());
}
Expand Down Expand Up @@ -1035,7 +1037,7 @@ fn find_age_range() {
.failure()
.code(1)
.stderr(predicate::str::contains(
"Error: Expected a decimal integer (with optional + or - prefix) argument to",
"find: Expected a decimal integer (with optional + or - prefix) argument to",
))
.stdout(predicate::str::is_empty());
}
Expand Down
Loading