mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Bug#39559: dump of stored procedures / functions with C-style \
comment can't be read back A change to the lexer in 5.1 caused slash-asterisk-bang-version sections to be terminated early if there exists a slash-asterisk- style comment inside it. Nesting comments is usually illegal, but we rely on versioned comment blocks in mysqldump, and the contents of those sections must be allowed to have comments. The problem was that when encountering open-comment tokens and consuming -or- passing through the contents, the "in_comment" state at the end was clobbered with the not-in-a-comment value, regardless of whether we were in a comment before this or not. So, """/*!VER one /* two */ three */""" would lose its in-comment state between "two" and "three". Save the echo and in-comment state, and restore it at the end of the comment if we consume a comment.
This commit is contained in:
@ -1160,6 +1160,18 @@ public:
|
||||
m_echo= echo;
|
||||
}
|
||||
|
||||
void save_in_comment_state()
|
||||
{
|
||||
m_echo_saved= m_echo;
|
||||
in_comment_saved= in_comment;
|
||||
}
|
||||
|
||||
void restore_in_comment_state()
|
||||
{
|
||||
m_echo= m_echo_saved;
|
||||
in_comment= in_comment_saved;
|
||||
}
|
||||
|
||||
/**
|
||||
Skip binary from the input stream.
|
||||
@param n number of bytes to accept.
|
||||
@ -1417,6 +1429,7 @@ private:
|
||||
|
||||
/** Echo the parsed stream to the pre-processed buffer. */
|
||||
bool m_echo;
|
||||
bool m_echo_saved;
|
||||
|
||||
/** Pre-processed buffer. */
|
||||
char *m_cpp_buf;
|
||||
@ -1479,6 +1492,7 @@ public:
|
||||
|
||||
/** State of the lexical analyser for comments. */
|
||||
enum_comment_state in_comment;
|
||||
enum_comment_state in_comment_saved;
|
||||
|
||||
/**
|
||||
Starting position of the TEXT_STRING or IDENT in the pre-processed
|
||||
|
Reference in New Issue
Block a user