Re: [PATCH] O_CLOEXEC not honored on Windows - handle inheritance chain

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bryan Green <dbryan(dot)green(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] O_CLOEXEC not honored on Windows - handle inheritance chain
Date: 2025-12-13 03:57:58
Message-ID: CA+hUKGJOVyea=EqZaMy9nt0Js10+E9y1FYL0=E_+UskZi-3wXQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Dec 13, 2025 at 3:44 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> > Hearing nothing, pushed.
>
> fairywren is unimpressed:
>
> ../pgsql/src/test/modules/test_cloexec/test_cloexec.c: In function 'run_parent_tests':
> ../pgsql/src/test/modules/test_cloexec/test_cloexec.c:137:29: warning: unused variable 'space_pos' [-Wunused-variable]
> 137 | char *space_pos;
> | ^~~~~~~~~

The CI MinGW task also shows this warning, but it doesn't use -Werror.
The separate CompileWarnings task does, being its purpose, and it
includes a MinGW cross-build step, but that uses configure, and this
test is built only by meson. That wasn't a great idea... we knew we
were only dealing with Windows but forgot about MinGW, so I'll go and
write a patch to fix that aspect later today so we're covered for
warnings. I'll also think about whether it's worth checking for MinGW
warnings in both assert and non-assert builds (as we do for regular
Linux gcc/clang), and I'd also like to try to catch warnings from MSVC
and had an idea for how to do that... I might also try to think about
meson-vs-configure cross checks...

> What is the point of that first snprintf(cmdline, ...), when its
> result is guaranteed to be overwritten just below?
>
> I'm also dubious about using MAX_PATH here; see the commentary
> about MAXPGPATH in pg_config_manual.h. Also, what's the point of
> using MAX_PATH when the result is going to be transferred into
> cmdline (with a hardwired size of 1024)?

Fair points, I'll wait and see if Bryan is free to write a patch on
Monday (US), and otherwise write one myself.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bryan Green 2025-12-13 04:10:45 Re: [PATCH] O_CLOEXEC not honored on Windows - handle inheritance chain
Previous Message Tom Lane 2025-12-13 02:44:11 Re: [PATCH] O_CLOEXEC not honored on Windows - handle inheritance chain