Re: [PATCH] Fix TAP tests with recent IPC::Run on Windows - Mailing list pgsql-hackers
| From | Andrew Bille |
|---|---|
| Subject | Re: [PATCH] Fix TAP tests with recent IPC::Run on Windows |
| Date | |
| Msg-id | CAJnzary5aPNTjtzsWMitCr2WaRPx8dKxxCcvTJVb+YUZeypUKg@mail.gmail.com Whole thread |
| In response to | Re: [PATCH] Fix TAP tests with recent IPC::Run on Windows (Nazir Bilal Yavuz <byavuz81@gmail.com>) |
| List | pgsql-hackers |
Hi Nazir, Thanks, these are very useful references. The MinGW case in [2] looks particularly close to what I reproduced. The failures started exactly after IPC::Run was updated from 20250809.0 to 20260322.0, and installing the older version made the CI pass again. That seems to be the same compatibility change that triggered the failures I saw. The macOS case in [1] may be a somewhat different issue despite the similar "Bad file descriptor" symptom. As far as I understand, those failures went through the IO::Pty path in BackgroundPsql.pm, while this patch deliberately leaves the PTY path unchanged and changes only the non-PTY IPC::Run redirections. I also found two older reports which seem relevant. BUG #19541 from June reports 154 test failures on Windows. One of the shown failures passes an LSN containing an unexpected line ending back to psql, which looks very similar to the CRLF/text-mode failures fixed by this patch: https://www.postgresql.org/message-id/19541-059eb8da45044c7c%40postgresql.org There is also an older report about pg_upgrade on Windows where xcopy silently failed to copy pg_xact when stdout was redirected but stdin was not. Redirecting stdin reportedly fixed it: https://www.postgresql.org/message-id/152112210959.1217.7911406465826869349%40wrigleys.postgresql.org That is particularly interesting because it matches what I observed in the pg_upgrade tests: pg_upgrade ran the xcopy command, but the target pg_xact did not contain the expected file. Providing an explicit stdin endpoint made the test pass. So at least the MinGW failures and the pg_upgrade stdin behavior seem to have been observed independently before. Thanks, Andrew, Postgres Professional On Fri, Sep 25, 2026 at 4:11 PM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote: > > Hi, > > On Fri, 25 Sept 2026 at 11:59, Andrew Bille <andrewbille@gmail.com> wrote: > > > > While running the TAP test suite on Windows with IPC::Run 20260402.0, > > I found a number of failures caused by changes in IPC::Run's Win32 > > stream handling. > > There were two distinct symptoms. > > First, IPC::Run now uses binary mode by default on Windows. Text > > captured into Perl scalars therefore retains CRLF, while a number of > > TAP tests expect the previous text-mode behavior. This caused many > > comparisons to fail even though the displayed output looked identical. > > The patch adds ipc_run_text_mode() and uses it for IPC::Run redirects > > whose contents are treated as text by the tests. > > Second, a few tests relied on implicit standard streams. With the > > recent IPC::Run this resulted in failures such as: > > > > psql: error: could not print result table: Bad file descriptor > > > > and, in pg_upgrade tests, child xcopy commands failing to copy > > pg_xact unless stdin was supplied explicitly. > > Those cases now use explicit stream endpoints. > > I tested the patch with the full test suite on Windows using both: > > IPC::Run 20260402.0 > > IPC::Run 20231003.0 > > Both pass. I also tested the changes on Linux successfully. > > I haven't looked at the patches yet but +1 to fixing these problems. > > I saw same problems on the macOS [1] and MinGW CI [2] task when we > were using Cirrus. These discussions might help. > > [1] https://postgr.es/m/CAN55FZ3VOUSO2ZmBUE9wRNnL9fUQfGv5qWefk_1pWYqgJ1bRSQ%40mail.gmail.com > [2] https://postgr.es/m/CAN55FZ06xanSbJdHe-CurjX_qNuBWZDEvS1kAk36L38YCtZXnw%40mail.gmail.com > > -- > Regards, > Nazir Bilal Yavuz > Microsoft
pgsql-hackers by date: