sys-file-writer: Put long variable name in variable attributes.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 16 Jun 2011 01:55:54 +0000 (18:55 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 16 Jun 2011 01:55:54 +0000 (18:55 -0700)
Otherwise, PSPP cannot read back .sav files that it writes, if
they contain variable attributes for variables with long names.

Thanks to Curt Reinhold <Curt.Reinhold@psychonomics.de> for
providing the .sav file that led to this discovery and to John
Darrington for helping to investigate.

doc/dev/system-file-format.texi
src/data/sys-file-writer.c
tests/data/sys-file.at

index b0b69dd4cae54f0922bd497232811ff1bd027c1f..22209a5fcd2183a709d5fbee57f765420499bb2b 100644 (file)
@@ -1133,8 +1133,8 @@ element.
 In record type 18, this field contains a sequence of one or more
 variable attribute sets.  If more than one variable attribute set is
 present, each one after the first is delimited from the previous by
 In record type 18, this field contains a sequence of one or more
 variable attribute sets.  If more than one variable attribute set is
 present, each one after the first is delimited from the previous by
-@code{/}.  Each variable attribute set consists of a (potentially
-long) variable name,
+@code{/}.  Each variable attribute set consists of a long
+variable name,
 followed by @code{:}, followed by an attribute set with the same
 syntax as on record type 17.
 
 followed by @code{:}, followed by an attribute set with the same
 syntax as on record type 17.
 
index d98c0a11cbcbebad56274aade4c82a658f291771..a67cf7dd2f609ef3ce724acde611ad6497ef9ee1 100644 (file)
@@ -625,7 +625,7 @@ write_variable_attributes (struct sfm_writer *w, const struct dictionary *d)
         {
           if (n_attrsets++)
             ds_put_byte (&s, '/');
         {
           if (n_attrsets++)
             ds_put_byte (&s, '/');
-          ds_put_format (&s, "%s:", var_get_short_name (v, 0));
+          ds_put_format (&s, "%s:", var_get_name (v));
           put_attrset (&s, attrs);
         }
     }
           put_attrset (&s, attrs);
         }
     }
index a2980853e1224e4cbde2bb36580add60d70fa3a0..5975e0f3b7326c4e44e8141d735d64c418648b97 100644 (file)
@@ -387,20 +387,20 @@ AT_SETUP([system file character encoding])
 AT_CHECK([supports_encodings windows-1252])
 AT_DATA([save.sps], [dnl
 SET LOCALE='windows-1252'.
 AT_CHECK([supports_encodings windows-1252])
 AT_DATA([save.sps], [dnl
 SET LOCALE='windows-1252'.
-DATA LIST LIST NOTABLE /àéîöç * roué (A9) croûton (A1000).
+DATA LIST LIST NOTABLE /àéîöçxyzabc * roué (A9) croûton (A1000).
 FILE LABEL 'clientèle confrère cortège crèche'.
 DOCUMENT coördinate smörgåsbord
 épée séance soufflé soirée
 jalapeño vicuña.
 VALUE LABEL
 FILE LABEL 'clientèle confrère cortège crèche'.
 DOCUMENT coördinate smörgåsbord
 épée séance soufflé soirée
 jalapeño vicuña.
 VALUE LABEL
-      /àéîöç 1 'éclair élan'
+      /àéîöçxyzabc 1 'éclair élan'
       /roué 'abcdefghi' 'sauté précis'.
 VARIABLE LABEL
       roué 'Provençal soupçon'.
 DATAFILE ATTRIBUTE
       ATTRIBUTE=Furtwängler('kindergärtner').
 VARIABLE ATTRIBUTE
       /roué 'abcdefghi' 'sauté précis'.
 VARIABLE LABEL
       roué 'Provençal soupçon'.
 DATAFILE ATTRIBUTE
       ATTRIBUTE=Furtwängler('kindergärtner').
 VARIABLE ATTRIBUTE
-      VARIABLES=àéîöç
+      VARIABLES=àéîöçxyzabc
       ATTRIBUTE=Atatürk('Düsseldorf Gewürztraminer').
 BEGIN DATA.
 1 a x
       ATTRIBUTE=Atatürk('Düsseldorf Gewürztraminer').
 BEGIN DATA.
 1 a x
@@ -431,7 +431,7 @@ jalapeño vicuña.
 (Entered <date>)
 
 Variable,Description,,Position
 (Entered <date>)
 
 Variable,Description,,Position
-àéîöç,Format: F8.2,,1
+àéîöçxyzabc,Format: F8.2,,1
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,