ipmitool -I open lan print_print_print_we_like_printing
The above command gives the same result as the below command
ipmitool -I open lan print
This is not the way programs are normally expected to operate
The reason is that all strings are compared with strncmp() so that any extra characters are ignored. Unfortunately there are some ipmi parameters that have one being the leading sub-string of the other (an example is "event_msg_intr" and "event_msg"). It's not obvious that the string comparisons need to be performed in a particular order so that the longest strings are checked first, this is a minefield for people maintaining the code, and can cause problems for the user. For example, if a user makes a typo while entering "event_msg_intr", it may be interpreted by ipmitool as "event_msg".
It should just use strcmp(), which will be less error prone and faster.
There are lots of places where strncmp() is used with
n
argument calculated via__maxlen
macro that callsstrlen()
. This per se looks useless to me and defeats the possible purpose of usingstrncmp()
. However inlib/ipmi-mc.c
that macro is not used, hence your problem. I think thatstrncmp()
and__maxlen()
must be replaced in most places with juststrcmp()
. That will also get rid of warnings related to__maxlen()
macro definition.When I have time, I'll look into it.
Fixed on GitHub, see https://github.com/ipmitool/ipmitool/issues/104