Re: Avoid duplicate file references in backend .pot file

From: "Jonathan Gonzalez V(dot)" <jonathan(at)abdiel(dot)eu>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid duplicate file references in backend .pot file
Date: 2026-11-03 11:17:40
Message-ID: 87pkwmduzv.fsf@abdiel.eu
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

Peter Eisentraut <peter(at)eisentraut(dot)org> writes:

> The list of files for the backend's message catalog is collected with find,
> which also lists symlinks, namely the generated files that are linked from
> src/include/utils/ to src/backend/utils/ (such as guc_tables.inc.c) and the
> port/pg_sema.c and port/pg_shmem.c links created by configure. Since the link
> targets are found under their real names as well, xgettext processed those files
> twice, resulting in duplicate "#:" references like
>
> #: ../include/utils/guc_tables.inc.c:410 utils/guc_tables.inc.c:410
>
> This is an old problem, but the introduction of guc_tables.inc.c in PG19 has
> made it much more noticeable.
>
> I propose the attached patch to fix this by restricting find to regular files.

> gettext-files: generated-parser-sources generated-headers
> - find $(srcdir) $(srcdir)/../common $(srcdir)/../port $(srcdir)/../include/ \( -name '*.c' -o -name "proctypelist.h" \) -print | LC_ALL=C sort >$@
> + find $(srcdir) $(srcdir)/../common $(srcdir)/../port $(srcdir)/../include/ -type f \( -name '*.c' -o -name "proctypelist.h" \) -print | LC_ALL=C sort >$@

This make a lot of sense to me, I've tested and found that

./../include/utils/pgstat_wait_event.c
./../include/utils/wait_event_funcs_data.c

both were also symlinks.

This case totally escaped to my tests the last I checked that file! Work
as expected!

Regards,
--
Jonathan Gonzalez V.
EDB
https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakub Wartak 2026-11-03 11:31:30 Re: [Bug Report + Patch] File descriptor leak when io_method=io_uring
Previous Message Virender Singla 2026-11-03 11:17:01 Re: Allow pg_read_all_stats to read replication origin status