-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Propagate IMMUTABLE
flag on socket protocol (driver=>upsd
); use it in netset
; sanity-check if (defaulted) NUMBER
values are not in fact STRING
s
#2549
Draft
jimklimov
wants to merge
12
commits into
networkupstools:master
Choose a base branch
from
jimklimov:issue-266
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+122
−2
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
jimklimov
added
enhancement
NUT protocols
documentation-protocol
Submitted vendor-provided or user-discovered protocol information, or similar data (measurements...)
C-str
Issues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocks
labels
Jul 23, 2024
Rebased over proposed PR #2552 which covers the noisy but mostly cosmetic changes, to group logical-change commits later in the stack. |
…lag on values in DEBUG builds [networkupstools#266] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…etworkupstools#266] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…e as float or long int [networkupstools#266] If we assume a value without flags is by default a NUMBER but is not, re-default it to STRING. If it is also flagged explicitly as a NUMBER but is not, yell a warning for upstream to fix the code. Eventually this should be a reason to report protocol error, but not now. Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…, STRING and NUMBER flags [networkupstools#266] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…E" flag value [networkupstools#266] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
… reinventing the wheel [networkupstools#266, networkupstools#966] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…pstools#266] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…MMUTABLE flag propagation on socket protocol (and fix float=>double) Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…tworkupstools#266] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…orkupstools#266] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…rkupstools#266] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-str
Issues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocks
documentation-protocol
Submitted vendor-provided or user-discovered protocol information, or similar data (measurements...)
enhancement
NUT protocols
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 various sides of issue #266 and should help hunt down cases where we do not provide a
NUMBER
/STRING
flag for the readings.Currently this PR does not enforce the
STRING:N
type but logs messages to that effect to help with further troubleshooting. One problem was about picking theaux
value (e.g. allowed string length) at a point far away from code that should have defined the variable type in the first place. Another concern is about propagating the guessedSTRING
type "upwards", so thatnetset
can set it safely. Although if it lacks any type flag in the first place, most of those checks are (before and still) bypassed and any value should be settable.Possibly the better place for this sanity-checking logic of newly posted data vs. flags of a state entry is in core
state.c
code, to transplant pieces of bothnetset.c::set_var()
andnetget.c::get_type()
to restrict type usage that should conform to declared flags.Another aspect is bringing
IMMUTABLE
flag presence into consideration when trying to set values over NUT protocol (it is not exposed inGET TYPE
of the networked protocol to avoid changing the RFC).Screenshot with a driver that has
override.battery.charge=10
inups.conf
:Currently planning this PR to hang around for reviews and discussion until the next release after an upcoming one; some less questionable changes may be cherry-picked earlier.
This sort of change, or something inspired by it to ensure proper data type mapping with flags (maybe a table based on
docs/nut-names.txt
to auto-flag device readings by pattern name? maybe from a loadable file, DMF or parseconf'ed?), would also be useful for efforts like #2525/#2524 which can culminate in reporting of JSON from NUT clients (web or not) -- and then best with a specific reportable schema.