Re: echo(1): check for stdio errors

2022-08-11 Thread Stuart Henderson
On 2022/08/10 19:37, Scott Cheloha wrote: > On Thu, Aug 11, 2022 at 02:22:08AM +0200, Jeremie Courreges-Anglas wrote: > > On Wed, Aug 10 2022, Scott Cheloha wrote: > > > [...] > > > > > > 1. Our ksh(1) already checks for stdout errors in the echo builtin. > > > > So do any of the scripts in our

Re: echo(1): check for stdio errors

2022-08-10 Thread Scott Cheloha
On Thu, Aug 11, 2022 at 02:22:08AM +0200, Jeremie Courreges-Anglas wrote: > On Wed, Aug 10 2022, Scott Cheloha wrote: > > [...] > > > > 1. Our ksh(1) already checks for stdout errors in the echo builtin. > > So do any of the scripts in our source tree use /bin/echo for whatever > reason? If so,

Re: echo(1): check for stdio errors

2022-08-10 Thread Jeremie Courreges-Anglas
On Wed, Aug 10 2022, Scott Cheloha wrote: > On Wed, Aug 10, 2022 at 02:23:08PM -0600, Theo de Raadt wrote: >> Scott Cheloha wrote: >> >> > On Wed, Aug 10, 2022 at 12:26:17PM -0600, Theo de Raadt wrote: >> > > Scott Cheloha wrote: >> > > >> > > > We're sorta-kinda circling around adding the

Re: echo(1): check for stdio errors

2022-08-10 Thread Scott Cheloha
On Wed, Aug 10, 2022 at 02:23:08PM -0600, Theo de Raadt wrote: > Scott Cheloha wrote: > > > On Wed, Aug 10, 2022 at 12:26:17PM -0600, Theo de Raadt wrote: > > > Scott Cheloha wrote: > > > > > > > We're sorta-kinda circling around adding the missing (?) stdio error > > > > checking to other

Re: echo(1): check for stdio errors

2022-08-10 Thread Jeremie Courreges-Anglas
On Wed, Aug 10 2022, "Theo de Raadt" wrote: > Scott Cheloha wrote: > >> We're sorta-kinda circling around adding the missing (?) stdio error >> checking to other utilities in bin/ and usr.bin/, no? I want to be >> sure I understand how to do the next patch, because if we do that it >> will

Re: echo(1): check for stdio errors

2022-08-10 Thread Theo de Raadt
Scott Cheloha wrote: > On Wed, Aug 10, 2022 at 12:26:17PM -0600, Theo de Raadt wrote: > > Scott Cheloha wrote: > > > > > We're sorta-kinda circling around adding the missing (?) stdio error > > > checking to other utilities in bin/ and usr.bin/, no? I want to be > > > sure I understand how to

Re: echo(1): check for stdio errors

2022-08-10 Thread Scott Cheloha
On Wed, Aug 10, 2022 at 12:26:17PM -0600, Theo de Raadt wrote: > Scott Cheloha wrote: > > > We're sorta-kinda circling around adding the missing (?) stdio error > > checking to other utilities in bin/ and usr.bin/, no? I want to be > > sure I understand how to do the next patch, because if we

Re: echo(1): check for stdio errors

2022-08-10 Thread Theo de Raadt
Scott Cheloha wrote: > We're sorta-kinda circling around adding the missing (?) stdio error > checking to other utilities in bin/ and usr.bin/, no? I want to be > sure I understand how to do the next patch, because if we do that it > will probably be a bunch of programs all at once. This

Re: echo(1): check for stdio errors

2022-08-10 Thread Scott Cheloha
On Sat, Jul 30, 2022 at 05:23:37PM -0600, Todd C. Miller wrote: > On Sat, 30 Jul 2022 18:19:02 -0500, Scott Cheloha wrote: > > > Bump. The standard's error cases for fflush(3) are identical to those > > for fclose(3): > > > > https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html

Re: echo(1): check for stdio errors

2022-07-30 Thread Todd C . Miller
On Sat, 30 Jul 2022 18:19:02 -0500, Scott Cheloha wrote: > Bump. The standard's error cases for fflush(3) are identical to those > for fclose(3): > > https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html > https://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html >

Re: echo(1): check for stdio errors

2022-07-30 Thread Scott Cheloha
On Mon, Jul 11, 2022 at 01:27:23PM -0500, Scott Cheloha wrote: > On Mon, Jul 11, 2022 at 08:31:04AM -0600, Todd C. Miller wrote: > > On Sun, 10 Jul 2022 20:58:35 -0900, Philip Guenther wrote: > > > > > Three thoughts: > > > 1) Since stdio errors are sticky, is there any real advantage to checking

Re: echo(1): check for stdio errors

2022-07-11 Thread Scott Cheloha
On Mon, Jul 11, 2022 at 08:31:04AM -0600, Todd C. Miller wrote: > On Sun, 10 Jul 2022 20:58:35 -0900, Philip Guenther wrote: > > > Three thoughts: > > 1) Since stdio errors are sticky, is there any real advantage to checking > > each call instead of just checking the final fclose()? My thinking

Re: echo(1): check for stdio errors

2022-07-11 Thread Todd C . Miller
On Sun, 10 Jul 2022 20:58:35 -0900, Philip Guenther wrote: > Three thoughts: > 1) Since stdio errors are sticky, is there any real advantage to checking > each call instead of just checking the final fclose()? Will that really catch all errors? From what I can tell, fclose(3) can succeed even

Re: echo(1): check for stdio errors

2022-07-10 Thread Philip Guenther
On Sun, Jul 10, 2022 at 1:08 PM Scott Cheloha wrote: > ok? > > Index: echo.c > === > RCS file: /cvs/src/bin/echo/echo.c,v > retrieving revision 1.10 > diff -u -p -r1.10 echo.c > --- echo.c 9 Oct 2015 01:37:06 - 1.10 >

echo(1): check for stdio errors

2022-07-10 Thread Scott Cheloha
ok? Index: echo.c === RCS file: /cvs/src/bin/echo/echo.c,v retrieving revision 1.10 diff -u -p -r1.10 echo.c --- echo.c 9 Oct 2015 01:37:06 - 1.10 +++ echo.c 10 Jul 2022 22:00:18 - @@ -53,12 +53,15 @@ main(int