diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-12-18 17:50:09 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-12-21 10:34:02 +0100 |
commit | 3b654d54c1081ae9eab54bebe7093704749d31cf (patch) | |
tree | 5801f98cbd5a85112c46c4c67e66a95b867626e3 | |
parent | 9dadfdcde5a63a4d67f0f7a3720632bcb1d589d7 (diff) | |
download | mariadb-git-3b654d54c1081ae9eab54bebe7093704749d31cf.tar.gz |
longer regex error messages
-rw-r--r-- | extra/comp_err.c | 21 | ||||
-rw-r--r-- | mysql-test/main/func_regexp_pcre.result | 8 | ||||
-rw-r--r-- | mysql-test/main/func_regexp_pcre_debug.result | 2 | ||||
-rw-r--r-- | sql/share/errmsg-utf8.txt | 14 |
4 files changed, 22 insertions, 23 deletions
diff --git a/extra/comp_err.c b/extra/comp_err.c index a504832a60f..e6ea9acccb9 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -31,6 +31,7 @@ #include <m_string.h> #include <my_getopt.h> #include <my_dir.h> +#include <ctype.h> #define MAX_ROWS 3000 #define ERRORS_PER_RANGE 1000 @@ -749,18 +750,19 @@ static struct message *find_message(struct errors *err, const char *lang, for the format specifiers RETURN VALUE - Returns the checksum for all the characters of the + Returns the checksum for all letters of the format specifiers Ex. - "text '%-64.s' text part 2 %d'" - ^^^^^^ ^^ + "text '%-.64s' text part 2 %zu'" + ^ ^^ characters will be xored to form checksum + Non-letters are skipped, because they do not change the type + of the argument. + NOTE: - Does not support format specifiers with positional args - like "%2$s" but that is not yet supported by my_vsnprintf - either. + Does not support format specifiers with positional args like "%2$s" */ static ha_checksum checksum_format_specifier(const char* msg) @@ -777,20 +779,17 @@ static ha_checksum checksum_format_specifier(const char* msg) start= p+1; /* Entering format specifier */ num_format_specifiers++; } - else if (start) + else if (start && isalpha(*p)) { + chksum= my_checksum(chksum, p, 1); switch(*p) { case 'd': case 'u': case 'x': case 's': case 'M': - chksum= my_checksum(chksum, (uchar*) start, (uint) (p + 1 - start)); start= 0; /* Not in format specifier anymore */ break; - - default: - break; } } diff --git a/mysql-test/main/func_regexp_pcre.result b/mysql-test/main/func_regexp_pcre.result index 0187831aff6..ad7d406d3c1 100644 --- a/mysql-test/main/func_regexp_pcre.result +++ b/mysql-test/main/func_regexp_pcre.result @@ -793,7 +793,7 @@ SELECT 'a\nb' RLIKE '(?-s)a.b'; 0 SET default_regex_flags=DEFAULT; SELECT REGEXP_SUBSTR('Monday Mon','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$'); -ERROR 42000: Got error 'two named subpatterns have the same name (PCRE2_DUPNAMES not set' from regexp +ERROR 42000: Regex error 'two named subpatterns have the same name (PCRE2_DUPNAMES not set) at offset 30' SET default_regex_flags='DUPNAMES'; SELECT REGEXP_SUBSTR('Monday Mon','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$'); REGEXP_SUBSTR('Monday Mon','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$') @@ -817,10 +817,10 @@ SELECT 'AB' RLIKE 'A# this is a comment\nB'; 1 SET default_regex_flags=DEFAULT; SELECT 'Aq' RLIKE 'A\\q'; -ERROR 42000: Got error 'unrecognized character follows \ at offset 2' from regexp +ERROR 42000: Regex error 'unrecognized character follows \ at offset 2' SET default_regex_flags='EXTRA'; SELECT 'Aq' RLIKE 'A\\q'; -ERROR 42000: Got error 'unrecognized character follows \ at offset 2' from regexp +ERROR 42000: Regex error 'unrecognized character follows \ at offset 2' SET default_regex_flags=DEFAULT; SELECT 'a\nb\nc' RLIKE '^b$'; 'a\nb\nc' RLIKE '^b$' @@ -860,7 +860,7 @@ SELECT 0xE001 REGEXP @regCheck; 0xE001 REGEXP @regCheck 0 Warnings: -Warning 1139 Got error 'UTF-8 error: 1 byte missing at end' from regexp +Warning 1139 Regex error 'UTF-8 error: 1 byte missing at end' # Testing workaround N1: This makes the pattern to be a binary string: SET NAMES latin1; SET @regCheck= X'E001'; diff --git a/mysql-test/main/func_regexp_pcre_debug.result b/mysql-test/main/func_regexp_pcre_debug.result index e44492fca72..6f82cb903d2 100644 --- a/mysql-test/main/func_regexp_pcre_debug.result +++ b/mysql-test/main/func_regexp_pcre_debug.result @@ -3,7 +3,7 @@ SELECT 'a' RLIKE 'a'; 'a' RLIKE 'a' 0 Warnings: -Warning 1139 Got error 'pcre_exec: Internal error (-123)' from regexp +Warning 1139 Regex error 'pcre_exec: Internal error (-123)' SET debug_dbug=''; SELECT 'a' RLIKE 'a'; 'a' RLIKE 'a' diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 68b0b6bd586..dbff2b204d8 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -3186,13 +3186,13 @@ ER_INVALID_USE_OF_NULL 22004 swe "Felaktig använding av NULL" ukr "Хибне використання значення NULL" ER_REGEXP_ERROR 42000 - cze "Regulární výraz vrátil chybu '%-.64s'" + cze "Regulární výraz vrátil chybu: %s" dan "Fik fejl '%-.64s' fra regexp" nla "Fout '%-.64s' ontvangen van regexp" - eng "Got error '%-.64s' from regexp" - est "regexp tagastas vea '%-.64s'" + eng "Regex error '%s'" + est "regexp tagastas vea: %s" fre "Erreur '%-.64s' provenant de regexp" - ger "regexp lieferte Fehler '%-.64s'" + ger "Regexp Fehler %s" hindi "regexp में '%-.64s' त्रुटि हुई" hun "'%-.64s' hiba a regularis kifejezes hasznalata soran (regexp)" ita "Errore '%-.64s' da regexp" @@ -3200,11 +3200,11 @@ ER_REGEXP_ERROR 42000 kor "regexp에서 '%-.64s'가 났습니다." por "Obteve erro '%-.64s' em regexp" rum "Eroarea '%-.64s' obtinuta din expresia regulara (regexp)" - rus "Получена ошибка '%-.64s' от регулярного выражения" - serbian "Funkcija regexp je vratila grešku '%-.64s'" + rus "Ошибка регулярного выражения: %s" + serbian "Funkcija regexp je vratila grešku: %s" spa "Obtenido error '%-.64s' de regexp" swe "Fick fel '%-.64s' från REGEXP" - ukr "Отримано помилку '%-.64s' від регулярного виразу" + ukr "Помилка регулярного виразу: %s" ER_MIX_OF_GROUP_FUNC_AND_FIELDS 42000 cze "Pokud není žádná GROUP BY klauzule, není dovoleno současné použití GROUP položek (MIN(),MAX(),COUNT()...) s ne GROUP položkami" dan "Sammenblanding af GROUP kolonner (MIN(),MAX(),COUNT()...) uden GROUP kolonner er ikke tilladt, hvis der ikke er noget GROUP BY prædikat" |