From 6007721eb527794f1f7cc3b7a18b4a34d0474e0c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 14 Sep 2014 01:38:52 -0700 Subject: [PATCH] WIXBUG:4513 - Fix condition keyword detection in modularization regex. The regex in the modularization of conditions would incorrectly recognize keywords that were part of property names. For example, the property "NOTEWORTHY" would be parsed as the keyword "NOT" and the property "EWORTHY". This fix ensures there is whitespace after keywords. --- History.md | 2 ++ src/tools/wix/Row.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index 602c0158d..73168960a 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,5 @@ +* RobMen: WIXBUG:4513 - Fix condition keyword detection in modularization regex. + ## WixBuild: Version 3.9.901.0 * BobArnson: WIXBUG:4510 - Empty the post-reboot resume command line when recreating it. diff --git a/src/tools/wix/Row.cs b/src/tools/wix/Row.cs index 43bbc559d..d19472839 100644 --- a/src/tools/wix/Row.cs +++ b/src/tools/wix/Row.cs @@ -578,7 +578,7 @@ internal string GetModularizedValue(Field field, string modularizationGuid, Hash // to shred the entire condition into the identifiers that need to be // modularized. Let's break it down piece by piece: // - // 1. Look for the operators: NOT, EQV, XOR, OR, AND, IMP. Note that the + // 1. Look for the operators: NOT, EQV, XOR, OR, AND, IMP (plus a space). Note that the // regular expression is case insensitive so we don't have to worry about // all the permutations of these strings. // 2. Look for quoted strings. Quoted strings are just text and are ignored @@ -588,7 +588,7 @@ internal string GetModularizedValue(Field field, string modularizationGuid, Hash // strings these enviroment variable references are ignored outright. // 4. Match all identifiers that are things that need to be modularized. Note // the special characters (!, $, ?, &) that denote Component and Feature states. - regex = new Regex(@"NOT|EQV|XOR|OR|AND|IMP|"".*?""|%[a-zA-Z_][a-zA-Z0-9_\.]*|(?[!$\?&]?[a-zA-Z_][a-zA-Z0-9_\.]*)", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture); + regex = new Regex(@"NOT\s|EQV\s|XOR\s|OR\s|AND\s|IMP\s|"".*?""|%[a-zA-Z_][a-zA-Z0-9_\.]*|(?[!$\?&]?[a-zA-Z_][a-zA-Z0-9_\.]*)", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture); // less performant version of the above with captures showing where everything lives // regex = new Regex(@"(?NOT|EQV|XOR|OR|AND|IMP)|(?"".*?"")|(?%[a-zA-Z_][a-zA-Z0-9_\.]*)|(?[!$\?&]?[a-zA-Z_][a-zA-Z0-9_\.]*)",RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);