Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Use __fpurge when fpurge is undeclared



On Thu, Oct 2, 2025 at 10:50 AM Jun. T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
>
> In the thread (28 and 29, Jan 2024)
> '[PATCH] Improve stdio management when redirecting descriptors'
>
> > 2024/01/29 22:03, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > On Mon, Jan 29, 2024 at 2:59 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> >>
> >> According to my manpages, int fpurge is not available on linux
> >> (glibc), but there is void __fpurge.
> >
> > Yes, however, as far as we can tell stdio implementations that don't
> > expose fpurge don't need to call it.
>
> So the first thing we need to know is whether calling fpurge() is necessary
> or not on musl-based systems.
>
> On your Gentoo, without your patch, please try the following:
>
> % ./configre
> then comment out the line
> #define HAVE_FPURGE 1
> in config.h, and
> % make
> % TESTNUM=A05 make check
>
> Does this test succeed?
>
> On macOS and FreeBSD, where fpurge() is available, the above test fails
> at the test hunk
>
>   print foo >&-
> 0:'>&-' redirection
>
> so it seems calling fpurge() is indeed necessary on these systems.
>
> If the test succeeds without calling fpurge() on Gentoo, I _guess_
> fpurge() is not required, but not 100% sure.

Sorry, this message got flagged as spam.

I can send a revised patch that simply checks if fpurge has been
declared and does not attempt to call __fpurge.




Messages sorted by: Reverse Date, Date, Thread, Author