-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #4615: chown isnt showing a message #4758
fix #4615: chown isnt showing a message #4758
Conversation
…cified in the `--from` args.
Seems that the GNU test isn't fixed:
|
This comment was marked as resolved.
This comment was marked as resolved.
GNU testsuite comparison:
|
Printing the message in stdout fixes the first part of the GNU test. |
…h entry when `chown -v -R --from=`
GNU testsuite comparison:
|
src/uucore/src/lib/features/perms.rs
Outdated
@@ -260,6 +260,27 @@ impl ChownExecutor { | |||
} | |||
} | |||
} else { | |||
if self.verbosity.level == VerbosityLevel::Verbose { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move this into a function?
fn print_verbose(&self, path: &Path, uid: u32, gid: Option<u32>) {
if self.verbosity.level == VerbosityLevel::Verbose {
match gid {
Some(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()),
);
}
None => {
println!(
"ownership of {} retained as {}",
path.quote(),
entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
);
}
}
}
}
and call:
print_verbose(path, uid, self.dest_gid.map(|_| meta.gid()));
GNU testsuite comparison:
|
…cified in the `--from` args.
…h entry when `chown -v -R --from=`
3678b4a
to
aabf5de
Compare
With GNU chown 9.3, the following commands:
all output:
uutils chown, on the other hand, returns in all three cases:
|
…3/coreutils into 4615_chown_isnt_showing_a_message
Corrected. |
Thanks! |
This PR add a message when the current user is not matched by the
from
argument and the verbosity is increased.Two different messages are displayed depending if a group is set or not to match the observed behavior on GNU chown.
This PR fixes #4615.