Repository navigation
fix: pass each trigger command its own text in thold_set_environ() (#760) - #870
Merged
bmfmancini merged 1 commit intoNov 6, 2026
Merged
Conversation
…acti#760) The low and normal branches of thold_command_execution() passed trigger_cmd_high to thold_set_environ(). thold_set_environ() does not currently read its $text argument (it exports the same THOLD_* variables whatever it is given), so this changes nothing at runtime, but each branch now passes the command it is about to run, and a future change that does use $text will not silently get the high command. All three branches are already exercised by TholdCommandExecutionTest's breach-direction cases.
|
somethingwithproof
approved these changes
Nov 6, 2026
somethingwithproof
left a comment
Member
There was a problem hiding this comment.
No blockers found. The full suite passes on Linux/PHP 8.4; PHP 8.2–8.4 CI is green.
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.



Description
The low and normal branches of
thold_command_execution()passedtrigger_cmd_hightothold_set_environ(). This PR passes each branch the command it's about to run.This changes nothing at runtime.
thold_set_environ()doesn't read its$textargument; it exports the sameTHOLD_*variables whatever it's given. So low and normal commands already received the correct environment. The change makes the call sites say what they mean, so a future change that does use$textwon't silently get the high command.Related Issue
Fixes #760.
Motivation and Context
Correctness of the call sites; there's no user-visible behaviour change.
How Has This Been Tested?
Unit tests:
TholdCommandExecutionTest's breach-direction cases already run all three branches, and the full suite passes.Real poller: Cacti 1.2.32, PHP 8.4, cactid every 60 s, with this exact commit deployed and Enable Threshold Scripts on (restored afterwards). A live threshold was breached low and then restored. Its low and normal commands recorded their environment:
THOLD_*variables, correctTHOLD_THRESHOLDNAMEandTHOLD_CURRENTVALUETHOLD_*variables, correctTHOLD_THRESHOLDNAMEandTHOLD_CURRENTVALUETypes of changes
Checklist: