Re: pg_logging_init() can return ENOTTY with TAP tests

2020-09-18 Thread Michael Paquier
On Fri, Sep 18, 2020 at 09:54:42PM -0400, Tom Lane wrote: > No, absolutely not. That way leads to madness, because you will be trying > to enforce a system-wide property for the benefit of a few places. There > is *no code anywhere* that promises to leave errno zero, but what you are >

Re: pg_logging_init() can return ENOTTY with TAP tests

2020-09-18 Thread Tom Lane
Michael Paquier writes: > On Fri, Sep 18, 2020 at 09:56:14AM -0400, Tom Lane wrote: >> No, this is a bad idea. The right place to fix this is whatever code >> segment is relying on errno to be initially zero; that is NEVER a sane >> assumption. That is, a valid coding pattern is something like

Re: pg_logging_init() can return ENOTTY with TAP tests

2020-09-18 Thread Michael Paquier
On Fri, Sep 18, 2020 at 09:56:14AM -0400, Tom Lane wrote: > No, this is a bad idea. The right place to fix this is whatever code > segment is relying on errno to be initially zero; that is NEVER a sane > assumption. That is, a valid coding pattern is something like It seems to me that it could

Re: pg_logging_init() can return ENOTTY with TAP tests

2020-09-18 Thread Tom Lane
Michael Paquier writes: > Some system calls may not set errno even if they succeed, like > strtol() on Linux for example, so in this case it can cause option > handling to fail because of the error set by logging initialization. > Shouldn't we reset errno to 0 once logging initialization is done?