chgrp: verbose "retained as" may print an empty group name for unmapped GIDs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Component
chgrp
Description
When running in group-only mode (e.g., chgrp) with --verbose and the requested group equals the current group (so no change occurs), wrap_chown should prints
group of 'FILE' retained as <group>
however
} else if verbosity.level == VerbosityLevel::Verbose {
out = if verbosity.groups_only {
format!(
"group of {} retained as {}",
path.quote(),
entries::gid2grp(dest_gid).unwrap_or_default()
)
} else {
format!(
"ownership of {} retained as {}:{}",
path.quote(),
entries::uid2usr(dest_uid).unwrap_or_else(|_| dest_uid.to_string()),
entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
)
};
}
will print out empty string while the C version prints group id.
Test / Reproduction Steps
core_sbx$ touch tmp
core_sbx$ chgrp 1337 tmp
core_sbx$ chgrp -v 1337 tmp
group of 'tmp' retained as 1337
core_sbx$ ../../coreutils/target/release/chgrp -v 1337 tmp
../../coreutils/target/release/chgrp: group of 'tmp' retained as
Impact
Incorrect or confusing diagnostics. Breaks tests or scripts that parse verbose output.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in chgrp's wrap_chown implementation, specifically the verbose, group-only retained-as branch. Reproduce the case with a numeric unmapped GID such as 1337, then compare the Rust output with the expected C-style diagnostic. Done means the verbose message includes the numeric GID instead of an empty group name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100