Fix handling of spaces in driver status_set() args#2801
Merged
jimklimov merged 15 commits intonetworkupstools:masterfrom Feb 14, 2025
Merged
Fix handling of spaces in driver status_set() args#2801jimklimov merged 15 commits intonetworkupstools:masterfrom
status_set() args#2801jimklimov merged 15 commits intonetworkupstools:masterfrom
Conversation
…etworkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
…tworkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
…atus_set() [networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
…tworkupstools#2565, networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
…ng "A FEW TOKENS" at once, recurse to add one by one and so avoid duplicates [networkupstools#2708] As a side effect, should also strip surrounding whitespace characters. Signed-off-by: Jim Klimov <[email protected]>
…_set() args are stripped [networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
…LM can be added [networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
|
❌ Build nut 2.8.2.2745-master failed (commit ad58b274d3 by @jimklimov) |
The fault puzzled me though: we do pre-remove '.inst' whole... [00:36:07] CHECKING if any executable files were installed to locations other than those covered by this recipe, so might not have needed DLLs bundled near them [00:36:08] ln: ./.inst/NUT-for-Windows-x86_64-SNAPSHOT: cannot overwrite directory [00:36:08] Command exited with code 1 Signed-off-by: Jim Klimov <[email protected]>
Relocated code tried earlier in generic_gpio_utest.c (not as portable a container - far from everyone builds it) Signed-off-by: Jim Klimov <[email protected]>
…stools#2708] Signed-off-by: Jim Klimov <[email protected]>
Signed-off-by: Jim Klimov <[email protected]>
…rkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
…tworkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
…rings of another [networkupstools#2708, networkupstools#2565] Signed-off-by: Jim Klimov <[email protected]>
0df4947 to
332cd9e
Compare
…) for test mocks [networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
|
✅ Build nut 2.8.2.2749-master completed (commit 4635becef3 by @jimklimov) |
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Feb 23, 2025
…some drivers do for readability [networkupstools#2801, networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Feb 23, 2025
…s may still appear twice [networkupstools#2801, networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Feb 23, 2025
… #ifdef DEBUG not #if 0 [networkupstools#2801] Signed-off-by: Jim Klimov <[email protected]>
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Feb 23, 2025
… would not appear twice: delay status_set("ALARM") effect and make it reasonable [networkupstools#2801, networkupstools#2708]
Signed-off-by: Jim Klimov <[email protected]>
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Feb 23, 2025
…RM") cases to set the ups.status token [networkupstools#2801, networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Feb 23, 2025
…") cases to automatically alarm_commit() if the injected value is all the alarm we have [networkupstools#2801, networkupstools#2708] Signed-off-by: Jim Klimov <[email protected]>
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Feb 23, 2025
…us_set("ALARM") and later proper alarm_set(), report only the content provided by the latter [networkupstools#2801, networkupstools#2708]
Signed-off-by: Jim Klimov <[email protected]>
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.
Addresses part of issue #2708: cleans up some drivers to not use spaces, and for those where not easily avoidable (e.g.
snmp-upswhere strings come from mapping tables) tolerates them better by recursing into self for each found token (avoid duplicates).Also fixes one bug with
status_getchecks added in #2565 (and maybe there's another, see below).TODO: this is a relatively hot code path, some optimization may be useful:
strcmpfor space again when we know it is not there, maybe use a public wrapper method vs. implem with more args, or moving this logic into a new method for use-cases where we do not pass known-clean verbatim stringsstatus_getchecks, avoid long repetitive string walks (keep an array of offsets to starts/ends of tokens in one string? keep all statuses as a dynamic array of strings and only combine into one atstatus_commit- also avoidssprintfcatover and over?)TODO: Check if there's a bug about
status_getstopping on first substring e.g. a contrivedBYPASS BYmay not reportBYas having been set now. UPDATE: indeed, the bug was there. Inner and tail substrings were also impacted (PA,PASS).