Re: 64 bit numbers vs format strings
| От | Thomas Munro | 
|---|---|
| Тема | Re: 64 bit numbers vs format strings | 
| Дата | |
| Msg-id | CA+hUKG+pp==d-3LVhdNOvOAzwQN0vP4gBSxtHkmxnmfQD3NY=w@mail.gmail.com обсуждение исходный текст  | 
		
| Ответ на | Re: 64 bit numbers vs format strings (Tom Lane <tgl@sss.pgh.pa.us>) | 
| Ответы | 
                	
            		Re: 64 bit numbers vs format strings
            		
            		 | 
		
| Список | pgsql-hackers | 
On Tue, Mar 18, 2025 at 4:48 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > Thomas Munro <thomas.munro@gmail.com> writes: > > On Mon, Mar 17, 2025 at 8:09 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > >> Hmm, I find that comment fairly scary. How do we know that the > >> runtime library actually gets this right on every supported platform? > > > I don't know too much about libintl and its history other than what > > I've looked up for these discussions, but I can't find any other > > implementations other than Sun's, GNU's and NetBSD's. Sun/Oracle and > > NetBSD went out of their way to understand these and other GNUisms. > > Okay, that reduces the size of the problem considerably. For the record, I found one more hiding on Alpine Linux. It has two implementations available: 1. You can install the regular GNU library and tools with "gettext" and "gettext-dev". Then I assume this all just works. 2. There is a cleanroom implementation reachable with "musl-libintl". It supplies a different /usr/include/libintl.h that activates an implementation inside musl itself, and IIRC "gettext-tiny" gives you msgfmt etc. I bet this new 64-bit stuff doesn't work though: they do support %<PRIu64> etc, but the lookup table[1] seems a little on the short side for our usage. gettext-tiny's README.md also explains that they pre-chew them in msgfmt, so GNU/non-GNU combinations probably break once you start using these macros, if they ever worked. It looks like the packages and docker scripts people use to run PostgreSQL on Alpine don't enable nls anyway, so I doubt we'll hear anything about this from the field. It might still be interesting to know which msgfmt/libintl pair the BF animals are using (CC Wolfgang), and whether this stuff actually works. If not, installing "gettext" and "gettext-dev" would likely be the solution, though if the musl version already works for %<PRIu64>, perhaps a small PR could get the other variants to work too? [1] https://github.com/sabotage-linux/gettext-tiny/blob/master/src/poparser.c
В списке pgsql-hackers по дате отправления: