|
From: Juhász P. <pet...@gm...> - 2023-03-07 19:38:32
|
Dear gnuplot list members, The following data file + gnuplot script produce incorrect behavior with a recent git build, indicating possible memory corruption while reading strings from the data file: # -- data file --- 1;1; 1;2; 1aa;3;1.1 1;4; 1;5; 1;2; 1;3; 1;4; 1;5; # -- script ---- set dataf sep ';' plot 'foo' u 0:2:(strcol(3)) w labels point On my machine this produces a plot where all points after the third have the same "1.1" label. When you move the plot around (in an interactive terminal, e.g. with an arrow key), all points get the same label. Interestingly, everything seems to work as expected if you remove the "a"s from the data file. Other, even weirder effects can be coaxed out of gnuplot if you add some characters to other lines than the third. This seems like a bug. I think the explicit non-standard separator and the field being the last one are both necessary conditions. Some background and explanation: This report is actually related to an earlier discussion on this list, where I complained that lines containing missing values are silently dropped, and that column(i) seemed different from $i. Today I updated to the current development version, and noticed that my workaround to the missing values using column() no longer worked. So I experimented with some things, and at first I've thought that strcol() might be able to help me, as it didn't seem to be bothered by missing fields, but then I noticed the weirdness described above. As for fixing this bug, I think it is important to preserve strcol()'s ability to just return the empty string in case of missing data - after all, it is advertised to return the content of column X as a string. If the column is empty, then by definition its contents are the empty string. best regards, Peter Juhasz |