Skip to content

Commit

Permalink
Show the message "ownership of 'foo' retained as 'bar'" for every pat…
Browse files Browse the repository at this point in the history
…h entry when `chown -v -R --from=`
  • Loading branch information
djedi23 authored and cakebaker committed May 22, 2023
1 parent 8d5e4a2 commit 75baf2a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/uucore/src/lib/features/perms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,27 @@ impl ChownExecutor {
};

if !self.matched(meta.uid(), meta.gid()) {
if self.verbosity.level == VerbosityLevel::Verbose {
// Display a message when the current user/group doesn't match those specified in
// the `--from` args.
if self.dest_gid.is_none() {
let uid = meta.uid();
println!(
"ownership of {} retained as {}",
path.quote(),
entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
);
} else {
let uid = meta.uid();
let gid = meta.gid();
println!(
"ownership of {} retained as {}:{}",
path.quote(),
entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
);
}
}
continue;
}

Expand Down

0 comments on commit 75baf2a

Please sign in to comment.