From: Ben Pfaff Date: Thu, 16 Jun 2011 01:55:54 +0000 (-0700) Subject: sys-file-writer: Put long variable name in variable attributes. X-Git-Tag: v0.7.9~281 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=099b41646452789d8a5b31218fa6522d1ea46584;p=pspp-builds.git sys-file-writer: Put long variable name in variable attributes. Otherwise, PSPP cannot read back .sav files that it writes, if they contain variable attributes for variables with long names. Thanks to Curt Reinhold for providing the .sav file that led to this discovery and to John Darrington for helping to investigate. --- diff --git a/doc/dev/system-file-format.texi b/doc/dev/system-file-format.texi index b0b69dd4..22209a5f 100644 --- a/doc/dev/system-file-format.texi +++ b/doc/dev/system-file-format.texi @@ -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 -@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. diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index d98c0a11..a67cf7dd 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -625,7 +625,7 @@ write_variable_attributes (struct sfm_writer *w, const struct dictionary *d) { 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); } } diff --git a/tests/data/sys-file.at b/tests/data/sys-file.at index a2980853..5975e0f3 100644 --- a/tests/data/sys-file.at +++ b/tests/data/sys-file.at @@ -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'. -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 - /àéîöç 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 - VARIABLES=àéîöç + VARIABLES=àéîöçxyzabc ATTRIBUTE=Atatürk('Düsseldorf Gewürztraminer'). BEGIN DATA. 1 a x @@ -431,7 +431,7 @@ jalapeño vicuña. (Entered ) Variable,Description,,Position -àéîöç,Format: F8.2,,1 +àéîöçxyzabc,Format: F8.2,,1 ,Measure: Scale,, ,Display Alignment: Right,, ,Display Width: 8,,