From: Chet Ramey Date: Fri, 9 Dec 2011 01:07:56 +0000 (-0500) Subject: commit bash-20090413 snapshot X-Git-Tag: bash-4.3-alpha~232 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83c14a205e8c33f73384ee2a9f70237c1c96c510;p=thirdparty%2Fbash.git commit bash-20090413 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index aa65b8de7..6e710684e 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -7912,3 +7912,25 @@ lib/readline/rlprivate.h lib/readline/display.c - block SIGWINCH during redisplay like SIGINT. Should fix bug reported by Nicolai Lissner + + 4/13 + ---- +lib/readline/readline.h + - new readline state variable: RL_STATE_REDISPLAYING + +lib/readline/display.c + - in rl_redisplay, don't block SIGWINCH during redisplay; just set + the REDISPLAYING state + +lib/readline/terminal.c + - in rl_resize_terminal, don't call rl_redisplay_after_sigwinch() if + we're already in the middle of redisplay (RL_STATE_REDISPLAYING). + Fix for bug reported by Nicolai Lissner + + 4/15 + ---- +parse.y + - fix parse_comsub to add check for \n when seeing whether the current + character can change to a state where a reserved word is legal, + since it is not a shell meta character. Fixes bug reported by + Bernd Eggink . diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index 760d0d1f4..c7950e41a 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -7910,4 +7910,19 @@ lib/readline/rlprivate.h - new extern declarations for _rl_block_sigwinch and _rl_release_sigwinch lib/readline/display.c - - block SIGWINCH during redisplay like SIGINT + - block SIGWINCH during redisplay like SIGINT. Should fix bug reported + by Nicolai Lissner + + 4/13 + ---- +lib/readline/readline.h + - new readline state variable: RL_STATE_REDISPLAYING + +lib/readline/display.c + - in rl_redisplay, don't block SIGWINCH during redisplay; just set + the REDISPLAYING state + +lib/readline/terminal.c + - in rl_resize_terminal, don't call rl_redisplay_after_sigwinch() if + we're already in the middle of redisplay (RL_STATE_REDISPLAYING). + Fix for bug reported by Nicolai Lissner diff --git a/lib/readline/display.c b/lib/readline/display.c index 7a62fc38c..9ac420a22 100644 --- a/lib/readline/display.c +++ b/lib/readline/display.c @@ -512,7 +512,7 @@ rl_redisplay () /* Block keyboard interrupts because this function manipulates global data structures. */ _rl_block_sigint (); - _rl_block_sigwinch (); + RL_SETSTATE (RL_STATE_REDISPLAYING); if (!rl_display_prompt) rl_display_prompt = ""; @@ -1237,8 +1237,8 @@ rl_redisplay () visible_wrap_offset = wrap_offset; } + RL_UNSETSTATE (RL_STATE_REDISPLAYING); _rl_release_sigint (); - _rl_release_sigwinch (); } /* PWP: update_line() is based on finding the middle difference of each @@ -1774,7 +1774,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) space_to_eol will insert too many spaces. XXX - maybe we should adjust col_lendiff based on the difference between _rl_last_c_pos and _rl_screenwidth */ - if (col_lendiff && (_rl_last_c_pos < _rl_screenwidth)) + if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth))) #endif { if (_rl_term_autowrap && current_line < inv_botlin) diff --git a/lib/readline/display.c~ b/lib/readline/display.c~ index e941c78ac..39bbb94d6 100644 --- a/lib/readline/display.c~ +++ b/lib/readline/display.c~ @@ -512,6 +512,7 @@ rl_redisplay () /* Block keyboard interrupts because this function manipulates global data structures. */ _rl_block_sigint (); + RL_SETSTATE (RL_STATE_REDISPLAYING); if (!rl_display_prompt) rl_display_prompt = ""; @@ -1236,6 +1237,7 @@ rl_redisplay () visible_wrap_offset = wrap_offset; } + RL_UNSETSTATE (RL_STATE_REDISPLAYING); _rl_release_sigint (); } diff --git a/lib/readline/readline.h b/lib/readline/readline.h index ba0d5d624..fa02dec0d 100644 --- a/lib/readline/readline.h +++ b/lib/readline/readline.h @@ -814,8 +814,9 @@ extern int rl_inhibit_completion; #define RL_STATE_VIMOTION 0x100000 /* reading vi motion arg */ #define RL_STATE_MULTIKEY 0x200000 /* reading multiple-key command */ #define RL_STATE_VICMDONCE 0x400000 /* entered vi command mode at least once */ +#define RL_STATE_REDISPLAYING 0x800000 /* updating terminal display */ -#define RL_STATE_DONE 0x800000 /* done; accepted line */ +#define RL_STATE_DONE 0x1000000 /* done; accepted line */ #define RL_SETSTATE(x) (rl_readline_state |= (x)) #define RL_UNSETSTATE(x) (rl_readline_state &= ~(x)) diff --git a/lib/readline/terminal.c b/lib/readline/terminal.c index 87fdf1012..768ec9bbd 100644 --- a/lib/readline/terminal.c +++ b/lib/readline/terminal.c @@ -355,7 +355,7 @@ rl_resize_terminal () _rl_get_screen_size (fileno (rl_instream), 1); if (CUSTOM_REDISPLAY_FUNC ()) rl_forced_update_display (); - else + else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0) _rl_redisplay_after_sigwinch (); } } diff --git a/parse.y b/parse.y index 7148b02ec..6e5d65c83 100644 --- a/parse.y +++ b/parse.y @@ -3374,7 +3374,7 @@ eof_error: } /* Meta-characters that can introduce a reserved word. Not perfect yet. */ - if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch)) + if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && (shellmeta(ch) || ch == '\n')) { /* Add this character. */ RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64); diff --git a/parse.y~ b/parse.y~ index 22929b3fb..7c1f19fd2 100644 --- a/parse.y~ +++ b/parse.y~ @@ -1879,7 +1879,7 @@ read_secondary_line (remove_quoted_newline) prompt_again (); ret = read_a_line (remove_quoted_newline); #if defined (HISTORY) - if (remember_on_history && (parser_state & PST_HEREDOC)) + if (ret && remember_on_history && (parser_state & PST_HEREDOC)) { /* To make adding the the here-document body right, we need to rely on history_delimiting_chars() returning \n for the first line of @@ -3374,7 +3374,7 @@ eof_error: } /* Meta-characters that can introduce a reserved word. Not perfect yet. */ - if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch)) + if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && (shellmeta(ch) || ch == '\n')) { /* Add this character. */ RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64); @@ -3505,12 +3505,12 @@ eof_error: else if MBTEST(ch == close && (tflags & LEX_INCASE) == 0) /* ending delimiter */ { count--; -/*itrace("parse_comsub:%d: found close: count = %d", line_number, count);*/ +itrace("parse_comsub:%d: found close: count = %d", line_number, count); } else if MBTEST(((flags & P_FIRSTCLOSE) == 0) && (tflags & LEX_INCASE) == 0 && ch == open) /* nested begin */ { count++; -/*itrace("parse_comsub:%d: found open: count = %d", line_number, count);*/ +itrace("parse_comsub:%d: found open: count = %d", line_number, count); } /* Add this character. */ diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 3efcf32d6..72ec06a2c 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/chet/bash/bash-current +BUILD_DIR=/usr/local/build/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR