Skip to content
  • Sven Sandberg's avatar
    ab8038ef
    BUG#32303805: MYSQLTEST_ESCAPE FAILS ON WINDOWS · ab8038ef
    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: default avatar <deepa.dixit@oracle.com>
    Reviewed-By: default avatar <pedro.figueiredo@oracle.com>
    ab8038ef
    BUG#32303805: MYSQLTEST_ESCAPE FAILS ON WINDOWS
    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: default avatar <deepa.dixit@oracle.com>
    Reviewed-By: default avatar <pedro.figueiredo@oracle.com>
Loading