From: Chet Ramey Date: Fri, 9 Dec 2011 01:18:59 +0000 (-0500) Subject: commit bash-20091022 snapshot X-Git-Tag: bash-4.3-alpha~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b06e584e05571ead82fa569df3a2f49a199d94b0;p=thirdparty%2Fbash.git commit bash-20091022 snapshot --- diff --git a/COMPAT b/COMPAT index c635c8a13..63940e6d7 100644 --- a/COMPAT +++ b/COMPAT @@ -323,3 +323,6 @@ bash-2.0 were significant.) search the current directory for its filename argument, even if "." is not in $PATH. Posix says that the shell shouldn't look in $PWD in this case. + +44. Bash-4.1 uses the current locale when comparing strings using the < and + > operators to the `[[' command. diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 4e80baf43..f06b996ce 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9071,3 +9071,27 @@ builtins/evalstring.c indicating a parse error, print a warning message if the conditions would require a posix-mode shell to abort (parse error in a `.' script or eval string) + + 10/19 + ----- +builtins/evalfile.c + - even if the `check binary' flag is not passed to _evalfile, return an + error after reading 128 null characters if called by `source', on + the assumption that it's probably a binary file. [This will be in + bash-4.1-beta] + + 10/24 + ----- +[bash-4.1-alpha released] + +bashline.c + - don't call command_substitution_completion_function if we're + completing a substring delimited by a single quote. Fixes bug + reported by bash-bugs@atu.cjb.net + +lib/readline/complete.c + - make sure _rl_skip_completed_text defaults to 0, as the + documentation states (incorrect in bash-4.1-alpha) + - in insert_match, skip over a close quote in the replacement text if + the character at point when completion is invoked is a single + quote. Fixes complaint from bash-bugs@atu.cjb.net diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index 7cb641080..cb8e985bb 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -9049,8 +9049,8 @@ parse.y execute_cmd.c - in execute_in_subshell, make sure we set setjmp(return_catch) before running the command, in case the command or its word expansion - calls jump_to_top_level. Fixes bug reported by Enrique Perez-Terron - + calls jump_to_top_level. Fixes bug reported by Nils Bernhard + subst.c - new PF_NOSPLIT2 flag for param_expand @@ -9071,3 +9071,27 @@ builtins/evalstring.c indicating a parse error, print a warning message if the conditions would require a posix-mode shell to abort (parse error in a `.' script or eval string) + + 10/19 + ----- +builtins/evalfile.c + - even if the `check binary' flag is not passed to _evalfile, return an + error after reading 128 null characters if called by `source', on + the assumption that it's probably a binary file. [This will be in + bash-4.1-beta] + + 10/24 + ----- +[bash-4.1-alpha released] + +bashline.c + - don't call command_substitution_completion_function if we're + completing a substring delimited by a single quote. Fixes bug + reported by bash-bugs@atu.cjb.net + +lib/readline/complete.c + - make sure _rl_skip_completed_text defaults to 0, as the + documentation states (incorrect in bash-4.1-alpha) + - in insert_match, skip over a close quote in the replacement text if + the character at point when completion is invoked is a single + quote diff --git a/MANIFEST b/MANIFEST index 284dd0e0f..c8d5c2e15 100644 --- a/MANIFEST +++ b/MANIFEST @@ -488,6 +488,8 @@ po/fi.gmo f po/fi.po f po/fr.gmo f po/fr.po f +po/ga.gmo f +po/ga.po f po/hu.gmo f po/hu.po f po/id.gmo f diff --git a/MANIFEST~ b/MANIFEST~ index 707c7a734..284dd0e0f 100644 --- a/MANIFEST~ +++ b/MANIFEST~ @@ -833,6 +833,7 @@ tests/exp.tests f tests/exp.right f tests/exp1.sub f tests/exp2.sub f +tests/exp3.sub f tests/extglob.tests f tests/extglob.right f tests/extglob1.sub f diff --git a/NEWS b/NEWS index 05573cca6..e7e02054b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,114 @@ +This is a terse description of the new features added to bash-4.1 since +the release of bash-4.0. As always, the manual page (doc/bash.1) is +the place to look for complete descriptions. + +1. New Features in Bash + +a. Here-documents within $(...) command substitutions may once more be + delimited by the closing right paren, instead of requiring a newline. + +b. Bash's file status checks (executable, readable, etc.) now take file + system ACLs into account on file systems that support them. + +c. Bash now passes environment variables with names that are not valid + shell variable names through into the environment passed to child + processes. + +d. The `execute-unix-command' readline function now attempts to clear and + reuse the current line rather than move to a new one after the command + executes. + +e. `printf -v' can now assign values to array indices. + +f. New `complete -E' and `compopt -E' options that work on the "empty" + completion: completion attempted on an empty command line. + +g. New complete/compgen/compopt -D option to define a `default' completion: + a completion to be invoked on command for which no completion has been + defined. If this function returns 124, programmable completion is + attempted again, allowing a user to dynamically build a set of completions + as completion is attempted by having the default completion function + install individual completion functions each time it is invoked. + +h. When displaying associative arrays, subscripts are now quoted. + +i. Changes to dabbrev-expand to make it more `emacs-like': no space appended + after matches, completions are not sorted, and most recent history entries + are presented first. + +j. The [[ and (( commands are now subject to the setting of `set -e' and the + ERR trap. + +k. The source/. builtin now removes NUL bytes from the file before attempting + to parse commands. + +l. There is a new configuration option (in config-top.h) that forces bash to + forward all history entries to syslog. + +m. A new variable $BASHOPTS to export shell options settable using `shopt' to + child processes. + +n. There is a new confgure option that forces the extglob option to be + enabled by default. + +o. New variable $BASH_XTRACEFD; when set to an integer bash will write xtrace + output to that file descriptor. + +p. If the optional left-hand-side of a redirection is of the form {var}, the + shell assigns the file descriptor used to $var or uses $var as the file + descriptor to move or close, depending on the redirection operator. + +q. The < and > operators to the [[ conditional command now do string + comparison according to the current locale. + +r. Programmable completion now uses the completion for `b' instead of `a' + when completion is attempted on a line like: a $(b c. + +s. Force extglob on temporarily when parsing the pattern argument to + the == and != operators to the [[ command, for compatibility. + +t. Changed the behavior of interrupting the wait builtin when a SIGCHLD is + received and a trap on SIGCHLD is set to be Posix-mode only. + +u. The read builtin has a new `-N nchars' option, which reads exactly NCHARS + characters, ignoring delimiters like newline. + +2. New Features in Readline + +a. New bindable function: menu-complete-backward. + +b. In the vi insertion keymap, C-n is now bound to menu-complete by default, + and C-p to menu-complete-backward. + +c. When in vi command mode, repeatedly hitting ESC now does nothing, even + when ESC introduces a bound key sequence. This is closer to how + historical vi behaves. + +d. New bindable function: skip-csi-sequence. Can be used as a default to + consume key sequences generated by keys like Home and End without having + to bind all keys. + +e. New application-settable function: rl_filename_rewrite_hook. Can be used + to rewite or modify filenames read from the file system before they are + compared to the word to be completed. + +f. New bindable variable: skip-completed-text, active when completing in the + middle of a word. If enabled, it means that characters in the completion + that match characters in the remainder of the word are "skipped" rather + than inserted into the line. + +g. The pre-readline-6.0 version of menu completion is available as + "old-menu-complete" for users who do not like the readline-6.0 version. + +h. New bindable variable: echo-control-characters. If enabled, and the + tty ECHOCTL bit is set, controls the echoing of characters corresponding + to keyboard-generated signals. + +i. New bindable variable: enable-meta-key. Controls whether or not readline + sends the smm/rmm sequences if the terminal indicates it has a meta key + that enables eight-bit characters. + +------------------------------------------------------------------------------- This is a terse description of the new features added to bash-4.0 since the release of bash-3.2. As always, the manual page (doc/bash.1) is the place to look for complete descriptions. diff --git a/README b/README index 2d43cea62..73bb5f3de 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ Introduction ============ -This is GNU Bash, version 4.0. Bash is the GNU Project's Bourne +This is GNU Bash, version 4.1. Bash is the GNU Project's Bourne Again SHell, a complete implementation of the POSIX.2 shell spec, but also with interactive command line editing, job control on architectures that support it, csh-like features such as history diff --git a/bashline.c b/bashline.c index d7a309c6f..7658771eb 100644 --- a/bashline.c +++ b/bashline.c @@ -1315,8 +1315,9 @@ attempt_shell_completion (text, start, end) /* Special handling for command substitution. If *TEXT is a backquote, it can be the start or end of an old-style command substitution, or unmatched. If it's unmatched, both calls to unclosed_pair will - succeed. */ - if (*text == '`' && + succeed. Don't bother if readline found a single quote and we are + completing on the substring. */ + if (*text == '`' && rl_completion_quote_character != '\'' && (in_command_position || (unclosed_pair (rl_line_buffer, start, "`") && unclosed_pair (rl_line_buffer, end, "`")))) matches = rl_completion_matches (text, command_subst_completion_function); diff --git a/bashline.c~ b/bashline.c~ index 1e0f8e3d6..d7a309c6f 100644 --- a/bashline.c~ +++ b/bashline.c~ @@ -1197,7 +1197,7 @@ find_cmd_start (start) register int s, os; os = 0; - while (((s = skip_to_delim (rl_line_buffer, os, COMMAND_SEPARATORS, SD_NOJMP)) <= start) && + while (((s = skip_to_delim (rl_line_buffer, os, COMMAND_SEPARATORS, SD_NOJMP|SD_NOSKIPCMD)) <= start) && rl_line_buffer[s]) os = s+1; return os; diff --git a/builtins/evalfile.c b/builtins/evalfile.c index 1b6b8c94f..972d03932 100644 --- a/builtins/evalfile.c +++ b/builtins/evalfile.c @@ -81,7 +81,7 @@ _evalfile (filename, flags) { volatile int old_interactive; procenv_t old_return_catch; - int return_val, fd, result, pflags, i; + int return_val, fd, result, pflags, i, nnull; ssize_t nr; /* return value from read(2) */ char *string; struct stat finfo; @@ -189,11 +189,20 @@ file_error_and_exit: i = strlen (string); if (i < nr) { - for (i = 0; i < nr; i++) + for (nnull = i = 0; i < nr; i++) if (string[i] == '\0') { memmove (string+i, string+i+1, nr - i); nr--; + /* Even if the `check binary' flag is not set, we want to avoid + sourcing files with more than 256 null characters -- that + probably indicates a binary file. */ + if ((flags & FEVAL_BUILTIN) && ++nnull > 256) + { + free (string); + (*errfunc) (_("%s: cannot execute binary file"), filename); + return ((flags & FEVAL_BUILTIN) ? EX_BINARY_FILE : -1); + } } } diff --git a/lib/readline/complete.c b/lib/readline/complete.c index ea2c864de..9ba54268b 100644 --- a/lib/readline/complete.c +++ b/lib/readline/complete.c @@ -183,7 +183,7 @@ int rl_visible_stats = 0; characters from the match that match characters following point in the word. This means, for instance, completing when the cursor is after the `e' in `Makefile' won't result in `Makefilefile'. */ -int _rl_skip_completed_text = 1; +int _rl_skip_completed_text = 0; /* If non-zero, then this is the address of a function to call when completing on a directory name. The function is called with @@ -1570,7 +1570,7 @@ insert_match (match, start, mtype, qc) { char *replacement, *r; char oqc; - int end; + int end, rlen; oqc = qc ? *qc : '\0'; replacement = make_quoted_replacement (match, mtype, qc); @@ -1578,6 +1578,7 @@ insert_match (match, start, mtype, qc) /* Now insert the match. */ if (replacement) { + rlen = strlen (replacement); /* Don't double an opening quote character. */ if (qc && *qc && start && rl_line_buffer[start - 1] == *qc && replacement[0] == *qc) @@ -1588,6 +1589,9 @@ insert_match (match, start, mtype, qc) replacement[0] != oqc) start--; end = rl_point - 1; + /* Don't double a closing quote character */ + if (qc && *qc && end && rl_line_buffer[rl_point] == *qc && replacement[rlen - 1] == *qc) + end++; if (_rl_skip_completed_text) { r = replacement; diff --git a/lib/readline/complete.c~ b/lib/readline/complete.c~ index 0aa714f90..913c8dec1 100644 --- a/lib/readline/complete.c~ +++ b/lib/readline/complete.c~ @@ -183,7 +183,7 @@ int rl_visible_stats = 0; characters from the match that match characters following point in the word. This means, for instance, completing when the cursor is after the `e' in `Makefile' won't result in `Makefilefile'. */ -int _rl_skip_completed_text = 1; +int _rl_skip_completed_text = 0; /* If non-zero, then this is the address of a function to call when completing on a directory name. The function is called with @@ -1570,7 +1570,7 @@ insert_match (match, start, mtype, qc) { char *replacement, *r; char oqc; - int end, ostart; + int end; oqc = qc ? *qc : '\0'; replacement = make_quoted_replacement (match, mtype, qc); @@ -2226,12 +2226,12 @@ rl_filename_completion_function (text, state) } /* An initial implementation of a menu completion function a la tcsh. The - first time (if the last readline command was not rl_menu_complete), we + first time (if the last readline command was not rl_old_menu_complete), we generate the list of matches. This code is very similar to the code in rl_complete_internal -- there should be a way to combine the two. Then, for each item in the list of matches, we insert the match in an undoable fashion, with the appropriate character appended (this happens on the - second and subsequent consecutive calls to rl_menu_complete). When we + second and subsequent consecutive calls to rl_old_menu_complete). When we hit the end of the match list, we restore the original unmatched text, ring the bell, and reset the counter to zero. */ int @@ -2251,7 +2251,7 @@ rl_old_menu_complete (count, invoking_key) /* The first time through, we generate the list of matches and set things up to insert them. */ - if (rl_last_func != rl_menu_complete) + if (rl_last_func != rl_old_menu_complete) { /* Clean up from previous call, if any. */ FREE (orig_text); diff --git a/lib/sh/fnxform.c b/lib/sh/fnxform.c index 55281b0a6..499b9cb9d 100644 --- a/lib/sh/fnxform.c +++ b/lib/sh/fnxform.c @@ -185,7 +185,6 @@ char * fnx_tofs (string) char *string; { -bar return string; } diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 72ec06a2c..3efcf32d6 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/bash/bash-current +BUILD_DIR=/usr/local/build/chet/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR diff --git a/tests/exec.right b/tests/exec.right index 8f974ae59..2146d4720 100644 --- a/tests/exec.right +++ b/tests/exec.right @@ -16,17 +16,17 @@ after exec1.sub without args: 0 126 ./execscript: line 46: .: /: is a directory 1 -127 +126 0 this is bashenv ./exec3.sub: line 3: /tmp/bash-notthere: No such file or directory ./exec3.sub: line 3: exec: /tmp/bash-notthere: cannot execute: No such file or directory 126 -./execscript: line 68: notthere: No such file or directory +./execscript: line 70: notthere: No such file or directory 127 -./execscript: line 71: notthere: No such file or directory +./execscript: line 73: notthere: No such file or directory 127 -./execscript: line 74: notthere: No such file or directory +./execscript: line 76: notthere: No such file or directory 127 this is sh this is sh diff --git a/tests/execscript b/tests/execscript index 5e11e235d..3629c57a9 100644 --- a/tests/execscript +++ b/tests/execscript @@ -48,6 +48,8 @@ echo $? # try sourcing a binary file -- post-2.04 versions don't do the binary file # check, and will probably fail with `command not found', or status 127 +# bash-4.1 and later check for 256 NUL characters and fail as binary files +# if there are more than that, it's probably binary . ${THIS_SH} 2>/dev/null echo $? diff --git a/tests/redir8.sub b/tests/redir8.sub index 7990a4afb..5f972a14d 100644 --- a/tests/redir8.sub +++ b/tests/redir8.sub @@ -1,3 +1,4 @@ +cd ${TMPDIR:=/var/tmp} rm -f u ${THIS_SH} -c 'exec 10>&1; echo fd 10 >&10' 10>u