On Sun, Oct 05, 2025 at 08:03:34AM +0200, cygwin wrote:
> On 10/5/2025 6:57 AM, Duncan Roe via Cygwin wrote:
> > If the bug is to persist, I suggest to munge psize.c:-
> >
> > | *** builtins/psize.c.bu Fri Aug 15 05:56:53 2008
> > | --- builtins/psize.c Sun Oct 5 14:06:50 2025
> > | ***************
> > | *** 51,57 ****
> > | sigpipe (sig)
> > | int sig;
> > | {
> > | ! fprintf (stderr, "%d\n", nw);
> > | exit (0);
> > | }
> > |
> > | --- 51,57 ----
> > | sigpipe (sig)
> > | int sig;
> > | {
> > | ! fprintf (stderr, "%d\n", nw - 128);
> > | exit (0);
> > | }
> > |
> >
> > N.B. blank lines (after removing 1st 2 chars) have 2 trailing spaces.
> >
> > Cheers ... Duncan.
> >
> Subtracting 128 (the granularity of the test code), seems very arbitrary and
> kludgy.
Kludgy?? It's the expected result when you write that number of bytes.
Anyway, it's a *tested* and *working* 1-line fix. Any 1-line fix is a good fix.
>
> An obvious simplification is to disable SIGPIPE and use a loop that ends
> when 0or -1
> is returned, like this:
>
> /* The following code was written directly in the mail and not tested */
Clearly not tested 🙄
>
> Â /* TODO: ignore SIGPIPE instead of setting a handler */
>
> nw = 0;
> for(;;)
> {
> i = write (1, buf, 128);
> if (i <= 0)
> break;
> Â nw += i;
> }
> /* These are the error codes in the POSIX write(3P) man page
> * associated with hitting the pipe limit or similar,
> * maybe this code should accept a few more error codes in
> * real world use for this.
> */
> if (errno == EPIPE || errno == ENOSPC || errno == EAGAIN ||
> errno == EFBIG || errno == ENOBUFS)
> fprintf (stderr, "%d\n", nw);
> else
> perror (argv[0]);
Doesn't work. As per my previous email, the over-capacity write only returns on
receipt of a signal, but before the signal is delivered.
It *might* work if the pipe were made non-blocking, but that's a lot of code
churn compared with a 1-liner.
>
> Another simplification would be for psize.c to open its own pipe and
> simply never read from it, thus removing any dependency on how the build
> time shell and sleep programs handle the pipe.
Won't work, see above.
>
> --
> Jakob Bohm, CIO, partner, WiseMo A/S. https://www.wisemo.com
> Transformervej 29, 2860 Soborg, Denmark. direct: +45 31 13 16 10
> <tel:+4531131610>
> This message is only for its intended recipient, delete if misaddressed.
> WiseMo - Remote Service Management for PCs, Phones and Embedded
Cheers ... Duncan.
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple