Skip to content

Commit

Permalink
Merge branch 'master' into issue-704
Browse files Browse the repository at this point in the history
  • Loading branch information
jimklimov authored Aug 12, 2024
2 parents e75c6cd + 443ba6a commit bd963e7
Show file tree
Hide file tree
Showing 68 changed files with 1,344 additions and 220 deletions.
20 changes: 18 additions & 2 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ https://github.com/networkupstools/nut/milestone/11
sockets and a tight polling loop that hogged CPU. While the underlying
bug is ancient, it took recent development to hit it as a practical
regression. [issue #1904, issue #2484]
* Fallback `localtime_r()` and `gmtime_r()` for some platform builds where
a `*_s()` variant was available was not handled correctly. [PR #2583]
- development iterations of NUT should now identify with not only the semantic
version of a preceding release, but with git-derived information about the
Expand Down Expand Up @@ -93,7 +95,7 @@ https://github.com/networkupstools/nut/milestone/11
- A new `NUT_QUIET_INIT_BANNER` envvar (presence or "true" value) can now
prevent the tool name and NUT version banner from being unilaterally
printed out when NUT programs start. [issues #1789 vs. #316]
printed out when NUT programs start. [issues #1789 vs. #316; #2573]
- Extended `upsdrvctl` with a `list` operation (or `-l` option) to report
manageable device configuration names (possible `<ups>` arguments to
Expand Down Expand Up @@ -121,10 +123,14 @@ https://github.com/networkupstools/nut/milestone/11
- usbhid-ups updates:
* Support of the `onlinedischarge_log_throttle_hovercharge` in the NUT
v2.8.2 release was found to be incomplete. [#2423, follow-up to #2215]
* Added support for `lbrb_log_delay_sec=N` setting to delay propagation of
`LB` or `LB+RB` state (buggy with APC BXnnnnMI devices circa 2023-2024).
This may work better with flags like `onlinedischarge_calibration` and
`lbrb_log_delay_without_calibrating` for some devices. [#2347]
* General suggestion from `possibly_supported()` message method for devices
with VendorID=`0x06da` (Phoenixtec), seen in some models supported by
MGE HID or Liebert HID, updated to suggest trying `nutdrv_qx`. [#334]
* MGE HID list of `mge_model_names[]` was extended for Eaton 5PX and 5SC
* MGE HID list of `mge_model_names[]` was extended for Eaton 9E, 5PX and 5SC
series (largely guessing, feedback and PRs for adaptation to actual
string values reported by devices via USB are welcome), so these devices
would now report `battery.voltage` and `battery.voltage.nominal`. [#2380]
Expand Down Expand Up @@ -194,6 +200,9 @@ during a NUT build.
all supported buses with `-m auto` takes unbearably long. [#2523]
* bumped version of `libnutscan` to 2.6.0, it now includes a few more
methods and symbols from `libcommon`. [issue #2244, PR #2509]
* do not actively suggest `vendor(id)`, `product(id)`, and `serial` options
for `bcmxcp_usb`, `richcomm_usb` and `nutdrv_atcl_usb` drivers for now
[#1763, #1764, #1768, #2580]
- common code:
* introduced a `NUT_DEBUG_SYSLOG` environment variable to tweak activation
Expand Down Expand Up @@ -224,8 +233,15 @@ during a NUT build.
and values (or macros) in the NUT codebase. [issue #1176, issue #31]
* custom `distcheck-something` targets did not inherit `DISTCHECK_FLAGS`
properly. [#2541]
* added `status_get()` in NUT driver state API, to check if a status
token string had been set recently, and to avoid duplicate settings.
[PR #2565]
* local socket/pipe protocol introduced a `LOGOUT` command for cleaner
disconnection handling. [#2572]
* codebase adapted to the liking of `clang-18` and newer revisions of
`gcc-13`+ whose static analyzers on NUT CI farm complained about some
imperfections after adding newer OS revisions to the population of
build agents. [#2585, #2588]
- updated `docs/nut-names.txt` with items defined by 42ITy NUT fork. [#2339]
Expand Down
13 changes: 13 additions & 0 deletions UPGRADING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ Changes from 2.8.2 to 2.8.3
devices; just in case a flag toggle `powercom_sdcmd_byte_order_fallback`
was added to set the old behavior (if some devices do need it). [PR #2480]
- Added support for `lbrb_log_delay_sec=N` setting to delay propagation of
`LB` or `LB+RB` state (buggy with APC BXnnnnMI devices/firmwares issued
circa 2023-2024 which flood the logs with spurious LOWBATT and REPLACEBATT
events). This may work better for some devices when combined with flags
like `onlinedischarge_calibration` and `lbrb_log_delay_without_calibrating`.
[#2347]
- Enabled installation of built PDF and HTML (including man page renditions)
files under the configured `docdir`. It seems previously they were only
built (if requested) but not installed via `make`, unlike the common man
Expand Down Expand Up @@ -110,6 +117,12 @@ Changes from 2.8.2 to 2.8.3
tool name and NUT version banner from being printed out when programs
start. [issues #1789 vs. #316]
- A `configure` script option to `--enable-NUT_STRARG-always` was added
to enable the `NUT_STRARG` macro (to handle `NULL` string printing)
even if system libraries seem to safely support this behavior natively.
This should primarily help against overly zealous static analysis tools
in recent compiler generations. [#2585]
Changes from 2.8.1 to 2.8.2
---------------------------
Expand Down
8 changes: 6 additions & 2 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ if [ -z "${CANBUILD_LIBGD_CGI-}" ]; then

# NUT CI farm with Jenkins can build it; Travis could not
[[ "$CI_OS_NAME" = "freebsd" ]] && CANBUILD_LIBGD_CGI=yes \
|| [[ "$TRAVIS_OS_NAME" = "freebsd" ]] && CANBUILD_LIBGD_CGI=no
|| { [[ "$TRAVIS_OS_NAME" = "freebsd" ]] && CANBUILD_LIBGD_CGI=no ; }

# See also below for some compiler-dependent decisions
fi
Expand Down Expand Up @@ -1294,7 +1294,11 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp
CONFIG_OPTS+=("--with-cgi=auto")
fi
else
CONFIG_OPTS+=("--with-cgi=auto")
if [ "${CANBUILD_LIBGD_CGI-}" = "no" ] ; then
CONFIG_OPTS+=("--without-cgi")
else
CONFIG_OPTS+=("--with-cgi=auto")
fi
fi
;;
"default-alldrv:no-distcheck")
Expand Down
25 changes: 25 additions & 0 deletions clients/nutclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,31 @@ std::vector<std::string> TcpClient::explode(const std::string& str, size_t begin
}
state = QUOTED_STRING;
break;

#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) )
# pragma GCC diagnostic push
#endif
#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT
# pragma GCC diagnostic ignored "-Wcovered-switch-default"
#endif
#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE
# pragma GCC diagnostic ignored "-Wunreachable-code"
#endif
/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunreachable-code"
# pragma clang diagnostic ignored "-Wcovered-switch-default"
#endif
default:
/* Must not occur. */
break;
#ifdef __clang__
# pragma clang diagnostic pop
#endif
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) )
# pragma GCC diagnostic pop
#endif
}
}

Expand Down
18 changes: 8 additions & 10 deletions clients/upsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ static UPSCONN_t *ups = NULL;

static void usage(const char *prog)
{
printf("Network UPS Tools upsc %s\n\n", UPS_VERSION);
print_banner_once(prog, 2);
printf("NUT read-only client program to display UPS variables.\n");

printf("usage: %s -l | -L [<hostname>[:port]]\n", prog);
printf("\nusage: %s -l | -L [<hostname>[:port]]\n", prog);
printf(" %s <ups> [<variable>]\n", prog);
printf(" %s -c <ups>\n", prog);

printf("\nDemo program to display UPS variables.\n\n");

printf("First form (lists UPSes):\n");
printf("\nFirst form (lists UPSes):\n");
printf(" -l - lists each UPS on <hostname>, one per line.\n");
printf(" -L - lists each UPS followed by its description (from ups.conf).\n");
printf(" Default hostname: localhost\n");
Expand Down Expand Up @@ -251,12 +250,11 @@ int main(int argc, char **argv)
break;

case 'V':
/* just show the version and optional
* CONFIG_FLAGS banner if available */
print_banner_once(prog, 1);
nut_report_config_flags();

fatalx(EXIT_SUCCESS, "Network UPS Tools upsc %s", UPS_VERSION);
#ifndef HAVE___ATTRIBUTE__NORETURN
exit(EXIT_SUCCESS); /* Should not get here in practice, but compiler is afraid we can fall through */
#endif
exit(EXIT_SUCCESS);

case 'h':
default:
Expand Down
5 changes: 5 additions & 0 deletions clients/upsclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ const char *upscli_strerror(UPSCONN_t *ups)
upscli_errlist[ups->upserror].str,
ups->pc_ctx.errmsg);
return ups->errbuf;

default:
break;
}

#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL
Expand Down Expand Up @@ -1060,6 +1063,8 @@ int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags
case EAI_SYSTEM:
ups->syserrno = errno;
break;
default:
break;
}

ups->upserror = UPSCLI_ERR_UNKNOWN;
Expand Down
16 changes: 8 additions & 8 deletions clients/upscmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ struct list_t {

static void usage(const char *prog)
{
printf("Network UPS Tools upscmd %s\n\n", UPS_VERSION);
printf("usage: %s [-h]\n", prog);
print_banner_once(prog, 2);
printf("NUT administration client program to initiate instant commands on UPS hardware.\n");

printf("\nusage: %s [-h]\n", prog);
printf(" %s [-l <ups>]\n", prog);
printf(" %s [-u <username>] [-p <password>] [-w] [-t <timeout>] <ups> <command> [<value>]\n\n", prog);
printf("Administration program to initiate instant commands on UPS hardware.\n");
printf("\n");
printf(" -h display this help text\n");
printf(" -V display the version of this software\n");
Expand Down Expand Up @@ -312,12 +313,11 @@ int main(int argc, char **argv)
break;

case 'V':
/* just show the version and optional
* CONFIG_FLAGS banner if available */
print_banner_once(prog, 1);
nut_report_config_flags();

fatalx(EXIT_SUCCESS, "Network UPS Tools upscmd %s", UPS_VERSION);
#ifndef HAVE___ATTRIBUTE__NORETURN
exit(EXIT_SUCCESS); /* Should not get here in practice, but compiler is afraid we can fall through */
#endif
exit(EXIT_SUCCESS);

case 'h':
default:
Expand Down
17 changes: 12 additions & 5 deletions clients/upslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ static void help(const char *prog)

static void help(const char *prog)
{
printf("UPS status logger.\n");
print_banner_once(prog, 2);
printf("NUT read-only client program - UPS status logger.\n");

printf("\nusage: %s [OPTIONS]\n", prog);
printf("\n");
Expand Down Expand Up @@ -439,10 +440,7 @@ int main(int argc, char **argv)
logformat = DEFAULT_LOGFORMAT;
user = RUN_AS_USER;

if (!banner_is_disabled()) {
printf("Network UPS Tools %s %s\n", prog, UPS_VERSION);
fflush(stdout);
}
print_banner_once(prog, 0);

while ((i = getopt(argc, argv, "+hs:l:i:f:u:Vp:FBm:")) != -1) {
switch(i) {
Expand Down Expand Up @@ -508,6 +506,9 @@ int main(int argc, char **argv)
break;

case 'V':
/* just show the version and optional
* CONFIG_FLAGS banner if available */
print_banner_once(prog, 1);
nut_report_config_flags();
exit(EXIT_SUCCESS);

Expand All @@ -522,6 +523,12 @@ int main(int argc, char **argv)
case 'B':
foreground = 0;
break;

default:
fatalx(EXIT_FAILURE,
"Error: unknown option -%c. Try -h for help.",
(char)i);

}
}

Expand Down
14 changes: 7 additions & 7 deletions clients/upsmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2627,9 +2627,10 @@ static void help(const char *arg_progname)
/* printf("\n"); */
}

printf("Monitors UPS servers and may initiate shutdown if necessary.\n\n");
print_banner_once(arg_progname, 2);
printf("NUT client which monitors UPS servers and may initiate shutdown if necessary.\n");

printf("usage: %s [OPTIONS]\n\n", arg_progname);
printf("\nusage: %s [OPTIONS]\n\n", arg_progname);
printf(" -c <cmd> send command to running process\n");
printf(" commands:\n");
printf(" - fsd: shutdown all primary-mode UPSes (use with caution)\n");
Expand Down Expand Up @@ -2908,10 +2909,7 @@ int main(int argc, char *argv[])
}
#endif

if (!banner_is_disabled()) {
printf("Network UPS Tools %s %s\n", prog, UPS_VERSION);
fflush(stdout);
}
print_banner_once(prog, 0);

/* if no configuration file is specified on the command line, use default */
configfile = xmalloc(SMALLBUF);
Expand Down Expand Up @@ -2973,7 +2971,9 @@ int main(int argc, char *argv[])
run_as_user = xstrdup(optarg);
break;
case 'V':
/* just show the optional CONFIG_FLAGS banner */
/* just show the version and optional
* CONFIG_FLAGS banner if available */
print_banner_once(prog, 1);
nut_report_config_flags();
exit(EXIT_SUCCESS);
case '4':
Expand Down
11 changes: 7 additions & 4 deletions clients/upsrw.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ struct list_t {

static void usage(const char *prog)
{
printf("Network UPS Tools %s %s\n\n", prog, UPS_VERSION);
printf("usage: %s [-h]\n", prog);
print_banner_once(prog, 2);
printf("NUT administration client program to set variables within UPS hardware.\n");

printf("\nusage: %s [-h]\n", prog);
printf(" %s [-s <variable>] [-u <username>] [-p <password>] [-w] [-t <timeout>] <ups>\n\n", prog);
printf("Demo program to set variables within UPS hardware.\n");
printf("\n");
printf(" -h display this help text\n");
printf(" -V display the version of this software\n");
Expand Down Expand Up @@ -668,7 +669,9 @@ int main(int argc, char **argv)
tracking_enabled = 1;
break;
case 'V':
printf("Network UPS Tools %s %s\n", prog, UPS_VERSION);
/* just show the version and optional
* CONFIG_FLAGS banner if available */
print_banner_once(prog, 1);
nut_report_config_flags();
exit(EXIT_SUCCESS);
case 'h':
Expand Down
8 changes: 8 additions & 0 deletions clients/upssched.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ static void us_serialize(int op)
ret = read(pipefd[0], &ch, 1);
close(pipefd[0]);
break;

default:
break;
}
}
#endif
Expand Down Expand Up @@ -1531,6 +1534,11 @@ int main(int argc, char **argv)
/* just show the optional CONFIG_FLAGS banner */
nut_report_config_flags();
exit(EXIT_SUCCESS);

default:
fatalx(EXIT_FAILURE,
"Error: unknown option -%c. Try -h for help.",
(char)i);
}
}

Expand Down
Loading

0 comments on commit bd963e7

Please sign in to comment.