1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

Ensure that mtr.out-of-source is not acccidently calling itself

Calling itself will cause extensive memory usage that can kill
the machine when it runs out of memory (happend to me).

Fixed by having mtr.out-of-source checking that it is not calling itself.
In addition added a check for cmake to expand symlinks to make the
check if we are running mtr 'out of source' safer.

Author: Sergei Golubchik <serg@mariadb.org> (CMakeList.txt changes)
This commit is contained in:
Monty
2026-05-13 17:04:01 +03:00
parent d37e50c6d0
commit da58c0c137
2 changed files with 14 additions and 0 deletions

View File

@@ -16,6 +16,11 @@
INSTALL_MYSQL_TEST("." "")
IF (NOT CMAKE_REAL_SOURCE_DIR)
get_filename_component(CMAKE_REAL_SOURCE_DIR "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(CMAKE_REAL_BINARY_DIR "${CMAKE_BINARY_DIR}" REALPATH)
ENDIF()
IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Enable running mtr from build directory
CONFIGURE_FILE(

View File

@@ -1,5 +1,14 @@
#!/usr/bin/env perl
# Call mtr in out-of-source build
use Cwd qw(cwd abs_path);
$ENV{MTR_BINDIR} = '@CMAKE_BINARY_DIR@';
my $dir= cwd();
my $new_dir= abs_path('@CMAKE_SOURCE_DIR@');
if ($dir eq $new_dir . '/mysql-test')
{
print stderr "Something went wrong. Do 'git checkout mysql-test/mariadb-test-run.pl' and try again";
exit 1;
}
chdir('@CMAKE_SOURCE_DIR@/mysql-test');
exit(system($^X, '@CMAKE_SOURCE_DIR@/mysql-test/mariadb-test-run.pl', @ARGV) >> 8);