From 099b41646452789d8a5b31218fa6522d1ea46584 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 15 Jun 2011 18:55:54 -0700 Subject: [PATCH] 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. --- doc/dev/system-file-format.texi | 4 ++-- src/data/sys-file-writer.c | 2 +- tests/data/sys-file.at | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) 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,, -- 2.30.2