From 3a7c642e223ec260042bfecc12da49717ae77d76 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Mon, 16 Dec 2019 09:43:38 -0500 Subject: [PATCH] commit bash-20191213 snapshot --- CHANGES | 46 +++++++++--------- COMPAT | 2 +- CWRU/CWRU.chlog | 37 +++++++++++++++ NEWS | 12 ++--- bashline.c | 20 ++++++-- bashline.h | 44 +++++++++--------- builtins/bind.def | 27 ++++++++++- builtins/fc.def | 2 +- builtins/gen-helpfiles.c | 2 +- config-bot.h | 2 +- examples/functions/autoload.v2 | 2 +- examples/functions/autoload.v4 | 8 ++-- examples/functions/csh-compat | 2 +- examples/functions/sort-pos-params | 2 +- examples/loadables/README | 2 +- examples/loadables/realpath.c | 2 +- examples/loadables/setpgid.c | 2 +- examples/loadables/tee.c | 2 +- examples/startup-files/Bash_aliases | 2 +- execute_cmd.c | 2 +- execute_cmd.h | 4 +- expr.c | 2 +- include/posixdir.h | 2 +- lib/readline/doc/hsuser.texi | 2 +- lib/readline/doc/rltech.texi | 6 +-- lib/readline/examples/fileman.c | 2 +- lib/readline/histexpand.c | 2 +- lib/readline/isearch.c | 7 ++- lib/readline/posixdir.h | 72 ++++++++++++++++++++++++++++- lib/readline/posixdir.h~ | 1 + lib/readline/rlmbutil.h | 2 +- lib/readline/signals.c | 2 +- lib/sh/pathcanon.c | 2 +- lib/sh/strftime.c | 6 +-- lib/sh/stringvec.c | 2 - subst.h | 4 +- support/man2html.c | 6 +-- support/shobj-conf | 42 +---------------- tests/array.tests | 4 +- tests/assoc.tests | 2 +- tests/builtins.tests | 4 +- tests/dbg-support.tests | 2 +- tests/dstack.tests | 2 +- tests/errors.tests | 2 +- tests/new-exp2.sub | 2 +- tests/source5.sub | 2 +- tests/varenv.tests | 2 +- tests/varenv14.sub | 2 +- variables.c | 10 ++-- variables.h | 2 +- 50 files changed, 268 insertions(+), 154 deletions(-) mode change 120000 => 100644 lib/readline/posixdir.h create mode 120000 lib/readline/posixdir.h~ diff --git a/CHANGES b/CHANGES index 262fd656..a90dfd7a 100644 --- a/CHANGES +++ b/CHANGES @@ -79,7 +79,7 @@ d. Fixed a problem with using `*' and `@' as subscripts when assigning values e. Fixed a bug that could cause a huge memory allocation when completing a word beginning with an invalid tilde expansion. -f. Cleaned up some incompatiblities with bash-4.4 when expanding indexed array +f. Cleaned up some incompatibilities with bash-4.4 when expanding indexed array subscripts used in arithmetic expansions when assoc_expand_once is enabled. g. The ${parameter@a} expansion will display attributes even if `parameter' is @@ -731,7 +731,7 @@ h. The `name' argument to the `coproc' reserved word now undergoes word i. A nameref name resolution loop in a function now resolves to a variable by that name in the global scope. -j. The `wait' builtin now has a `-f' option, which signfies to wait until the +j. The `wait' builtin now has a `-f' option, which signifies to wait until the specified job or process terminates, instead of waiting until it changes state. @@ -1374,7 +1374,7 @@ j. Fixed a bug involving sign extension when reallocating the input line k. Bash now does a better job at identifying syntax errors during word completion and tailoring completion appropriately. -l. Bash now uses the current locale's decimal point in comamnd timing output. +l. Bash now uses the current locale's decimal point in command timing output. m. Fixed a bug that caused segmentation faults while reading here documents if PS2 contains a command substitution. @@ -1417,7 +1417,7 @@ x. Fixed a bug that caused the shell to exit with the wrong (but non-zero) y. Fixed a bug that caused the `time' reserved word to not be recognized as such in all contexts where it should have been. -z. Fixed a bug that caused the shell to close process subsitution file +z. Fixed a bug that caused the shell to close process substitution file descriptors when executing a script without the `#!' leading line. aa. Fixed a typo that caused the `compat42' shell option to set the wrong @@ -1814,7 +1814,7 @@ bb. Aliases whose value ends in a shell metacharacter now expand in a way to 4. New Features in Readline -a. The history truncation code now uses the same error recovery mechansim as +a. The history truncation code now uses the same error recovery mechanism as the history writing code, and restores the old version of the history file on error. The error recovery mechanism handles symlinked history files. @@ -2151,7 +2151,7 @@ c. Fixed a bug that caused the pattern removal and pattern substitution word expansions and case statement word expansion to not match the empty string. d. Fixed a bug that caused the tzset() function to not work after changing - the TZ enviroment variable. + the TZ environment variable. e. Fixed a bug that caused the RHS of an assignment statement to undergo word splitting when it contained an unquoted $@. @@ -2202,7 +2202,7 @@ t. Fixed a problem with the bash malloc's internal idea of the top of the memory heap that resulted in incorrect decisions to try to reduce the break and give memory back to the kernel. -u. There are changes to the expansions peformed on compound array assignments, +u. There are changes to the expansions performed on compound array assignments, in an effort to make foo=( [ind1]=bar [ind2]=baz ) identical to foo[ind1]=bar foo[ind2]=baz. @@ -3204,7 +3204,7 @@ j. Fixed a bug in brace expansion that caused unwanted zero padding of the k. Fixed a bug that prevented the |& construct from working as intended when used with a simple command with additional redirections. -l. Fixed a bug with the case statment ;& terminator that caused the shell to +l. Fixed a bug with the case statement ;& terminator that caused the shell to dereference a NULL pointer. m. Fixed a bug that caused assignment statements or redirections preceding @@ -3937,7 +3937,7 @@ l. Fixed a bug in the code that buffers characters received very quickly in succession which caused characters to be dropped. m. Fixed a bug that caused readline to reference uninitialized data structures - if it received a SIGWINCH before completing initialzation. + if it received a SIGWINCH before completing initialization. n. Fixed a bug that caused the vi-mode `last command' to be set incorrectly and therefore unrepeatable. @@ -4269,7 +4269,7 @@ x. Fixed a bug that caused the shell to dump core when performing filename y. Returned to the original Bourne shell rules for parsing ``: no recursive parsing of embedded quoted strings or ${...} constructs. -z. The inheritence of the DEBUG, RETURN, and ERR traps is now dependent only +z. The inheritance of the DEBUG, RETURN, and ERR traps is now dependent only on the settings of the `functrace' and `errtrace' shell options, rather than whether or not the shell is in debugging mode. @@ -4504,7 +4504,7 @@ and the previous version, bash-3.1-alpha1. a. Added some system-specific signal names. b. Fixed a typo in the ulimit builtin to make `x' the right option to - maniuplate the limit on file locks. + manipulate the limit on file locks. c. Fixed a problem with using += to append to index 0 of an array variable when not using subscript syntax. @@ -5205,7 +5205,7 @@ y. Fixed a problem that could cause here documents to not be created correctly 2. Changes to Readline a. Change to history expansion functions to treat `^' as equivalent to word - one, as the documention states. + one, as the documentation states. b. Some changes to the display code to improve display and redisplay of multibyte characters. @@ -5822,7 +5822,7 @@ c. Fixed a problem which caused the display to be messed up when the last line of a multi-line prompt (possibly containing invisible characters) was longer than the screen width. -d. Fixed a problem with the vi-mode `r' command that ocurred on systems with +d. Fixed a problem with the vi-mode `r' command that occurred on systems with support for multibyte characters when running in a locale without any multibyte characters. @@ -6235,7 +6235,7 @@ l. The `printf' builtin now handles the `ll' and `j' length modifiers passed to printf(3). m. Renamed a number of the bash-specific autoconf macros in aclocal.m4 to - have more sytematic naming, with accompanying changes to configure.in. + have more systematic naming, with accompanying changes to configure.in. n. Fixed snprintf to handle long doubles and the %a/%A conversions by falling back to sprintf, as long as sprintf supports them. @@ -6348,7 +6348,7 @@ and the previous version, bash-2.05a-alpha1. 1. Changes to Bash -a. Fixed a bug in the evalution of arithmetic `for' statements when the +a. Fixed a bug in the evaluation of arithmetic `for' statements when the expanded expression is NULL. b. Fixed an unassigned variable problem in the redirection printing code. @@ -6404,7 +6404,7 @@ o. `umask' now prints four digits when printing in octal mode, for p. Lots of changes to the `printf' builtin from Paul Eggert: it handles `L' formats and long doubles better, and internal functions have been - simpified where appropriate. + simplified where appropriate. q. Some `time_t' fixes for machines were a time_t is bigger than a long. @@ -6477,7 +6477,7 @@ c. `ulimit' prints `hard' or `soft' when a value is not `unlimited' but is a. New bindable variable `history-preserve-point'. If set, the history code attempts to place the user at the same location on each history - line retrived with previous-history or next-history. + line retrieved with previous-history or next-history. ------------------------------------------------------------------------------ This document details the changes between this version, bash-2.05a-alpha1, @@ -6544,9 +6544,9 @@ v. Fixes, mostly from Paul Eggert, for a few possible buffer overflows in w. Fixes from Paul Eggert to avoid most of the type casts in the shell code, and use more appropriate types for a number of variables. -x. Command substition no longer inherits the DEBUG trap. +x. Command substitution no longer inherits the DEBUG trap. -y. Some fixes to the process substition code on machines without /dev/fd so +y. Some fixes to the process substitution code on machines without /dev/fd so that named pipes are not removed inappropriately. z. The loadable `getconf' builtin is now much more complete, and will become @@ -6943,7 +6943,7 @@ g. Renamed rltty_set_default_bindings to rl_tty_set_default_bindings and a. A new loadable builtin, realpath, which canonicalizes and expands symlinks in pathname arguments. -b. When `set' is called without options, it prints function defintions in a +b. When `set' is called without options, it prints function definitions in a way that allows them to be reused as input. This affects `declare' and `declare -p' as well. @@ -7702,7 +7702,7 @@ m. Improvements were made to the `read' builtin so that it makes many n. The expansion of $- will include `c' and `s' when those options are supplied at shell invocation. -o. Several improvments were made to the completion code: variable completion +o. Several improvements were made to the completion code: variable completion now works better when there are unterminated expansions, command completion understands quotes better, and completion now works in certain unclosed $(... constructs. @@ -7790,7 +7790,7 @@ d. There is a new shell option, no_empty_command_completion, which, when enabled, disables command completion when TAB is typed on an empty line. e. The `help' builtin has a `-s' option to just print a builtin's usage - synopsys. + synopsis. f. There are several new arithmetic operators: id++, id-- (variable post-increment/decrement), ++id, --id (variabl pre-increment/decrement), @@ -9674,5 +9674,5 @@ b. A bug encountered when expand-tilde was enabled and file completion was c. A slight change was made to the incremental search termination behavior. ESC still terminates the search, but if input is pending or arrives within 0.1 seconds (on systems with select(2)), it is used as a prefix - character. This is intented to allow users to terminate searches with + character. This is intended to allow users to terminate searches with the arrow keys and get the behavior they expect. diff --git a/COMPAT b/COMPAT index ce6a791c..1b25c064 100644 --- a/COMPAT +++ b/COMPAT @@ -292,7 +292,7 @@ above. 36. Bash-4.0 now allows process substitution constructs to pass unchanged through brace expansion, so any expansion of the contents will have to be - separately specified, and each process subsitution will have to be + separately specified, and each process substitution will have to be separately entered. 37. Bash-4.0 now allows SIGCHLD to interrupt the wait builtin, as Posix diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 0de1c9d7..57271429 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -7003,3 +7003,40 @@ lib/readline/display.c lib/readline/display.c - ADJUST_CPOS: define macro and use it in places where _rl_last_c_pos is changed + + 12/12 + ----- +lib/readline/isearch.c + - _rl_isearch_dispatch: check for multibyte characters mapped to one + of the editing functions we treat specially to modify the search + string + + 12/13 + ----- +support/shobj-conf + - FreeBSD and Dragonfly are ELF-only and can use the same code as + Linux, so add those to the linux stanza and remove the old FreeBSD + version-specific sections. Report and fix from Baptiste Daroussin + + +bashline.[ch] + - bash_execute_unix_command: no longer static, available for other + parts of the shell to use + +bashline.c + - unbind_unix_command: take a key sequence as an argument, and unbind + it in the appropriate unix command keymap + +builtins/bind.def + - unbind_keyseq: if we are unbinding a key sequence bound to + bash_execute_unix_command, which means it was added by `bind -x', + call unbind_unix_command() to remove it from the appropriate unix + command keymap. Fixes issue originally raised by + Koichi Murase and recently by + Šimon Let + - bind_builtin: check the number of bindings to bash_execute_unix_command + before and after a call to rl_parse_and_bind and if there are fewer + after binding, we know that the bind has re-bound one of the key + sequences that was bound to execute a shell command. We unbind any + key sequences from the list before the call to rl_parse_and_bind that + don't appear in the list after the call using unbind_unix_command diff --git a/NEWS b/NEWS index 9e4570b2..11968455 100644 --- a/NEWS +++ b/NEWS @@ -29,7 +29,7 @@ h. The `name' argument to the `coproc' reserved word now undergoes word i. A nameref name resolution loop in a function now resolves to a variable by that name in the global scope. -j. The `wait' builtin now has a `-f' option, which signfies to wait until the +j. The `wait' builtin now has a `-f' option, which signifies to wait until the specified job or process terminates, instead of waiting until it changes state. @@ -328,7 +328,7 @@ rr. Bash now uses mktemp() when creating internal temporary files; it produces 2. New Features in Readline -a. The history truncation code now uses the same error recovery mechansim as +a. The history truncation code now uses the same error recovery mechanism as the history writing code, and restores the old version of the history file on error. The error recovery mechanism handles symlinked history files. @@ -1549,7 +1549,7 @@ e. The history expansion code now allows any character to terminate a f. New bindable variable `history-preserve-point'. If set, the history code attempts to place the user at the same location on each history - line retrived with previous-history or next-history. + line retrieved with previous-history or next-history. ------------------------------------------------------------------------------- This is a terse description of the new features added to bash-2.05 since @@ -1578,7 +1578,7 @@ c. `complete' and `compgen' now take a `-o value' option, which controls some d. A new loadable builtin, realpath, which canonicalizes and expands symlinks in pathname arguments. -e. When `set' is called without options, it prints function defintions in a +e. When `set' is called without options, it prints function definitions in a way that allows them to be reused as input. This affects `declare' and `declare -p' as well. This only happens when the shell is not in POSIX mode, since POSIX.2 forbids this behavior. @@ -1989,7 +1989,7 @@ p. The shell now supports integer-indexed arrays of unlimited length, q. ${!var}: indirect variable expansion, equivalent to eval \${$var}. -r. ${paramter:offset[:length]}: variable substring extraction. +r. ${parameter:offset[:length]}: variable substring extraction. s. ${parameter/pattern[/[/]string]}: variable pattern substitution. @@ -2113,7 +2113,7 @@ iii. Changes to Posix mode: any symbolic links. o A non-interactive shell exits if a variable assignment error occurs when no command name follows the assignment statements. - o A non-interactive shell exits if the interation variable in a + o A non-interactive shell exits if the iteration variable in a `for' statement or the selection variable in a `select' statement is read-only or another variable assignment error occurs. o The `<>' redirection operator now opens a file for both stdin and diff --git a/bashline.c b/bashline.c index e992c64b..419986eb 100644 --- a/bashline.c +++ b/bashline.c @@ -201,7 +201,6 @@ static int putx PARAMS((int)); static Keymap get_cmd_xmap_from_edit_mode PARAMS((void)); static Keymap get_cmd_xmap_from_keymap PARAMS((Keymap)); -static int bash_execute_unix_command PARAMS((int, int)); static void init_unix_command_map PARAMS((void)); static int isolate_sequence PARAMS((char *, int, int, int *)); @@ -297,7 +296,7 @@ int dircomplete_expand_relpath = 0; /* When non-zero, perform `normal' shell quoting on completed filenames even when the completed name contains a directory name with a shell - variable referene, so dollar signs in a filename get quoted appropriately. + variable reference, so dollar signs in a filename get quoted appropriately. Set to zero to remove dollar sign (and braces or parens as needed) from the set of characters that will be quoted. */ int complete_fullquote = 1; @@ -4266,7 +4265,7 @@ putx(c) #endif } -static int +int bash_execute_unix_command (count, key) int count; /* ignored */ int key; @@ -4539,6 +4538,21 @@ bind_keyseq_to_unix_command (line) return 0; } +int +unbind_unix_command (kseq) + char *kseq; +{ + Keymap cmd_xmap; + + cmd_xmap = get_cmd_xmap_from_keymap (rl_get_keymap ()); + if (rl_bind_keyseq_in_map (kseq, (rl_command_func_t *)NULL, cmd_xmap) != 0) + { + builtin_error (_("`%s': cannot unbind in command keymap"), kseq); + return 0; + } + return 1; +} + /* Used by the programmable completion code. Complete TEXT as a filename, but return only directories as matches. Dequotes the filename before attempting to find matches. */ diff --git a/bashline.h b/bashline.h index 2571e11f..48c9fecf 100644 --- a/bashline.h +++ b/bashline.h @@ -1,6 +1,6 @@ /* bashline.h -- interface to the bash readline functions in bashline.c. */ -/* Copyright (C) 1993-2009 Free Software Foundation, Inc. +/* Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -35,33 +35,35 @@ extern int dircomplete_expand; extern int dircomplete_expand_relpath; extern int complete_fullquote; -extern void posix_readline_initialize __P((int)); -extern void reset_completer_word_break_chars __P((void)); -extern int enable_hostname_completion __P((int)); -extern void initialize_readline __P((void)); -extern void bashline_reset __P((void)); -extern void bashline_reinitialize __P((void)); -extern int bash_re_edit __P((char *)); +extern void posix_readline_initialize PARAMS((int)); +extern void reset_completer_word_break_chars PARAMS((void)); +extern int enable_hostname_completion PARAMS((int)); +extern void initialize_readline PARAMS((void)); +extern void bashline_reset PARAMS((void)); +extern void bashline_reinitialize PARAMS((void)); +extern int bash_re_edit PARAMS((char *)); -extern void bashline_set_event_hook __P((void)); -extern void bashline_reset_event_hook __P((void)); +extern void bashline_set_event_hook PARAMS((void)); +extern void bashline_reset_event_hook PARAMS((void)); -extern int bind_keyseq_to_unix_command __P((char *)); -extern int print_unix_command_map __P((void)); +extern int bind_keyseq_to_unix_command PARAMS((char *)); +extern int bash_execute_unix_command PARAMS((int, int)); +extern int print_unix_command_map PARAMS((void)); +extern int unbind_unix_command PARAMS((char *)); -extern char **bash_default_completion __P((const char *, int, int, int, int)); +extern char **bash_default_completion PARAMS((const char *, int, int, int, int)); -void set_directory_hook __P((void)); +void set_directory_hook PARAMS((void)); /* Used by programmable completion code. */ -extern char *command_word_completion_function __P((const char *, int)); -extern char *bash_groupname_completion_function __P((const char *, int)); -extern char *bash_servicename_completion_function __P((const char *, int)); +extern char *command_word_completion_function PARAMS((const char *, int)); +extern char *bash_groupname_completion_function PARAMS((const char *, int)); +extern char *bash_servicename_completion_function PARAMS((const char *, int)); -extern char **get_hostname_list __P((void)); -extern void clear_hostname_list __P((void)); +extern char **get_hostname_list PARAMS((void)); +extern void clear_hostname_list PARAMS((void)); -extern char **bash_directory_completion_matches __P((const char *)); -extern char *bash_dequote_text __P((const char *)); +extern char **bash_directory_completion_matches PARAMS((const char *)); +extern char *bash_dequote_text PARAMS((const char *)); #endif /* _BASHLINE_H_ */ diff --git a/builtins/bind.def b/builtins/bind.def index 5290592d..ea1f47cf 100644 --- a/builtins/bind.def +++ b/builtins/bind.def @@ -277,7 +277,28 @@ bind_builtin (list) /* Process the rest of the arguments as binding specifications. */ while (list) { + int olen, nlen, d, i; + char **obindings, **nbindings; + + obindings = rl_invoking_keyseqs (bash_execute_unix_command); + olen = obindings ? strvec_len (obindings) : 0; + rl_parse_and_bind (list->word->word); + + nbindings = rl_invoking_keyseqs (bash_execute_unix_command); + nlen = nbindings ? strvec_len (nbindings) : 0; + + if (nlen < olen) /* fewer bind -x bindings */ + for (d = olen - nlen, i = 0; i < olen && d > 0; i++) + if (nlen == 0 || strvec_search (nbindings, obindings[i]) >= 0) + { + unbind_unix_command (obindings[i]); + d--; + } + + strvec_dispose (obindings); + strvec_dispose (nbindings); + list = list->next; } @@ -348,6 +369,7 @@ unbind_keyseq (seq) { char *kseq; int kslen; + rl_command_func_t *f; kseq = (char *)xmalloc ((2 * strlen (seq)) + 1); if (rl_translate_keyseq (seq, kseq, &kslen)) @@ -356,7 +378,7 @@ unbind_keyseq (seq) builtin_error (_("`%s': cannot unbind"), seq); return EXECUTION_FAILURE; } - if (rl_function_of_keyseq_len (kseq, kslen, (Keymap)0, (int *)0) == 0) + if ((f = rl_function_of_keyseq_len (kseq, kslen, (Keymap)0, (int *)0)) == 0) { free (kseq); return (EXECUTION_SUCCESS); @@ -372,6 +394,9 @@ unbind_keyseq (seq) return (EXECUTION_FAILURE); } + if (f == bash_execute_unix_command) + unbind_unix_command (seq); + free (kseq); return (EXECUTION_SUCCESS); } diff --git a/builtins/fc.def b/builtins/fc.def index d6d00c2a..f7b1e0ec 100644 --- a/builtins/fc.def +++ b/builtins/fc.def @@ -452,7 +452,7 @@ fc_builtin (list) } #if defined (READLINE) - /* If we're executing as part of a dispatched readline commnand like + /* If we're executing as part of a dispatched readline command like {emacs,vi}_edit_and_execute_command, the readline state will indicate it. We could remove the partial command from the history, but ksh93 doesn't so we stay compatible. */ diff --git a/builtins/gen-helpfiles.c b/builtins/gen-helpfiles.c index fac34edf..93c3a5dd 100644 --- a/builtins/gen-helpfiles.c +++ b/builtins/gen-helpfiles.c @@ -102,7 +102,7 @@ int write_helpfiles __P((struct builtin *)); /* For each file mentioned on the command line, process it and write the information to STRUCTFILE and EXTERNFILE, while - creating the production file if neccessary. */ + creating the production file if necessary. */ int main (argc, argv) int argc; diff --git a/config-bot.h b/config-bot.h index 0589244f..b075c778 100644 --- a/config-bot.h +++ b/config-bot.h @@ -141,7 +141,7 @@ /* check multibyte capability for I18N code */ /************************************************/ -/* For platforms which support the ISO C amendement 1 functionality we +/* For platforms which support the ISO C amendment 1 functionality we support user defined character classes. */ /* Solaris 2.5 has a bug: must be included before . */ #if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) && defined (HAVE_LOCALE_H) diff --git a/examples/functions/autoload.v2 b/examples/functions/autoload.v2 index e8f34335..e29c6958 100644 --- a/examples/functions/autoload.v2 +++ b/examples/functions/autoload.v2 @@ -29,7 +29,7 @@ _aindex=0 # # Declare a function ($1) to be autoloaded from a file ($2) when it is first # called. This defines a `temporary' function that will `.' the file -# containg the real function definition, then execute that new definition with +# containing the real function definition, then execute that new definition with # the arguments given to this `fake' function. The autoload function defined # by the file and the file itself *must* be named identically. # diff --git a/examples/functions/autoload.v4 b/examples/functions/autoload.v4 index a172e612..7f60563b 100644 --- a/examples/functions/autoload.v4 +++ b/examples/functions/autoload.v4 @@ -383,7 +383,7 @@ OPTIONS 'theCharCount=\$(wc -c \$theFuncFile)' - for each funcion and + for each function and if \$theCharCount < \$AUTOLOAD_SHIM_OVERHEAD @@ -416,7 +416,7 @@ NOTES backticks or $(), or in a script that is not being sourced into the current environment. If you have not previously called the function in question at your command line or in a script that was sourced into - the current envirnoment, then the various subshells are going to + the current environment, then the various subshells are going to encounter the shim and replace with the real code before executing. Remember, however, that environment modifications that occur in a @@ -490,9 +490,9 @@ NOTES matter how hard you try, your autoloaded functions will be unavailable to you, even if you run 'autoload -x -f'. The typical condition for this is starting up not a subshell, but a brand new - DIFFERENT shell. And the typical example of this is git extentions. + DIFFERENT shell. And the typical example of this is git extensions. - At the time of this writing, git extentions work by taking a command + At the time of this writing, git extensions work by taking a command 'git foo' and looking for a file 'git-foo' on the path. 'git' then executes 'git-foo' in a new shell - it executes your command in /bin/sh. That's not a subshell of your process. It will not get your diff --git a/examples/functions/csh-compat b/examples/functions/csh-compat index b8dcf8f7..54c8488c 100644 --- a/examples/functions/csh-compat +++ b/examples/functions/csh-compat @@ -1,4 +1,4 @@ -# C-shell compatabilty package. +# C-shell compatibilty package. # setenv VAR VALUE function setenv () { diff --git a/examples/functions/sort-pos-params b/examples/functions/sort-pos-params index 3fbf7dba..95acd85f 100644 --- a/examples/functions/sort-pos-params +++ b/examples/functions/sort-pos-params @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Sort the positional paramters. +# Sort the positional parameters. # Make sure the positional parameters are passed as arguments to the function. # If -u is the first arg, remove duplicate array members. sort_posparams() diff --git a/examples/loadables/README b/examples/loadables/README index f9bcfac6..6820c960 100644 --- a/examples/loadables/README +++ b/examples/loadables/README @@ -41,7 +41,7 @@ without having to search for the right CFLAGS and LDFLAGS. basename.c Return non-directory portion of pathname. cat.c cat(1) replacement with no options - the way cat was intended. dirname.c Return directory portion of pathname. -fdflags.c Change the flag associated with one of bash's open file desriptors. +fdflags.c Change the flag associated with one of bash's open file descriptors. finfo.c Print file info. head.c Copy first part of files. hello.c Obligatory "Hello World" / sample loadable. diff --git a/examples/loadables/realpath.c b/examples/loadables/realpath.c index 9892ddb8..0974ac41 100644 --- a/examples/loadables/realpath.c +++ b/examples/loadables/realpath.c @@ -130,7 +130,7 @@ char *realpath_doc[] = { "Display the canonicalized version of each PATHNAME argument, resolving", "symbolic links. The -c option checks whether or not each resolved name", "exists. The -s option produces no output; the exit status determines the", - "valididty of each PATHNAME. The -v option produces verbose output. The", + "validity of each PATHNAME. The -v option produces verbose output. The", "exit status is 0 if each PATHNAME was resolved; non-zero otherwise.", (char *)NULL }; diff --git a/examples/loadables/setpgid.c b/examples/loadables/setpgid.c index 7da58f13..e56fd51e 100644 --- a/examples/loadables/setpgid.c +++ b/examples/loadables/setpgid.c @@ -105,7 +105,7 @@ const char *setpgid_doc[] = { "invoke the setpgid(2) system call", "", "Arguments:", - " pid : numeric process identifer, >= 0", + " pid : numeric process identifier, >= 0", " pgrpid: numeric process group identifier, >=0", "See the setpgid(2) manual page.", (const char *)NULL diff --git a/examples/loadables/tee.c b/examples/loadables/tee.c index 819d83ae..283f23f1 100644 --- a/examples/loadables/tee.c +++ b/examples/loadables/tee.c @@ -164,7 +164,7 @@ char *tee_doc[] = { "Duplicate standard output.", "", "Copy standard input to standard output, making a copy in each", - "filename argument. If the `-a' option is gived, the specified", + "filename argument. If the `-a' option is given, the specified", "files are appended to, otherwise they are overwritten. If the", "`-i' option is supplied, tee ignores interrupts.", (char *)NULL diff --git a/examples/startup-files/Bash_aliases b/examples/startup-files/Bash_aliases index bb9c01e4..2abb93ee 100644 --- a/examples/startup-files/Bash_aliases +++ b/examples/startup-files/Bash_aliases @@ -17,7 +17,7 @@ alias pu="pushd" alias po="popd" # -# Csh compatability: +# Csh compatibility: # alias unsetenv=unset function setenv () { diff --git a/execute_cmd.c b/execute_cmd.c index 21d45cf0..e0950e62 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -538,7 +538,7 @@ async_redirect_stdin () /* Execute the command passed in COMMAND, perhaps doing it asynchronously. COMMAND is exactly what read_command () places into GLOBAL_COMMAND. - ASYNCHROUNOUS, if non-zero, says to do this command in the background. + ASYNCHRONOUS, if non-zero, says to do this command in the background. PIPE_IN and PIPE_OUT are file descriptors saying where input comes from and where it goes. They can have the value of NO_PIPE, which means I/O is stdin/stdout. diff --git a/execute_cmd.h b/execute_cmd.h index 5ec0abef..4aada39d 100644 --- a/execute_cmd.h +++ b/execute_cmd.h @@ -44,7 +44,7 @@ struct execstate }; -/* Variables delared in execute_cmd.c, used by many other files */ +/* Variables declared in execute_cmd.c, used by many other files */ extern int return_catch_flag; extern int return_catch_value; extern volatile int last_command_exit_value; @@ -67,7 +67,7 @@ extern char *the_printed_command_except_trap; extern char *this_command_name; extern SHELL_VAR *this_shell_function; -/* Functions delared in execute_cmd.c, used by many other files */ +/* Functions declared in execute_cmd.c, used by many other files */ extern struct fd_bitmap *new_fd_bitmap __P((int)); extern void dispose_fd_bitmap __P((struct fd_bitmap *)); diff --git a/expr.c b/expr.c index b30050e3..6c147b79 100644 --- a/expr.c +++ b/expr.c @@ -1520,7 +1520,7 @@ evalerror (msg) Base may be >=2 and <=64. If base is <= 36, the numbers are drawn from [0-9][a-zA-Z], and lowercase and uppercase letters may be used - interchangably. If base is > 36 and <= 64, the numbers are drawn + interchangeably. If base is > 36 and <= 64, the numbers are drawn from [0-9][a-z][A-Z]_@ (a = 10, z = 35, A = 36, Z = 61, @ = 62, _ = 63 -- you get the picture). */ diff --git a/include/posixdir.h b/include/posixdir.h index 0921c5d7..af5be801 100644 --- a/include/posixdir.h +++ b/include/posixdir.h @@ -46,7 +46,7 @@ # define D_NAMLEN(d) ((d)->d_namlen) #endif /* !HAVE_DIRENT_H */ -/* The bash code fairly consistenly uses d_fileno; make sure it's available */ +/* The bash code fairly consistently uses d_fileno; make sure it's available */ #if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (HAVE_STRUCT_DIRENT_D_FILENO) # define d_fileno d_ino #endif diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi index b265ff53..998eb652 100644 --- a/lib/readline/doc/hsuser.texi +++ b/lib/readline/doc/hsuser.texi @@ -164,7 +164,7 @@ When editing is complete, the edited commands are echoed and executed. In the second form, @var{command} is re-executed after each instance of @var{pat} in the selected command is replaced by @var{rep}. -@var{command} is intepreted the same as @var{first} above. +@var{command} is interpreted the same as @var{first} above. A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so that typing @samp{r cc} runs the last command beginning with @code{cc} diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi index ff8bd04b..92125d76 100644 --- a/lib/readline/doc/rltech.texi +++ b/lib/readline/doc/rltech.texi @@ -2042,7 +2042,7 @@ remove any quote characters from the directory name, because its result will be passed directly to @code{opendir()}. The directory rewrite hook returns an integer that should be non-zero if -the function modfies its directory argument. +the function modifies its directory argument. The function should not modify the directory argument if it returns 0. @end deftypevar @@ -2054,7 +2054,7 @@ is passed to @code{stat()} to determine the file's type and characteristics. This function does not need to remove quote characters from the filename. The stat hook returns an integer that should be non-zero if -the function modfies its directory argument. +the function modifies its directory argument. The function should not modify the directory argument if it returns 0. @end deftypevar @@ -2648,7 +2648,7 @@ com_help (arg) if (!printed) @{ - printf ("No commands match `%s'. Possibilties are:\n", arg); + printf ("No commands match `%s'. Possibilities are:\n", arg); for (i = 0; commands[i].name; i++) @{ diff --git a/lib/readline/examples/fileman.c b/lib/readline/examples/fileman.c index c821df03..6391ae6b 100644 --- a/lib/readline/examples/fileman.c +++ b/lib/readline/examples/fileman.c @@ -417,7 +417,7 @@ com_help (arg) if (!printed) { - printf ("No commands match `%s'. Possibilties are:\n", arg); + printf ("No commands match `%s'. Possibilities are:\n", arg); for (i = 0; commands[i].name; i++) { diff --git a/lib/readline/histexpand.c b/lib/readline/histexpand.c index 0d6358df..b986dba0 100644 --- a/lib/readline/histexpand.c +++ b/lib/readline/histexpand.c @@ -89,7 +89,7 @@ char history_expansion_char = '!'; char history_subst_char = '^'; /* During tokenization, if this character is seen as the first character - of a word, then it, and all subsequent characters upto a newline are + of a word, then it, and all subsequent characters up to a newline are ignored. For a Bourne shell, this should be '#'. Bash special cases the interactive comment character to not be a comment delimiter. */ char history_comment_char = '\0'; diff --git a/lib/readline/isearch.c b/lib/readline/isearch.c index 058d0878..c8f60a01 100644 --- a/lib/readline/isearch.c +++ b/lib/readline/isearch.c @@ -391,7 +391,12 @@ add_character: /* Translate the keys we do something with to opcodes. */ if (c >= 0 && cxt->keymap[c].type == ISFUNC) { - f = cxt->keymap[c].function; + /* If we have a multibyte character, see if it's bound to something that + affects the search. */ + if (cxt->mb[1]) + f = rl_function_of_keyseq (cxt->mb, cxt->keymap, (int *)NULL); + else + f = cxt->keymap[c].function; if (f == rl_reverse_search_history) cxt->lastc = (cxt->sflags & SF_REVERSE) ? -1 : -2; diff --git a/lib/readline/posixdir.h b/lib/readline/posixdir.h deleted file mode 120000 index 8b163845..00000000 --- a/lib/readline/posixdir.h +++ /dev/null @@ -1 +0,0 @@ -../../include/posixdir.h \ No newline at end of file diff --git a/lib/readline/posixdir.h b/lib/readline/posixdir.h new file mode 100644 index 00000000..af5be801 --- /dev/null +++ b/lib/readline/posixdir.h @@ -0,0 +1,71 @@ +/* posixdir.h -- Posix directory reading includes and defines. */ + +/* Copyright (C) 1987,1991,2012 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Bash is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Bash. If not, see . +*/ + +/* This file should be included instead of or . */ + +#if !defined (_POSIXDIR_H_) +#define _POSIXDIR_H_ + +#if defined (HAVE_DIRENT_H) +# include +# if defined (HAVE_STRUCT_DIRENT_D_NAMLEN) +# define D_NAMLEN(d) ((d)->d_namlen) +# else +# define D_NAMLEN(d) (strlen ((d)->d_name)) +# endif /* !HAVE_STRUCT_DIRENT_D_NAMLEN */ +#else +# if defined (HAVE_SYS_NDIR_H) +# include +# endif +# if defined (HAVE_SYS_DIR_H) +# include +# endif +# if defined (HAVE_NDIR_H) +# include +# endif +# if !defined (dirent) +# define dirent direct +# endif /* !dirent */ +# define D_NAMLEN(d) ((d)->d_namlen) +#endif /* !HAVE_DIRENT_H */ + +/* The bash code fairly consistently uses d_fileno; make sure it's available */ +#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (HAVE_STRUCT_DIRENT_D_FILENO) +# define d_fileno d_ino +#endif + +/* Posix does not require that the d_ino field be present, and some + systems do not provide it. */ +#if !defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO) +# define REAL_DIR_ENTRY(dp) 1 +#else +# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0) +#endif /* _POSIX_SOURCE */ + +#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (BROKEN_DIRENT_D_INO) +# define D_INO_AVAILABLE +#endif + +/* Signal the rest of the code that it can safely use dirent.d_fileno */ +#if defined (D_INO_AVAILABLE) || defined (HAVE_STRUCT_DIRENT_D_FILENO) +# define D_FILENO_AVAILABLE 1 +#endif + +#endif /* !_POSIXDIR_H_ */ diff --git a/lib/readline/posixdir.h~ b/lib/readline/posixdir.h~ new file mode 120000 index 00000000..8b163845 --- /dev/null +++ b/lib/readline/posixdir.h~ @@ -0,0 +1 @@ +../../include/posixdir.h \ No newline at end of file diff --git a/lib/readline/rlmbutil.h b/lib/readline/rlmbutil.h index 6fd03f6a..4d3e9070 100644 --- a/lib/readline/rlmbutil.h +++ b/lib/readline/rlmbutil.h @@ -28,7 +28,7 @@ /* check multibyte capability for I18N code */ /************************************************/ -/* For platforms which support the ISO C amendement 1 functionality we +/* For platforms which support the ISO C amendment 1 functionality we support user defined character classes. */ /* Solaris 2.5 has a bug: must be included before . */ #if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) && defined (HAVE_LOCALE_H) diff --git a/lib/readline/signals.c b/lib/readline/signals.c index d738db4e..074de6ad 100644 --- a/lib/readline/signals.c +++ b/lib/readline/signals.c @@ -220,7 +220,7 @@ _rl_handle_signal (int sig) sane without stopping on SIGTTOU if we have been placed into the background. Even trying to get the current terminal pgrp with tcgetpgrp() will generate SIGTTOU, so we don't bother. Don't bother - doing this if we've been stopped on SIGTTOU; it's aready too late. */ + doing this if we've been stopped on SIGTTOU; it's already too late. */ sigemptyset (&set); sigaddset (&set, SIGTTOU); sigprocmask (SIG_BLOCK, &set, (sigset_t *)NULL); diff --git a/lib/sh/pathcanon.c b/lib/sh/pathcanon.c index f9506dff..7d0df9f9 100644 --- a/lib/sh/pathcanon.c +++ b/lib/sh/pathcanon.c @@ -90,7 +90,7 @@ _path_isdir (path) /* Canonicalize PATH, and return a new path. The new path differs from PATH in that: - Multple `/'s are collapsed to a single `/'. + Multiple `/'s are collapsed to a single `/'. Leading `./'s and trailing `/.'s are removed. Trailing `/'s are removed. Non-leading `../'s and trailing `..'s are handled by removing diff --git a/lib/sh/strftime.c b/lib/sh/strftime.c index 0ababc14..0fdcd8c6 100644 --- a/lib/sh/strftime.c +++ b/lib/sh/strftime.c @@ -642,7 +642,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr) sprintf(tbuf+1, "%02ld%02ld", off/60, off%60); break; - case 'Z': /* time zone name or abbrevation */ + case 'Z': /* time zone name or abbreviation */ #ifdef HAVE_TZNAME i = (daylight && timeptr->tm_isdst > 0); /* 0 or 1 */ strcpy(tbuf, tzname[i]); @@ -939,7 +939,7 @@ static char *array[] = "(%%H) hour (24-hour clock, 00..23) %H", "(%%I) hour (12-hour clock, 01..12) %I", "(%%M) minute (00..59) %M", - "(%%N) Emporer/Era Name %N", + "(%%N) Emperor/Era Name %N", "(%%O) Locale extensions (ignored) %O", "(%%R) time, 24-hour (%%H:%%M) %R", "(%%S) second (00..60) %S", @@ -960,7 +960,7 @@ static char *array[] = "(%%k) hour, 24-hour clock, blank pad ( 0..23) %k", "(%%l) hour, 12-hour clock, blank pad ( 0..12) %l", "(%%m) month (01..12) %m", - "(%%o) Emporer/Era Year %o", + "(%%o) Emperor/Era Year %o", "(%%p) locale's AM or PM based on 12-hour clock %p", "(%%r) time, 12-hour (same as %%I:%%M:%%S %%p) %r", "(%%u) ISO 8601: Weekday as decimal number [1 (Monday) - 7] %u", diff --git a/lib/sh/stringvec.c b/lib/sh/stringvec.c index 3bb4ab70..c7ac3e9b 100644 --- a/lib/sh/stringvec.c +++ b/lib/sh/stringvec.c @@ -122,7 +122,6 @@ strvec_remove (array, name) return 0; } -#ifdef INCLUDE_UNUSED /* Find NAME in ARRAY. Return the index of NAME, or -1 if not present. ARRAY should be NULL terminated. */ int @@ -137,7 +136,6 @@ strvec_search (array, name) return (-1); } -#endif /* Allocate and return a new copy of ARRAY and its contents. */ char ** diff --git a/subst.h b/subst.h index c0e474ab..d607f203 100644 --- a/subst.h +++ b/subst.h @@ -111,7 +111,7 @@ extern char *string_list_dollar_star __P((WORD_LIST *, int, int)); /* Expand $@ into a single string, obeying POSIX rules. */ extern char *string_list_dollar_at __P((WORD_LIST *, int, int)); -/* Turn the positional paramters into a string, understanding quoting and +/* Turn the positional parameters into a string, understanding quoting and the various subtleties of using the first character of $IFS as the separator. Calls string_list_dollar_at, string_list_dollar_star, and string_list as appropriate. */ @@ -216,7 +216,7 @@ extern char *get_dollar_var_value __P((intmax_t)); /* Quote a string to protect it from word splitting. */ extern char *quote_string __P((char *)); -/* Quote escape characters (characters special to interals of expansion) +/* Quote escape characters (characters special to internals of expansion) in a string. */ extern char *quote_escapes __P((const char *)); diff --git a/support/man2html.c b/support/man2html.c index b10cb959..e6f441b4 100644 --- a/support/man2html.c +++ b/support/man2html.c @@ -49,8 +49,8 @@ * * Tables are converted but some features are not possible in html. * * The tabbing environment is converted by counting characters and adding * spaces. This might go wrong (outside
)
- *  * Some pages look beter if man2html works in troff mode, especially pages
- *    with tables. You can deside at compile time which made you want to use.
+ *  * Some pages look better if man2html works in troff mode, especially pages
+ *    with tables. You can decide at compile time which made you want to use.
  *
  *    -DNROFF=0     troff mode
  *    -DNROFF=1     nroff mode   (default)
@@ -3805,7 +3805,7 @@ scan_troff(char *c, int san, char **result)
 			   && *(h + 1) && islower(*(h + 1))
 			   && *(h + 2) && isspace(*(h + 2))) {
 			/*
-			 * BSD imbedded command eg ".It Fl Ar arg1 Fl Ar
+			 * BSD embedded command eg ".It Fl Ar arg1 Fl Ar
 			 * arg2"
 			 */
 			FLUSHIBP;
diff --git a/support/shobj-conf b/support/shobj-conf
index 31ff97d5..5a3f9776 100644
--- a/support/shobj-conf
+++ b/support/shobj-conf
@@ -10,7 +10,7 @@
 # Chet Ramey
 # chet@po.cwru.edu
 
-#   Copyright (C) 1996-2014 Free Software Foundation, Inc.
+#   Copyright (C) 1996-2019 Free Software Foundation, Inc.
 #
 #   This file is part of GNU Bash, the Bourne Again SHell.
 #
@@ -123,7 +123,7 @@ sunos5*|solaris2*)
 	;;
 
 # All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd.
-linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
+linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*|dragonfly*)
 	SHOBJ_CFLAGS=-fPIC
 	SHOBJ_LD='${CC}'
 	SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
@@ -132,44 +132,6 @@ linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
 	;;
 
-freebsd2*)
-	SHOBJ_CFLAGS=-fpic
-	SHOBJ_LD=ld
-	SHOBJ_LDFLAGS='-x -Bshareable'
-
-	SHLIB_XLDFLAGS='-R$(libdir)'
-	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
-	;;
-
-# FreeBSD-3.x ELF
-freebsd3*|freebsdaout*)
-	SHOBJ_CFLAGS=-fPIC
-	SHOBJ_LD='${CC}'
-
-	if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
-		SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
-
-		SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
-		SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
-	else
-		SHOBJ_LDFLAGS='-shared'
-
-		SHLIB_XLDFLAGS='-R$(libdir)'
-		SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
-	fi
-	;;
-
-# FreeBSD-4.x and later have only ELF
-freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*)
-	SHOBJ_CFLAGS=-fPIC
-	SHOBJ_LD='${CC}'
-
-	SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
-	SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
-
-	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
-	;;
-
 # Darwin/MacOS X
 darwin*)
 	# Common definitions for all darwin/mac os x versions
diff --git a/tests/array.tests b/tests/array.tests
index 7308eee7..91f33b72 100644
--- a/tests/array.tests
+++ b/tests/array.tests
@@ -168,7 +168,7 @@ echo ${x[4]}
 echo efgh | ( read x[1] ; echo ${x[1]} )
 echo wxyz | ( declare -a x ; read x ; echo $x ; echo ${x[0]} )
 
-# Make sure that arrays can be used to save the positional paramters verbatim
+# Make sure that arrays can be used to save the positional parameters verbatim
 set -- a 'b c' d 'e f g' h
 
 ARGV=( [0]=$0 "$@" )
@@ -260,7 +260,7 @@ ${THIS_SH} ./array2.sub
 # some old bugs and ksh93 compatibility tests
 ${THIS_SH} ./array3.sub
 
-# some compound assingment parsing problems that showed up in bash-3.1-release
+# some compound assignment parsing problems that showed up in bash-3.1-release
 ${THIS_SH} ./array4.sub
 
 set +u
diff --git a/tests/assoc.tests b/tests/assoc.tests
index 847b4779..205d8e19 100644
--- a/tests/assoc.tests
+++ b/tests/assoc.tests
@@ -31,7 +31,7 @@ declare -p fluff
 
 unset fluff
 
-# TEST - compount assignment and variable attributes
+# TEST - compound assignment and variable attributes
 declare -A wheat chaff
 wheat=( [zero]=0 [one]=a [two]=b [three]=c )
 
diff --git a/tests/builtins.tests b/tests/builtins.tests
index b422b217..4e314416 100644
--- a/tests/builtins.tests
+++ b/tests/builtins.tests
@@ -137,7 +137,7 @@ hash -r
 hash
 
 # this had better succeed, since command -p guarantees we will find the
-# standard utilties
+# standard utilities
 command -p hash rm
 
 # check out source/.
@@ -186,7 +186,7 @@ echo "$@"
 # test out cd and $CDPATH
 ${THIS_SH} ./builtins1.sub
 
-# test behavior of `.' when given a non-existant file argument
+# test behavior of `.' when given a non-existent file argument
 ${THIS_SH} ./source5.sub
 
 # test bugs in sourcing non-regular files, fixed post-bash-3.2
diff --git a/tests/dbg-support.tests b/tests/dbg-support.tests
index 2e356696..b4a58e4b 100644
--- a/tests/dbg-support.tests
+++ b/tests/dbg-support.tests
@@ -116,7 +116,7 @@ echo `sourced_fn`
 x=$((sourced_fn))
 x={ sourced_fn }
 
-# Make sure we step into sourced_fn as a comand when we request to do so.
+# Make sure we step into sourced_fn as a command when we request to do so.
 # Vanilla bash 2.0 doesn't do.
 set -o functrace
 x={ sourced_fn }
diff --git a/tests/dstack.tests b/tests/dstack.tests
index 33a4fbee..116e935f 100644
--- a/tests/dstack.tests
+++ b/tests/dstack.tests
@@ -15,7 +15,7 @@ export LC_ALL=C
 export LANG=C
 
 dirs -c
-# error -- nonexistant directory
+# error -- non-existent directory
 pushd /tmp/xxx-notthere
 
 # errors -- empty stack
diff --git a/tests/errors.tests b/tests/errors.tests
index 36151bc3..7258ac6b 100644
--- a/tests/errors.tests
+++ b/tests/errors.tests
@@ -108,7 +108,7 @@ local
 # logout of a non-login shell is an error
 logout
 
-# try to hash a non-existant command
+# try to hash a non-existent command
 hash notthere
 
 # bad option to hash, although it may mean `verbose' at some future point
diff --git a/tests/new-exp2.sub b/tests/new-exp2.sub
index da38c479..8dfe788f 100644
--- a/tests/new-exp2.sub
+++ b/tests/new-exp2.sub
@@ -50,7 +50,7 @@ if [[ $LINES2 -gt 0 ]]; then
 fi
 set +o posix
 
-# now see what happens when we try it with a non-existant file
+# now see what happens when we try it with a non-existent file
 rm -f /tmp/redir-notthere
 LINES3=$(< /tmp/redir-notthere)
 echo $?
diff --git a/tests/source5.sub b/tests/source5.sub
index 2f3048a6..4149c11f 100644
--- a/tests/source5.sub
+++ b/tests/source5.sub
@@ -19,7 +19,7 @@ export LANG=C
 
 set +o posix
 
-# attempting to source a non-existant file is not an error...
+# attempting to source a non-existent file is not an error...
 . /tmp/source-notthere
 
 echo after bad source 1
diff --git a/tests/varenv.tests b/tests/varenv.tests
index c05d1f65..b92c8766 100644
--- a/tests/varenv.tests
+++ b/tests/varenv.tests
@@ -247,7 +247,7 @@ ${THIS_SH} ./varenv11.sub
 # temporary environment variable propagation and scoping in posix mode
 ${THIS_SH} ./varenv12.sub
 
-# temporary environment and invalid shell indentifier names
+# temporary environment and invalid shell identifier names
 ${THIS_SH} ./varenv13.sub
 
 # localvar_inherit
diff --git a/tests/varenv14.sub b/tests/varenv14.sub
index 2a1c645d..091c4700 100644
--- a/tests/varenv14.sub
+++ b/tests/varenv14.sub
@@ -11,7 +11,7 @@
 #   You should have received a copy of the GNU General Public License
 #   along with this program.  If not, see .
 #
-# testing framework for local variable inheritence
+# testing framework for local variable inheritance
 
 shopt -s localvar_inherit
 declare -A var
diff --git a/variables.c b/variables.c
index 84fcd5bb..acef9373 100644
--- a/variables.c
+++ b/variables.c
@@ -1168,7 +1168,7 @@ print_var_function (var)
    unused otherwise.
 
    dynamic_value is called from find_variable_internal to return a `new'
-   value for the specified dynamic varible.  If this function is NULL,
+   value for the specified dynamic variable.  If this function is NULL,
    the variable is treated as a `normal' shell variable.  If it is not,
    however, then this function is called like this:
 	tempvar = (*(var->dynamic_value)) (var);
@@ -2452,7 +2452,7 @@ nameref_transform_name (name, flags)
     {
       v = find_variable_last_nameref (name, 1);
       /* If we're making local variables, only follow namerefs that point to
-	 non-existant variables at the same variable context. */
+	 non-existent variables at the same variable context. */
       if (v && v->context != variable_context)
 	v = 0;
     }
@@ -2965,7 +2965,7 @@ make_local_array_variable (name, assoc_ok)
     return var;
 
   /* Validate any value we inherited from a variable instance at a previous
-     scope and disard anything that's invalid. */
+     scope and discard anything that's invalid. */
   if (localvar_inherit && assoc_p (var))
     {
       internal_warning ("%s: cannot inherit value from incompatible type", name);
@@ -3018,7 +3018,7 @@ make_local_assoc_variable (name, array_ok)
     return var;
 
   /* Validate any value we inherited from a variable instance at a previous
-     scope and disard anything that's invalid. */
+     scope and discard anything that's invalid. */
   if (localvar_inherit && array_p (var))
     {
       internal_warning ("%s: cannot inherit value from incompatible type", name);
@@ -5012,7 +5012,7 @@ do \
     export_env[export_env_index] = (char *)NULL; \
   } while (0)
 
-/* Add ASSIGN to EXPORT_ENV, or supercede a previous assignment in the
+/* Add ASSIGN to EXPORT_ENV, or supersede a previous assignment in the
    array with the same left-hand side.  Return the new EXPORT_ENV. */
 char **
 add_or_supercede_exported_var (assign, do_alloc)
diff --git a/variables.h b/variables.h
index 2f6e3546..4097e797 100644
--- a/variables.h
+++ b/variables.h
@@ -162,7 +162,7 @@ typedef struct _vlist {
 /* Variable names: lvalues */
 #define name_cell(var)		((var)->name)
 
-/* Acessing variable values: rvalues */
+/* Accessing variable values: rvalues */
 #define value_cell(var)		((var)->value)
 #define function_cell(var)	(COMMAND *)((var)->value)
 #define array_cell(var)		(ARRAY *)((var)->value)