Re: ksh: require expression in while loop

2021-07-05 Thread Reuben ua Bríġ
> Date: Mon, 5 Jul 2021 07:54:10 -0600 > From: "Todd C. Miller" > That would result in an error like: > > ksh: syntax error: `done' unexpected > > instead of: > > ksh: syntax error: `do' unexpected > > But perhaps this is not important. It is also possible to call > yyerror() direct

Re: ksh: require expression in while loop

2021-07-05 Thread Todd C . Miller
On Mon, 05 Jul 2021 16:30:49 +0959, Reuben ua =?UTF-8?Q?Br=C3=AD=C4=A1?= wrote: > if i might suggest a slight variation, how about only requiring that > at least one of the lists is non-empty, in the case of while, and > leaving for, until, etc. as they are? > > this way nothing is broken. > > you

Re: ksh: require expression in while loop

2021-07-05 Thread Todd C . Miller
On Mon, 05 Jul 2021 15:08:27 +0200, Jeremie Courreges-Anglas wrote: > LGTM as a first step, ok jca@ Committed. > I'd prefer to fix the odd uses we have in tree and end up with your > initial diff in a third step. > > Here are the three cases pointed out by halex@, mechanical diff. > > ok? / Todd

Re: ksh: require expression in while loop

2021-07-05 Thread Reuben ua Bríġ
> Date: Mon, 5 Jul 2021 14:41:46 +0200 > From: Alexander Hall > I don't really see what you win either. the point of todds diff is to fix the issue i raised: Subject: while do done Date: Mon, 28 Jun 2021 22:20:15 +1000 From: Reuben ua Bríġ To: m...@openbsd.org

Re: ksh: require expression in while loop

2021-07-05 Thread Todd C . Miller
On Mon, 05 Jul 2021 14:47:08 +0200, Alexander Hall wrote: > Please note that I'm not really opposing the initial suggestion per se. I'm n > ot sure "do done" is even valid in ksh93. It is not. > Nowadays I try to avoid "do done", and my personal scripts breaking I can han > dle. I was just point

Re: ksh: require expression in while loop

2021-07-05 Thread Reuben ua Bríġ
> Date: Sun, 4 Jul 2021 16:25:39 -0600 > From: Todd C. Miller > let's just require a non-empty expression but still allow an empty > loop body. if i might suggest a slight variation, how about only requiring that at least one of the lists is non-empty, in the case of while, and leaving for, unt

Re: ksh: require expression in while loop

2021-07-05 Thread Alexander Hall
On July 5, 2021 3:12:07 PM GMT+02:00, "Reuben ua Bríġ" wrote: >> Date: Mon, 5 Jul 2021 14:41:46 +0200 >> From: Alexander Hall > >> I don't really see what you win either. > >the point of todds diff is to fix the issue i raised: > > Subject: while do done > Date: Mon, 28 Jun 2021

Re: ksh: require expression in while loop

2021-07-05 Thread Alexander Hall
On July 5, 2021 3:08:27 PM GMT+02:00, Jeremie Courreges-Anglas wrote: >On Sun, Jul 04 2021, Todd C. Miller wrote: >> On Sun, 04 Jul 2021 23:25:25 +0200, Alexander Hall wrote: >> >>> The "... do done" variant has been frequently used by me, and seems to >>> appear >>> at least three times in

Re: ksh: require expression in while loop

2021-07-05 Thread Jeremie Courreges-Anglas
On Sun, Jul 04 2021, Todd C. Miller wrote: > On Sun, 04 Jul 2021 23:25:25 +0200, Alexander Hall wrote: > >> The "... do done" variant has been frequently used by me, and seems to appear >> at least three times in install.sub, so if this goes in, please scan the scr >> ipts in our tree first, at l

Re: ksh: require expression in while loop

2021-07-05 Thread Alexander Hall
On July 5, 2021 12:25:39 AM GMT+02:00, "Todd C. Miller" wrote: >On Sun, 04 Jul 2021 23:25:25 +0200, Alexander Hall wrote: > >> The "... do done" variant has been frequently used by me, and seems to appear >> at least three times in install.sub, so if this goes in, please scan the scr >> ipts

Re: ksh: require expression in while loop

2021-07-05 Thread Alexander Hall
On July 5, 2021 8:31:49 AM GMT+02:00, "Reuben ua Bríġ" wrote: >> Date: Sun, 4 Jul 2021 16:25:39 -0600 >> From: Todd C. Miller > >> let's just require a non-empty expression but still allow an empty >> loop body. > >if i might suggest a slight variation, how about only requiring that >at leas

Re: ksh: require expression in while loop

2021-07-04 Thread Todd C . Miller
On Sun, 04 Jul 2021 23:25:25 +0200, Alexander Hall wrote: > The "... do done" variant has been frequently used by me, and seems to appear > at least three times in install.sub, so if this goes in, please scan the scr > ipts in our tree first, at least for trivial cases. Fair enough, let's just r

Re: ksh: require expression in while loop

2021-07-04 Thread Alexander Hall
The "... do done" variant has been frequently used by me, and seems to appear at least three times in install.sub, so if this goes in, please scan the scripts in our tree first, at least for trivial cases. /Alexander On July 2, 2021 8:20:44 PM GMT+02:00, "Todd C. Miller" wrote: >Currently, ou

Re: ksh: require expression in while loop

2021-07-02 Thread Todd C . Miller
Updated diff that also requires a non-empty command list for "for" loops and adjusts the NOTES file to match. - todd Index: bin/ksh/NOTES === RCS file: /cvs/src/bin/ksh/NOTES,v retrieving revision 1.16 diff -u -p -u -r1.16 NOTES ---

ksh: require expression in while loop

2021-07-02 Thread Todd C . Miller
Currently, our ksh/sh accepts things like: while do done which cannot be interrupted via ^C by default. If, However, the expression is not empty everything is fine. E.g. while :; do done Most other shells require a non-empty expression which avoids this problem (zsh is the outlier her