Fix spurious "Output was trimmed" message in archive.extracted#69770
Open
ggiesen wants to merge 3 commits into
Open
Fix spurious "Output was trimmed" message in archive.extracted#69770ggiesen wants to merge 3 commits into
ggiesen wants to merge 3 commits into
Conversation
archive.extracted appended ". Output was trimmed to {} number of
lines" unconditionally whenever files were extracted, even though
trimming only happens when trim_output is set. With the default
trim_output=False this produced the misleading comment "Output was
trimmed to False number of lines" while nothing was trimmed. Guard the
append with the same trim_output check that gates the actual trimming so
the message only appears when output was really trimmed.
Fixes saltstack#59570
bdrx312
reviewed
Jul 12, 2026
Per review on saltstack#69770.
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.
What does this PR do?
archive.extractedappended. Output was trimmed to {} number of linesto the state comment every time files were extracted, regardless of whether any trimming actually happened. Trimming only occurs when thetrim_outputargument is set, so with its default value (trim_output=False) the message was still added with the literal value interpolated, producing the misleading commentOutput was trimmed to False number of lines.This wraps the comment append in
if trim_output:-- the same condition that already gates the actual output trimming -- so the message is only shown when output was really trimmed. By that pointtrim_outputhas been normalized (True-> 100, string integers -> int), so the value shown is always the accurate line count.What issues does this PR fix or reference?
Fixes #59570
Previous Behavior
Running
archive.extractedon a source that actually extracts files, without specifyingtrim_output, produced:even though no output had been trimmed.
New Behavior
With the default
trim_output, the trailing "Output was trimmed to ..." sentence is no longer added:When
trim_outputis set to a truthy value and output is actually trimmed, the message still appears with the correct line count (e.g.Output was trimmed to 1 number of lines), unchanged from before.Note: the issue discussion also raised a larger redesign of
trim_output(accepting only integers and treating "unset" as "don't trim", since it currently accepts both bool and int withTruemeaning 100). That is a breaking API change that would need a deprecation cycle and is intentionally left out of this fix; this PR resolves the reported symptom without changing the argument's contract.Merge requirements satisfied?
changelog/59570.fixed.mdaddedtest_tar_bsdtar_without_trim_output_59570(defaulttrim_output, asserts the message is absent) andtest_tar_bsdtar_with_trim_output_zero(explicit falsytrim_output=0); the existingtest_tar_bsdtar_with_trim_output(trim_output=1) is retained as the must-not-regress case proving the message still appears when trimming really happens.Commits signed with GPG?
No