diff --git a/include/common/version.h b/include/common/version.h index fd5c954401..b610c50e07 100644 --- a/include/common/version.h +++ b/include/common/version.h @@ -42,6 +42,12 @@ #define PRODUCT_STATUS "Status: development branch - not safe for use in production." #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 #define PRODUCT_URL CONFIG_PRODUCT_URL #else diff --git a/src/haproxy.c b/src/haproxy.c index 32d9d33cec..b03d0ad5e4 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -545,6 +545,26 @@ static void display_version() { printf("HA-Proxy version %s %s - https://haproxy.org/\n" 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()