Skip to content

Fixed --simulate=diff to show the new target of a replaced symlink - #6438

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

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

Conversation

@nickanderson

@nickanderson nickanderson commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

With --simulate=diff, when a symlink replaced a link with a wrong target or an obstructing file, the report read the link from the real filesystem instead of the changes chroot: a wrong link showed its old target with the first characters cut off, and an obstruction showed "Invalid target". It now reads the link from the changes chroot and shows the new target.

Ticket: ENT-14713

Tests: new 29_simulate_mode/diff_mode_symlinks.cf covers both cases; it fails with the fix reverted. Full acceptance, unit (incl. ASAN/UBSan) and static checks pass locally.

🤖 Generated with Claude Code

When a symlink in the changes chroot replaced a link with a wrong target
or an obstructing file, the diff report read the link from the real
filesystem instead of from the changes chroot. A wrong link showed its
old target with the first characters cut off, and an obstruction showed
"Invalid target" because the original was a regular file.

Ticket: ENT-14713
Changelog: Title
Comment thread cf-agent/simulate_mode.c
GetFileTypeDescription(st_chrooted.st_mode));
ManifestStatInfo(&st_chrooted);
ManifestFileDetails(path, &st_chrooted, true);
ManifestFileDetails(chrooted_path, &st_chrooted, true);
Comment thread cf-agent/simulate_mode.c
printf("'%s' is a %s\n", path, GetFileTypeDescription(st_chrooted.st_mode));
ManifestStatInfo(&st_chrooted);
ManifestFileDetails(path, &st_chrooted, true);
ManifestFileDetails(chrooted_path, &st_chrooted, true);
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.

2 participants