On 4/1/16 4:21 AM, Piotr Grzybowski wrote:
> Hello!
> 
>  I firmly believe that the attached patch fixes the problem at hand; what
> it breaks I have no idea. Kindly requesting a review.

It breaks the test suite.

It tries to do a little bit too much: it should not add the character to
the return buffer and go on to the next one if later code needs to do
something with it (e.g., if it's a `)').

Here's a version of the patch that does the trick.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.4-rc1/parse.y	2016-01-15 08:52:07.000000000 -0500
--- parse.y	2016-04-01 08:03:53.000000000 -0400
***************
*** 3877,3880 ****
--- 3880,3884 ----
  		{
  		  tflags |= LEX_INCASE;
+ 		  tflags &= ~LEX_RESWDOK;
  /*itrace("parse_comsub:%d: found `case', lex_incase -> 1 lex_reswdok -> 0", line_number);*/
  		}
***************
*** 3882,3888 ****
  		{
  		  tflags &= ~LEX_INCASE;
! /*itrace("parse_comsub:%d: found `esac', lex_incase -> 0 lex_reswdok -> 0", line_number);*/
  		}
- 	      tflags &= ~LEX_RESWDOK;
  	    }
  	  else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
--- 3886,3898 ----
  		{
  		  tflags &= ~LEX_INCASE;
! /*itrace("parse_comsub:%d: found `esac', lex_incase -> 0 lex_reswdok -> 1", line_number);*/
! 		  tflags |= LEX_RESWDOK;
! 		  lex_rwlen = 0;
! 		}
! 	      else
! 		{
! 		  tflags &= ~LEX_RESWDOK;
! /*itrace("parse_comsub:%d: found `%.4s', lex_reswdok -> 0", line_number, ret+retind-4);*/
  		}
  	    }
  	  else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))

Reply via email to