1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2023-09-11 14:46:39 +03:00
98 changed files with 1125 additions and 22817 deletions

View File

@@ -20,9 +20,10 @@ package My::Platform;
use strict;
use File::Basename;
use File::Path;
use Carp;
use base qw(Exporter);
our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL IS_AIX
our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX
native_path posix_path mixed_path
check_socket_path_length process_alive open_for_append);
@@ -33,9 +34,15 @@ BEGIN {
die "Could not execute 'cygpath': $!";
}
eval 'sub IS_CYGWIN { 1 }';
eval 'sub IS_MSYS { 0 }';
}
elsif ($^O eq "msys") {
eval 'sub IS_CYGWIN { 1 }';
eval 'sub IS_MSYS { 1 }';
}
else {
eval 'sub IS_CYGWIN { 0 }';
eval 'sub IS_MSYS { 0 }';
}
if ($^O eq "MSWin32") {
eval 'sub IS_WIN32PERL { 1 }';
@@ -95,8 +102,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;
}
@@ -219,4 +231,69 @@ sub open_for_append
}
sub check_cygwin_subshell
{
# Only pipe (or sh-expansion) is fed to /bin/sh
my $out= `echo %comspec%|cat`;
return ($out =~ /\bcmd.exe\b/) ? 0 : 1;
}
sub install_shell_wrapper()
{
system("rm -f /bin/sh.exe") and die $!;
my $wrapper= <<'EOF';
#!/bin/bash
if [[ -n "$MTR_PERL" && "$1" = "-c" ]]; then
shift
exec $(cygpath -m "$COMSPEC") /C "$@"
fi
exec /bin/bash "$@"
EOF
open(OUT, '>', "/bin/sh") or die "/bin/sh: $!\n";
print OUT $wrapper;
close(OUT);
system("chmod +x /bin/sh") and die $!;
print "Cygwin subshell wrapper /bin/sh was installed, please restart MTR!\n";
exit(0);
}
sub uninstall_shell_wrapper()
{
system("rm -f /bin/sh") and die $!;
system("cp /bin/bash.exe /bin/sh.exe") and die $!;
}
sub cygwin_subshell_fix
{
my ($opt_name, $opt_value)= @_;
if ($opt_name ne "cygwin-subshell-fix") {
confess "Wrong option name: ${opt_name}";
}
if ($opt_value eq "do") {
if (check_cygwin_subshell()) {
install_shell_wrapper();
} else {
print "Cygwin subshell fix was already installed, skipping...\n";
}
} elsif ($opt_value eq "remove") {
if (check_cygwin_subshell()) {
print "Cygwin subshell fix was already uninstalled, skipping...\n";
} else {
uninstall_shell_wrapper();
}
} else {
die "Wrong --cygwin-subshell-fix value: ${opt_value} (expected do/remove)";
}
}
sub options
{
if (IS_CYGWIN) {
return ('cygwin-subshell-fix=s' => \&cygwin_subshell_fix);
} else {
return ();
}
}
1;

View File

@@ -102,7 +102,7 @@ else
# Find the safe process binary or script
sub find_bin {
if (IS_WIN32PERL or IS_CYGWIN)
if (IS_WINDOWS)
{
# Use my_safe_process.exe
my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],

View File

@@ -111,7 +111,7 @@ sub read_test {
$serialized =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/eg;
my $test= Storable::thaw($serialized);
use Data::Dumper;
die "wrong class (hack attempt?): ".ref($test)."\n".Dumper(\$test, $serialized)
confess "Not My::Test: ". ref($test). "\n". Dumper(\$test, $serialized)
unless ref($test) eq 'My::Test';
resfile_from_test($test) if $::opt_resfile;
return $test;

View File

@@ -48,6 +48,7 @@ our $timestamp= 0;
our $timediff= 0;
our $name;
our $verbose;
# TODO: no option for that? Why is it different from $verbose?
our $verbose_restart= 0;
our $timer= 1;
our $tests_total;