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.
From cbcbfe685b7569292e2516c41a1a8fadcb72bc58 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Mon, 2 Nov 2026 11:29:07 +0100
Subject: [PATCH] Avoid duplicate file references in backend .pot file

The list of files for the backend's message catalog is collected with
find, which also listed 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

Fix by restricting find to regular files.
---
 src/backend/nls.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/nls.mk b/src/backend/nls.mk
index 698b1083f4b..636002f29c9 100644
--- a/src/backend/nls.mk
+++ b/src/backend/nls.mk
@@ -28,7 +28,7 @@ GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS) \
                    error_cb:2:c-format
 
 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 >$@
 
 my-clean:
        rm -f gettext-files
-- 
2.56.0

Reply via email to