Repository navigation
fix(chown): no-op success, stdout reports, empty spec (#1701 #1702 #1703) - #1734
Merged
Merged
Conversation
…s a no-op (Refs #1701 #1702 #1703) GNU coreutils 9.4 lets the kernel decide: chown() with the file's own uid/gid is a success for the file owner, and ''/':' parse to unset fields so nothing is requested at all. WinuxCmd resolved SIDs and then entered the privileged SetSecurityInfo path unconditionally, so a correct-owner request could still come back EPERM (#1701), and '' hit the "invalid spec" diagnostic (#1703). process_file now models the spec as fields (owner/group, matching GNU's user_name/group_name truthiness), resolves the requested SIDs, and compares them against the path's current SIDs with EqualSid. When every requested field already matches and the caller is the file owner, the privileged write is skipped and the request succeeds — covering owner, owner:, --from, --reference, -h and -R. Actual mutations keep failing with GNU's inner error() wording ("changing ownership of"/"changing group of", chown-core.c:481-486) instead of the old access-probe "cannot access". describe_change (chown-core.c:151-208) is mirrored verbatim: retained /changed/failed reports go to stdout via printf with no program-name prefix, -v prints every outcome, -c prints only real changes (#1702), and a no-field spec ('' or ':') selects the bare "retained"/"failed" forms without "as"/"to". Failed stat probes still emit the CH_FAILED line under -v, showing the link's own ids for dangling targets. New user-visible report text carries command.chown.report.* keys with English fallbacks; the zh-CN catalog patch lives in winuxcmd-i18n. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1701 #1702 #1703. No-op ownership changes exit 0, -v reports on stdout and -c stays silent, empty spec is a no-op. 6 new tr! report keys with a local catalog patch. Refs #1701 #1702 #1703