Hi,

1) you are right, an eof in the middle of a <comment> section must be
   handled explicitly, otherwise it ends by an unrelated error later,
   just as it currently does. By the way, here it ends with
   [no-options-error] which has no corresponding message in
   'help-opal-wrapper.txt'.

   I joined the patch to correct this <comment> problem.

2) indeed, other lex files have similar patterns to 'keyval_lex.l', so
   we should correct them also. I will take a look at them.

Thanks,

Piotr


Le 21/06/2013 00:17, Jeff Squyres (jsquyres) a écrit :
Piotr --

Many thanks for the patch.  Sorry, our lex is quite a bit rusty, and it took us 
quite a while to look at this.  :-\

I have a few questions:

1. What happens if the file ends while in<comment>?  E.g., if a the last line of the file 
is "/* Hello".

2. Does this same kind of fixup need to be applied to the 5 other flex files in 
the OMPI source tree?



On May 30, 2013, at 11:30 AM, Piotr Lesnicki<piotr.lesni...@ext.bull.net>  
wrote:

Hi,

The parser of key/value configuration files (like
'openmpi-mca-params.conf') has some small bugs:

- a parsing error occurs when there is no new line at the end of the
  file (and the error shows while reading the next conf file)
- error messages display wrong line numbers
- error messages show nothing meaninful when a new line replaces an
  expected token

I attached a patch of the lex production rules of the keyval
parser to correct this.



# steps to reproduce (all versions):
$ cp $OPAL_PREFIX/etc/openmpi-mca-params.conf .
$ (head -n -1 openmpi-mca-params.conf ; tail -n1 openmpi-mca-params.conf | tr -d 
'\n')>  params.conf
$ export OMPI_MCA_mca_param_files=$PWD/params.conf
$ mpicc -v
[berlin73:00360] keyval parser: error 1 reading file 
/home_nfs/lesnickp/tmp/params.conf at line 160:
  #
[berlin73:00360] keyval parser: error 1 reading file 
/home_nfs/lesnickp/local/openmpi-1.6.3/share/openmpi/mpicc-wrapper-data.txt at 
line 1:
  # There can be multiple blocks of configuration data, chosen by
[...]


--
Piotr LESNICKI
<lex.patch>_______________________________________________
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel


diff -r 8d3bf35f2294 -r 0c52ab670ae9 opal/util/keyval/keyval_lex.l
--- a/opal/util/keyval/keyval_lex.l	Mon Jun 17 20:02:40 2013 +0200
+++ b/opal/util/keyval/keyval_lex.l	Fri Jun 21 11:28:29 2013 +0200
@@ -66,6 +66,7 @@
 <comment>[^*\n]*       ; /* Eat up non '*'s */
 <comment>"*"+[^*/\n]*  ; /* Eat '*'s not followed by a '/' */
 <comment>\n         { opal_util_keyval_yynewlines++; }
+<comment><<EOF>>    { BEGIN(INITIAL); return OPAL_UTIL_KEYVAL_PARSE_DONE; }
 <comment>"*"+"/"    { BEGIN(INITIAL); /* Done with Block Comment */ }

 {WHITE}*"="{WHITE}* { BEGIN(VALUE); return OPAL_UTIL_KEYVAL_PARSE_EQUAL; }

Reply via email to