Repository navigation
Separate execution traces from error output exactly, and filter by PS4 only when it is literal - #133
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 54 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
mernst
added a commit
to mernst/plume-scripts
that referenced
this pull request
Oct 9, 2026
# Conflicts: # cronic # tests/cronic-test/cronic-test.sh
Bash 4.1 or later writes its trace to a separate file, which the report shows under "TRACE OUTPUT". For other shells, trace lines are still removed from stderr by PS4; a multibyte first character of PS4 is repeated as a whole, and a PS4 containing a newline is not used for filtering.
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.
cronicremoves execution-trace lines from the wrapped command's error output, using a pattern built fromPS4. The pattern was built by insertingPS4into a regular expression without escaping, so:PS4with regular-expression metacharacters, such as[trace], did not match its own trace lines, which were then reported as errors;PS4with an expansion, such as+${LINENO}:, was matched literally, though its expansion differs from line to line. Any looser pattern for such aPS4could also match, and hide, a real error such as+++ b/file.This pull request:
BASH_XTRACEFD, so trace lines are separated from the error output exactly, whateverPS4is. The trace appears in the report under "TRACE OUTPUT". The file descriptor is allocated by bash, so it does not collide with descriptors that the wrapped command uses;PS4, but:PS4's metacharacters before building the pattern;PS4as a whole, whatever the locale;PS4contains no$, backquote, backslash, or newline. Otherwise, the trace lines are reported along with the rest of the error output, so that no real error is hidden;cronic --help;PS4in stderr are skipped when run as root, because bash then ignoresPS4from the environment.This is split out of #129.