Andrew, I would very much appreciate your and other PLplot API expert's comments on this issue.
I noticed during some of my generic testing today that the output file name was truncated for the 31st example at the 79th character. This seems to be a rather tight limit for today's computers where full pathnames of files can reach far beyond 79 characters. Accordingly I have replaced (revision 11375) all occurrences of 80 by 256 in examples/*/*31* and changed plgfnam internally so that it truncates at the 255th character. The result works, but I view this internal change to plgfnam as a dangerous temporary measure because those who stick with the old limit of 80-byte buffers for their plgfnam calls will have a guaranteed buffer overflow because the revised plgfnam puts a "\0" in the 256th byte of the buffer. Here is what I propose instead of this temporary measure. We go with a backward-incompatible API change (and associated soname bump to force everybody to recompile) of c_plgfnam( char *fnam ); ==> c_plgfnam( char *fnam, PLINT n); where n is the size of the buffer that has been allocated. Internally, c_plgfnam will use n for the strncpy call as well as figuring out the last byte to zero. Note, the other two PLplot functions (plgver and plgdev) that return character strings have recommendations in the documentation to allocate 80-byte buffers to contain the version string and device name. That recommendation should be entirely safe for the forseeable future. Note it is only a recommendation and inside those routines that limit is not enforced. However, plgfnam is quite different. The 80-byte buffer limit there is recommended and also enforced internally by the implementation (before the above commit). That caused truncated filename results to be returned whenever the length of the full pathnames of files used by file device drivers exceeded 79 bytes. I need comments and discussion by our API experts here to make sure the proposed backwards-incompatible change to the plgfnam API is the way to go. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel