Re: [PATCH 2.3.1 1/1] Common: variable expansion in property value on the last line of properties file fails

Guy <guy.tal@...>

Hi Damian,

A week ago I published a patch that fix the parser failure to expand a variable on the last line.
Can you or anyone else review that fix?

Guy Tal

On 03/09/2014 19:32, Guy wrote:


The properties file parser fails to expand variable if such exists in a value that is also at the last line in the properties file.
For example, Consider <EOF> as the last character in file, if the last property in the file is as follows:$(SOME_VALUE)<EOF>
and $(SOME_VALUE)=Hello World, we would expect to be "Hello World", but it doesn't, it remains $(SOME_VALUE)

The properties file parser expands environment variable if such exists inside a property value, but not if the value is the last one before end-of-file.

The solution is to check if there are key and value already parsed also when reaching end of file.
Plese look at common/c_cpp/src/c/properties.l from line 159:
<<EOF>>                         { /* Handle EOF right at the end of a */
                                    /* value string */
                                    if ( curKey && curValue )
                                        replaceValue = propertiesImpl_ReplaceEnvironmentVariable(curValue); //<- beginning of the missing part
                                        if(replaceValue != NULL)
                                           /* Delete the original value */

                                           /* Copy the replaced value into the
                                            * current value pointer. */
                                           curValue = replaceValue;
}                                   //<- that is all

I opened a bug at:

I provide here a patch of the lex file for review.

Guy Tal

Openmama-dev mailing list

Join { to automatically receive all group messages.