Skip to content

Conversation

@systemcrash
Copy link

Exiting is rather pointless if the driver does not recognise the parameter. The driver ignores it anyway (?).

This is intended to resolve a problem where we use nut in openwrt and a startup script does not know what parameters a driver can take in advance (and users might not have read the man page), but execution halts if an unknown parameter is encountered.

Nothing bad happens, and a warning can be printed instead of an error.

See also https://utcc.utoronto.ca/~cks/space/blog/programming/ErrorsShouldRequireFixing

exiting is rather pointless if the driver does not recognise
the parameter. The driver ignores it anyway.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
@jimklimov
Copy link
Member

Well, this is arguable TBH. If the program is asked to do something it has no idea about, it can at least deduce it won't fulfill the user's explicit requirement. It may be in fact misleading to proceed as if nothing happened for no reason, and the user should fix the config. (We do e.g. ignore user/group ID changes on platforms where they can not be done, but there's a reason for that. And maybe that's not too right too.)

WDYT @aquette @clepple @gdt ?

@gdt
Copy link
Contributor

gdt commented Jan 12, 2026

I lean to continuing to error on bad params.

@AppVeyorBot
Copy link

@jimklimov jimklimov added service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug portability We want NUT to build and run everywhere possible labels Jan 13, 2026
@jimklimov
Copy link
Member

jimklimov commented Jan 13, 2026

Posted on mailing list to gather more opinions about which approach is the lesser evil - to crash, or to pass and so hide user config errors (and welcome strange unexpected behaviours where something does not work as it presumably was told to).

On the technical side, ignoring an unknown option should indeed be same as never receiving it. To me the problem is more of a social one, where somebody explicitly writes a config file leading to/due to certain expectations, and those expectations are not met by a driver version that has no idea about that concept. So by the principle of least surprise, aborting when not knowing how to proceed (and so asking the local expert human for instructions) is the correct way.

@jimklimov jimklimov marked this pull request as draft January 13, 2026 10:58
@kellybyrd
Copy link
Contributor

Another vote for: "stop on unknown params". The system cannot know if the user intended to give a valid newer parameter to an older version or if the user misspelled a parameter that is valid to the current version. IMO, halting on not recognized input is the least surprising thing the NUT can do.

If not, where does this stop? what if config files have options that are not valid with the current release or misspelled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

portability We want NUT to build and run everywhere possible service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants