Re: Custom Glibc collation version strings under LOCPATH

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Thomas Munro <thomas.munro@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-06-04T09:17:46Z
Lists: pgsql-hackers
On 04.06.25 06:03, Thomas Munro wrote:
> One way to move to a newer glibc-based Linux distribution but keep the
> locales working the same* without keeping the associated zombie C code
> alive is to find the source system's collation definition source
> files, compile them with the localedef on the target system and point
> to the top-level directory with the environment variable LOCPATH.
> 
> That runs directly into the naivity of commit d5ac14f9's
> gnu_get_libc_version() kludge.  So here's a patch that allows a brave
> user of that recompilation technique to drop a custom version string
> into a file called one of:
> 
>        * $LOCPATH/<collcollate>/LC_COLLATE.version
>        * $LOCPATH/<collcollate>/version
>        * $LOCPATH/LC_COLLATE.version
>        * $LOCPATH/version

Nice idea.

The patch looks mostly straightforward.

I wonder why you want to capture LOCPATH early in main.c.  It seems 
sufficient to look it up when needed?




Commits

  1. Use libc version as a collation version on glibc systems.