From: Date: October 2 2006 5:45pm Subject: bk commit into 5.0 tree (jpipes:1.2288) BUG#21412 List-Archive: http://lists.mysql.com/commits/12951 X-Bug: 21412 Message-Id: <20061002154553.CAC9C47010D@shakedown.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of jpipes. When jpipes does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2006-10-02 11:45:48-04:00, jpipes@shakedown.(none) +4 -0 Fix for Bug #21412 (client allows DELIMITER with backslash character) BitKeeper/etc/ignore@stripped, 2006-10-02 11:45:46-04:00, jpipes@shakedown.(none) +3 -0 Added mysql-test/t/tmp.test mysql-test/r/tmp.result client/tmp.diff to the ignore list client/mysql.cc@stripped, 2006-10-02 11:45:46-04:00, jpipes@shakedown.(none) +24 -3 Fix for Bug #21412 (client allows DELIMITER with backslash) mysql-test/r/mysql.result@stripped, 2006-10-02 11:45:46-04:00, jpipes@shakedown.(none) +4 -0 Added test case for Bug #21412 mysql-test/t/mysql.test@stripped, 2006-10-02 11:45:46-04:00, jpipes@shakedown.(none) +18 -0 Added test case for Bug #21412 # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jpipes # Host: shakedown.(none) # Root: /home/jpipes/dev/mysql-5.0-maint --- 1.218/client/mysql.cc 2006-10-02 11:45:53 -04:00 +++ 1.219/client/mysql.cc 2006-10-02 11:45:53 -04:00 @@ -800,10 +800,23 @@ default_charset_used= 1; break; case OPT_DELIMITER: - if (argument == disabled_my_option) + if (argument == disabled_my_option) + { strmov(delimiter, DEFAULT_DELIMITER); - else - strmake(delimiter, argument, sizeof(delimiter) - 1); + } + else + { + /* Check that delimiter does not contain a backslash */ + if (!strstr(argument, "\\")) + { + strmake(delimiter, argument, sizeof(delimiter) - 1); + } + else + { + put_info("DELIMITER cannot contain a backslash character", INFO_ERROR); + return 0; + } + } delimiter_length= (uint)strlen(delimiter); delimiter_str= delimiter; break; @@ -3010,6 +3023,14 @@ put_info("DELIMITER must be followed by a 'delimiter' character or string", INFO_ERROR); return 0; + } + else + { + if (strstr(tmp, "\\")) + { + put_info("DELIMITER cannot contain a backslash character", INFO_ERROR); + return 0; + } } strmake(delimiter, tmp, sizeof(delimiter) - 1); delimiter_length= (int)strlen(delimiter); --- 1.16/mysql-test/r/mysql.result 2006-10-02 11:45:53 -04:00 +++ 1.17/mysql-test/r/mysql.result 2006-10-02 11:45:53 -04:00 @@ -139,4 +139,8 @@ \\ '; '; +1 +1 +ERROR at line 1: DELIMITER cannot contain a backslash character +ERROR at line 1: DELIMITER cannot contain a backslash character End of 5.0 tests --- 1.16/mysql-test/t/mysql.test 2006-10-02 11:45:53 -04:00 +++ 1.17/mysql-test/t/mysql.test 2006-10-02 11:45:53 -04:00 @@ -147,4 +147,22 @@ --exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1 +# +# Bug #21412: mysql cmdline client allows backslash(es) +# as delimiter but can't recognize them +# + +# This should work just fine... +--exec echo "DELIMITER /" > $MYSQLTEST_VARDIR/tmp/bug21412.sql +--exec echo "SELECT 1/" >> $MYSQLTEST_VARDIR/tmp/bug21412.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 + +# This should give an error... +--exec echo "DELIMITER \\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 + +# As should this... +--exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 + --echo End of 5.0 tests --- 1.233/BitKeeper/etc/ignore 2006-10-02 11:45:53 -04:00 +++ 1.234/BitKeeper/etc/ignore 2006-10-02 11:45:53 -04:00 @@ -1318,3 +1318,6 @@ win/vs8cache.txt zlib/*.ds? zlib/*.vcproj +mysql-test/t/tmp.test +mysql-test/r/tmp.result +client/tmp.diff