List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:March 7 2011 3:20pm
Subject:bzr commit into mysql-trunk-mtr branch (bjorn.munch:3040) Bug#11747313
View as plain text  
#At file:///home/bm136801/my/system-tr/ based on revid:bjorn.munch@stripped

 3040 Bjorn Munch	2011-03-07
      Bug #11747313 31741: MYSQLTEST - DEPRECATE "SYSTEM" COMMAND
      Removed do_system() in mysqltest.cc, replaced with error
      Adapted mysqltest.test
      Replaces some uses with new commands or exec
      mysql-test/t/mysqlbinlog_raw_mode.test: had to build a .sh script

    modified:
      client/mysqltest.cc
      mysql-test/r/mysqltest.result
      mysql-test/t/mysqlbinlog_raw_mode.test
      mysql-test/t/mysqltest.test
      mysql-test/t/partition_mgm_err2.test
      mysql-test/t/repair.test
      mysql-test/t/show_check.test
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2011-02-23 04:53:07 +0000
+++ b/client/mysqltest.cc	2011-03-07 15:17:39 +0000
@@ -3049,83 +3049,6 @@ int do_modify_var(struct st_command *com
 
 
 /*
-  Wrapper for 'system' function
-
-  NOTE
-  If mysqltest is executed from cygwin shell, the command will be
-  executed in the "windows command interpreter" cmd.exe and we prepend "sh"
-  to make it be executed by cygwins "bash". Thus commands like "rm",
-  "mkdir" as well as shellscripts can executed by "system" in Windows.
-
-*/
-
-int my_system(DYNAMIC_STRING* ds_cmd)
-{
-#if defined __WIN__ && defined USE_CYGWIN
-  /* Dump the command into a sh script file and execute with system */
-  str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
-  return system(tmp_sh_cmd);
-#else
-  return system(ds_cmd->str);
-#endif
-}
-
-
-/*
-  SYNOPSIS
-  do_system
-  command	called command
-
-  DESCRIPTION
-  system <command>
-
-  Eval the query to expand any $variables in the command.
-  Execute the command with the "system" command.
-
-*/
-
-void do_system(struct st_command *command)
-{
-  DYNAMIC_STRING ds_cmd;
-  DBUG_ENTER("do_system");
-
-  if (strlen(command->first_argument) == 0)
-    die("Missing arguments to system, nothing to do!");
-
-  init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256);
-
-  /* Eval the system command, thus replacing all environment variables */
-  do_eval(&ds_cmd, command->first_argument, command->end, !is_windows);
-
-#ifdef __WIN__
-#ifndef USE_CYGWIN
-   /* Replace /dev/null with NUL */
-   while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
-     ;
-#endif
-#endif
-
-
-  DBUG_PRINT("info", ("running system command '%s' as '%s'",
-                      command->first_argument, ds_cmd.str));
-  if (my_system(&ds_cmd))
-  {
-    if (command->abort_on_error)
-      die("system command '%s' failed", command->first_argument);
-
-    /* If ! abort_on_error, log message and continue */
-    dynstr_append(&ds_res, "system command '");
-    replace_dynstr_append(&ds_res, command->first_argument);
-    dynstr_append(&ds_res, "' failed\n");
-  }
-
-  command->last_argument= command->end;
-  dynstr_free(&ds_cmd);
-  DBUG_VOID_RETURN;
-}
-
-
-/*
   SYNOPSIS
   set_wild_chars
   set  true to set * etc. as wild char, false to reset
@@ -8615,7 +8538,10 @@ int main(int argc, char **argv)
       case Q_INC: do_modify_var(command, DO_INC); break;
       case Q_DEC: do_modify_var(command, DO_DEC); break;
       case Q_ECHO: do_echo(command); command_executed++; break;
-      case Q_SYSTEM: do_system(command); break;
+      case Q_SYSTEM:
+        die("'system' command  is deprecated, use exec or\n"\
+            "  see the manual for portable commands to use");
+	break;
       case Q_REMOVE_FILE: do_remove_file(command); break;
       case Q_REMOVE_FILES_WILDCARD: do_remove_files_wildcard(command); break;
       case Q_MKDIR: do_mkdir(command); break;

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2011-01-12 10:22:11 +0000
+++ b/mysql-test/r/mysqltest.result	2011-03-07 15:17:39 +0000
@@ -412,9 +412,8 @@ mysqltest: At line 1: Cannot perform inc
 mysqltest: At line 1: End of line junk detected: "1000"
 mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
 mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
-mysqltest: At line 1: Missing arguments to system, nothing to do!
-mysqltest: At line 1: Missing arguments to system, nothing to do!
-system command 'NonExistsinfComamdn 2> /dev/null' failed
+mysqltest: At line 1: 'system' command  is deprecated, use exec or
+  see the manual for portable commands to use
 test
 test2
 test3

=== modified file 'mysql-test/t/mysqlbinlog_raw_mode.test'
--- a/mysql-test/t/mysqlbinlog_raw_mode.test	2010-05-21 21:48:20 +0000
+++ b/mysql-test/t/mysqlbinlog_raw_mode.test	2011-03-07 15:17:39 +0000
@@ -7,8 +7,13 @@
 # If exit code is good or bad then entry in raw_mode_exit table will be created
 # Anything above exit code 1 is bad.  We wait for this
 CREATE TABLE raw_mode_exit (exit_code INT);
---system `$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001 ; [ \$? -le 1 ]` && $MYSQL -e "use test; INSERT INTO raw_mode_exit VALUES (1);" &
-
+# Now jump some loops to have mysqlbinlog executed in the background
+--write_file $MYSQL_TMP_DIR/mbl.sh
+#!/bin/sh
+(`$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001 ; [ $? -le 1 ]` && $MYSQL -e "use test; INSERT INTO raw_mode_exit VALUES (1);") < /dev/null > /dev/null 2>&1 &
+EOF
+--chmod 0755 $MYSQL_TMP_DIR/mbl.sh
+--exec $MYSQL_TMP_DIR/mbl.sh
 let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
 --source include/wait_condition.inc
 --diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
@@ -24,5 +29,6 @@ DROP TABLE raw_mode_exit;
 --remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001
 --remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000002
 --remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000003
+--remove_file $MYSQL_TMP_DIR/mbl.sh
 
 --echo End of tests

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2011-01-12 10:22:11 +0000
+++ b/mysql-test/t/mysqltest.test	2011-03-07 15:17:39 +0000
@@ -1072,22 +1072,11 @@ echo $d;
 
 
 # ----------------------------------------------------------------------------
-# Test system
+# Test system (which is now deprecated)
 # ----------------------------------------------------------------------------
-#system ls > /dev/null;
-system echo "hej" > /dev/null;
-#--system ls > /dev/null
---system echo "hej" > /dev/null;
 
 --error 1
---exec echo "system;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
-
---disable_abort_on_error
-system NonExistsinfComamdn 2> /dev/null;
---enable_abort_on_error
-
+--exec echo "system something;" | $MYSQL_TEST 2>&1
 
 # ----------------------------------------------------------------------------
 # Test delimiter

=== modified file 'mysql-test/t/partition_mgm_err2.test'
--- a/mysql-test/t/partition_mgm_err2.test	2007-04-25 18:21:55 +0000
+++ b/mysql-test/t/partition_mgm_err2.test	2011-03-07 15:17:39 +0000
@@ -11,8 +11,9 @@
 #
 # BUG: 14354 Partitions: data directory clause fails
 #
---system rm -rf $MYSQLTEST_VARDIR/tmp/bug14354
---system mkdir $MYSQLTEST_VARDIR/tmp/bug14354
+--error 0,1
+--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/bug14354
+--mkdir $MYSQLTEST_VARDIR/tmp/bug14354
 disable_query_log;
 eval CREATE TABLE t1 (id int) PARTITION BY RANGE(id) (
 PARTITION p1 VALUES LESS THAN (20) ENGINE=myisam
@@ -20,7 +21,8 @@ DATA DIRECTORY="$MYSQLTEST_VARDIR/tmp/bu
 INDEX DIRECTORY="$MYSQLTEST_VARDIR/tmp/bug14354");
 enable_query_log;
 INSERT INTO t1 VALUES (15);
---system test -f $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYD
---system test -f $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYI
+--file_exists $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYD
+--file_exists $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYI
 DROP TABLE t1;
---system rm -rf $MYSQLTEST_VARDIR/tmp/bug14354
+--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/bug14354
+--rmdir $MYSQLTEST_VARDIR/tmp/bug14354

=== modified file 'mysql-test/t/repair.test'
--- a/mysql-test/t/repair.test	2010-02-03 05:32:38 +0000
+++ b/mysql-test/t/repair.test	2011-03-07 15:17:39 +0000
@@ -30,7 +30,7 @@ repair table t1 use_frm;
 create table t1 engine=myisam SELECT 1,"table 1";
 flush tables;
 let $MYSQLD_DATADIR= `select @@datadir`;
-system echo 1 > $MYSQLD_DATADIR/test/t1.MYI ;
+exec echo 1 > $MYSQLD_DATADIR/test/t1.MYI ;
 repair table t1;
 repair table t1 use_frm;
 drop table t1;

=== modified file 'mysql-test/t/show_check.test'
--- a/mysql-test/t/show_check.test	2011-01-18 13:09:35 +0000
+++ b/mysql-test/t/show_check.test	2011-03-07 15:17:39 +0000
@@ -442,7 +442,7 @@ flush tables;
 
 # Create a junk frm file on disk
 let $MYSQLD_DATADIR= `select @@datadir`;
-system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
+exec echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
 --replace_column 6 # 7 # 8 # 9 #
 SHOW TABLE STATUS like 't1';
 --error ER_NOT_FORM_FILE


Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20110307151739-39gajv6l0rxx6tcg.bundle
Thread
bzr commit into mysql-trunk-mtr branch (bjorn.munch:3040) Bug#11747313Bjorn Munch7 Mar
  • Re: bzr commit into mysql-trunk-mtr branch (bjorn.munch:3040) Bug#11747313Guilhem Bichot8 Mar