Missing Newline Parse Error
[posted 2002/10/28]
Over a week ago, we applied the latest Solaris recommended patch cluster to our piktmaster machine, all 231 MB of it (yikes!!). We then took an unrelated action, refreshing our keys.conf and, using 'piktc -p', tried updating the PIKT.conf on all of our systems.
Uh, oh...
'piktc -pv -H piktmaster' ran but finished instantly, with no output and no apparent effect. Same story for all other piktc commands, including 'piktc -c'. Running with the -G (debuG) option and setting verbose_log to TRUE in PIKT.conf didn't help. The log files showed nothing.
I thought the worst, that recent changes to Solaris somehow broke piktc.
:-(
I looked and tested and looked and tested ...
The PIKT 'make check' ran normally. The evidence now pointed to there being a mistake in our configuration (.cfg files).
I tried a few of the config debugging techniques suggested in lib/configs_samples/ macros.cfg (also in the Reference) but to no avail.
Fortunately, we mirror our PIKT configuration just about daily. I relinked /pikt/lib/configs to the mirrored configs directory from a week earlier. 'piktc -c' worked fine. Good! The patches had not broken PIKT!
Relinking from one day's mirror to the next, I finally isolated the problem to a change made between 10/22 and 10/24. Fortunately, the recursive diff of the two directories reported relatively few changes. Unfortunately, it took me a while to catch this:
Warning: missing newline at end of file configs.021024/macros/sicksys_macros.cfg
Aha! I had edited the sicksys_macros.cfg file, adding a system but not hitting the Return key at the end of that line. I remembered that not ending the last line of a configuration file had caused a mysterious failure of piktc parsing before. I was disappointed to see that I had not documented that requirement in the Reference. pikt-1.16.0b fixes that.
The Config Files, Format section of the Reference now includes a warning about this missing newline parse error:
The last line of every config file must end with a linefeed. Without the linefeed, obscure parser errors (for example, the parser silently failing without explanation) might result.
And the lib/configs_samples/macros.cfg, also the Preprocessing, Parse Errors section of the Reference, now include this:
// --make sure that the last line of every config file ends with a line feed!
My apologies if that mysterious error has ever happened to you!
A word of advice: Archive your PIKT configuration, either by keeping dated mirror directories as we do or by using RCS, CVS, or some other revision control system. Having a last-known-good set of configs might be really helpful when you've broken your configuration and you can't directly figure out why.
For more examples, see Developer's Notes.