MINOR: version: emit the link to the known bugs in output of "haproxy -v"

The link to the known bugs page for the current version is built and
reported there. When it is a development version (less than 2 dots),
instead a link to github open issues is reported as there's no way to
be sure about the current situation in this case and it's better that
users report their trouble there.
This commit is contained in:
Willy Tarreau 2019-11-21 18:48:20 +01:00
parent 08dd202d73
commit 47479eb0e7
2 changed files with 26 additions and 0 deletions

View File

@ -42,6 +42,12 @@
#define PRODUCT_STATUS "Status: development branch - not safe for use in production." #define PRODUCT_STATUS "Status: development branch - not safe for use in production."
#endif #endif
#ifdef CONFIG_PRODUCT_URL_BUGS
#define PRODUCT_URL_BUGS CONFIG_PRODUCT_URL_BUGS
#else
#define PRODUCT_URL_BUGS "http://www.haproxy.org/bugs/bugs-%s.html"
#endif
#ifdef CONFIG_PRODUCT_URL #ifdef CONFIG_PRODUCT_URL
#define PRODUCT_URL CONFIG_PRODUCT_URL #define PRODUCT_URL CONFIG_PRODUCT_URL
#else #else

View File

@ -545,6 +545,26 @@ static void display_version()
{ {
printf("HA-Proxy version %s %s - https://haproxy.org/\n" printf("HA-Proxy version %s %s - https://haproxy.org/\n"
PRODUCT_STATUS "\n", haproxy_version, haproxy_date); PRODUCT_STATUS "\n", haproxy_version, haproxy_date);
if (strlen(PRODUCT_URL_BUGS) > 0) {
char base_version[20];
int dots = 0;
char *del;
/* only retrieve the base version without distro-specific extensions */
for (del = haproxy_version; *del; del++) {
if (*del == '.')
dots++;
else if (*del < '0' || *del > '9')
break;
}
strlcpy2(base_version, haproxy_version, del - haproxy_version + 1);
if (dots < 2)
printf("Known bugs: https://github.com/haproxy/haproxy/issues?q=is:issue+is:open\n");
else
printf("Known bugs: " PRODUCT_URL_BUGS "\n", base_version);
}
} }
static void display_build_opts() static void display_build_opts()