From: Ben Pfaff Date: Sat, 21 May 2022 21:56:49 +0000 (-0700) Subject: New command SHOW SYSTEM to easily print information useful in bug reports. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c92d3eed244f3958c01daf3ab901fbe2faa2b735;hp=bc07898bc39c984b7486dcdbd2cbb43fabb52678;p=pspp New command SHOW SYSTEM to easily print information useful in bug reports. --- diff --git a/NEWS b/NEWS index 4b9876cfdc..a4adf3afdb 100644 --- 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. diff --git a/doc/automake.mk b/doc/automake.mk index 5636fa302e..ae2a5c8cde 100644 --- a/doc/automake.mk +++ b/doc/automake.mk @@ -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 \ diff --git a/doc/bugs.texi b/doc/bugs.texi index 611041b29f..3f96242687 100644 --- a/doc/bugs.texi +++ b/doc/bugs.texi @@ -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 index 0000000000..b1fa99b98d --- /dev/null +++ b/doc/pspp-figures/show-system.sps @@ -0,0 +1 @@ +SHOW SYSTEM. \ No newline at end of file diff --git a/doc/utilities.texi b/doc/utilities.texi index 18a45095e9..c20410384e 100644 --- a/doc/utilities.texi +++ b/doc/utilities.texi @@ -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} diff --git a/src/language/utilities/set.c b/src/language/utilities/set.c index 9b18bfb0df..08675179ab 100644 --- a/src/language/utilities/set.c +++ b/src/language/utilities/set.c @@ -23,9 +23,6 @@ #include #include -#include "gl/ftoastr.h" -#include "gl/vasnprintf.h" - #include "data/casereader.h" #include "data/data-in.h" #include "data/data-out.h" @@ -52,11 +49,15 @@ #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); +} 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 }; diff --git a/src/ui/gui/help-menu.c b/src/ui/gui/help-menu.c index e63829cb06..20c52ee848 100644 --- a/src/ui/gui/help-menu.c +++ b/src/ui/gui/help-menu.c @@ -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);