LIST: Fix bug listing duplicate variables.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Apr 2024 17:07:16 +0000 (10:07 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Apr 2024 17:07:24 +0000 (10:07 -0700)
Thanks to Zhou Geng for reporting this bug as poc28 in the report here:
https://lists.gnu.org/archive/html/bug-gnu-pspp/2024-03/msg00015.html

src/language/commands/list.c
tests/language/commands/list.at

index 604f896e98b60c130ae944a49b7cf22f9751fc98..950bf645cc3370201929ca35c77ecf5e62d71878 100644 (file)
@@ -65,7 +65,7 @@ list_execute (const struct lst_cmd *lcmd, struct dataset *ds)
   struct subcase sc;
   subcase_init_empty (&sc);
   for (size_t i = 0; i < lcmd->n_vars; i++)
-    subcase_add_var (&sc, lcmd->vars[i], SC_ASCEND);
+    subcase_add_var_always (&sc, lcmd->vars[i], SC_ASCEND);
 
   struct casegrouper *grouper;
   struct casereader *group;
index c10c95a80943f737603d5386d6a443baacfdea3d..9d805a0595797d23612d23f351063be142431d3b 100644 (file)
@@ -361,4 +361,22 @@ AT_CHECK([pspp -O format=csv list.sps], [1], [dnl
     7 | LIST **.
       |      ^~"
 ])
+AT_CLEANUP
+
+dnl Checks for regression against a crash
+AT_SETUP([LIST duplicate variables])
+AT_DATA([list.sps], [dnl
+DATA LIST LIST NOTABLE /v r1 Se oRe o.
+BEGIN DATA.
+2
+END DATA.
+LIST o o.
+])
+AT_CHECK([pspp -O format=csv list.sps], [0], [dnl
+"list.sps:3: warning: Missing value(s) for all variables from r1 onward.  These will be filled with the system-missing value or blanks, as appropriate."
+
+Table: Data List
+o,o
+.  ,.  @&t@
+])
 AT_CLEANUP
\ No newline at end of file