From f352f3f5147e80cea9f9974a370d13039e29c515 Mon Sep 17 00:00:00 2001 From: dotta Date: Tue, 24 Mar 2026 11:55:39 -0500 Subject: [PATCH] Force embedded-postgres messages locale to C The vendor package still hardcoded LC_MESSAGES to en_US.UTF-8. That locale is missing in slim containers, and initdb fails during bootstrap even when --lc-messages=C is passed later. Co-Authored-By: Paperclip --- patches/embedded-postgres@18.1.0-beta.16.patch | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/patches/embedded-postgres@18.1.0-beta.16.patch b/patches/embedded-postgres@18.1.0-beta.16.patch index 99c2f911..f99088e7 100644 --- a/patches/embedded-postgres@18.1.0-beta.16.patch +++ b/patches/embedded-postgres@18.1.0-beta.16.patch @@ -2,9 +2,19 @@ diff --git a/dist/index.js b/dist/index.js index ccfe17a82f4879bf20cc345c579a987d9eba5309..dd689f5908f625f49b4785318daea736aa88927f 100644 --- a/dist/index.js +++ b/dist/index.js +@@ -24,7 +24,7 @@ const { Client } = pg; + * output of the `initdb` command to see if Postgres is ready. As we're looking + * for a particular string, we need to force that string into the right locale. + * @see https://github.com/leinelissen/embedded-postgres/issues/15 + */ +-const LC_MESSAGES_LOCALE = 'en_US.UTF-8'; ++const LC_MESSAGES_LOCALE = 'C'; + // The default configuration options for the class + const defaults = { + databaseDir: path.join(process.cwd(), 'data', 'db'), @@ -133,7 +133,7 @@ class EmbeddedPostgres { - `--pwfile=${passwordFile}`, - `--lc-messages=${LC_MESSAGES_LOCALE}`, + `--pwfile=${passwordFile}`, + `--lc-messages=${LC_MESSAGES_LOCALE}`, ...this.options.initdbFlags, - ], Object.assign(Object.assign({}, permissionIds), { env: { LC_MESSAGES: LC_MESSAGES_LOCALE } })); + ], Object.assign(Object.assign({}, permissionIds), { env: Object.assign(Object.assign({}, globalThis.process.env), { LC_MESSAGES: LC_MESSAGES_LOCALE }) }));