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
--- bin/ksh/NOTES       12 Jan 2018 14:20:57 -0000      1.16
+++ bin/ksh/NOTES       2 Jul 2021 18:45:11 -0000
@@ -195,10 +195,6 @@ Known differences between pdksh & at&t k
     - co-processes: if ksh93, the write portion of the co-process output is
       closed when the most recently started co-process exits. pdksh closes
       it when all the co-processes using it have exited.
-    - pdksh accepts empty command lists for while and for statements, while
-      at&t ksh (and sh) don't.  Eg., pdksh likes
-       while false ; do done
-      but ksh88 doesn't like it.
     - pdksh bumps RANDOM in parent after a fork, at&t ksh bumps it in both
       parent and child:
        RANDOM=1
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       2 Jul 2021 18:44:39 -0000
@@ -323,6 +323,8 @@ get_command(int cf)
                nesting_push(&old_nesting, c);
                t->vars = wordlist();
                t->left = dogroup();
+               if (t->left == NULL)
+                       syntaxerr(NULL);
                nesting_pop(&old_nesting);
                break;
 
@@ -331,7 +333,11 @@ 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();
+               if (t->right == NULL)
+                       syntaxerr(NULL);
                nesting_pop(&old_nesting);
                break;
 

Reply via email to