Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e2da680c
Commit
e2da680c
authored
Jan 23, 2018
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-13187 incorrect backslash parsing in clients
also cover USE and other built-in commands
parent
8637931f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
+68
-2
client/mysql.cc
client/mysql.cc
+5
-2
mysql-test/r/mysqldump-nl.result
mysql-test/r/mysqldump-nl.result
+43
-0
mysql-test/t/mysqldump-nl.test
mysql-test/t/mysqldump-nl.test
+20
-0
No files found.
client/mysql.cc
View file @
e2da680c
...
...
@@ -4559,8 +4559,11 @@ static char *get_arg(char *line, get_arg_mode mode)
}
for
(
start
=
ptr
;
*
ptr
;
ptr
++
)
{
if
((
*
ptr
==
'\\'
&&
ptr
[
1
])
||
// escaped character
(
!
short_cmd
&&
qtype
&&
*
ptr
==
qtype
&&
ptr
[
1
]
==
qtype
))
// quote
/* if short_cmd use historical rules (only backslash) otherwise SQL rules */
if
(
short_cmd
?
(
*
ptr
==
'\\'
&&
ptr
[
1
])
// escaped character
:
(
*
ptr
==
'\\'
&&
ptr
[
1
]
&&
qtype
!=
'`'
)
||
// escaped character
(
qtype
&&
*
ptr
==
qtype
&&
ptr
[
1
]
==
qtype
))
// quote
{
// Remove (or skip) the backslash (or a second quote)
if
(
mode
!=
CHECK
)
...
...
mysql-test/r/mysqldump-nl.result
View file @
e2da680c
...
...
@@ -124,3 +124,46 @@ v1
1v
drop database `mysqltest1
1tsetlqsym`;
create database `test```;
create database `test\``
\! ls
#`;
show databases like 'test%';
Database (test%)
test
test\`
\! ls
#
test`
--
-- Current Database: `test```
--
/*!40000 DROP DATABASE IF EXISTS `test```*/;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test``` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `test```;
--
-- Current Database: `test\``
-- \! ls
-- #`
--
/*!40000 DROP DATABASE IF EXISTS `test\``
\! ls
#`*/;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test\``
\! ls
#` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `test\``
\! ls
#`;
drop database `test```;
drop database `test\``
\! ls
#`;
mysql-test/t/mysqldump-nl.test
View file @
e2da680c
...
...
@@ -36,3 +36,23 @@ show tables from `mysqltest1
drop
database
`mysqltest1
1tsetlqsym`
;
create
database
`test```
;
create
database
`test\``
\
!
ls
#`;
show
databases
like
'test%'
;
exec
$MYSQL_DUMP
--
compact
--
comment
--
add
-
drop
-
database
--
databases
'test`'
'test\`
\! ls
#'
;
exec
$MYSQL_DUMP
--
compact
--
comment
--
add
-
drop
-
database
--
databases
'test`'
'test\`
\! ls
#'
|
$MYSQL
;
drop
database
`test```
;
drop
database
`test\``
\
!
ls
#`;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment