-
-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling of spaces in driver status_set()
args
#2801
Merged
jimklimov
merged 15 commits into
networkupstools:master
from
jimklimov:issue-2708-spaces
Feb 14, 2025
Merged
Fix handling of spaces in driver status_set()
args
#2801
jimklimov
merged 15 commits into
networkupstools:master
from
jimklimov:issue-2708-spaces
Feb 14, 2025
Conversation
This file contains 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
…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]>
arnaudquette-eaton
approved these changes
Feb 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
C-str
Issues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocks
enhancement
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-ups
where strings come from mapping tables) tolerates them better by recursing into self for each found token (avoid duplicates).Also fixes one bug with
status_get
checks added in #2565 (and maybe there's another, see below).TODO: this is a relatively hot code path, some optimization may be useful:
strcmp
for 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_get
checks, 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 avoidssprintfcat
over and over?)TODO: Check if there's a bug about
status_get
stopping on first substring e.g. a contrivedBYPASS BY
may not reportBY
as having been set now. UPDATE: indeed, the bug was there. Inner and tail substrings were also impacted (PA
,PASS
).