From 668f50077d2e4aa43a53e9e3ece63c3b9d76795b Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Sat, 3 Dec 2011 13:51:40 -0500 Subject: [PATCH] commit bash-20050929 snapshot --- CHANGES | 15 +++++++++++++ CWRU/CWRU.chlog | 14 ++++++++++++ CWRU/CWRU.chlog~ | 13 +++++++++++ bashhist.c | 2 +- bashhist.c~ | 5 +++++ execute_cmd.c | 6 +++++ lib/readline/examples/rlptytest.c | 47 +++++++++++++++++++++++++++++++++++++-- sig.c | 4 ++++ 8 files changed, 103 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index e00e964..c01698e 100644 --- a/CHANGES +++ b/CHANGES @@ -71,6 +71,18 @@ v. Fixed a bug that caused core dumps when interrupting loops running builtins w. Make sure that some of the functions bash provides replacements for are not cpp defines. +x. The code that scans embedded commands for the parser (`...` and $(...)) is + now more aware of embedded comments and their effect on quoted strings. + +y. Changed the `-n' option to the `history' builtin to not reset the number of + history lines read in the current session after reading the new lines from + the history file if the history is being appended when it is written to + the file, since the appending takes care of the problem that the adjustment + was intended to solve. + +z. Improved the error message displayed when a shell script fails to execute + because the environment and size of command line arguments is too large. + 2. Changes to Readline a. The `change-case' command now correctly changes the case of multibyte @@ -88,6 +100,9 @@ d. Fixed the non-incremental search code in vi mode to dispose of any current e. The variable assignment code now ignores whitespace at the end of lines. +f. The `C-w' binding in incremental search now understands multibyte + characters. + 3. New Features in Bash a. A new configuration option, `--enable-strict-posix-default', which will diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 1a892cf..5c791cf 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -12152,3 +12152,17 @@ lib/readline/rlmbutil.h lib/readline/text.c - use _rl_to_wupper and _rl_to_wlower as appropriate + + 9/26 + ---- +execute_cmd.c + - in shell_execve, if the exec fails due to E2BIG or ENOMEM, just print + the appropriate error message instead of checking out any interpreter + specified with #! + + 9/30 + ---- +bashhist.c + - make $HISTCMD available anytime remember_on_history is non-zero, + which indicates that we're saving commands to the history, and + let it evaluate to 1 if we're not diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index 2ab04f8..78fb9a2 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -12146,3 +12146,16 @@ builtins/history.def lib/readline/isearch.c - fix C-w handler for isearch string reader to handle multibyte chars + +lib/readline/rlmbutil.h + - new defines for _rl_to_wupper and _rl_to_wlower + +lib/readline/text.c + - use _rl_to_wupper and _rl_to_wlower as appropriate + + 9/26 + ---- +execute_cmd.c + - in shell_execve, if the exec fails due to E2BIG or ENOMEM, just print + the appropriate error message instead of checking out any interpreter + specified with #! diff --git a/bashhist.c b/bashhist.c index 1b2df16..5d2b817 100644 --- a/bashhist.c +++ b/bashhist.c @@ -713,7 +713,7 @@ int history_number () { using_history (); - return (get_string_value ("HISTSIZE") ? history_base + where_history () : 1); + return (remember_on_history ? history_base + where_history () : 1); } static int diff --git a/bashhist.c~ b/bashhist.c~ index 73637dc..1b2df16 100644 --- a/bashhist.c~ +++ b/bashhist.c~ @@ -156,6 +156,10 @@ int history_control; to a previous entry as part of command-oriented-history processing. */ int hist_last_line_added; +/* Set to 1 if builtins/history.def:push_history added the last history + entry. */ +int hist_last_line_pushed; + #if defined (READLINE) /* If non-zero, and readline is being used, the user is offered the chance to re-edit a failed history expansion. */ @@ -700,6 +704,7 @@ really_add_history (line) char *line; { hist_last_line_added = 1; + hist_last_line_pushed = 0; add_history (line); history_lines_this_session++; } diff --git a/execute_cmd.c b/execute_cmd.c index d05981b..409f1f9 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -3855,6 +3855,12 @@ shell_execve (command, args, env) errno = i; file_error (command); } + /* errors not involving the path argument to execve. */ + else if (i == E2BIG || i == ENOMEM) + { + errno = i; + file_error (command); + } else { /* The file has the execute bits set, but the kernel refuses to diff --git a/lib/readline/examples/rlptytest.c b/lib/readline/examples/rlptytest.c index 87bfc3a..79257db 100644 --- a/lib/readline/examples/rlptytest.c +++ b/lib/readline/examples/rlptytest.c @@ -1,3 +1,10 @@ +/* + * + * Another test harness for the readline callback interface. + * + * Author: Bob Rossi + */ + #if defined (HAVE_CONFIG_H) #include #endif @@ -229,7 +236,21 @@ int tty_cbreak(int fd){ buf.c_cc[VDSUSP] = _POSIX_VDISABLE; #endif - if(tcsetattr(fd, TCSAFLUSH, &buf) < 0) + /* enable flow control; only stty start char can restart output */ +#if 0 + buf.c_iflag |= (IXON|IXOFF); +#ifdef IXANY + buf.c_iflag &= ~IXANY; +#endif +#endif + + /* disable flow control; let ^S and ^Q through to pty */ + buf.c_iflag &= ~(IXON|IXOFF); +#ifdef IXANY + buf.c_iflag &= ~IXANY; +#endif + + if(tcsetattr(fd, TCSAFLUSH, &buf) < 0) return -1; ttystate = TCBREAK; @@ -246,6 +267,23 @@ int tty_cbreak(int fd){ return (0); } +int +tty_off_xon_xoff (int fd) +{ + struct termios buf; + int ttysavefd = -1; + + if(tcgetattr(fd, &buf) < 0) + return -1; + + buf.c_iflag &= ~(IXON|IXOFF); + + if(tcsetattr(fd, TCSAFLUSH, &buf) < 0) + return -1; + + return 0; +} + /* tty_reset: Sets the terminal attributes back to their previous state. * PRE: tty_cbreak must have already been called. * @@ -253,7 +291,8 @@ int tty_cbreak(int fd){ * * Returns: 0 on success, -1 on error */ -int tty_reset(int fd){ +int tty_reset(int fd) +{ if(ttystate != TCBREAK) return (0); @@ -273,6 +312,10 @@ main() if (val == -1) return -1; + val = tty_off_xon_xoff (masterfd); + if (val == -1) + return -1; + val = init_readline (slavefd, slavefd); if (val == -1) return -1; diff --git a/sig.c b/sig.c index 15af34a..cf2de2e 100644 --- a/sig.c +++ b/sig.c @@ -413,10 +413,14 @@ sighandler termination_unwind_protect (sig) int sig; { + /* I don't believe this condition ever tests true. */ if (sig == SIGINT && signal_is_trapped (SIGINT)) run_interrupt_trap (); #if defined (HISTORY) + /* This might be unsafe, since it eventually calls functions POSIX says + not to call from signal handlers. If it's a problem, take this code + out. */ if (interactive_shell && sig != SIGABRT) maybe_save_shell_history (); #endif /* HISTORY */ -- 2.7.4