Scilab hangs when incorrect format is used for file reading using mfscanf
Reported by Atri Bhattacharya
Originally assigned to Paul BIGNIER
abc.dat (64 bytes, video/mpeg)
SImple data file that triggers the big when used with mfscanf
BUG DESCRIPTION:
----------------
Using mfscanf to read columns of data from a formatted text file which has a string header (e.g. describing the columns of data) causes scilab (irrespective of whether one uses the GUI or the cli) to hang completely whilst using 100% CPU with no way other than manually killing the process (SIGKILL or the like). One ideally expects that the scanf function would be powerful enough to ignore lines of data that do not match the prescribed format, but in all practicality mfscanf should just print an error and abort rather than screwing up the entire scilab workspace by causing it to hang.
ERROR LOG:
----------
None
HOW TO REPRODUCE THE BUG:
-------------------------
Run the following code snippet on the a data file with two columns of data but which, say, starts with a string header:
f = mopen("datafile_with_string.dat");
A = mfscanf(-1, f, "%lg %lg");
mclose(f);
For example, try the above snippet on the attached data file where I have string column headers to indicate what the data represent.
OTHER INFORMATION:
------------------