Skip to content

Fixed --simulate=diff to report permission and ownership changes - #6436

Open
nickanderson wants to merge 1 commit into
cfengine:masterfrom
nickanderson:ENT-14694/master
Open

nickanderson wants to merge 1 commit into
cfengine:masterfrom
nickanderson:ENT-14694/master

Conversation

@nickanderson

@nickanderson nickanderson commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

With --simulate=diff, a file whose mode, owner or group changed without its contents was listed in the report with nothing under it, because only diff -u on the contents was shown. The report now prints the permission, owner and group changes before the content diff, e.g.:

'/tmp/perms' changed permissions from 0600 to 0000
'/tmp/chown-me' changed owner from 0/root to 2/bin
'/tmp/chown-me' changed group from 0/root to 2/bin

Ticket: ENT-14694

@nickanderson

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins

@cf-bottom

Copy link
Copy Markdown

The diff report only ran 'diff -u' on file contents, so a file whose
mode, owner or group changed without its contents was listed with
nothing under it. Permission, owner and group changes are now printed
before the content diff.

Ticket: ENT-14694
Changelog: Title
@nickanderson

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins

@cf-bottom

Copy link
Copy Markdown

Comment thread cf-agent/simulate_mode.c
char name[CF_SMALLBUF];
if (GetUserName(uid, name, sizeof(name), LOG_LEVEL_VERBOSE))
{
snprintf(buf, buf_size, "%ju/%s", (uintmax_t) uid, name);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to handle truncation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants