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

{on,off,reboot}delay needs standardization #972

Open
biergaizi opened this issue Jan 29, 2021 · 0 comments
Open

{on,off,reboot}delay needs standardization #972

biergaizi opened this issue Jan 29, 2021 · 0 comments
Labels
refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings

Comments

@biergaizi
Copy link
Contributor

biergaizi commented Jan 29, 2021

Many NUT drivers accept the options ondelay, offdelay, and rebootdelay at startup. But unlike their runtime equivalent (ups.delay.start, ups.delay.reboot and ups.delay.shutdown), it seems that there is currently no project-wide standard or documentation to specify their acceptable uses. The most common behavior in existing drivers is to parse them at startup and convert them to ups.delay.*. But due to the lack of standard, it's not guaranteed and occasionally confusions among developers and users arise. For example, in bug #957, the riello_usb and riello_ser drivers attempt to read ups.delay.start, but this variable is not initialized anywhere in the driver, nor the driver accept ondelay, causing a NULL pointer dereference - instead, it requires default.ups.delay.start, much to the surprise of the user.

Another potential benefit is reducing code duplication - every driver has its own parser to do same thing over and over, if we can have a standardized delay option, main.c can do it automatically.

The standard should address the following issues.

  1. Do we still really need {on,off,reboot}delay when we already have default.ups.delay.start to set these delays?
  2. If we decided to keep {on,off,reboot}delay, when must a driver accept them as options? This needs to be a standard. My idea: if ups.delay.start is writable, the driver must have ondelay, etc.
  3. Alternatively, perhaps the use of {on,off,reboot}delay should be discouraged and phased out. We can implemented the old options as a wrapper for the standardized default.ups.delay in main.c, only for backwards compatibility.
@biergaizi biergaizi changed the title {on,off,reboot}delay needs standardzation {on,off,reboot}delay needs standardization Jan 29, 2021
@jimklimov jimklimov added the refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings label Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings
Projects
None yet
Development

No branches or pull requests

2 participants