From 692004fed170c67b618b2b6f92f562e85668c69a Mon Sep 17 00:00:00 2001 From: Terje Rosten Date: Thu, 23 Feb 2017 07:42:47 -0800 Subject: [PATCH] Bug#25604587 BACKPORT BUG#24947217 TO 5.6 AND 5.7 Summary: Change is needed in MySQL 5.6 and 5.7 as well. Should resolve https://github.com/facebook/mysql-5.6/issues/885. Reviewed By: lth Differential Revision: D10407251 fbshipit-source-id: 4848c368b88 --- client/mysqltest.cc | 10 ++++++++-- mysql-test/mysql-test-run.pl | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 79e4ec591900..9a461303b529 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "my_regex.h" /* Our own version of regex */ #ifdef HAVE_SYS_WAIT_H @@ -56,6 +57,7 @@ using std::min; using std::max; +using std::string; #ifdef __WIN__ #include @@ -4800,7 +4802,11 @@ void do_perl(struct st_command *command) die("Failed to create temporary file for perl command"); my_close(fd, MYF(0)); - str_to_file(temp_file_path, ds_script.str, ds_script.length); + /* Compatibility for Perl 5.24 and newer. */ + string script = "push @INC, \".\";\n"; + script.append(ds_script.str, ds_script.length); + + str_to_file(temp_file_path, &script[0], script.size()); /* Format the "perl " command */ my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 38e21804abce..4ce7087ccd1c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # -*- cperl -*- -# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -101,6 +101,8 @@ BEGIN use IO::Socket::INET; use IO::Select; +push @INC, "."; + require "lib/mtr_process.pl"; require "lib/mtr_io.pl"; require "lib/mtr_gcov.pl";