New command SHOW SYSTEM to easily print information useful in bug reports.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 21 May 2022 21:56:49 +0000 (14:56 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 21 May 2022 21:56:49 +0000 (14:56 -0700)
NEWS
doc/automake.mk
doc/bugs.texi
doc/pspp-figures/show-system.sps [new file with mode: 0644]
doc/utilities.texi
src/language/utilities/set.c
src/ui/gui/help-menu.c

diff --git a/NEWS b/NEWS
index 4b9876cfdc5a36369b3d493bf2817973f3d2478c..a4adf3afdbe026863ea0b11591ae62a153e40214 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,9 @@ Changes from 1.4.1 to 1.5.5:
  * The user manual, in its Info and HTML versions, now includes
    graphical output examples and screenshots.
 
+ * New command SHOW SYSTEM to easily print system information useful
+   in bug reports.
+
  * Build changes:
 
    - Perl is no longer required to build.
index 5636fa302e1525a8440d20574276badc786794ad..ae2a5c8cde5b16be5c3050a316b576d17df17917 100644 (file)
@@ -127,6 +127,7 @@ FIGURE_SYNTAX = \
  doc/pspp-figures/independent-samples-t.sps \
  doc/pspp-figures/reliability.sps \
  doc/pspp-figures/select-if.sps \
+ doc/pspp-figures/show-system.sps \
  doc/pspp-figures/sort-cases.sps \
  doc/pspp-figures/split.sps \
  doc/pspp-figures/temporary.sps \
index 611041b29fb70a20b8bb7411fb962e45af063f41..3f96242687d486fb4b3f0174c311525e4c65d1ac 100644 (file)
@@ -53,27 +53,39 @@ to @email{bug-gnu-pspp@@gnu.org}.
 A high-quality bug report allows the developers to understand,
 reproduce, and ultimately fix the problem.  We recommend
 including the following:
+
 @itemize @bullet
-@item The version of @pspp{} in which you encountered the problem
-That means the precise version number.  ``The latest version''
-is often too ambiguous because
-releases happen quickly, and bug reports are archived indefinitely.
+@item
+The version of @pspp{} in which you encountered the problem.  It also
+often helps to know some information about how @pspp{} was built.
+
+With @pspp{} command syntax, @code{SHOW SYSTEM.} will output
+everything we ordinarily need.  In the PSPPIRE GUI,
+@clicksequence{Help @click{} System Info} produces the same output.
+
 @item The operating system and type of computer on which it is running.
+
 @item A sample of the syntax which causes the problem or, if it is a user
  interface problem, the sequence of steps required to reproduce it.
  Screenshots can be helpful for reporting bugs in the graphical user
  interface, especially since GUI bugs can arise on some systems but
  not others, but they do not usually help fixing other kinds of bugs.
+
 @item A description of what you think is wrong: What happened that you
-  didn't expect, and what did you expect to happen?
+  didn't expect, and what did you expect to happen?  Include any error
+  messages that @pspp{} output.
 @end itemize
 
 Here is one example of a bug report that includes all of the elements above:
 
 @cartouche
 @example
-When I run PSPP 0.8.4 on my GNU/Linux system, executing the following
-syntax:
+I'm running PSPP on a system where @code{SHOW SYSTEM.}  outputs the
+following:
+
+@psppoutput{show-system}
+
+The bug I'm seeing is that executing the following syntax:
 
  DATA LIST FREE /x *.
  BEGIN DATA.
diff --git a/doc/pspp-figures/show-system.sps b/doc/pspp-figures/show-system.sps
new file mode 100644 (file)
index 0000000..b1fa99b
--- /dev/null
@@ -0,0 +1 @@
+SHOW SYSTEM.
\ No newline at end of file
index 18a45095e986af89d3c1f26a93169fbddc90f2da..c20410384ed04d38ce78838e3ed45abf76d658e7 100644 (file)
@@ -1018,6 +1018,7 @@ SHOW
         [MXWARNS]
         [N]
         [SCOMPRESSION]
+        [SYSTEM]
         [TEMPDIR]
         [UNDEFINED]
         [VERSION]
@@ -1044,6 +1045,9 @@ Shows the operating system details.
 @item @subcmd{N}
 Reports the number of cases in the active dataset.  The reported number is not
 weighted.  If no dataset is defined, then @samp{Unknown} is reported.
+@item @subcmd{SYSTEM}
+Shows information about how PSPP was built.  This information is
+useful in bug reports.  @xref{Bugs}, for details.
 @item @subcmd{TEMPDIR}
 Shows the path of the directory where temporary files are stored.
 @item @subcmd{VERSION}
index 9b18bfb0dfb00e31aba44dc8831443cc15d8d3e2..08675179ab1ac63bd305f66a33bd8d78aaecae94 100644 (file)
@@ -23,9 +23,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "gl/ftoastr.h"
-#include "gl/vasnprintf.h"
-
 #include "data/casereader.h"
 #include "data/data-in.h"
 #include "data/data-out.h"
 #include "output/journal.h"
 #include "output/pivot-table.h"
 
+#include "gl/ftoastr.h"
 #include "gl/minmax.h"
+#include "gl/relocatable.h"
+#include "gl/vasnprintf.h"
 #include "gl/xalloc.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
+#define N_(msgid) (msgid)
 
 struct setting
   {
@@ -940,12 +941,6 @@ show_SUBTITLE (const struct dataset *ds UNUSED)
   return xstrdup (output_get_subtitle ());
 }
 
-static char *
-show_SYSTEM (const struct dataset *ds UNUSED)
-{
-  return xstrdup (host_system);
-}
-
 static char *
 show_TEMPDIR (const struct dataset *ds UNUSED)
 {
@@ -1168,6 +1163,36 @@ show_copying (const struct dataset *ds UNUSED)
 {
   fputs (copyleft, stdout);
 }
+
+static void
+add_row (struct pivot_table *table, const char *attribute,
+         const char *value)
+{
+  int row = pivot_category_create_leaf (table->dimensions[0]->root,
+                                        pivot_value_new_text (attribute));
+  if (value)
+    pivot_table_put1 (table, row, pivot_value_new_user_text (value, -1));
+}
+
+static void
+show_system (const struct dataset *ds UNUSED)
+{
+  struct pivot_table *table = pivot_table_create (N_("System Information"));
+  pivot_dimension_create (table, PIVOT_AXIS_ROW, N_("Attribute"));
+
+  add_row (table, N_("Version"), version);
+  add_row (table, N_("Host System"), host_system);
+  add_row (table, N_("Build System"), build_system);
+  add_row (table, N_("Locale Directory"), relocate (locale_dir));
+  add_row (table, N_("Compiler Version"),
+#ifdef __VERSION__
+           __VERSION__
+#else
+           "Unknown"
+#endif
+           );
+  pivot_table_submit (table);
+}
 \f
 static const struct setting settings[] = {
   { "BASETEXTDIRECTION", parse_BASETEXTDIRECTION, NULL },
@@ -1213,7 +1238,6 @@ static const struct setting settings[] = {
   { "SCOMPRESSION", parse_SCOMPRESSION, show_SCOMPRESSION },
   { "SEED", parse_SEED, NULL },
   { "SMALL", parse_SMALL, show_SMALL },
-  { "SYSTEM", NULL, show_SYSTEM },
   { "TEMPDIR", NULL, show_TEMPDIR },
   { "TNUMBERS", parse_TNUMBERS, show_TNUMBERS },
   { "TVARS", parse_TVARS, show_TVARS },
@@ -1293,6 +1317,8 @@ cmd_show (struct lexer *lexer, struct dataset *ds)
         show_warranty (ds);
       else if (lex_match_id (lexer, "COPYING") || lex_match_id (lexer, "LICENSE"))
         show_copying (ds);
+      else if (lex_match_id (lexer, "SYSTEM"))
+        show_system (ds);
       else if (lex_match_id (lexer, "TITLE"))
         {
           struct setting s = { .name = "TITLE", .show = show_TITLE };
index e63829cb06c7a143b80bca16d5bfe0d76e8031a3..20c52ee848bfc76cada6277a8c74e9ad9c95b5b4 100644 (file)
@@ -24,7 +24,9 @@
 #include "libpspp/copyleft.h"
 #include "libpspp/message.h"
 #include "libpspp/version.h"
+#include "ui/gui/executor.h"
 #include "ui/gui/help-menu.h"
+#include "ui/gui/psppire-data-window.h"
 
 #include "gl/configmake.h"
 #include "gl/relocatable.h"
@@ -125,6 +127,12 @@ on_activate_link (GtkAboutDialog *label,
 }
 #endif
 
+static void
+about_system_info (GtkMenuItem *mmm, GtkWindow *parent)
+{
+  execute_const_syntax_string (psppire_default_data_window (), "SHOW SYSTEM.");
+}
+
 static void
 about_new (GtkMenuItem *mmm, GtkWindow *parent)
 {
@@ -265,6 +273,7 @@ create_help_menu (GtkWindow *toplevel)
   GtkWidget *menu = gtk_menu_new ();
 
   GtkWidget *help_about = gtk_menu_item_new_with_mnemonic (_("_About"));
+  GtkWidget *help_system_info = gtk_menu_item_new_with_mnemonic (_("_System Information"));
   GtkWidget *help_ref = gtk_menu_item_new_with_mnemonic (_("_Reference Manual"));
 
   GtkAccelGroup *accel_group = gtk_accel_group_new ();
@@ -277,9 +286,11 @@ create_help_menu (GtkWindow *toplevel)
                              GTK_ACCEL_VISIBLE);
 
   gtk_menu_attach (GTK_MENU (menu), help_ref, 0, 1, 0, 1);
-  gtk_menu_attach (GTK_MENU (menu), help_about, 0, 1, 1, 2);
+  gtk_menu_attach (GTK_MENU (menu), help_system_info, 0, 1, 1, 2);
+  gtk_menu_attach (GTK_MENU (menu), help_about, 0, 1, 2, 3);
 
   g_signal_connect (help_about, "activate", G_CALLBACK (about_new), toplevel);
+  g_signal_connect (help_system_info, "activate", G_CALLBACK (about_system_info), toplevel);
   g_signal_connect (help_ref, "activate", G_CALLBACK (reference_manual), NULL);
 
   g_object_set (menuitem, "submenu", menu, NULL);