On Mon, Aug 5, 2024 at 8:50 PM Sandeep Thakkar <sandeep.thakkar@xxxxxxxxxxxxxxxx> wrote: > This issue is seen only on v16 and not the back branches (tested on 15 and 14) and also confirmed by @Ertan Küçükoglu at https://github.com/EnterpriseDB/edb-installers/issues/127#issuecomment-2268371442 Does that mean you can reproduce the problem with initdb.exe directly in a shell? That is, remove the EDB installer from the picture and compare v15 and v16 with the exact command line options that initcluster.vbs is using, or perhaps just: initdb.exe --locale="Turkish,Türkiye" --encoding=UTF-8 -D pgdata . o O (Why does that locale name have a comma?) If v15 works and v16 breaks, perhaps you could try comparing the output with the attached patch? It will give a hex dump of the contents of the locale name at various points in the program, to see if/where it was corrupted, which might also be a bit less confusing than looking at script output via email (I don't even know how many onion layers of transcoding are involved...)
From b97fe5a55e50a447d41a439412922ffe3f7e168b Mon Sep 17 00:00:00 2001 From: Thomas Munro <thomas.munro@xxxxxxxxx> Date: Tue, 6 Aug 2024 16:06:29 +1200 Subject: [PATCH 1/3] xxx debug --- src/bin/initdb/initdb.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 458dc1137a3..abe5983ab16 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -336,6 +336,33 @@ do { \ output_failed = true, output_errno = errno; \ } while (0) +static void +xxx_debug(const char *prefix, const char *s) +{ + const unsigned char *us; + + if (s == NULL) + { + printf("XXX debug: %s = NULL\n", prefix); + return; + } + + printf("XXX debug raw: %s = \"%s\"\n", prefix, s); + printf("XXX debug hex: %s = { ", prefix); + for (us = (const unsigned char *) s; *us; us++) + printf("%02x ", *us); + printf("}\n"); + printf("XXX debug txt: %s = { ", prefix); + for (us = (const unsigned char *) s; *us; us++) + { + if (*us >= 0x20 && *us < 0x80) + printf("%c ", *us); + else + printf("? "); + } + printf("}\n"); +} + /* * Escape single quotes and backslashes, suitably for insertions into * configuration files or SQL E'' strings. @@ -2369,8 +2396,10 @@ setlocales(void) * canonicalize locale names, and obtain any missing values from our * current environment */ + xxx_debug("setlocales lc_ctype", lc_ctype); check_locale_name(LC_CTYPE, lc_ctype, &canonname); lc_ctype = canonname; + xxx_debug("setlocales cannonname", lc_ctype); check_locale_name(LC_COLLATE, lc_collate, &canonname); lc_collate = canonname; check_locale_name(LC_NUMERIC, lc_numeric, &canonname); @@ -2597,7 +2626,10 @@ setup_locale_encoding(void) strcmp(lc_ctype, lc_monetary) == 0 && strcmp(lc_ctype, lc_messages) == 0 && (!icu_locale || strcmp(lc_ctype, icu_locale) == 0)) + { + xxx_debug("setup_locale_encoding", lc_ctype); printf(_("The database cluster will be initialized with locale \"%s\".\n"), lc_ctype); + } else { printf(_("The database cluster will be initialized with this locale configuration:\n")); @@ -3056,7 +3088,6 @@ initialize_data_directory(void) check_ok(); } - int main(int argc, char *argv[]) { @@ -3214,6 +3245,7 @@ main(int argc, char *argv[]) break; case 1: locale = pg_strdup(optarg); + xxx_debug("getopt optarg", locale); break; case 2: lc_collate = pg_strdup(optarg); -- 2.46.0