]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Include 'build info' in all --version text and About boxes.
authorSimon Tatham <anakin@pobox.com>
Sat, 21 Jan 2017 14:55:53 +0000 (14:55 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 21 Jan 2017 14:55:53 +0000 (14:55 +0000)
This shows the build platform (32- vs 64-bit in particular, and also
whether Unix GTK builds were compiled with or without the X11 pieces),
what compiler was used to build the binary, and any interesting build
options that might have been set on the make command line (especially,
but not limited to, the security-damaging ones like NO_SECURITY or
UNPROTECT). This will probably be useful all over the place, but in
particular it should allow the different Windows binaries to be told
apart!

Commits 21101c739 and 2eb952ca3 laid the groundwork for this, by
allowing the various About boxes to contain free text and also
ensuring they could be copied and pasted easily as part of a bug
report.

18 files changed:
cmdgen.c
misc.c
misc.h
pscp.c
psftp.c
unix/gtkdlg.c
unix/gtkmain.c
unix/unix.h
unix/uxpgnt.c
unix/uxplink.c
windows/pageant.rc
windows/puttygen.rc
windows/win_res.rc2
windows/windlg.c
windows/winpgen.c
windows/winpgnt.c
windows/winplink.c
windows/winstuff.h

index 265e5adc1ac9e450927100a6da5a7a2bce7333d5..d6c1f72115ac3080b17e7750aa1ee15350637e08 100644 (file)
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -129,7 +129,9 @@ void sk_cleanup(void)
 
 void showversion(void)
 {
-    printf("puttygen: %s\n", ver);
+    char *buildinfo_text = buildinfo("\n");
+    printf("puttygen: %s\n%s", ver, buildinfo_text);
+    sfree(buildinfo_text);
 }
 
 void usage(int standalone)
diff --git a/misc.c b/misc.c
index 7a7cc1945b7ed334145f12a0921a85a992d1bbed..06baf8d6fc6304d9b6f95821cb77c50fc3bf4715 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1147,3 +1147,65 @@ int strendswith(const char *s, const char *t)
     size_t slen = strlen(s), tlen = strlen(t);
     return slen >= tlen && !strcmp(s + (slen - tlen), t);
 }
+
+char *buildinfo(const char *newline)
+{
+    strbuf *buf = strbuf_new();
+
+    strbuf_catf(buf, "Build platform: %d-bit %s",
+                (int)(CHAR_BIT * sizeof(void *)),
+                BUILDINFO_PLATFORM);
+
+#ifdef __clang_version__
+    strbuf_catf(buf, "%sCompiler: clang %s", newline, __clang_version__);
+#elif defined __GNUC__ && defined __VERSION__
+    strbuf_catf(buf, "%sCompiler: gcc %s", newline, __VERSION__);
+#elif defined _MSC_VER
+    strbuf_catf(buf, "%sCompiler: Visual Studio", newline);
+#if _MSC_VER == 1900
+    strbuf_catf(buf, " 2015 / MSVC++ 14.0");
+#elif _MSC_VER == 1800
+    strbuf_catf(buf, " 2013 / MSVC++ 12.0");
+#elif _MSC_VER == 1700
+    strbuf_catf(buf, " 2012 / MSVC++ 11.0");
+#elif _MSC_VER == 1600
+    strbuf_catf(buf, " 2010 / MSVC++ 10.0");
+#elif  _MSC_VER == 1500
+    strbuf_catf(buf, " 2008 / MSVC++ 9.0");
+#elif  _MSC_VER == 1400
+    strbuf_catf(buf, " 2005 / MSVC++ 8.0");
+#elif  _MSC_VER == 1310
+    strbuf_catf(buf, " 2003 / MSVC++ 7.1");
+#else
+    strbuf_catf(buf, ", unrecognised version");
+#endif
+    strbuf_catf(buf, " (_MSC_VER=%d)", (int)_MSC_VER);
+#endif
+
+#ifdef NO_SECURITY
+    strbuf_catf(buf, "%sBuild option: NO_SECURITY", newline);
+#endif
+#ifdef NO_SECUREZEROMEMORY
+    strbuf_catf(buf, "%sBuild option: NO_SECUREZEROMEMORY", newline);
+#endif
+#ifdef NO_IPV6
+    strbuf_catf(buf, "%sBuild option: NO_IPV6", newline);
+#endif
+#ifdef NO_GSSAPI
+    strbuf_catf(buf, "%sBuild option: NO_GSSAPI", newline);
+#endif
+#ifdef STATIC_GSSAPI
+    strbuf_catf(buf, "%sBuild option: STATIC_GSSAPI", newline);
+#endif
+#ifdef UNPROTECT
+    strbuf_catf(buf, "%sBuild option: UNPROTECT", newline);
+#endif
+#ifdef FUZZING
+    strbuf_catf(buf, "%sBuild option: FUZZING", newline);
+#endif
+#ifdef DEBUG
+    strbuf_catf(buf, "%sBuild option: DEBUG", newline);
+#endif
+
+    return strbuf_to_str(buf);
+}
diff --git a/misc.h b/misc.h
index 9ab21a0b328eac392ca5753e21aa04d49648894c..32e7bc32de7ffd8d9cf00fb428fb6b048872fb7b 100644 (file)
--- a/misc.h
+++ b/misc.h
@@ -118,6 +118,8 @@ int get_ssh_uint32(int *datalen, const void **data, unsigned *ret);
  * form, check if it equals an ordinary C zero-terminated string. */
 int match_ssh_id(int stringlen, const void *string, const char *id);
 
+char *buildinfo(const char *newline);
+
 /*
  * Debugging functions.
  *
diff --git a/pscp.c b/pscp.c
index 9ea423fd00d1f7ddcf29092fca626f1758d7d5bb..25a2a7377e8e4f4984f46b586d71c8b735f08d14 100644 (file)
--- a/pscp.c
+++ b/pscp.c
@@ -2263,7 +2263,9 @@ static void usage(void)
 
 void version(void)
 {
-    printf("pscp: %s\n", ver);
+    char *buildinfo_text = buildinfo("\n");
+    printf("pscp: %s\n%s\n", ver, buildinfo_text);
+    sfree(buildinfo_text);
     cleanup_exit(1);
 }
 
diff --git a/psftp.c b/psftp.c
index d35b8fa3c305c31321ed3c526e5d11acd810d3d0..513f202b674cd81bd22946eca18746aa49e40750 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -2665,7 +2665,9 @@ static void usage(void)
 
 static void version(void)
 {
-  printf("psftp: %s\n", ver);
+  char *buildinfo_text = buildinfo("\n");
+  printf("psftp: %s\n%s\n", ver, buildinfo_text);
+  sfree(buildinfo_text);
   cleanup_exit(1);
 }
 
index 34773137b231ef25848e9482657afc431343a19a..4eb4b010a4341781b3f4a5fd59bed27e39a3614d 100644 (file)
@@ -3701,9 +3701,10 @@ void about_box(void *window)
     gtk_widget_show(w);
 
     {
+        char *buildinfo_text = buildinfo("\n");
         char *label_text = dupprintf
-            ("%s\n\n%s\n\n%s",
-             appname, ver,
+            ("%s\n\n%s\n\n%s\n\n%s",
+             appname, ver, buildinfo_text,
              "Copyright " SHORT_COPYRIGHT_DETAILS ". All rights reserved");
         w = gtk_label_new(label_text);
         gtk_label_set_justify(GTK_LABEL(w), GTK_JUSTIFY_CENTER);
index a7b4a4e918681002b50771dd4423a4c93a6ccd84..c681b93d825d174e726a6ead9e679e0001f0ca0b 100644 (file)
@@ -287,10 +287,13 @@ static void help(FILE *fp) {
 }
 
 static void version(FILE *fp) {
-    if(fprintf(fp, "%s: %s\n", appname, ver) < 0 || fflush(fp) < 0) {
+    char *buildinfo_text = buildinfo("\n");
+    if(fprintf(fp, "%s: %s\n%s\n", appname, ver, buildinfo_text) < 0 ||
+       fflush(fp) < 0) {
        perror("output error");
        exit(1);
     }
+    sfree(buildinfo_text);
 }
 
 static struct gui_data *the_inst;
index 029d32ff120103cf6fb45ef15c91037e3f7743af..76ec7531a3d8fd3f3e1c93d318ae7af87b6fcc26 100644 (file)
 #define META_MANUAL_MASK (GDK_MOD1_MASK)
 #define JUST_USE_GTK_CLIPBOARD_UTF8 /* low-level gdk_selection_* fails */
 #define DEFAULT_CLIPBOARD GDK_SELECTION_CLIPBOARD /* OS X has no PRIMARY */
+
+#define BUILDINFO_PLATFORM "OS X (GTK)"
+
+#elif defined NOT_X_WINDOWS
+
+#define BUILDINFO_PLATFORM "Unix (pure GTK)"
+
+#else
+
+#define BUILDINFO_PLATFORM "Unix (GTK + X11)"
+
 #endif
 
 struct Filename {
index 4f3dde2d1694cbd33a62636fd7d5b3267cbc3ac0..14f1366c28068d2155faa8c10bb0c3468b3655c3 100644 (file)
@@ -141,7 +141,9 @@ static void usage(void)
 
 static void version(void)
 {
-    printf("pageant: %s\n", ver);
+    char *buildinfo_text = buildinfo("\n");
+    printf("pageant: %s\n%s\n", ver, buildinfo_text);
+    sfree(buildinfo_text);
     exit(1);
 }
 
index 82693ba893ed98871afb5e37c52d662d717af113..bf55ea73e93b875ebf262edcdad1b913869b3c93 100644 (file)
@@ -594,7 +594,9 @@ static void usage(void)
 
 static void version(void)
 {
-    printf("plink: %s\n", ver);
+    char *buildinfo_text = buildinfo("\n");
+    printf("plink: %s\n%s\n", ver, buildinfo_text);
+    sfree(buildinfo_text);
     exit(1);
 }
 
index 91432cc7e0775974bc49a15646a94dbaf6508e11..b1756a6423a3b479014f019aa14d887c7427bffd 100644 (file)
@@ -36,14 +36,14 @@ BEGIN
 END
 
 /* Accelerators used: cl */
-213 DIALOG DISCARDABLE 140, 40, 214, 74
+213 DIALOG DISCARDABLE 140, 40, 214, 90
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "About Pageant"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    DEFPUSHBUTTON "&Close", IDOK, 160, 56, 48, 14
-    PUSHBUTTON "View &Licence", 101, 6, 56, 70, 14
-    EDITTEXT 1000, 10, 6, 194, 48, ES_READONLY | ES_MULTILINE | ES_CENTER, WS_EX_STATICEDGE
+    DEFPUSHBUTTON "&Close", IDOK, 160, 72, 48, 14
+    PUSHBUTTON "View &Licence", 101, 6, 72, 70, 14
+    EDITTEXT 1000, 10, 6, 194, 64, ES_READONLY | ES_MULTILINE | ES_CENTER, WS_EX_STATICEDGE
 END
 
 /* No accelerators used */
index 5c61ee7d76fa390df38a32dadcdc163eb000e784..cd4072ea774f634c3adb803684715c30de504de0 100644 (file)
@@ -29,14 +29,14 @@ BEGIN
 END
 
 /* Accelerators used: cl */
-213 DIALOG DISCARDABLE 140, 40, 214, 74
+213 DIALOG DISCARDABLE 140, 40, 214, 90
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "About PuTTYgen"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    DEFPUSHBUTTON "&Close", IDOK, 160, 56, 48, 14
-    PUSHBUTTON "View &Licence", 101, 6, 56, 70, 14
-    EDITTEXT 1000, 10, 6, 194, 48, ES_READONLY | ES_MULTILINE | ES_CENTER, WS_EX_STATICEDGE
+    DEFPUSHBUTTON "&Close", IDOK, 160, 72, 48, 14
+    PUSHBUTTON "View &Licence", 101, 6, 72, 70, 14
+    EDITTEXT 1000, 10, 6, 194, 64, ES_READONLY | ES_MULTILINE | ES_CENTER, WS_EX_STATICEDGE
 END
 
 /* No accelerators used */
index 28e663209f69c36e5ff612fdba5a84b13e514070..92d39cd5a235440ac4f00ef2f88dbd08aece54a2 100644 (file)
@@ -16,15 +16,15 @@ IDI_MAINICON ICON "putty.ico"
 IDI_CFGICON ICON "puttycfg.ico"
 
 /* Accelerators used: clw */
-IDD_ABOUTBOX DIALOG DISCARDABLE 140, 40, 214, 74
+IDD_ABOUTBOX DIALOG DISCARDABLE 140, 40, 270, 106
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "About PuTTY"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    DEFPUSHBUTTON "&Close", IDOK, 160, 56, 48, 14
-    PUSHBUTTON "View &Licence", IDA_LICENCE, 6, 56, 70, 14
-    PUSHBUTTON "Visit &Web Site", IDA_WEB, 84, 56, 70, 14
-    EDITTEXT IDA_TEXT, 10, 6, 194, 48, ES_READONLY | ES_MULTILINE | ES_CENTER, WS_EX_STATICEDGE
+    DEFPUSHBUTTON "&Close", IDOK, 216, 88, 48, 14
+    PUSHBUTTON "View &Licence", IDA_LICENCE, 6, 88, 70, 14
+    PUSHBUTTON "Visit &Web Site", IDA_WEB, 140, 88, 70, 14
+    EDITTEXT IDA_TEXT, 10, 6, 250, 80, ES_READONLY | ES_MULTILINE | ES_CENTER, WS_EX_STATICEDGE
 END
 
 /* Accelerators used: aco */
index 17327866edb44d132a24f3c202044badb158aec4..e29f12914e3428e0b54257a6ae837802cb0ef466 100644 (file)
@@ -200,10 +200,12 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
        SetWindowText(hwnd, str);
        sfree(str);
         {
+            char *buildinfo_text = buildinfo("\r\n");
             char *text = dupprintf
-                ("%s\r\n\r\n%s\r\n\r\n%s",
-                 appname, ver,
+                ("%s\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
+                 appname, ver, buildinfo_text,
                  "\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
+            sfree(buildinfo_text);
             SetDlgItemText(hwnd, IDA_TEXT, text);
             sfree(text);
         }
index 8468f805b4d7fef9d822410e5e02f979c41b61c0..4dd8272aa30761334b55696d64d73a600a5f39b1 100644 (file)
@@ -297,10 +297,12 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
        }
 
         {
+            char *buildinfo_text = buildinfo("\r\n");
             char *text = dupprintf
-                ("PuTTYgen\r\n\r\n%s\r\n\r\n%s",
-                 ver,
+                ("PuTTYgen\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
+                 ver, buildinfo_text,
                  "\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
+            sfree(buildinfo_text);
             SetDlgItemText(hwnd, 1000, text);
             sfree(text);
         }
index 06c5fac15d8316a92a475852033d88ed0e30c4c8..604d092f1119740447ea4b7d483f3bf7b22faa35 100644 (file)
@@ -152,10 +152,12 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
     switch (msg) {
       case WM_INITDIALOG:
         {
+            char *buildinfo_text = buildinfo("\r\n");
             char *text = dupprintf
-                ("Pageant\r\n\r\n%s\r\n\r\n%s",
-                 ver,
+                ("Pageant\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
+                 ver, buildinfo_text,
                  "\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
+            sfree(buildinfo_text);
             SetDlgItemText(hwnd, 1000, text);
             sfree(text);
         }
index 3b20a0ab36de378124a46b1e6cfdc28339704a06..d916104e3a9049f5137bd8a9d5f8312d0937aaac 100644 (file)
@@ -223,7 +223,9 @@ static void usage(void)
 
 static void version(void)
 {
-    printf("plink: %s\n", ver);
+    char *buildinfo_text = buildinfo("\n");
+    printf("plink: %s\n%s\n", ver, buildinfo_text);
+    sfree(buildinfo_text);
     exit(1);
 }
 
index b9602243b104ac08e2a9d7944359d12e4d647f3a..9829f0876c1149fcdb63d67f42192548a98f5c2b 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "winhelp.h"
 
+#define BUILDINFO_PLATFORM "Windows"
+
 struct Filename {
     char *path;
 };