On July 5, 2021 12:25:39 AM GMT+02:00, "Todd C. Miller" <[email protected]> 
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 least for trivial cases.
>
>Fair enough, let's just require a non-empty expression but still
>allow an empty loop body.  It would be a good idea to call this out
>as a portability issue in the ksh manual but that can be done
>separately.

Please note that I'm not really opposing the initial suggestion per se. I'm not 
sure "do done" is even valid in ksh93.

Nowadays I try to avoid "do done", and my personal scripts breaking I can 
handle. I was just pointing out that it would break some of the ones in-tree if 
we don't fix them first.

/Alexander

>
> - todd
>
>Index: bin/ksh/syn.c
>===================================================================
>RCS file: /cvs/src/bin/ksh/syn.c,v
>retrieving revision 1.39
>diff -u -p -u -r1.39 syn.c
>--- bin/ksh/syn.c      24 Apr 2018 08:25:16 -0000      1.39
>+++ bin/ksh/syn.c      4 Jul 2021 22:21:39 -0000
>@@ -331,6 +331,8 @@ get_command(int cf)
>               nesting_push(&old_nesting, c);
>               t = newtp((c == WHILE) ? TWHILE : TUNTIL);
>               t->left = c_list(true);
>+              if (t->left == NULL)
>+                      syntaxerr(NULL);
>               t->right = dogroup();
>               nesting_pop(&old_nesting);
>               break;

Reply via email to