diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-04-20 09:49:44 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-04-20 09:59:52 +0300 |
commit | 2b919118c2511c7741c21f325d2ca4f270aa3aba (patch) | |
tree | 80ede9f7aba529453f3b7bfba703989c29574e1d /src | |
parent | 7228d02989afd3858ce6eb4de845c56f4c0188a6 (diff) | |
download | postgresql-2b919118c2511c7741c21f325d2ca4f270aa3aba.tar.gz postgresql-2b919118c2511c7741c21f325d2ca4f270aa3aba.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/initdb/initdb.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index f4241128902..d26ff63e1db 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1165,9 +1165,9 @@ bootstrap_template1(void) bki_lines = replace_token(bki_lines, "ENCODING", encodingid); - bki_lines = replace_token(bki_lines, "LC_COLLATE", lc_collate); + bki_lines = replace_token(bki_lines, "LC_COLLATE", escape_quotes(lc_collate)); - bki_lines = replace_token(bki_lines, "LC_CTYPE", lc_ctype); + bki_lines = replace_token(bki_lines, "LC_CTYPE", escape_quotes(lc_ctype)); /* * Pass correct LC_xxx environment to bootstrap. @@ -2276,8 +2276,8 @@ strreplace(char *str, char *needle, char *replacement) #endif /* WIN32 */ /* - * Windows has a problem with locale names that have a dot or apostrophe in - * the country name. For example: + * Windows has a problem with locale names that have a dot in the country + * name. For example: * * "Chinese (Traditional)_Hong Kong S.A.R..950" * @@ -2295,15 +2295,15 @@ localemap(char *locale) #ifdef WIN32 /* - * Map the full country name to an abbreviation that setlocale() accepts - * "China" and "HKG" are listed here: + * Map the full country name to an abbreviation that setlocale() accepts. + * + * "HKG" is listed here: * http://msdn.microsoft.com/en-us/library/cdax410z%28v=vs.71%29.aspx * (Country/Region Strings). * * "ARE" is the ISO-3166 three-letter code for U.A.E. It is not on the * above list, but seems to work anyway. */ - strreplace(locale, "People's Republic of China", "China"); strreplace(locale, "Hong Kong S.A.R.", "HKG"); strreplace(locale, "U.A.E.", "ARE"); |