Re: Avoid duplicate file references in backend .pot file

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
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 07:13:16
Message-ID: 441BA3F5-8BC7-41A3-BEE7-5F61265FD607@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Nov 2, 2026, at 18:35, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> 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.
> <0001-Avoid-duplicate-file-references-in-backend-.pot-file.patch>

LGTM. I tested in this way:
```
% ls -l src/include/utils/guc_tables.inc.c
lrwxr-xr-x@ 1 chaol staff 43 Nov 3 13:27 src/include/utils/guc_tables.inc.c -> ../../../src/backend/utils/guc_tables.inc.c

% find src/backend src/common src/port src/include \
\( -name '*.c' -o -name 'proctypelist.h' \) \
-print | grep guc_tables.inc.c
src/backend/utils/guc_tables.inc.c
src/include/utils/guc_tables.inc.c

% find src/backend src/common src/port src/include -type f \
\( -name '*.c' -o -name 'proctypelist.h' \) \
-print | grep guc_tables.inc.c
src/backend/utils/guc_tables.inc.c
```

Without -type f, find lists both the regular file and the symbolic link. With -type f, it lists only the regular file, as expected.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeevan Chalke 2026-11-03 07:26:00 Re: PL/pgSQL: apply the too_many_rows extra check to EXECUTE ... INTO
Previous Message Ashutosh Bapat 2026-11-03 06:52:47 Re: [PATCH v1] Fix for bug #19773 : pg_dump differing generation expressions of inherited columns