1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-30836 MTR Cygwin fix

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.
This commit is contained in:
Aleksey Midenkov
2023-08-07 22:33:58 +03:00
committed by Daniel Black
parent 4ed583031a
commit 640cd404af
2 changed files with 14 additions and 8 deletions

View File

@ -96,8 +96,13 @@ sub mixed_path {
sub native_path {
my ($path)= @_;
$path=~ s/\//\\/g
if (IS_CYGWIN or IS_WIN32PERL);
if (IS_CYGWIN) {
# \\\\ protects against 2 expansions (just for the case)
$path=~ s/\/+|\\+/\\\\\\\\/g;
}
elsif (IS_WINDOWS) {
$path=~ s/\/+/\\/g;
}
return $path;
}