-
Sven Sandberg authored
* Background The 'escape' function in mysqltest, introduced in BUG#32246580, expects a single character for the first argument. It allows multi-line strings for the second argument. * Bug symptoms If the first argument was a newline character, the test would fail on Windows. If the second argument was a multi-line string, the test would fail on windows. * Analysis Windows uses multi-line newline characters. Therefore, when the first argument is newline, it works on Linux because newline is only one character, but fails on Windows because newline is two characters. In the regular expression library, apparently, the '.' character does not match \r, and/or there is a difference between Windows and Linux in whether \n is matched. * Solution Escaping newline characters is asking for portability bugs. Removed support for escaping newlines. Use (?:.|[\n\r]) to match any character including newline. (And switch to the default regular expression flavor, in order to support (?:...) patterns). Also made the regular expression a bit stricter, so it disallows leading and trailing junk, and disallows space around the character. And added tests for bad syntax. RB:25678 Reviewed-By:
<deepa.dixit@oracle.com> Reviewed-By:
<pedro.figueiredo@oracle.com>
Sven Sandberg authored* Background The 'escape' function in mysqltest, introduced in BUG#32246580, expects a single character for the first argument. It allows multi-line strings for the second argument. * Bug symptoms If the first argument was a newline character, the test would fail on Windows. If the second argument was a multi-line string, the test would fail on windows. * Analysis Windows uses multi-line newline characters. Therefore, when the first argument is newline, it works on Linux because newline is only one character, but fails on Windows because newline is two characters. In the regular expression library, apparently, the '.' character does not match \r, and/or there is a difference between Windows and Linux in whether \n is matched. * Solution Escaping newline characters is asking for portability bugs. Removed support for escaping newlines. Use (?:.|[\n\r]) to match any character including newline. (And switch to the default regular expression flavor, in order to support (?:...) patterns). Also made the regular expression a bit stricter, so it disallows leading and trailing junk, and disallows space around the character. And added tests for bad syntax. RB:25678 Reviewed-By:
<deepa.dixit@oracle.com> Reviewed-By:
<pedro.figueiredo@oracle.com>
Loading