Commit 380e2de1 authored by tsmith@quadxeon.mysql.com's avatar tsmith@quadxeon.mysql.com

Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/41

into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/41
parents 74fed0c3 44959af2
/* Copyright (C) 2000 MySQL AB
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
echo is a replacement for the "echo" command builtin to cmd.exe
on Windows, to get a Unix eqvivalent behaviour when running commands
like:
$> echo "hello" | mysql
The windows "echo" would have sent "hello" to mysql while
Unix echo will send hello without the enclosing hyphens
This is a very advanced high tech program so take care when
you change it and remember to valgrind it before production
use.
*/
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
for (i= 1; i < argc; i++)
{
fprintf(stdout, "%s", argv[i]);
if (i < argc - 1)
fprintf(stdout, " ");
}
fprintf(stdout, "\n");
return 0;
}
This diff is collapsed.
......@@ -8,6 +8,7 @@ use strict;
sub mtr_full_hostname ();
sub mtr_short_hostname ();
sub mtr_native_path($);
sub mtr_init_args ($);
sub mtr_add_arg ($$@);
sub mtr_path_exists(@);
......@@ -49,6 +50,16 @@ sub mtr_short_hostname () {
return $hostname;
}
# Convert path to OS native format
sub mtr_native_path($)
{
my $path= shift;
$path=~ s/\//\\/g
if ($::glob_win32);
return $path;
}
# FIXME move to own lib
sub mtr_init_args ($) {
......
......@@ -8,7 +8,7 @@ use Socket;
use Errno;
use strict;
use POSIX 'WNOHANG';
use POSIX qw(WNOHANG SIGHUP);
sub mtr_run ($$$$$$;$);
sub mtr_spawn ($$$$$$;$);
......@@ -125,19 +125,18 @@ sub spawn_impl ($$$$$$$$) {
{
if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
{
mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo");
mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
sleep(1);
redo FORK;
}
else
{
mtr_error("$path ($pid) can't be forked");
}
mtr_error("$path ($pid) can't be forked, error: $!");
}
if ( $pid )
{
spawn_parent_impl($pid,$mode,$path);
return spawn_parent_impl($pid,$mode,$path);
}
else
{
......@@ -202,8 +201,11 @@ sub spawn_impl ($$$$$$$$) {
{
mtr_child_error("failed to execute \"$path\": $!");
}
mtr_error("Should never come here 1!");
}
mtr_error("Should never come here 2!");
}
mtr_error("Should never come here 3!");
}
......@@ -216,12 +218,21 @@ sub spawn_parent_impl {
{
if ( $mode eq 'run' )
{
# Simple run of command, we wait for it to return
# Simple run of command, wait blocking for it to return
my $ret_pid= waitpid($pid,0);
if ( $ret_pid != $pid )
{
mtr_error("waitpid($pid, 0) returned $ret_pid " .
"when waiting for '$path'");
# The "simple" waitpid has failed, print debug info
# and try to handle the error
mtr_warning("waitpid($pid, 0) returned $ret_pid " .
"when waiting for '$path', error: '$!'");
if ( $ret_pid == -1 )
{
# waitpid returned -1, that would indicate the process
# no longer exist and waitpid couldn't wait for it.
return 1;
}
mtr_error("Error handling failed");
}
return mtr_process_exit_status($?);
......@@ -1089,12 +1100,6 @@ sub mtr_kill_processes ($) {
#
##############################################################################
# FIXME something is wrong, we sometimes terminate with "Hangup" written
# to tty, and no STDERR output telling us why.
# FIXME for some reason, setting HUP to 'IGNORE' will cause exit() to
# write out "Hangup", and maybe loose some output. We insert a sleep...
sub mtr_exit ($) {
my $code= shift;
mtr_timer_stop_all($::glob_timers);
......@@ -1106,7 +1111,7 @@ sub mtr_exit ($) {
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
kill('HUP', -$$) if !$::glob_win32_perl and $$ == getpgrp();
POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp();
exit($code);
}
......
......@@ -347,6 +347,7 @@ sub stop_all_servers ();
sub run_mysqltest ($);
sub usage ($);
######################################################################
#
# Main program
......@@ -1518,7 +1519,8 @@ sub executable_setup () {
sub generate_cmdline_mysqldump ($) {
my($mysqld) = @_;
return
"$exe_mysqldump --no-defaults -uroot " .
mtr_native_path($exe_mysqldump) .
" --no-defaults -uroot " .
"--port=$mysqld->{'port'} " .
"--socket=$mysqld->{'path_sock'} --password=";
}
......@@ -1624,7 +1626,7 @@ sub environment_setup () {
my $deb_version;
if ( $opt_valgrind and -d $debug_libraries_path and
(! -e '/etc/debian_version' or
($deb_version= mtr_grab_file('/etc/debian_version')) == 0 or
($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
$deb_version > 3.1 ) )
{
push(@ld_library_paths, $debug_libraries_path);
......@@ -1721,7 +1723,8 @@ sub environment_setup () {
# Setup env so childs can execute mysqlcheck
# ----------------------------------------------------
my $cmdline_mysqlcheck=
"$exe_mysqlcheck --no-defaults -uroot " .
mtr_native_path($exe_mysqlcheck) .
" --no-defaults -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
......@@ -1755,7 +1758,8 @@ sub environment_setup () {
if ( $exe_mysqlslap )
{
my $cmdline_mysqlslap=
"$exe_mysqlslap -uroot " .
mtr_native_path($exe_mysqlslap) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password= " .
"--lock-directory=$opt_tmpdir";
......@@ -1772,7 +1776,8 @@ sub environment_setup () {
# Setup env so childs can execute mysqlimport
# ----------------------------------------------------
my $cmdline_mysqlimport=
"$exe_mysqlimport -uroot " .
mtr_native_path($exe_mysqlimport) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
......@@ -1788,7 +1793,8 @@ sub environment_setup () {
# Setup env so childs can execute mysqlshow
# ----------------------------------------------------
my $cmdline_mysqlshow=
"$exe_mysqlshow -uroot " .
mtr_native_path($exe_mysqlshow) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
......@@ -1803,7 +1809,7 @@ sub environment_setup () {
# Setup env so childs can execute mysqlbinlog
# ----------------------------------------------------
my $cmdline_mysqlbinlog=
"$exe_mysqlbinlog" .
mtr_native_path($exe_mysqlbinlog) .
" --no-defaults --local-load=$opt_tmpdir";
if ( $mysql_version_id >= 50000 )
{
......@@ -1821,7 +1827,8 @@ sub environment_setup () {
# Setup env so childs can execute mysql
# ----------------------------------------------------
my $cmdline_mysql=
"$exe_mysql --no-defaults --host=localhost --user=root --password= " .
mtr_native_path($exe_mysql) .
" --no-defaults --host=localhost --user=root --password= " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} ".
"--character-sets-dir=$path_charsetsdir";
......@@ -1850,17 +1857,17 @@ sub environment_setup () {
# ----------------------------------------------------
# Setup env so childs can execute my_print_defaults
# ----------------------------------------------------
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
# ----------------------------------------------------
# Setup env so childs can execute mysqladmin
# ----------------------------------------------------
$ENV{'MYSQLADMIN'}= $exe_mysqladmin;
$ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin);
# ----------------------------------------------------
# Setup env so childs can execute perror
# ----------------------------------------------------
$ENV{'MY_PERROR'}= $exe_perror;
$ENV{'MY_PERROR'}= mtr_native_path($exe_perror);
# ----------------------------------------------------
# Add the path where mysqld will find udf_example.so
......@@ -4516,7 +4523,8 @@ sub run_mysqltest ($) {
# ----------------------------------------------------------------------
# export MYSQL_TEST variable containing <path>/mysqltest <args>
# ----------------------------------------------------------------------
$ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
$ENV{'MYSQL_TEST'}=
mtr_native_path($exe_mysqltest) . " " . join(" ", @$args);
# ----------------------------------------------------------------------
# Add arguments that should not go into the MYSQL_TEST env var
......
......@@ -210,7 +210,6 @@ source database
"MySQL: The world's most popular ;open source database"
echo message echo message
mysqltest: At line 1: Empty variable
mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec
MySQL
......@@ -507,8 +506,10 @@ drop table t1;
mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file'
mysqltest: At line 1: Missing required argument 'filename' to command 'write_file'
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
mysqltest: At line 1: End of line junk detected: "write_file filename ";
"
Some data
for cat_file command
of mysqltest
mysqltest: At line 1: Failed to open file non_existing_file
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
......
......@@ -847,6 +847,30 @@ num (select num + 2 FROM t1 LIMIT 1)
SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
ERROR 42S22: Unknown column 'num' in 'on clause'
DROP TABLE t1;
CREATE TABLE bug25126 (
val int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
);
UPDATE bug25126 SET MissingCol = MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'field list'
UPDATE bug25126 SET val = val ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
UPDATE bug25126 SET val = val ORDER BY val;
UPDATE bug25126 SET val = 1 ORDER BY val;
UPDATE bug25126 SET val = 1 ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
UPDATE bug25126 SET val = 1 ORDER BY val, MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
UPDATE bug25126 SET val = MissingCol ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
UPDATE bug25126 SET MissingCol = 1 ORDER BY val, MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
UPDATE bug25126 SET MissingCol = 1 ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol;
ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
DROP TABLE bug25126;
CREATE TABLE t1 (a int);
SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1;
val val1
......
......@@ -552,8 +552,8 @@ echo ;
# Illegal use of echo
--error 1
--exec echo "echo \$;" | $MYSQL_TEST 2>&1
#--error 1
#--exec echo "echo \$;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
......@@ -1469,8 +1469,8 @@ remove_file non_existing_file;
--error 1
--exec echo "write_file filename ;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "write_file filename \";" | $MYSQL_TEST 2>&1
#--error 1
#--exec echo "write_file filename \";" | $MYSQL_TEST 2>&1
write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Content for test_file1
......@@ -1484,6 +1484,74 @@ END_DELIMITER
file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
# ----------------------------------------------------------------------------
# test for append_file
# ----------------------------------------------------------------------------
write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Content for test_file1
EOF
file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
append_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Appended text
EOF
file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
append_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Appended text on nonexisting file
EOF
# ----------------------------------------------------------------------------
# test for cat_file
# ----------------------------------------------------------------------------
--write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp
Some data
for cat_file command
of mysqltest
EOF
cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
--error 1
--exec echo "cat_file non_existing_file;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# test for diff_files
# ----------------------------------------------------------------------------
--write_file $MYSQLTEST_VARDIR/tmp/diff1.tmp
Some data
for diff_file command
of mysqltest
EOF
--write_file $MYSQLTEST_VARDIR/tmp/diff2.tmp
Some data
for diff_file command
of mysqltest
EOF
--write_file $MYSQLTEST_VARDIR/tmp/diff3.tmp
Some other data
for diff_file command
of mysqltest
EOF
# Compare equal files
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
--diff_files $MYSQLTEST_VARDIR/tmp/diff2.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
# Compare files that differ
--error 1
--diff_files $MYSQLTEST_VARDIR/tmp/diff3.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
--error 1
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp
# Compare equal files, again...
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
# ----------------------------------------------------------------------------
# test for file_exist
# ----------------------------------------------------------------------------
......
......@@ -575,6 +575,35 @@ SELECT a + 1 AS num, (select num + 2 FROM t1 LIMIT 1) FROM t1;
SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
DROP TABLE t1;
#
# Bug#25126: Reference to non-existant column in UPDATE...ORDER BY...
# crashes server
#
CREATE TABLE bug25126 (
val int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
);
--error 1054
UPDATE bug25126 SET MissingCol = MissingCol;
--error 1054
UPDATE bug25126 SET val = val ORDER BY MissingCol;
UPDATE bug25126 SET val = val ORDER BY val;
UPDATE bug25126 SET val = 1 ORDER BY val;
--error 1054
UPDATE bug25126 SET val = 1 ORDER BY MissingCol;
--error 1054
UPDATE bug25126 SET val = 1 ORDER BY val, MissingCol;
--error 1054
UPDATE bug25126 SET val = MissingCol ORDER BY MissingCol;
--error 1054
UPDATE bug25126 SET MissingCol = 1 ORDER BY val, MissingCol;
--error 1054
UPDATE bug25126 SET MissingCol = 1 ORDER BY MissingCol;
--error 1054
UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
--error 1054
UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol;
DROP TABLE bug25126;
#
# Bug #25427: crash when order by expression contains a name
# that cannot be resolved unambiguously
......
......@@ -142,7 +142,8 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
# this avoid the rebuild of the built files in a source dist
lex_hash.h: gen_lex_hash.cc lex.h
$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
./gen_lex_hash$(EXEEXT) > $@
./gen_lex_hash$(EXEEXT) > $@-t
$(MV) $@-t $@
# For testing of udf_example.so; Works on platforms with gcc
# (This is not part of our build process but only provided as an example)
......
......@@ -1774,7 +1774,18 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
use the field from the Item_field in the select list and leave
the Item_field instance in place.
*/
set_field((*((Item_field**)res))->field);
Field *field= (*((Item_field**)res))->field;
if (field == NULL)
{
/* The column to which we link isn't valid. */
my_error(ER_BAD_FIELD_ERROR, MYF(0), (*res)->name,
current_thd->where);
return(1);
}
set_field(field);
return 0;
}
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment