Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2b91911

Browse files
committed
Quotes in strings injected into bki file need to escaped. In particular,
"People's Republic of China" locale on Windows was causing initdb to fail. This fixes bug #5818 reported by yulei. On master, this makes the mapping of "People's Republic of China" to just "China" obsolete. In 9.0 and 8.4, just fix the escaping. Earlier versions didn't have locale names in bki file.
1 parent 7228d02 commit 2b91911

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/bin/initdb/initdb.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -1165,9 +1165,9 @@ bootstrap_template1(void)
11651165

11661166
bki_lines = replace_token(bki_lines, "ENCODING", encodingid);
11671167

1168-
bki_lines = replace_token(bki_lines, "LC_COLLATE", lc_collate);
1168+
bki_lines = replace_token(bki_lines, "LC_COLLATE", escape_quotes(lc_collate));
11691169

1170-
bki_lines = replace_token(bki_lines, "LC_CTYPE", lc_ctype);
1170+
bki_lines = replace_token(bki_lines, "LC_CTYPE", escape_quotes(lc_ctype));
11711171

11721172
/*
11731173
* Pass correct LC_xxx environment to bootstrap.
@@ -2276,8 +2276,8 @@ strreplace(char *str, char *needle, char *replacement)
22762276
#endif /* WIN32 */
22772277

22782278
/*
2279-
* Windows has a problem with locale names that have a dot or apostrophe in
2280-
* the country name. For example:
2279+
* Windows has a problem with locale names that have a dot in the country
2280+
* name. For example:
22812281
*
22822282
* "Chinese (Traditional)_Hong Kong S.A.R..950"
22832283
*
@@ -2295,15 +2295,15 @@ localemap(char *locale)
22952295

22962296
#ifdef WIN32
22972297
/*
2298-
* Map the full country name to an abbreviation that setlocale() accepts
2299-
* "China" and "HKG" are listed here:
2298+
* Map the full country name to an abbreviation that setlocale() accepts.
2299+
*
2300+
* "HKG" is listed here:
23002301
* http://msdn.microsoft.com/en-us/library/cdax410z%28v=vs.71%29.aspx
23012302
* (Country/Region Strings).
23022303
*
23032304
* "ARE" is the ISO-3166 three-letter code for U.A.E. It is not on the
23042305
* above list, but seems to work anyway.
23052306
*/
2306-
strreplace(locale, "People's Republic of China", "China");
23072307
strreplace(locale, "Hong Kong S.A.R.", "HKG");
23082308
strreplace(locale, "U.A.E.", "ARE");
23092309

0 commit comments

Comments
 (0)