• Aleksey Midenkov's avatar
    MDEV-30836 MTR Cygwin fix · 640cd404
    Aleksey Midenkov authored
    Cygwin is more Unix-oriented. It does not treat \n as \r\n in regexps
    (fixed by \R), it supplies Unix-style paths (fixed by
    mixed_path()). It does some cleanup on paths when running exe, so it
    will be different in exe output (like with $exe_mysqld, comparing
    basename() is enough).
    
    Cygwin installation
    
    1. Just install latest perl version (only base package) and
       patchutils from cygwin-setup;
    2. Don't forget to add c:\cygwin64\bin into system path
       before any other perl flavors;
    3. There is path-style conflict (see below), you must replace
       c:\cygwin64\bin\sh.exe with the wrapper. Run MTR with
       --cygwin-subshell-fix=do for that. Make sure you are running Cygwin
       perl for the option to work.
    4. Restart buildbot via net stop buildbot; net start buildbot
    
    Path-style conflict of Cygwin-ish Perl
    
    Some exe paths are passed to mysqltest which are executed by a native
    call. This requires native-style paths (\-style). These exe paths also
    executed by Perl itself. Either by MTR itself which is not so
    critical, but also by tests' --perl blocks which is impossible to
    change. And if Perl detects shell-expansion or uses pipe command it
    passess this exe path to /bin/sh which is Cygwin-compiled bash that
    cannot work with \-style (or at least in -c processing). Thus we require
    \-style on some parts of MTR execution and /-style on another parts.
    
    The examples of tests which cover these different parts are:
    
        main.mysqlbinlog_row_compressed \
        main.sp_trans_log
    
    That could be great to force Perl to use something different from
    /bin/sh, but unfortunately /bin/sh is compiled-in into binary. So the
    only solution left is to overwrite /bin/sh with some wrapper script
    which passes the command to cmd.exe instead of bash.
    640cd404
Platform.pm 6.55 KB