Skip to content

fix(chown): no-op success, stdout reports, empty spec (#1701 #1702 #1703) - #1734

Merged
caomengxuan666 merged 1 commit into
mainfrom
fix/owner-1701-1703
Nov 14, 2026
Merged

caomengxuan666 merged 1 commit into
mainfrom
fix/owner-1701-1703

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

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

…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>
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 14, 2026 12:54
@caomengxuan666
caomengxuan666 merged commit 9838ed4 into main Nov 14, 2026
8 of 10 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/owner-1701-1703 branch November 14, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant