Skip to content
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

Test for and fix status_set("ALARM"); update code and docs on correct Numeric format usage #2812

Merged
merged 11 commits into from
Feb 24, 2025

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Feb 23, 2025

Work on status vs. alarms follows up from PR #2801 for issue #2708 : I've followed up on status_commit() unilaterally prepending ALARM to the ups.status string - and indeed, duplicates were possible in this manner (if someone would status_set("ALARM") during the cycle; notably no ups.alarm value got assigned in such use-case but an ALARM status became present). The series of commits confirm the existing (buggy) status-quo in unit-tests, then fix it (and the tests) to assign an alarm value "[N/A]" if none other is set yet, and expose it when we status_commit().

While in-tree drivers should not do status_set("ALARM"), currently the drivers/mge-utalk.c actually has a hit for that situation. This fix is primarily for the benefit of sane(r) behavior of any drivers coded in forks of NUT and not yet upstreamed, as well as for any use-cases harder to track down than grepping for this command string (crafted via mapping tables or resource files like DMF eventually).

Formatting spec originated from discussion in #2807

… would not appear twice: delay status_set("ALARM") effect and make it reasonable [networkupstools#2801, networkupstools#2708]

Signed-off-by: Jim Klimov <[email protected]>
…") 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]>
…om "%g" to "%f" to match NUT naming spec [networkupstools#2807]

Signed-off-by: Jim Klimov <[email protected]>
@jimklimov jimklimov added bug enhancement documentation NUT protocols portability We want NUT to build and run everywhere possible C-str Issues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocks labels Feb 23, 2025
@jimklimov jimklimov added this to the 2.8.3 milestone Feb 23, 2025
@jimklimov jimklimov added the refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings label 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]>
@jimklimov jimklimov merged commit 53a539b into networkupstools:master Feb 24, 2025
2 of 3 checks passed
@jimklimov jimklimov deleted the issue-2708-spaces branch February 24, 2025 09:44
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 documentation enhancement NUT protocols portability We want NUT to build and run everywhere possible refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant