]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: version: emit the link to the known bugs in output of "haproxy -v"
authorWilly Tarreau <w@1wt.eu>
Thu, 21 Nov 2019 17:48:20 +0000 (18:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 21 Nov 2019 17:48:20 +0000 (18:48 +0100)
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.

include/common/version.h
src/haproxy.c

index fd5c954401a23d8d03618949b61351288a3de173..b610c50e07c29db7c3b1db09c48098e3a157b66d 100644 (file)
 #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
index 32d9d33cecb52e1a6adf13eb728269f45576588a..b03d0ad5e43c41b796c011973a4b60ef56d54b54 100644 (file)
@@ -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()