Commit cf52dd17 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-22545: my_vsnprintf behaves not as in C standard

Added parameter %T for string which should be visibly truncated.
parent d8e2fa0c
......@@ -787,6 +787,7 @@ static ha_checksum checksum_format_specifier(const char* msg)
case 'x':
case 's':
case 'M':
case 'T':
chksum= my_checksum(chksum, (uchar*) start, (uint) (p + 1 - start));
start= 0; /* Not in format specifier anymore */
break;
......
......@@ -55,7 +55,8 @@
Supported formats are 's' (null pointer is accepted, printed as
"(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o',
'X', 'p' (works as 0x%x), 'f', 'g', 'M' (extension, see below).
'X', 'p' (works as 0x%x), 'f', 'g', 'M' (extension, see below),
'T' (extension, see below).
Standard syntax for positional arguments $n is supported.
......@@ -69,6 +70,9 @@
Format 'M': takes one integer, prints this integer, space, double quote
error message, double quote. In other words
printf("%M", n) === printf("%d \"%s\"", n, strerror(n))
Format 'T': takes string and print it like s but if the strints should be
truncated puts "..." at the end.
*/
#ifdef __cplusplus
......
......@@ -2,6 +2,6 @@ MySQL error code 150: Foreign key constraint is incorrectly formed
Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
OS error code 23: Too many open files in system
Win32 error code 23: Data error (cyclic redundancy check).
MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192T' for key %d
Win32 error code 1062: The service has not been started.
Illegal error code: 30000
Illegal error code: 10000
MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192T' for key %d
MySQL error code 1408 (ER_STARTUP): %s: ready for connections.
Version: '%s' socket: '%s' port: %d %s
MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it!
......
......@@ -11,7 +11,7 @@ drop table t1;
connection slave;
include/wait_for_slave_sql_to_stop.inc
call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.* error code=1062.*Error on slave:.* error.* 0");
Error: "Query caused different errors on master and slave. Error on master: message (format)='Duplicate entry '%-.192s' for key %d' error code=1062 ; Error on slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave)
Error: "Query caused different errors on master and slave. Error on master: message (format)='Duplicate entry '%-.192T' for key %d' error code=1062 ; Error on slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave)
Errno: "0" (expected 0)
drop table t1;
include/stop_slave.inc
......
......@@ -6661,7 +6661,7 @@ Item_float::Item_float(THD *thd, const char *str_arg, uint length):
&error);
if (error)
{
char tmp[NAME_LEN + 1];
char tmp[NAME_LEN + 2];
my_snprintf(tmp, sizeof(tmp), "%.*s", length, str_arg);
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", tmp);
}
......
......@@ -997,11 +997,16 @@ static Item *create_comparator(MY_XPATH *xpath,
b->type() == Item::XPATH_NODESET)
{
uint len= (uint)(xpath->query.end - context->beg);
set_if_smaller(len, 32);
my_printf_error(ER_UNKNOWN_ERROR,
"XPATH error: "
"comparison of two nodesets is not supported: '%.*s'",
MYF(0), len, context->beg);
if (len <= 32)
my_printf_error(ER_UNKNOWN_ERROR,
"XPATH error: "
"comparison of two nodesets is not supported: '%.*s'",
MYF(0), len, context->beg);
else
my_printf_error(ER_UNKNOWN_ERROR,
"XPATH error: "
"comparison of two nodesets is not supported: '%.32T'",
MYF(0), context->beg);
return 0; // TODO: Comparison of two nodesets
}
......@@ -2634,9 +2639,12 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
xpath->item= NULL;
DBUG_ASSERT(xpath->query.end > dollar_pos);
uint len= (uint)(xpath->query.end - dollar_pos);
set_if_smaller(len, 32);
my_printf_error(ER_UNKNOWN_ERROR, "Unknown XPATH variable at: '%.*s'",
MYF(0), len, dollar_pos);
if (len <= 32)
my_printf_error(ER_UNKNOWN_ERROR, "Unknown XPATH variable at: '%.*s'",
MYF(0), len, dollar_pos);
else
my_printf_error(ER_UNKNOWN_ERROR, "Unknown XPATH variable at: '%.32T'",
MYF(0), dollar_pos);
}
}
return xpath->item ? 1 : 0;
......@@ -2767,9 +2775,13 @@ bool Item_xml_str_func::fix_fields(THD *thd, Item **ref)
if (!rc)
{
uint clen= (uint)(xpath.query.end - xpath.lasttok.beg);
set_if_smaller(clen, 32);
my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%.*s'",
MYF(0), clen, xpath.lasttok.beg);
if (clen <= 32)
my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%.*s'",
MYF(0), clen, xpath.lasttok.beg);
else
my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%.32T'",
MYF(0), xpath.lasttok.beg);
return true;
}
......
......@@ -1197,30 +1197,30 @@ ER_TABLE_EXISTS_ERROR 42S01
swe "Tabellen '%-.192s' finns redan"
ukr "Таблиця '%-.192s' вже існує"
ER_BAD_TABLE_ERROR 42S02
cze "Neznámá tabulka '%-.100s'"
dan "Ukendt tabel '%-.100s'"
nla "Onbekende tabel '%-.100s'"
eng "Unknown table '%-.100s'"
est "Tundmatu tabel '%-.100s'"
fre "Table '%-.100s' inconnue"
ger "Unbekannte Tabelle '%-.100s'"
greek "Αγνωστος πίνακας '%-.100s'"
hindi "अज्ञात टेबल '%-.100s'"
hun "Ervenytelen tabla: '%-.100s'"
ita "Tabella '%-.100s' sconosciuta"
jpn "'%-.100s' は不明な表です。"
kor "테이블 '%-.100s'는 알수 없음"
nor "Ukjent tabell '%-.100s'"
norwegian-ny "Ukjent tabell '%-.100s'"
pol "Nieznana tabela '%-.100s'"
por "Tabela '%-.100s' desconhecida"
rum "Tabela '%-.100s' este invalida"
rus "Неизвестная таблица '%-.100s'"
serbian "Nepoznata tabela '%-.100s'"
slo "Neznáma tabuľka '%-.100s'"
spa "Tabla '%-.100s' desconocida"
swe "Okänd tabell '%-.100s'"
ukr "Невідома таблиця '%-.100s'"
cze "Neznámá tabulka '%-.100T'"
dan "Ukendt tabel '%-.100T'"
nla "Onbekende tabel '%-.100T'"
eng "Unknown table '%-.100T'"
est "Tundmatu tabel '%-.100T'"
fre "Table '%-.100T' inconnue"
ger "Unbekannte Tabelle '%-.100T'"
greek "Αγνωστος πίνακας '%-.100T'"
hindi "अज्ञात टेबल '%-.100T'"
hun "Ervenytelen tabla: '%-.100T'"
ita "Tabella '%-.100T' sconosciuta"
jpn "'%-.100T' は不明な表です。"
kor "테이블 '%-.100T'는 알수 없음"
nor "Ukjent tabell '%-.100T'"
norwegian-ny "Ukjent tabell '%-.100T'"
pol "Nieznana tabela '%-.100T'"
por "Tabela '%-.100T' desconhecida"
rum "Tabela '%-.100T' este invalida"
rus "Неизвестная таблица '%-.100T'"
serbian "Nepoznata tabela '%-.100T'"
slo "Neznáma tabuľka '%-.100T'"
spa "Tabla '%-.100T' desconocida"
swe "Okänd tabell '%-.100T'"
ukr "Невідома таблиця '%-.100T'"
ER_NON_UNIQ_ERROR 23000
cze "Sloupec '%-.192s' v %-.192s není zcela jasný"
dan "Felt: '%-.192s' i tabel %-.192s er ikke entydigt"
......@@ -1394,30 +1394,30 @@ ER_WRONG_VALUE_COUNT 21S01
swe "Antalet kolumner motsvarar inte antalet värden"
ukr "Кількість стовбців не співпадає з кількістю значень"
ER_TOO_LONG_IDENT 42000 S1009
cze "Jméno identifikátoru '%-.100s' je příliš dlouhé"
dan "Navnet '%-.100s' er for langt"
nla "Naam voor herkenning '%-.100s' is te lang"
eng "Identifier name '%-.100s' is too long"
est "Identifikaatori '%-.100s' nimi on liiga pikk"
fre "Le nom de l'identificateur '%-.100s' est trop long"
ger "Name des Bezeichners '%-.100s' ist zu lang"
greek "Το identifier name '%-.100s' είναι πολύ μεγάλο"
hindi "पहचानकर्ता का नाम '%-.100s' बहुत लंबा है"
hun "A(z) '%-.100s' azonositonev tul hosszu"
ita "Il nome dell'identificatore '%-.100s' e` troppo lungo"
jpn "識別子名 '%-.100s' は長すぎます。"
kor "Identifier '%-.100s'는 너무 길군요."
nor "Identifikator '%-.100s' er for lang"
norwegian-ny "Identifikator '%-.100s' er for lang"
pol "Nazwa identyfikatora '%-.100s' jest zbyt długa"
por "Nome identificador '%-.100s' é longo demais"
rum "Numele indentificatorului '%-.100s' este prea lung"
rus "Слишком длинный идентификатор '%-.100s'"
serbian "Ime '%-.100s' je predugačko"
slo "Meno identifikátora '%-.100s' je príliš dlhé"
spa "El nombre del identificador '%-.100s' es demasiado grande"
swe "Kolumnnamn '%-.100s' är för långt"
ukr "Ім'я ідентифікатора '%-.100s' задовге"
cze "Jméno identifikátoru '%-.100T' je příliš dlouhé"
dan "Navnet '%-.100T' er for langt"
nla "Naam voor herkenning '%-.100T' is te lang"
eng "Identifier name '%-.100T' is too long"
est "Identifikaatori '%-.100T' nimi on liiga pikk"
fre "Le nom de l'identificateur '%-.100T' est trop long"
ger "Name des Bezeichners '%-.100T' ist zu lang"
greek "Το identifier name '%-.100T' είναι πολύ μεγάλο"
hindi "पहचानकर्ता का नाम '%-.100T' बहुत लंबा है"
hun "A(z) '%-.100T' azonositonev tul hosszu"
ita "Il nome dell'identificatore '%-.100T' e` troppo lungo"
jpn "識別子名 '%-.100T' は長すぎます。"
kor "Identifier '%-.100T'는 너무 길군요."
nor "Identifikator '%-.100T' er for lang"
norwegian-ny "Identifikator '%-.100T' er for lang"
pol "Nazwa identyfikatora '%-.100T' jest zbyt długa"
por "Nome identificador '%-.100T' é longo demais"
rum "Numele indentificatorului '%-.100T' este prea lung"
rus "Слишком длинный идентификатор '%-.100T'"
serbian "Ime '%-.100T' je predugačko"
slo "Meno identifikátora '%-.100T' je príliš dlhé"
spa "El nombre del identificador '%-.100T' es demasiado grande"
swe "Kolumnnamn '%-.100T' är för långt"
ukr "Ім'я ідентифікатора '%-.100T' задовге"
ER_DUP_FIELDNAME 42S21 S1009
cze "Zdvojené jméno sloupce '%-.192s'"
dan "Feltnavnet '%-.192s' findes allerede"
......@@ -1471,30 +1471,30 @@ ER_DUP_KEYNAME 42000 S1009
# When using this error code, please use ER(ER_DUP_ENTRY_WITH_KEY_NAME)
# for the message string. See, for example, code in handler.cc.
ER_DUP_ENTRY 23000 S1009
cze "Zdvojený klíč '%-.192s' (číslo klíče %d)"
dan "Ens værdier '%-.192s' for indeks %d"
nla "Dubbele ingang '%-.192s' voor zoeksleutel %d"
eng "Duplicate entry '%-.192s' for key %d"
est "Kattuv väärtus '%-.192s' võtmele %d"
fre "Duplicata du champ '%-.192s' pour la clef %d"
ger "Doppelter Eintrag '%-.192s' für Schlüssel %d"
greek "Διπλή εγγραφή '%-.192s' για το κλειδί %d"
hindi "सामान प्रवेश '%-.192s' KEY %d के लिए"
hun "Duplikalt bejegyzes '%-.192s' a %d kulcs szerint"
ita "Valore duplicato '%-.192s' per la chiave %d"
jpn "'%-.192s' は索引 %d で重複しています。"
kor "중복된 입력 값 '%-.192s': key %d"
nor "Like verdier '%-.192s' for nøkkel %d"
norwegian-ny "Like verdiar '%-.192s' for nykkel %d"
pol "Powtórzone wystąpienie '%-.192s' dla klucza %d"
por "Entrada '%-.192s' duplicada para a chave %d"
rum "Cimpul '%-.192s' e duplicat pentru cheia %d"
rus "Дублирующаяся запись '%-.192s' по ключу %d"
serbian "Dupliran unos '%-.192s' za ključ '%d'"
slo "Opakovaný kľúč '%-.192s' (číslo kľúča %d)"
spa "Entrada duplicada '%-.192s' para la clave %d"
swe "Dublett '%-.192s' för nyckel %d"
ukr "Дублюючий запис '%-.192s' для ключа %d"
cze "Zdvojený klíč '%-.192T' (číslo klíče %d)"
dan "Ens værdier '%-.192T' for indeks %d"
nla "Dubbele ingang '%-.192T' voor zoeksleutel %d"
eng "Duplicate entry '%-.192T' for key %d"
est "Kattuv väärtus '%-.192T' võtmele %d"
fre "Duplicata du champ '%-.192T' pour la clef %d"
ger "Doppelter Eintrag '%-.192T' für Schlüssel %d"
greek "Διπλή εγγραφή '%-.192T' για το κλειδί %d"
hindi "सामान प्रवेश '%-.192T' KEY %d के लिए"
hun "Duplikalt bejegyzes '%-.192T' a %d kulcs szerint"
ita "Valore duplicato '%-.192T' per la chiave %d"
jpn "'%-.192T' は索引 %d で重複しています。"
kor "중복된 입력 값 '%-.192T': key %d"
nor "Like verdier '%-.192T' for nøkkel %d"
norwegian-ny "Like verdiar '%-.192T' for nykkel %d"
pol "Powtórzone wystąpienie '%-.192T' dla klucza %d"
por "Entrada '%-.192T' duplicada para a chave %d"
rum "Cimpul '%-.192T' e duplicat pentru cheia %d"
rus "Дублирующаяся запись '%-.192T' по ключу %d"
serbian "Dupliran unos '%-.192T' za ključ '%d'"
slo "Opakovaný kľúč '%-.192T' (číslo kľúča %d)"
spa "Entrada duplicada '%-.192T' para la clave %d"
swe "Dublett '%-.192T' för nyckel %d"
ukr "Дублюючий запис '%-.192T' для ключа %d"
ER_WRONG_FIELD_SPEC 42000 S1009
cze "Chybná specifikace sloupce '%-.192s'"
dan "Forkert kolonnespecifikaton for felt '%-.192s'"
......@@ -1521,30 +1521,30 @@ ER_WRONG_FIELD_SPEC 42000 S1009
swe "Felaktigt kolumntyp för kolumn '%-.192s'"
ukr "Невірний специфікатор стовбця '%-.192s'"
ER_PARSE_ERROR 42000 s1009
cze "%s blízko '%-.80s' na řádku %d"
dan "%s nær '%-.80s' på linje %d"
nla "%s bij '%-.80s' in regel %d"
eng "%s near '%-.80s' at line %d"
est "%s '%-.80s' ligidal real %d"
fre "%s près de '%-.80s' à la ligne %d"
ger "%s bei '%-.80s' in Zeile %d"
greek "%s πλησίον '%-.80s' στη γραμμή %d"
hindi "%s के पास '%-.80s' लाइन %d में"
hun "A %s a '%-.80s'-hez kozeli a %d sorban"
ita "%s vicino a '%-.80s' linea %d"
jpn "%s : '%-.80s' 付近 %d 行目"
kor "'%s' 에러 같읍니다. ('%-.80s' 명령어 라인 %d)"
nor "%s nær '%-.80s' på linje %d"
norwegian-ny "%s attmed '%-.80s' på line %d"
pol "%s obok '%-.80s' w linii %d"
por "%s próximo a '%-.80s' na linha %d"
rum "%s linga '%-.80s' pe linia %d"
rus "%s около '%-.80s' на строке %d"
serbian "'%s' u iskazu '%-.80s' na liniji %d"
slo "%s blízko '%-.80s' na riadku %d"
spa "%s cerca '%-.80s' en la linea %d"
swe "%s nära '%-.80s' på rad %d"
ukr "%s біля '%-.80s' в строці %d"
cze "%s blízko '%-.80T' na řádku %d"
dan "%s nær '%-.80T' på linje %d"
nla "%s bij '%-.80T' in regel %d"
eng "%s near '%-.80T' at line %d"
est "%s '%-.80T' ligidal real %d"
fre "%s près de '%-.80T' à la ligne %d"
ger "%s bei '%-.80T' in Zeile %d"
greek "%s πλησίον '%-.80T' στη γραμμή %d"
hindi "%s के पास '%-.80T' लाइन %d में"
hun "A %s a '%-.80T'-hez kozeli a %d sorban"
ita "%s vicino a '%-.80T' linea %d"
jpn "%s : '%-.80T' 付近 %d 行目"
kor "'%s' 에러 같읍니다. ('%-.80T' 명령어 라인 %d)"
nor "%s nær '%-.80T' på linje %d"
norwegian-ny "%s attmed '%-.80T' på line %d"
pol "%s obok '%-.80T' w linii %d"
por "%s próximo a '%-.80T' na linha %d"
rum "%s linga '%-.80T' pe linia %d"
rus "%s около '%-.80T' на строке %d"
serbian "'%s' u iskazu '%-.80T' na liniji %d"
slo "%s blízko '%-.80T' na riadku %d"
spa "%s cerca '%-.80T' en la linea %d"
swe "%s nära '%-.80T' på rad %d"
ukr "%s біля '%-.80T' в строці %d"
ER_EMPTY_QUERY 42000
cze "Výsledek dotazu je prázdný"
dan "Forespørgsel var tom"
......@@ -2380,30 +2380,30 @@ ER_TABLE_NOT_LOCKED
ER_UNUSED_17
eng "You should never see it"
ER_WRONG_DB_NAME 42000
cze "Nepřípustné jméno databáze '%-.100s'"
dan "Ugyldigt database navn '%-.100s'"
nla "Databasenaam '%-.100s' is niet getoegestaan"
eng "Incorrect database name '%-.100s'"
est "Vigane andmebaasi nimi '%-.100s'"
fre "Nom de base de donnée illégal: '%-.100s'"
ger "Unerlaubter Datenbankname '%-.100s'"
greek "Λάθος όνομα βάσης δεδομένων '%-.100s'"
hindi "डेटाबेस नाम '%-.100s' गलत है"
hun "Hibas adatbazisnev: '%-.100s'"
ita "Nome database errato '%-.100s'"
jpn "データベース名 '%-.100s' は不正です。"
kor "'%-.100s' 데이타베이스의 이름이 부정확합니다."
nor "Ugyldig database navn '%-.100s'"
norwegian-ny "Ugyldig database namn '%-.100s'"
pol "Niedozwolona nazwa bazy danych '%-.100s'"
por "Nome de banco de dados '%-.100s' incorreto"
rum "Numele bazei de date este incorect '%-.100s'"
rus "Некорректное имя базы данных '%-.100s'"
serbian "Pogrešno ime baze '%-.100s'"
slo "Neprípustné meno databázy '%-.100s'"
spa "Nombre de base de datos ilegal '%-.100s'"
swe "Felaktigt databasnamn '%-.100s'"
ukr "Невірне ім'я бази данних '%-.100s'"
cze "Nepřípustné jméno databáze '%-.100T'"
dan "Ugyldigt database navn '%-.100T'"
nla "Databasenaam '%-.100T' is niet getoegestaan"
eng "Incorrect database name '%-.100T'"
est "Vigane andmebaasi nimi '%-.100T'"
fre "Nom de base de donnée illégal: '%-.100T'"
ger "Unerlaubter Datenbankname '%-.100T'"
greek "Λάθος όνομα βάσης δεδομένων '%-.100T'"
hindi "डेटाबेस नाम '%-.100T' गलत है"
hun "Hibas adatbazisnev: '%-.100T'"
ita "Nome database errato '%-.100T'"
jpn "データベース名 '%-.100T' は不正です。"
kor "'%-.100T' 데이타베이스의 이름이 부정확합니다."
nor "Ugyldig database navn '%-.100T'"
norwegian-ny "Ugyldig database namn '%-.100T'"
pol "Niedozwolona nazwa bazy danych '%-.100T'"
por "Nome de banco de dados '%-.100T' incorreto"
rum "Numele bazei de date este incorect '%-.100T'"
rus "Некорректное имя базы данных '%-.100T'"
serbian "Pogrešno ime baze '%-.100T'"
slo "Neprípustné meno databázy '%-.100T'"
spa "Nombre de base de datos ilegal '%-.100T'"
swe "Felaktigt databasnamn '%-.100T'"
ukr "Невірне ім'я бази данних '%-.100T'"
ER_WRONG_TABLE_NAME 42000
cze "Nepřípustné jméno tabulky '%-.100s'"
dan "Ugyldigt tabel navn '%-.100s'"
......@@ -4688,15 +4688,15 @@ ER_NO_DEFAULT 42000
spa "Variable '%-.64s' no tiene un valor patrón"
swe "Variabel '%-.64s' har inte ett DEFAULT-värde"
ER_WRONG_VALUE_FOR_VAR 42000
nla "Variabele '%-.64s' kan niet worden gewijzigd naar de waarde '%-.200s'"
eng "Variable '%-.64s' can't be set to the value of '%-.200s'"
ger "Variable '%-.64s' kann nicht auf '%-.200s' gesetzt werden"
ita "Alla variabile '%-.64s' non puo' essere assegato il valore '%-.200s'"
jpn "変数 '%-.64s' に値 '%-.200s' を設定できません。"
por "Variável '%-.64s' não pode ser configurada para o valor de '%-.200s'"
rus "Переменная '%-.64s' не может быть установлена в значение '%-.200s'"
spa "Variable '%-.64s' no puede ser configurada para el valor de '%-.200s'"
swe "Variabel '%-.64s' kan inte sättas till '%-.200s'"
nla "Variabele '%-.64s' kan niet worden gewijzigd naar de waarde '%-.200T'"
eng "Variable '%-.64s' can't be set to the value of '%-.200T'"
ger "Variable '%-.64s' kann nicht auf '%-.200T' gesetzt werden"
ita "Alla variabile '%-.64s' non puo' essere assegato il valore '%-.200T'"
jpn "変数 '%-.64s' に値 '%-.200T' を設定できません。"
por "Variável '%-.64s' não pode ser configurada para o valor de '%-.200T'"
rus "Переменная '%-.64s' не может быть установлена в значение '%-.200T'"
spa "Variable '%-.64s' no puede ser configurada para el valor de '%-.200T'"
swe "Variabel '%-.64s' kan inte sättas till '%-.200T'"
ER_WRONG_TYPE_FOR_VAR 42000
nla "Foutief argumenttype voor variabele '%-.64s'"
eng "Incorrect argument type to variable '%-.64s'"
......@@ -5140,11 +5140,11 @@ ER_DUPLICATED_VALUE_IN_TYPE
por "Coluna '%-.100s' tem valor duplicado '%-.64s' em %s"
spa "Columna '%-.100s' tiene valor doblado '%-.64s' en %s"
ER_TRUNCATED_WRONG_VALUE 22007
eng "Truncated incorrect %-.32s value: '%-.128s'"
ger "Falscher %-.32s-Wert gekürzt: '%-.128s'"
jpn "不正な %-.32s の値が切り捨てられました。: '%-.128s'"
por "Truncado errado %-.32s valor: '%-.128s'"
spa "Equivocado truncado %-.32s valor: '%-.128s'"
eng "Truncated incorrect %-.32T value: '%-.128T'"
ger "Falscher %-.32T-Wert gekürzt: '%-.128T'"
jpn "不正な %-.32T の値が切り捨てられました。: '%-.128T'"
por "Truncado errado %-.32T valor: '%-.128T'"
spa "Equivocado truncado %-.32T valor: '%-.128T'"
ER_TOO_MUCH_AUTO_TIMESTAMP_COLS
eng "Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause"
ger "Fehlerhafte Tabellendefinition. Es kann nur eine einzige TIMESTAMP-Spalte mit CURRENT_TIMESTAMP als DEFAULT oder in einer ON-UPDATE-Klausel geben"
......@@ -5181,8 +5181,8 @@ ER_WARN_INVALID_TIMESTAMP
eng "Invalid TIMESTAMP value in column '%s' at row %lu"
ger "Ungültiger TIMESTAMP-Wert in Feld '%s', Zeile %lu"
ER_INVALID_CHARACTER_STRING
eng "Invalid %s character string: '%.64s'"
ger "Ungültiger %s-Zeichen-String: '%.64s'"
eng "Invalid %s character string: '%.64T'"
ger "Ungültiger %s-Zeichen-String: '%.64T'"
ER_WARN_ALLOWED_PACKET_OVERFLOWED
eng "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
ger "Ergebnis von %s() war größer als max_allowed_packet (%ld) Bytes und wurde deshalb gekürzt"
......@@ -5426,11 +5426,11 @@ ER_DIVISION_BY_ZERO 22012
ger "Division durch 0"
hindi "0 से विभाजन"
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 22007
eng "Incorrect %-.32s value: '%-.128s' for column `%.192s`.`%.192s`.`%.192s` at row %lu"
ger "Falscher %-.32s-Wert: '%-.128s' für Feld '`%.192s`.`%.192s`.`%.192s` in Zeile %lu"
eng "Incorrect %-.32s value: '%-.128T' for column `%.192s`.`%.192s`.`%.192s` at row %lu"
ger "Falscher %-.32s-Wert: '%-.128T' für Feld '`%.192s`.`%.192s`.`%.192s` in Zeile %lu"
ER_ILLEGAL_VALUE_FOR_TYPE 22007
eng "Illegal %s '%-.192s' value found during parsing"
ger "Nicht zulässiger %s-Wert '%-.192s' beim Parsen gefunden"
eng "Illegal %s '%-.192T' value found during parsing"
ger "Nicht zulässiger %s-Wert '%-.192T' beim Parsen gefunden"
ER_VIEW_NONUPD_CHECK
eng "CHECK OPTION on non-updatable view %`-.192s.%`-.192s"
ger "CHECK OPTION auf nicht-aktualisierbarem View %`-.192s.%`-.192s"
......@@ -5576,8 +5576,8 @@ ER_CANT_CREATE_USER_WITH_GRANT 42000
eng "You are not allowed to create a user with GRANT"
ger "Sie dürfen keinen Benutzer mit GRANT anlegen"
ER_WRONG_VALUE_FOR_TYPE
eng "Incorrect %-.32s value: '%-.128s' for function %-.32s"
ger "Falscher %-.32s-Wert: '%-.128s' für Funktion %-.32s"
eng "Incorrect %-.32s value: '%-.128T' for function %-.32s"
ger "Falscher %-.32s-Wert: '%-.128T' für Funktion %-.32s"
ER_TABLE_DEF_CHANGED
eng "Table definition has changed, please retry transaction"
ger "Tabellendefinition wurde geändert, bitte starten Sie die Transaktion neu"
......@@ -5756,8 +5756,8 @@ ER_HOSTNAME
ger "Hostname"
hindi "होस्ट का नाम"
ER_WRONG_STRING_LENGTH
eng "String '%-.70s' is too long for %s (should be no longer than %d)"
ger "String '%-.70s' ist zu lang für %s (sollte nicht länger sein als %d)"
eng "String '%-.70T' is too long for %s (should be no longer than %d)"
ger "String '%-.70T' ist zu lang für %s (sollte nicht länger sein als %d)"
ER_NON_INSERTABLE_TABLE
eng "The target table %-.100s of the %s is not insertable-into"
ger "Die Zieltabelle %-.100s von %s ist nicht einfügbar"
......@@ -5964,8 +5964,8 @@ ER_PLUGIN_IS_NOT_LOADED
eng "Plugin '%-.192s' is not loaded"
ger "Plugin '%-.192s' ist nicht geladen"
ER_WRONG_VALUE
eng "Incorrect %-.32s value: '%-.128s'"
ger "Falscher %-.32s-Wert: '%-.128s'"
eng "Incorrect %-.32s value: '%-.128T'"
ger "Falscher %-.32s-Wert: '%-.128T'"
ER_NO_PARTITION_FOR_GIVEN_VALUE
eng "Table has no partition for value %-.64s"
ger "Tabelle hat für den Wert %-.64s keine Partition"
......@@ -6108,8 +6108,8 @@ ER_WRONG_PARTITION_NAME
ER_CANT_CHANGE_TX_CHARACTERISTICS 25001
eng "Transaction characteristics can't be changed while a transaction is in progress"
ER_DUP_ENTRY_AUTOINCREMENT_CASE
eng "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '%-.192s' for key '%-.192s'"
ger "ALTER TABLE führt zur Neusequenzierung von auto_increment, wodurch der doppelte Eintrag '%-.192s' für Schlüssel '%-.192s' auftritt"
eng "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '%-.192T' for key '%-.192s'"
ger "ALTER TABLE führt zur Neusequenzierung von auto_increment, wodurch der doppelte Eintrag '%-.192T' für Schlüssel '%-.192s' auftritt"
ER_EVENT_MODIFY_QUEUE_ERROR
eng "Internal scheduler error %d"
ger "Interner Scheduler-Fehler %d"
......@@ -6164,29 +6164,29 @@ ER_NATIVE_FCT_NAME_COLLISION
# When using this error message, use the ER_DUP_ENTRY error code. See, for
# example, code in handler.cc.
ER_DUP_ENTRY_WITH_KEY_NAME 23000 S1009
cze "Zvojený klíč '%-.64s' (číslo klíče '%-.192s')"
dan "Ens værdier '%-.64s' for indeks '%-.192s'"
nla "Dubbele ingang '%-.64s' voor zoeksleutel '%-.192s'"
eng "Duplicate entry '%-.64s' for key '%-.192s'"
est "Kattuv väärtus '%-.64s' võtmele '%-.192s'"
fre "Duplicata du champ '%-.64s' pour la clef '%-.192s'"
ger "Doppelter Eintrag '%-.64s' für Schlüssel '%-.192s'"
greek "Διπλή εγγραφή '%-.64s' για το κλειδί '%-.192s'"
hun "Duplikalt bejegyzes '%-.64s' a '%-.192s' kulcs szerint"
ita "Valore duplicato '%-.64s' per la chiave '%-.192s'"
jpn "'%-.64s' は索引 '%-.192s' で重複しています。"
kor "중복된 입력 값 '%-.64s': key '%-.192s'"
nor "Like verdier '%-.64s' for nøkkel '%-.192s'"
norwegian-ny "Like verdiar '%-.64s' for nykkel '%-.192s'"
pol "Powtórzone wystąpienie '%-.64s' dla klucza '%-.192s'"
por "Entrada '%-.64s' duplicada para a chave '%-.192s'"
rum "Cimpul '%-.64s' e duplicat pentru cheia '%-.192s'"
rus "Дублирующаяся запись '%-.64s' по ключу '%-.192s'"
serbian "Dupliran unos '%-.64s' za ključ '%-.192s'"
slo "Opakovaný kľúč '%-.64s' (číslo kľúča '%-.192s')"
spa "Entrada duplicada '%-.64s' para la clave '%-.192s'"
swe "Dublett '%-.64s' för nyckel '%-.192s'"
ukr "Дублюючий запис '%-.64s' для ключа '%-.192s'"
cze "Zvojený klíč '%-.64T' (číslo klíče '%-.192s')"
dan "Ens værdier '%-.64T' for indeks '%-.192s'"
nla "Dubbele ingang '%-.64T' voor zoeksleutel '%-.192s'"
eng "Duplicate entry '%-.64T' for key '%-.192s'"
est "Kattuv väärtus '%-.64T' võtmele '%-.192s'"
fre "Duplicata du champ '%-.64T' pour la clef '%-.192s'"
ger "Doppelter Eintrag '%-.64T' für Schlüssel '%-.192s'"
greek "Διπλή εγγραφή '%-.64T' για το κλειδί '%-.192s'"
hun "Duplikalt bejegyzes '%-.64T' a '%-.192s' kulcs szerint"
ita "Valore duplicato '%-.64T' per la chiave '%-.192s'"
jpn "'%-.64T' は索引 '%-.192s' で重複しています。"
kor "중복된 입력 값 '%-.64T': key '%-.192s'"
nor "Like verdier '%-.64T' for nøkkel '%-.192s'"
norwegian-ny "Like verdiar '%-.64T' for nykkel '%-.192s'"
pol "Powtórzone wystąpienie '%-.64T' dla klucza '%-.192s'"
por "Entrada '%-.64T' duplicada para a chave '%-.192s'"
rum "Cimpul '%-.64T' e duplicat pentru cheia '%-.192s'"
rus "Дублирующаяся запись '%-.64T' по ключу '%-.192s'"
serbian "Dupliran unos '%-.64T' za ključ '%-.192s'"
slo "Opakovaný kľúč '%-.64T' (číslo kľúča '%-.192s')"
spa "Entrada duplicada '%-.64T' para la clave '%-.192s'"
swe "Dublett '%-.64T' för nyckel '%-.192s'"
ukr "Дублюючий запис '%-.64T' для ключа '%-.192s'"
ER_BINLOG_PURGE_EMFILE
eng "Too many files opened, please execute the command again"
ger "Zu viele offene Dateien, bitte führen Sie den Befehl noch einmal aus"
......@@ -6467,8 +6467,8 @@ ER_SLAVE_CANT_CREATE_CONVERSION
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
eng "Cannot modify @@session.binlog_format inside a transaction"
ER_PATH_LENGTH
eng "The path specified for %.64s is too long"
hindi "%.64s के लिए निर्दिष्ट पथ बहुत लंबा है"
eng "The path specified for %.64T is too long"
hindi "%.64T के लिए निर्दिष्ट पथ बहुत लंबा है"
ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT
eng "'%s' is deprecated and will be removed in a future release"
ger "'%s' ist veraltet und wird in einer zukünftigen Version entfernt werden"
......@@ -6573,7 +6573,7 @@ ER_MULTI_UPDATE_KEY_CONFLICT
# When translating this error message make sure to include "ALTER TABLE" in the
# message as mysqlcheck parses the error message looking for ALTER TABLE.
ER_TABLE_NEEDS_REBUILD
eng "Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!"
eng "Table rebuild required. Please do \"ALTER TABLE `%-.32T` FORCE\" or dump/reload to fix it!"
WARN_OPTION_BELOW_LIMIT
eng "The value of '%s' should be no less than the value of '%s'"
......@@ -7166,8 +7166,8 @@ ER_UNKNOWN_OPTION
eng "Unknown option '%-.64s'"
hindi "अज्ञात विकल्प '%-.64s'"
ER_BAD_OPTION_VALUE
eng "Incorrect value '%-.64s' for option '%-.64s'"
hindi "गलत मान '%-.64s' विकल्प '%-.64s' के लिए"
eng "Incorrect value '%-.64T' for option '%-.64s'"
hindi "गलत मान '%-.64T' विकल्प '%-.64s' के लिए"
ER_UNUSED_6
eng "You should never see it"
ER_UNUSED_7
......@@ -7324,8 +7324,8 @@ ER_ROLE_DROP_EXISTS
ER_CANNOT_CONVERT_CHARACTER
eng "Cannot convert '%s' character 0x%-.64s to '%s'"
ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007
eng "Incorrect default value '%-.128s' for column '%.192s'"
hindi "गलत डिफ़ॉल्ट मान '%-.128s' कॉलम '%.192s' के लिए"
eng "Incorrect default value '%-.128T' for column '%.192s'"
hindi "गलत डिफ़ॉल्ट मान '%-.128T' कॉलम '%.192s' के लिए"
ER_KILL_QUERY_DENIED_ERROR
eng "You are not owner of query %lu"
ger "Sie sind nicht Eigentümer von Abfrage %lu"
......
......@@ -224,7 +224,8 @@ static char *backtick_string(CHARSET_INFO *cs, char *to, const char *end,
*/
static char *process_str_arg(CHARSET_INFO *cs, char *to, const char *end,
size_t width, char *par, uint print_type)
size_t width, char *par, uint print_type,
my_bool nice_cut)
{
int well_formed_error;
uint dots= 0;
......@@ -232,24 +233,34 @@ static char *process_str_arg(CHARSET_INFO *cs, char *to, const char *end,
if (!par)
par = (char*) "(null)";
plen= slen= strnlen(par, width + 1);
if (plen > width)
plen= width;
if (left_len <= plen)
plen = left_len - 1;
if ((slen > plen))
if (nice_cut)
{
if (plen < 3)
plen= slen= strnlen(par, width + 1);
if (plen > width)
plen= width;
if (left_len <= plen)
plen = left_len - 1;
if ((slen > plen))
{
dots= (uint) plen;
plen= 0;
}
else
{
dots= 3;
plen-= 3;
if (plen < 3)
{
dots= (uint) plen;
plen= 0;
}
else
{
dots= 3;
plen-= 3;
}
}
}
else
{
plen= slen= strnlen(par, width);
dots= 0;
if (left_len <= plen)
plen = left_len - 1;
}
plen= my_well_formed_length(cs, par, par + plen, width, &well_formed_error);
if (print_type & ESCAPED_ARG)
......@@ -446,6 +457,7 @@ static char *process_args(CHARSET_INFO *cs, char *to, char *end,
switch (args_arr[i].arg_type) {
case 's':
case 'b':
case 'T':
args_arr[i].str_arg= va_arg(ap, char *);
break;
case 'f':
......@@ -480,12 +492,14 @@ static char *process_args(CHARSET_INFO *cs, char *to, char *end,
size_t width= 0, length= 0;
switch (print_arr[i].arg_type) {
case 's':
case 'T':
{
char *par= args_arr[print_arr[i].arg_idx].str_arg;
width= (print_arr[i].flags & WIDTH_ARG)
? (size_t)args_arr[print_arr[i].width].longlong_arg
: print_arr[i].width;
to= process_str_arg(cs, to, end, width, par, print_arr[i].flags);
to= process_str_arg(cs, to, end, width, par, print_arr[i].flags,
(print_arr[i].arg_type == 'T'));
break;
}
case 'b':
......@@ -552,7 +566,7 @@ static char *process_args(CHARSET_INFO *cs, char *to, char *end,
*to++= '"';
my_strerror(errmsg_buff, sizeof(errmsg_buff), (int) larg);
to= process_str_arg(cs, to, real_end, width, errmsg_buff,
print_arr[i].flags);
print_arr[i].flags, 1);
if (real_end > to) *to++= '"';
}
break;
......@@ -676,10 +690,10 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
fmt= check_longlong(fmt, &have_longlong);
if (*fmt == 's') /* String parameter */
if (*fmt == 's' || *fmt == 'T') /* String parameter */
{
reg2 char *par= va_arg(ap, char *);
to= process_str_arg(cs, to, end, width, par, print_type);
to= process_str_arg(cs, to, end, width, par, print_type, (*fmt == 'T'));
continue;
}
else if (*fmt == 'b') /* Buffer parameter */
......@@ -731,7 +745,8 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
*to++= ' ';
*to++= '"';
my_strerror(errmsg_buff, sizeof(errmsg_buff), (int) larg);
to= process_str_arg(cs, to, real_end, width, errmsg_buff, print_type);
to= process_str_arg(cs, to, real_end, width, errmsg_buff,
print_type, 1);
if (real_end > to) *to++= '"';
}
continue;
......
......@@ -61,7 +61,7 @@ static void test_many(const char **res, const char *fmt, ...)
int main(void)
{
plan(43);
plan(47);
test1("Constant string",
"Constant string");
......@@ -99,27 +99,33 @@ int main(void)
test1("Width is ignored for strings <x> <y>",
"Width is ignored for strings <%04s> <%5s>", "x", "y");
test1("Precision works for strings <ab...>",
test1("Precision works for strings <abcde>",
"Precision works for strings <%.5s>", "abcdef!");
test1("Precision works for strings <ab...>",
"Precision works for strings <%.5T>", "abcdef!");
test1("Flag '`' (backtick) works: `abcd` `op``q` (mysql extension)",
"Flag '`' (backtick) works: %`s %`.4s (mysql extension)",
"abcd", "op`qrst");
test1("Flag '`' (backtick) works: `abcd` `op``q...` (mysql extension)",
"Flag '`' (backtick) works: %`s %`.7s (mysql extension)",
"Flag '`' (backtick) works: %`T %`.7T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Flag '`' (backtick) works: `abcd` `.` (mysql extension)",
"Flag '`' (backtick) works: %`s %`.1s (mysql extension)",
"Flag '`' (backtick) works: %`T %`.1T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Flag '`' (backtick) works: `abcd` `...` (mysql extension)",
"Flag '`' (backtick) works: %`s %`.3s (mysql extension)",
"Flag '`' (backtick) works: %`T %`.3T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Flag '`' (backtick) works: `abcd` `op...` (mysql extension)",
"Flag '`' (backtick) works: %`s %`.5s (mysql extension)",
"Flag '`' (backtick) works: %`T %`.5T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Flag '`' (backtick) works: `abcd` `op``...` (mysql extension)",
"Flag '`' (backtick) works: %`s %`.6s (mysql extension)",
"Flag '`' (backtick) works: %`T %`.6T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Length modifiers work: 1 * -1 * 2 * 3",
......@@ -141,15 +147,21 @@ int main(void)
test1("Asterisk '*' as a width works: < 4>",
"Asterisk '*' as a width works: <%*d>", 5, 4);
test1("Asterisk '*' as a precision works: <qwe...>",
test1("Asterisk '*' as a precision works: <qwerty>",
"Asterisk '*' as a precision works: <%.*s>", 6, "qwertyuiop");
test1("Asterisk '*' as a precision works: <qwe...>",
"Asterisk '*' as a precision works: <%.*T>", 6, "qwertyuiop");
test1("Positional arguments for a width: < 4>",
"Positional arguments for a width: <%1$*2$d>", 4, 5);
test1("Positional arguments for a precision: <qwe...>",
test1("Positional arguments for a precision: <qwerty>",
"Positional arguments for a precision: <%1$.*2$s>", "qwertyuiop", 6);
test1("Positional arguments for a precision: <qwe...>",
"Positional arguments for a precision: <%1$.*2$T>", "qwertyuiop", 6);
test1("Positional arguments and a width: <0000ab>",
"Positional arguments and a width: <%1$06x>", 0xab);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment