+++ /dev/null
-This document details the changes between this version, bash-4.3-beta, and the
-previous version, bash-4.3-alpha.
-
-1. Changes to Bash
-
-a. Fixed a bug in the prompt directory name "trimming" code that caused
- memory corruption and garbled the results.
-
-b. Fixed a bug that caused single quotes that resulted from $'...' quoting
- in the replacement portion of a double-quoted ${word/pat/rep} expansion
- to be treated as quote characters.
-
-c. Fixed a bug that caused assignment statements preceding a command word to
- result in assignment statements following a declaration command to not be
- expanded like assignment statements.
-
-d. Fixed a bug with variable search order in the presence of local variables
- with the same name as variables in the temporary environment supplied to
- a shell function.
-
-e. Fixed a bug that caused constructs like 1<(2) to be interpreted as process
- substitutions even in an arithmetic context.
-
-f. Fixed several cases where `invisible' variables (variables with attributes
- but no values, which are technically unset) were treated incorrectly.
-
-g. Fixed a bug that caused group commands in pipelines that were not the
- last element to not run the EXIT trap.
-
-h. Fixed a bug that caused `unset -n' to not unset a nameref variable in
- certain cases.
-
-i. Fixed the nameref circular reference checking to be less strict and only
- disallow a nameref variable with the same value as its name at the global
- scope.
-
-2. Changes to Readline
-
-a. Fixed a bug in vi mode that caused the arrow keys to set the saved last
- vi-mode command to the wrong value.
-
-b. Fixed a bug that caused double-quoted strings to be scanned incorrectly
- when being used as the value of a readline variable assignment.
-
-c. Fixed a bug with vi mode that prevented `.' from repeating a command
- entered on a previous line (command).
-
-d. Fixed a bug that could cause completion to core dump if it was interrupted
- by a signal.
-
-3. New Features in Bash
-
-a. Shells started to run process substitutions now run any trap set on EXIT.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.3-alpha,
-and the previous version, bash-4.2-release.
-
-1. Changes to Bash
-
-a. Fixed several bugs concerning incomplete bracket expressions in filename
- generation (globbing) patterns.
-
-b. Fixed a bug with single quotes and WORD in ${param op WORD} when running
- in Posix mode.
-
-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.
-
-e. Fixed a bug that caused the RHS of an assignment statement to undergo
- word splitting when it contained an unquoted $@.
-
-f. Fixed bugs that caused the shell to not react to a SIGINT sent while
- waiting for a child process to exit.
-
-g. Bash doesn't try to run things in a signal handler context when it gets a
- signal (SIGINT/SIGHUP/etc) while reading input using readline but still
- be responsive to terminating signals.
-
-h. Fixed a bug that caused bash to go into an infinite loop if a filename
- to be matched contained an invalid multibyte character.
-
-i. Fixed a bug that caused PS4 to end up being truncated if it is longer
- than 128 bytes.
-
-j. Fixed a bug that caused brace expansion to not skip over double-quoted
- command substitution.
-
-k. System-specific updates for: DJGPP, HP/UX, Mac OS X
-
-l. Fixed a bug in displaying commands that caused redirections to be associated
- with the wrong part of the command.
-
-m. Fixed the coproc cleanup to unset the appropriate shell variables when a
- coproc terminates.
-
-n. Fixed a bug that caused `fc' to dump core due to incorrect calculation of
- the last history entry.
-
-o. Added workarounds for FreeBSD's implementation of faccessat/eaccess and
- `test -x'.
-
-p. Fixed a bug that caused the shell to not match patterns containing
- control-A.
-
-q. Fixed a bug that could result in doubled error messages when the `printf'
- builtin got a write error.
-
-r. Fixed a bug that caused the shell to not correctly expand words containing
- multiple consecutive quoted empty strings (""""""aa).
-
-s. Fixed a bug that caused the shell to not correctly parse multi-line
- process substitutions containing comments and quoted strings.
-
-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,
- in an effort to make foo=( [ind1]=bar [ind2]=baz ) identical to
- foo[ind1]=bar foo[ind2]=baz.
-
-v. Bash now reports an error if `read -a name' is used when `name' is an
- existing associative array.
-
-w. Fixed a bug that allowed an attempted assignment to a readonly variable
- in an arithmetic expression to not return failure.
-
-x. Fixed several bugs that caused completion functions to be invoked even when
- the cursor was before the first word in the command.
-
-y. Fixed a bug that caused parsing a command substitution to overwrite the
- parsing state associated with the complete input line.
-
-z. Fixed several bugs with the built-in snprintf replacement and field widths
- and floating point.
-
-aa. Fixed a bug that caused incorrect offset calculations and input buffer
- corruption when reading files longer than 2^31 bytes.
-
-bb. Fixed several bugs where bash performed arithmetic evaluation in contexts
- where evaluation is suppressed.
-
-cc. Fixed a bug that caused bash to close FIFOs used for process substitution
- too early when a shell function was executing, but protect against using
- all file descriptors when the shell functions are invoked inside loops.
-
-dd. Added checks for printable (and non-printable) multibyte characters for
- use in error messages.
-
-ee. Fixed a bug that caused ^O (operate-and-get-next) to not work correctly
- at the end of the history list.
-
-ff. Fixed a bug that caused command-oriented history to incorrectly combine
- here documents into one line.
-
-gg. Fixed a bug that caused importing SHELLOPTS from the environment into a
- Posix-mode shell to print an error message and refuse to parse it.
-
-hh. Fixed a bug that caused the shell to delete an extra history entry when
- using `history -s'.
-
-ii. Fixed a bug that caused floating-point exceptions and overflow errors
- for the / and % arithmetic operators when using INTMAX_MIN and -1.
-
-jj. Fixed a bug that caused parsing errors when reading an arithmetic for
- loop inside a command substitution.
-
-kk. Fixed a bug that caused a readonly function to be unset when unset was
- called without the -f or -v option.
-
-ll. Fixed several bugs in the code that quotes characters special to regular
- expressions when used in a quoted string on the RHS of the =~ operator
- to the [[ command.
-
-mm. Fixed a bug that caused redirections to fail because the file descriptor
- limit was set to a value less than 10.
-
-nn. Fixed a bug that caused the `read' builtin to execute code in a signal
- handler context if read timed out.
-
-oo. Fixed a bug that caused extended globbing patterns to not match files
- beginning with `.' correctly when a `.' was explicitly supplied in the
- pattern.
-
-pp. Fixed a bug that caused key sequences longer than two characters to not
- work when used with `bind -x'.
-
-qq. Fixed a bug that resulted in redefined functions having the wrong source
- file names in BASH_SOURCE.
-
-rr. Fixed a bug that caused the read builtin to assign null strings to variables
- when using `read -N', which caused core dumps when referenced
-
-ss. Fixed a bug that caused `bash -m script' to not enable job control while
- running the script.
-
-tt. Fixed a bug that caused `printf -v var' to dump core when used with the
- %b format code.
-
-uu. Fixed a bug that caused the shell to exit with the wrong status if -e was
- active and the shell exited on a substitution error.
-
-vv. Fixed a bug that caused the shell to seg fault if an array variable with
- the same name as an existing associative array was implicitly created by
- an assignment (declare a[n]=b).
-
-ww. Fixed a bug that caused a redirection to misbehave if the number specified
- for a file descriptor overflows an intmax_t.
-
-xx. Fixed several bugs with the handling of valid and invalid unicode character
- values when used with the \u and \U escape sequences to printf and $'...'.
-
-yy. Fixed a bug that caused tildes to not be escaped in expanded filenames,
- making them subject to later expansion.
-
-zz. When using the pattern substitution word expansion, bash now runs the
- replacement string through quote removal, since it allows quotes in that
- string to act as escape characters. This is not backwards compatible, so
- it can be disabled by setting the bash compatibility mode to 4.2.
-
-aaa. Fixed the rest of the cases where the shell runs non-allowed code in a
- signal handler context.
-
-bbb. Fixed a bug that caused spurious DEL characters (\177) to appear in
- double-quoted expansion where the RHS is evaluated to the empty string.
-
-ccc. Fixed a bug that caused the use of the shell's internal random number
- generator for temporary file names to perturb the random number
- sequence.
-
-ddd. Fixed several bugs that caused `declare -g' to not set the right global
- variables or to misbehave when declaring global indexed arrays.
-
-eee. Fixed a logic bug that caused extended globbing in a multibyte locale to
- cause failures when using the pattern substititution word expansions.
-
-fff. Fixed a bug that caused the `lastpipe' option to corrupt the file
- descriptor used to read the script.
-
-ggg. Fixed a bug that causes the shell to delete DEL characters in the
- expanded value of variables used in the same quoted string as variables
- that expand to nothing.
-
-hhh. Fixed a bug that caused the shell to assign the wrong value from an
- assignment like (( x=7 )) when `x' was an existing array variable.
-
-iii. Fixed a bug that caused the shell to misbehave when generating sequences
- and the boundary values overflow an intmax_t.
-
-jjj. Fixed a bug caused expansion errors if an expansion of "$@" appeared
- next to another expansion (e.g.. "${@}${x}").
-
-kkk. Fixed a potential buffer overflow bug when performing /dev/fd expansion.
-
-lll. Fixed a bug that resulted in an extra semicolon being added to compound
- assignments when they were added to the history list.
-
-mmm. Fixed a bug that caused mapfile to read one extra line from the input.
-
-nnn. Fixed a bug that caused the mail checking code to use uninitialized
- values.
-
-ooo. Fixed a bug that prevented history timestamps from being saved if the
- history comment character is unset.
-
-ppp. Fixed a bug that caused the case-modifying expansions to not work with
- multibyte characters.
-
-qqq. Fixed a bug that caused the edit-and-execute bindable readline command
- to see the wrong data if invoked in the middle of a multi-line quoted
- string.
-
-rrr. Fixed a bug that resulted in the shell returning the wrong exit status
- for a background command on systems that recycle PIDs very quickly.
-
-sss. Fixed a bug that caused asynchronous group commands to not run any EXIT
- trap defined in the body of the command.
-
-ttt. Fixed a bug that caused `eval "... ; return"' to not clean up properly.
-
-uuu. Fixed a bug that caused the shell to dump core if `read' reads an escaped
- IFS whitespace character.
-
-vvv. Fixed a bug that caused BASH_COMMAND to be set to an incorrect value when
- executing a (...) subshell.
-
-www. Fixed a couple of pointer aliasing bugs with the token string in arithmetic
- evaluation.
-
-xxx. Fixed a bug with parsing multi-line command substitutions when reading
- the `do' keyword followed by whitespace.
-
-yyy. Fixed a bug that caused the shell to seg fault if the time given to the
- printf %(...)T format overflowed the value accepted by localtime(3).
-
-zzz. Fixed a problem with displaying help topics in two columns when the
- translated text contained multibyte characters.
-
-aaaa. Fixed a bug with the extended globbing pattern matcher where a `*' was
- followed by a negated extended glob pattern.
-
-bbbb. Fixed a race condition with short-lived coproc creation and reaping that
- caused the child process to be reaped before the various coproc shell
- variables were initialized.
-
-cccc. Fixed a bug where turning off `errexit' in command substitution subshells
- was not reflected in $SHELLOPTS.
-
-dddd. Partially fixed an inconsistency in how the shell treated shell
- functions run from an EXIT trap.
-
-eeee. Fixed a bug in how the shell invalidated FIFOs used for process
- substitution when executing a pipeline (once rather than in every child).
-
-ffff. Fixed a bug that occurred when expanding a special variable ($@, $*)
- within double quotes and the expansion resulted in an empty string.
-
-gggg. Fixed bugs with executing a SIGCHLD trap handler to make sure that it's
- executed once per exited child.
-
-hhhh. Fixed a bug that caused `declare' and `test' to find variables that
- had been given attributes but not assigned values. Such variables are
- not set.
-
-iiii. Fixed a bug that caused commands in process substitutions to not look in
- the local temporary environment when performing word expansions.
-
-jjjj. Fixed several problems with globstar expansions (**/**) returning null
- filenames and multiple instances of the same pathname.
-
-kkkk. Fixed an oversight that did not allow the exit status of `coproc' to
- be inverted using `!'.
-
-llll. Fixed a bug that caused the -e option to be re-enabled using `set -e'
- even when executing in a context where -e is ignored.
-
-mmmm. Fixed a (mostly theoretical) bug with input lines longer than SIZE_MAX.
-
-nnnn. Fixed a bug that could result in double evaluation of command
- substitutions when they appear in failed redirections.
-
-oooo. Fixed a bug that could cause seg faults during `mapfile' callbacks if
- the callback unsets the array variable mapfile is using.
-
-pppp. Fixed several problems with variable assignments using ${var:=value}
- when the variable assignment is supposed to have side effects.
-
-qqqq. Fixed a bug that caused a failure of an assignment statement preceding a
- builtin caused the next invocation of a special builtin to exit the shell.
-
-rrrr. Fixed several problems with IFS when it appears in the temporary environment
- and is used in redirections.
-
-ssss. Fixed a problem that caused IFS changes using ${IFS:=value} to modify
- how preceding expansions were split.
-
-tttt. Fixed a problem that caused subshells to not run an EXIT trap they set.
-
-uuuu. Fixed a problem that caused shells started in posix mode to attempt to
- import shell functions with invalid names from the environment. We now
- print a warning.
-
-vvvv. Worked around a kernel problem that caused SIGCHLD to interrupt open(2)
- on a FIFO used for process substitution, even if the SIGCHLD handler was
- installed with the SA_RESTART flag.
-
-wwww. Fixed a problem that resulted in inconsistent expansion of $* and ${a[*]}.
-
-xxxx. Fixed a problem that caused `read -t' to crash when interrupted by
- SIGINT.
-
-yyyy. Fixed a problem that caused pattern removal to fail randomly because the
- pattern matcher read beyond the end of a string.
-
-zzzz. Fixed a bug that caused core dumps when shell functions tried to create
- local shadow copies of special variables like GROUPS.
-
-aaaaa. Fixed a bug that caused SIGTERM to be occasionally lost by children of
- interactive shells when it arrived before the child process reset the
- handler from SIG_DFL.
-
-bbbbb. Fixed a bug that caused redirections like <&n- to leave file descriptor
- n closed if executed with a builtin command.
-
-ccccc. Fixed a bug that caused incorrect completion quoting when completing a
- word containing a globbing character with `show-all-if-ambiguous' set.
-
-ddddd. Fixed a bug that caused printf's %q format specifier not to quote a
- tilde even if it appeared in a location where it would be subject to
- tilde expansion.
-
-2. Changes to Readline
-
-a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode
- commands to work on the entire line.
-
-b. Fixed a bug that caused redisplay problems with prompts longer than 128
- characters and history searches.
-
-c. Fixed a bug that caused readline to try and run code to modify its idea
- of the screen size in a signal handler context upon receiving a SIGWINCH.
-
-d. Fixed a bug that caused the `meta' key to be enabled beyond the duration
- of an individual call top readline().
-
-e. Added a workaround for a wcwidth bug in Mac OS X that caused readline's
- redisplay to mishandle zero-width combining characters.
-
-f. Fixed a bug that caused readline to `forget' part of a key sequence when
- a multiple-key sequence caused it to break out of an incremental search.
-
-g. Fixed bugs that caused readline to execute code in a signal handler
- context if interrupted while reading from the file system during completion.
-
-h. Fixed a bug that caused readline to `forget' part of a key sequence when
- reading an unbound multi-character key sequence.
-
-i. Fixed a bug that caused Readline's signal handlers to be installed beyond
- the bounds of a single call to readline().
-
-j. Fixed a bug that caused the `.' command to not redo the most recent `R'
- command in vi mode.
-
-k. Fixed a bug that caused ignoring case in completion matches to result in
- readline using the wrong match.
-
-l. Paren matching now works in vi insert mode.
-
-m. Fix menu-completion to make show-all-if-ambiguous and menu-complete-display-prefix
- work together.
-
-n. Fixed a bug that didn't allow the `cc', `dd', or `yy' commands to be redone
- in vi editing mode.
-
-o. Fixed a bug that caused the filename comparison code to not compare
- multibyte characters correctly when using case-sensitive or case-mapping
- comparisons.
-
-p. Fixed the input reading loop to call the input hook function only when there
- is no terminal input available.
-
-q. Fixed a bug that caused binding a macro to a multi-character key sequence
- where the sequence and macro value share a common prefix to not perform
- the macro replacement.
-
-r. Fixed several redisplay errors with multibyte characters and prompts
- containing invisible characters when using horizontal scrolling.
-
-s. Fixed a bug that caused redisplay errors when trying to overwrite
- existing characters using multibyte characters.
-
-3. New Features in Bash
-
-a. The `helptopic' completion action now maps to all the help topics, not just
- the shell builtins.
-
-b. The `help' builtin no longer does prefix substring matching, so `help read'
- does not match `readonly'.
-
-c. The shell can be compiled to not display a message about processes that
- terminate due to SIGTERM.
-
-d. Non-interactive shells now react to the setting of checkwinsize and set
- LINES and COLUMNS after a foreground job exits.
-
-e. There is a new shell option, `globasciiranges', which, when set to on,
- forces globbing range comparisons to use character ordering as if they
- were run in the C locale.
-
-f. There is a new shell option, `direxpand', which makes filename completion
- expand variables in directory names in the way bash-4.1 did.
-
-g. In Posix mode, the `command' builtin does not change whether or not a
- builtin it shadows is treated as an assignment builtin.
-
-h. The `return' and `exit' builtins accept negative exit status arguments.
-
-i. The word completion code checks whether or not a filename containing a
- shell variable expands to a directory name and appends `/' to the word
- as appropriate. The same code expands shell variables in command names
- when performing command completion.
-
-j. In Posix mode, it is now an error to attempt to define a shell function
- with the same name as a Posix special builtin.
-
-k. When compiled for strict Posix conformance, history expansion is disabled
- by default.
-
-l. The history expansion character (!) does not cause history expansion when
- followed by the closing quote in a double-quoted string.
-
-m. `complete' and its siblings compgen/compopt now takes a new `-o noquote'
- option to inhibit quoting of the completions.
-
-n. Setting HISTSIZE to a value less than zero causes the history list to be
- unlimited (setting it 0 zero disables the history list).
-
-o. Setting HISTFILESIZE to a value less than zero causes the history file size
- to be unlimited (setting it to 0 causes the history file to be truncated
- to zero size).
-
-p. The `read' builtin now skips NUL bytes in the input.
-
-q. There is a new `bind -X' option to print all key sequences bound to Unix
- commands.
-
-r. When in Posix mode, `read' is interruptible by a trapped signal. After
- running the trap handler, read returns 128+signal and throws away any
- partially-read input.
-
-s. The command completion code skips whitespace and assignment statements
- before looking for the command name word to be completed.
-
-t. The build process has a new mechanism for constructing separate help files
- that better reflects the current set of compilation options.
-
-u. The -nt and -ot options to test now work with files with nanosecond
- timestamp resolution.
-
-v. The shell saves the command history in any shell for which history is
- enabled and HISTFILE is set, not just interactive shells.
-
-w. The shell has `nameref' variables and new -n(/+n) options to declare and
- unset to use them, and a `test -R' option to test for them.
-
-x. The shell now allows assigning, referencing, and unsetting elements of
- indexed arrays using negative subscripts (a[-1]=2, echo ${a[-1]}) which
- count back from the last element of the array.
-
-y. The {x}<word redirection feature now allows words like {array[ind]} and
- can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
-
-z. There is a new CHILD_MAX special shell variable; its value controls the
- number of exited child statues the shell remembers.
-
-aa. There is a new configuration option (--enable-direxpand-default) that
- causes the `direxpand' shell option to be enabled by default.
-
-bb. Bash does not do anything special to ensure that the file descriptor
- assigned to X in {x}<foo remains open after the block containing it
- completes.
-
-cc. The `wait' builtin has a new `-n' option to wait for the next child to
- change status.
-
-dd. The `printf' %(...)T format specifier now uses the current time if no
- argument is supplied.
-
-ee. There is a new variable, BASH_COMPAT, that controls the current shell
- compatibility level.
-
-ff. The `popd' builtin now treats additional arguments as errors.
-
-gg. The brace expansion code now treats a failed sequence expansion as a
- simple string and will continue to expand brace terms in the remainder
- of the word.
-
-4. New Features in Readline
-
-a. Readline is now more responsive to SIGHUP and other fatal signals when
- reading input from the terminal or performing word completion but no
- longer attempts to run any not-allowable functions from a signal handler
- context.
-
-b. There are new bindable commands to search the history for the string of
- characters between the beginning of the line and the point
- (history-substring-search-forward, history-substring-search-backward)
-
-c. Readline allows quoted strings as the values of variables when setting
- them with `set'. As a side effect, trailing spaces and tabs are ignored
- when setting a string variable's value.
-
-d. The history library creates a backup of the history file when writing it
- and restores the backup on a write error.
-
-e. New application-settable variable: rl_filename_stat_hook: a function called
- with a filename before using it in a call to stat(2). Bash uses it to
- expand shell variables so things like $HOME/Downloads have a slash
- appended.
-
-f. New bindable function `print-last-kbd-macro', prints the most-recently-
- defined keyboard macro in a reusable format.
-
-g. New user-settable variable `colored-stats', enables use of colored text
- to denote file types when displaying possible completions (colored analog
- of visible-stats).
-
-h. New user-settable variable `keyseq-timout', acts as an inter-character
- timeout when reading input or incremental search strings.
-
-i. New application-callable function: rl_clear_history. Clears the history list
- and frees all readline-associated private data.
-
-j. New user-settable variable, show-mode-in-prompt, adds a characters to the
- beginning of the prompt indicating the current editing mode.
-
-k. New application-settable variable: rl_input_available_hook; function to be
- called when readline detects there is data available on its input file
- descriptor.
-
-l. Readline calls an application-set event hook (rl_signal_event_hook) after
- it gets a signal while reading input (read returns -1/EINTR but readline
- does not handle the signal immediately) to allow the application to handle
- or otherwise note it. Not currently called for SIGHUP or SIGTERM.
-
-m. If the user-settable variable `history-size' is set to a value less than
- 0, the history list size is unlimited.
-
+++ /dev/null
-This document details the changes between this version, bash-4.3-beta, and the
-previous version, bash-4.3-alpha.
-
-1. Changes to Bash
-
-a. Fixed a bug in the prompt directory name "trimming" code that caused
- memory corruption and garbled the results.
-
-b. Fixed a bug that caused single quotes that resulted from $'...' quoting
- in the replacement portion of a double-quoted ${word/pat/rep} expansion
- to be treated as quote characters.
-
-c. Fixed a bug that caused assignment statements preceding a command word to
- result in assignment statements following a declaration command to not be
- expanded like assignment statements.
-
-d. Fixed a bug with variable search order in the presence of local variables
- with the same name as variables in the temporary environment supplied to
- a shell function.
-
-e. Fixed a bug that caused constructs like 1<(2) to be interpreted as process
- substitutions even in an arithmetic context.
-
-f. Fixed several cases where `invisible' variables (variables with attributes
- but no values, which are technically unset) were treated incorrectly.
-
-g. Fixed a bug that caused group commands in pipelines that were not the
- last element to not run the EXIT trap.
-
-h. Fixed a bug that caused `unset -n' to not unset a nameref variable in
- certain cases.
-
-i. Fixed the nameref circular reference checking to be less strict and only
- disallow a nameref variable with the same value as its name at the global
- scope.
-
-2. Changes to Readline
-
-a. Fixed a bug in vi mode that caused the arrow keys to set the saved last
- vi-mode command to the wrong value.
-
-b. Fixed a bug that caused double-quoted strings to be scanned incorrectly
- when being used as the value of a readline variable assignment.
-
-c. Fixed a bug with vi mode that prevented `.' from repeating a command
- entered on a previous line (command).
-
-d. Fixed a bug that could cause completion to core dump if it was interrupted
- by a signal.
-
-3. New Features in Bash
-
-a. Shells started to run process substitutions now run any trap set on EXIT.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.3-alpha,
-and the previous version, bash-4.2-release.
-
-1. Changes to Bash
-
-a. Fixed several bugs concerning incomplete bracket expressions in filename
- generation (globbing) patterns.
-
-b. Fixed a bug with single quotes and WORD in ${param op WORD} when running
- in Posix mode.
-
-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.
-
-e. Fixed a bug that caused the RHS of an assignment statement to undergo
- word splitting when it contained an unquoted $@.
-
-f. Fixed bugs that caused the shell to not react to a SIGINT sent while
- waiting for a child process to exit.
-
-g. Bash doesn't try to run things in a signal handler context when it gets a
- signal (SIGINT/SIGHUP/etc) while reading input using readline but still
- be responsive to terminating signals.
-
-h. Fixed a bug that caused bash to go into an infinite loop if a filename
- to be matched contained an invalid multibyte character.
-
-i. Fixed a bug that caused PS4 to end up being truncated if it is longer
- than 128 bytes.
-
-j. Fixed a bug that caused brace expansion to not skip over double-quoted
- command substitution.
-
-k. System-specific updates for: DJGPP, HP/UX, Mac OS X
-
-l. Fixed a bug in displaying commands that caused redirections to be associated
- with the wrong part of the command.
-
-m. Fixed the coproc cleanup to unset the appropriate shell variables when a
- coproc terminates.
-
-n. Fixed a bug that caused `fc' to dump core due to incorrect calculation of
- the last history entry.
-
-o. Added workarounds for FreeBSD's implementation of faccessat/eaccess and
- `test -x'.
-
-p. Fixed a bug that caused the shell to not match patterns containing
- control-A.
-
-q. Fixed a bug that could result in doubled error messages when the `printf'
- builtin got a write error.
-
-r. Fixed a bug that caused the shell to not correctly expand words containing
- multiple consecutive quoted empty strings (""""""aa).
-
-s. Fixed a bug that caused the shell to not correctly parse multi-line
- process substitutions containing comments and quoted strings.
-
-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,
- in an effort to make foo=( [ind1]=bar [ind2]=baz ) identical to
- foo[ind1]=bar foo[ind2]=baz.
-
-v. Bash now reports an error if `read -a name' is used when `name' is an
- existing associative array.
-
-w. Fixed a bug that allowed an attempted assignment to a readonly variable
- in an arithmetic expression to not return failure.
-
-x. Fixed several bugs that caused completion functions to be invoked even when
- the cursor was before the first word in the command.
-
-y. Fixed a bug that caused parsing a command substitution to overwrite the
- parsing state associated with the complete input line.
-
-z. Fixed several bugs with the built-in snprintf replacement and field widths
- and floating point.
-
-aa. Fixed a bug that caused incorrect offset calculations and input buffer
- corruption when reading files longer than 2^31 bytes.
-
-bb. Fixed several bugs where bash performed arithmetic evaluation in contexts
- where evaluation is suppressed.
-
-cc. Fixed a bug that caused bash to close FIFOs used for process substitution
- too early when a shell function was executing, but protect against using
- all file descriptors when the shell functions are invoked inside loops.
-
-dd. Added checks for printable (and non-printable) multibyte characters for
- use in error messages.
-
-ee. Fixed a bug that caused ^O (operate-and-get-next) to not work correctly
- at the end of the history list.
-
-ff. Fixed a bug that caused command-oriented history to incorrectly combine
- here documents into one line.
-
-gg. Fixed a bug that caused importing SHELLOPTS from the environment into a
- Posix-mode shell to print an error message and refuse to parse it.
-
-hh. Fixed a bug that caused the shell to delete an extra history entry when
- using `history -s'.
-
-ii. Fixed a bug that caused floating-point exceptions and overflow errors
- for the / and % arithmetic operators when using INTMAX_MIN and -1.
-
-jj. Fixed a bug that caused parsing errors when reading an arithmetic for
- loop inside a command substitution.
-
-kk. Fixed a bug that caused a readonly function to be unset when unset was
- called without the -f or -v option.
-
-ll. Fixed several bugs in the code that quotes characters special to regular
- expressions when used in a quoted string on the RHS of the =~ operator
- to the [[ command.
-
-mm. Fixed a bug that caused redirections to fail because the file descriptor
- limit was set to a value less than 10.
-
-nn. Fixed a bug that caused the `read' builtin to execute code in a signal
- handler context if read timed out.
-
-oo. Fixed a bug that caused extended globbing patterns to not match files
- beginning with `.' correctly when a `.' was explicitly supplied in the
- pattern.
-
-pp. Fixed a bug that caused key sequences longer than two characters to not
- work when used with `bind -x'.
-
-qq. Fixed a bug that resulted in redefined functions having the wrong source
- file names in BASH_SOURCE.
-
-rr. Fixed a bug that caused the read builtin to assign null strings to variables
- when using `read -N', which caused core dumps when referenced
-
-ss. Fixed a bug that caused `bash -m script' to not enable job control while
- running the script.
-
-tt. Fixed a bug that caused `printf -v var' to dump core when used with the
- %b format code.
-
-uu. Fixed a bug that caused the shell to exit with the wrong status if -e was
- active and the shell exited on a substitution error.
-
-vv. Fixed a bug that caused the shell to seg fault if an array variable with
- the same name as an existing associative array was implicitly created by
- an assignment (declare a[n]=b).
-
-ww. Fixed a bug that caused a redirection to misbehave if the number specified
- for a file descriptor overflows an intmax_t.
-
-xx. Fixed several bugs with the handling of valid and invalid unicode character
- values when used with the \u and \U escape sequences to printf and $'...'.
-
-yy. Fixed a bug that caused tildes to not be escaped in expanded filenames,
- making them subject to later expansion.
-
-zz. When using the pattern substitution word expansion, bash now runs the
- replacement string through quote removal, since it allows quotes in that
- string to act as escape characters. This is not backwards compatible, so
- it can be disabled by setting the bash compatibility mode to 4.2.
-
-aaa. Fixed the rest of the cases where the shell runs non-allowed code in a
- signal handler context.
-
-bbb. Fixed a bug that caused spurious DEL characters (\177) to appear in
- double-quoted expansion where the RHS is evaluated to the empty string.
-
-ccc. Fixed a bug that caused the use of the shell's internal random number
- generator for temporary file names to perturb the random number
- sequence.
-
-ddd. Fixed several bugs that caused `declare -g' to not set the right global
- variables or to misbehave when declaring global indexed arrays.
-
-eee. Fixed a logic bug that caused extended globbing in a multibyte locale to
- cause failures when using the pattern substititution word expansions.
-
-fff. Fixed a bug that caused the `lastpipe' option to corrupt the file
- descriptor used to read the script.
-
-ggg. Fixed a bug that causes the shell to delete DEL characters in the
- expanded value of variables used in the same quoted string as variables
- that expand to nothing.
-
-hhh. Fixed a bug that caused the shell to assign the wrong value from an
- assignment like (( x=7 )) when `x' was an existing array variable.
-
-iii. Fixed a bug that caused the shell to misbehave when generating sequences
- and the boundary values overflow an intmax_t.
-
-jjj. Fixed a bug caused expansion errors if an expansion of "$@" appeared
- next to another expansion (e.g.. "${@}${x}").
-
-kkk. Fixed a potential buffer overflow bug when performing /dev/fd expansion.
-
-lll. Fixed a bug that resulted in an extra semicolon being added to compound
- assignments when they were added to the history list.
-
-mmm. Fixed a bug that caused mapfile to read one extra line from the input.
-
-nnn. Fixed a bug that caused the mail checking code to use uninitialized
- values.
-
-ooo. Fixed a bug that prevented history timestamps from being saved if the
- history comment character is unset.
-
-ppp. Fixed a bug that caused the case-modifying expansions to not work with
- multibyte characters.
-
-qqq. Fixed a bug that caused the edit-and-execute bindable readline command
- to see the wrong data if invoked in the middle of a multi-line quoted
- string.
-
-rrr. Fixed a bug that resulted in the shell returning the wrong exit status
- for a background command on systems that recycle PIDs very quickly.
-
-sss. Fixed a bug that caused asynchronous group commands to not run any EXIT
- trap defined in the body of the command.
-
-ttt. Fixed a bug that caused `eval "... ; return"' to not clean up properly.
-
-uuu. Fixed a bug that caused the shell to dump core if `read' reads an escaped
- IFS whitespace character.
-
-vvv. Fixed a bug that caused BASH_COMMAND to be set to an incorrect value when
- executing a (...) subshell.
-
-www. Fixed a couple of pointer aliasing bugs with the token string in arithmetic
- evaluation.
-
-xxx. Fixed a bug with parsing multi-line command substitutions when reading
- the `do' keyword followed by whitespace.
-
-yyy. Fixed a bug that caused the shell to seg fault if the time given to the
- printf %(...)T format overflowed the value accepted by localtime(3).
-
-zzz. Fixed a problem with displaying help topics in two columns when the
- translated text contained multibyte characters.
-
-aaaa. Fixed a bug with the extended globbing pattern matcher where a `*' was
- followed by a negated extended glob pattern.
-
-bbbb. Fixed a race condition with short-lived coproc creation and reaping that
- caused the child process to be reaped before the various coproc shell
- variables were initialized.
-
-cccc. Fixed a bug where turning off `errexit' in command substitution subshells
- was not reflected in $SHELLOPTS.
-
-dddd. Partially fixed an inconsistency in how the shell treated shell
- functions run from an EXIT trap.
-
-eeee. Fixed a bug in how the shell invalidated FIFOs used for process
- substitution when executing a pipeline (once rather than in every child).
-
-ffff. Fixed a bug that occurred when expanding a special variable ($@, $*)
- within double quotes and the expansion resulted in an empty string.
-
-gggg. Fixed bugs with executing a SIGCHLD trap handler to make sure that it's
- executed once per exited child.
-
-hhhh. Fixed a bug that caused `declare' and `test' to find variables that
- had been given attributes but not assigned values. Such variables are
- not set.
-
-iiii. Fixed a bug that caused commands in process substitutions to not look in
- the local temporary environment when performing word expansions.
-
-jjjj. Fixed several problems with globstar expansions (**/**) returning null
- filenames and multiple instances of the same pathname.
-
-kkkk. Fixed an oversight that did not allow the exit status of `coproc' to
- be inverted using `!'.
-
-llll. Fixed a bug that caused the -e option to be re-enabled using `set -e'
- even when executing in a context where -e is ignored.
-
-mmmm. Fixed a (mostly theoretical) bug with input lines longer than SIZE_MAX.
-
-nnnn. Fixed a bug that could result in double evaluation of command
- substitutions when they appear in failed redirections.
-
-oooo. Fixed a bug that could cause seg faults during `mapfile' callbacks if
- the callback unsets the array variable mapfile is using.
-
-pppp. Fixed several problems with variable assignments using ${var:=value}
- when the variable assignment is supposed to have side effects.
-
-qqqq. Fixed a bug that caused a failure of an assignment statement preceding a
- builtin caused the next invocation of a special builtin to exit the shell.
-
-rrrr. Fixed several problems with IFS when it appears in the temporary environment
- and is used in redirections.
-
-ssss. Fixed a problem that caused IFS changes using ${IFS:=value} to modify
- how preceding expansions were split.
-
-tttt. Fixed a problem that caused subshells to not run an EXIT trap they set.
-
-uuuu. Fixed a problem that caused shells started in posix mode to attempt to
- import shell functions with invalid names from the environment. We now
- print a warning.
-
-vvvv. Worked around a kernel problem that caused SIGCHLD to interrupt open(2)
- on a FIFO used for process substitution, even if the SIGCHLD handler was
- installed with the SA_RESTART flag.
-
-wwww. Fixed a problem that resulted in inconsistent expansion of $* and ${a[*]}.
-
-xxxx. Fixed a problem that caused `read -t' to crash when interrupted by
- SIGINT.
-
-yyyy. Fixed a problem that caused pattern removal to fail randomly because the
- pattern matcher read beyond the end of a string.
-
-zzzz. Fixed a bug that caused core dumps when shell functions tried to create
- local shadow copies of special variables like GROUPS.
-
-aaaaa. Fixed a bug that caused SIGTERM to be occasionally lost by children of
- interactive shells when it arrived before the child process reset the
- handler from SIG_DFL.
-
-bbbbb. Fixed a bug that caused redirections like <&n- to leave file descriptor
- n closed if executed with a builtin command.
-
-ccccc. Fixed a bug that caused incorrect completion quoting when completing a
- word containing a globbing character with `show-all-if-ambiguous' set.
-
-ddddd. Fixed a bug that caused printf's %q format specifier not to quote a
- tilde even if it appeared in a location where it would be subject to
- tilde expansion.
-
-2. Changes to Readline
-
-a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode
- commands to work on the entire line.
-
-b. Fixed a bug that caused redisplay problems with prompts longer than 128
- characters and history searches.
-
-c. Fixed a bug that caused readline to try and run code to modify its idea
- of the screen size in a signal handler context upon receiving a SIGWINCH.
-
-d. Fixed a bug that caused the `meta' key to be enabled beyond the duration
- of an individual call top readline().
-
-e. Added a workaround for a wcwidth bug in Mac OS X that caused readline's
- redisplay to mishandle zero-width combining characters.
-
-f. Fixed a bug that caused readline to `forget' part of a key sequence when
- a multiple-key sequence caused it to break out of an incremental search.
-
-g. Fixed bugs that caused readline to execute code in a signal handler
- context if interrupted while reading from the file system during completion.
-
-h. Fixed a bug that caused readline to `forget' part of a key sequence when
- reading an unbound multi-character key sequence.
-
-i. Fixed a bug that caused Readline's signal handlers to be installed beyond
- the bounds of a single call to readline().
-
-j. Fixed a bug that caused the `.' command to not redo the most recent `R'
- command in vi mode.
-
-k. Fixed a bug that caused ignoring case in completion matches to result in
- readline using the wrong match.
-
-l. Paren matching now works in vi insert mode.
-
-m. Fix menu-completion to make show-all-if-ambiguous and menu-complete-display-prefix
- work together.
-
-n. Fixed a bug that didn't allow the `cc', `dd', or `yy' commands to be redone
- in vi editing mode.
-
-o. Fixed a bug that caused the filename comparison code to not compare
- multibyte characters correctly when using case-sensitive or case-mapping
- comparisons.
-
-p. Fixed the input reading loop to call the input hook function only when there
- is no terminal input available.
-
-q. Fixed a bug that caused binding a macro to a multi-character key sequence
- where the sequence and macro value share a common prefix to not perform
- the macro replacement.
-
-r. Fixed several redisplay errors with multibyte characters and prompts
- containing invisible characters when using horizontal scrolling.
-
-s. Fixed a bug that caused redisplay errors when trying to overwrite
- existing characters using multibyte characters.
-
-3. New Features in Bash
-
-a. The `helptopic' completion action now maps to all the help topics, not just
- the shell builtins.
-
-b. The `help' builtin no longer does prefix substring matching, so `help read'
- does not match `readonly'.
-
-c. The shell can be compiled to not display a message about processes that
- terminate due to SIGTERM.
-
-d. Non-interactive shells now react to the setting of checkwinsize and set
- LINES and COLUMNS after a foreground job exits.
-
-e. There is a new shell option, `globasciiranges', which, when set to on,
- forces globbing range comparisons to use character ordering as if they
- were run in the C locale.
-
-f. There is a new shell option, `direxpand', which makes filename completion
- expand variables in directory names in the way bash-4.1 did.
-
-g. In Posix mode, the `command' builtin does not change whether or not a
- builtin it shadows is treated as an assignment builtin.
-
-h. The `return' and `exit' builtins accept negative exit status arguments.
-
-i. The word completion code checks whether or not a filename containing a
- shell variable expands to a directory name and appends `/' to the word
- as appropriate. The same code expands shell variables in command names
- when performing command completion.
-
-j. In Posix mode, it is now an error to attempt to define a shell function
- with the same name as a Posix special builtin.
-
-k. When compiled for strict Posix conformance, history expansion is disabled
- by default.
-
-l. The history expansion character (!) does not cause history expansion when
- followed by the closing quote in a double-quoted string.
-
-m. `complete' and its siblings compgen/compopt now takes a new `-o noquote'
- option to inhibit quoting of the completions.
-
-n. Setting HISTSIZE to a value less than zero causes the history list to be
- unlimited (setting it 0 zero disables the history list).
-
-o. Setting HISTFILESIZE to a value less than zero causes the history file size
- to be unlimited (setting it to 0 causes the history file to be truncated
- to zero size).
-
-p. The `read' builtin now skips NUL bytes in the input.
-
-q. There is a new `bind -X' option to print all key sequences bound to Unix
- commands.
-
-r. When in Posix mode, `read' is interruptible by a trapped signal. After
- running the trap handler, read returns 128+signal and throws away any
- partially-read input.
-
-s. The command completion code skips whitespace and assignment statements
- before looking for the command name word to be completed.
-
-t. The build process has a new mechanism for constructing separate help files
- that better reflects the current set of compilation options.
-
-u. The -nt and -ot options to test now work with files with nanosecond
- timestamp resolution.
-
-v. The shell saves the command history in any shell for which history is
- enabled and HISTFILE is set, not just interactive shells.
-
-w. The shell has `nameref' variables and new -n(/+n) options to declare and
- unset to use them, and a `test -R' option to test for them.
-
-x. The shell now allows assigning, referencing, and unsetting elements of
- indexed arrays using negative subscripts (a[-1]=2, echo ${a[-1]}) which
- count back from the last element of the array.
-
-y. The {x}<word redirection feature now allows words like {array[ind]} and
- can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
-
-z. There is a new CHILD_MAX special shell variable; its value controls the
- number of exited child statues the shell remembers.
-
-aa. There is a new configuration option (--enable-direxpand-default) that
- causes the `direxpand' shell option to be enabled by default.
-
-bb. Bash does not do anything special to ensure that the file descriptor
- assigned to X in {x}<foo remains open after the block containing it
- completes.
-
-cc. The `wait' builtin has a new `-n' option to wait for the next child to
- change status.
-
-dd. The `printf' %(...)T format specifier now uses the current time if no
- argument is supplied.
-
-ee. There is a new variable, BASH_COMPAT, that controls the current shell
- compatibility level.
-
-ff. The `popd' builtin now treats additional arguments as errors.
-
-gg. The brace expansion code now treats a failed sequence expansion as a
- simple string and will continue to expand brace terms in the remainder
- of the word.
-
-4. New Features in Readline
-
-a. Readline is now more responsive to SIGHUP and other fatal signals when
- reading input from the terminal or performing word completion but no
- longer attempts to run any not-allowable functions from a signal handler
- context.
-
-b. There are new bindable commands to search the history for the string of
- characters between the beginning of the line and the point
- (history-substring-search-forward, history-substring-search-backward)
-
-c. Readline allows quoted strings as the values of variables when setting
- them with `set'. As a side effect, trailing spaces and tabs are ignored
- when setting a string variable's value.
-
-d. The history library creates a backup of the history file when writing it
- and restores the backup on a write error.
-
-e. New application-settable variable: rl_filename_stat_hook: a function called
- with a filename before using it in a call to stat(2). Bash uses it to
- expand shell variables so things like $HOME/Downloads have a slash
- appended.
-
-f. New bindable function `print-last-kbd-macro', prints the most-recently-
- defined keyboard macro in a reusable format.
-
-g. New user-settable variable `colored-stats', enables use of colored text
- to denote file types when displaying possible completions (colored analog
- of visible-stats).
-
-h. New user-settable variable `keyseq-timout', acts as an inter-character
- timeout when reading input or incremental search strings.
-
-i. New application-callable function: rl_clear_history. Clears the history list
- and frees all readline-associated private data.
-
-j. New user-settable variable, show-mode-in-prompt, adds a characters to the
- beginning of the prompt indicating the current editing mode.
-
-k. New application-settable variable: rl_input_available_hook; function to be
- called when readline detects there is data available on its input file
- descriptor.
-
-l. Readline calls an application-set event hook (rl_signal_event_hook) after
- it gets a signal while reading input (read returns -1/EINTR but readline
- does not handle the signal immediately) to allow the application to handle
- or otherwise note it. Not currently called for SIGHUP or SIGTERM.
-
-m. If the user-settable variable `history-size' is set to a value less than
- 0, the history list size is unlimited.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.2-release,
-and the previous version, bash-4.2-rc2.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused some variables to be clobbered by a longjmp,
- resulting in stack corruption.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.2-rc2,
-and the previous version, bash-4.2-rc1.
-
-1. Changes to Bash
-
-a. Changes to bash_directory_completion_hook so that it's assigned to the
- readline rl_directory_rewrite_hook variable, which modifies the directory
- name passed to opendir without modifying the directory name the user
- typed.
-
-b. Fixed bug in select builtin that caused it to not terminate correctly if
- the read timed out due to $TMOUT.
-
-c. Fixed a problem that resulted in non-repeatable sequences of random
- numbers when RANDOM=0.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.2-rc1,
-and the previous version, bash-4.2-beta.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused some redirection errors to leak file descriptors.
-
-b. Fixed a bug that caused unary `+' and `-' arithmetic operators to have a
- higher precedence than unary `!' and `~'.
-
-c. Fixed a bug that caused simple commands in a pipeline to affect the exit
- status ($?) seen by subsequent pipeline commands.
-
-d. A number of cygwin-specific changes to avoid the use of text-mode files
- and file access, and to make sure that \r is handled correctly.
-
-e. Fixed a bug that caused the read builtin to not return failure if an
- attempt is made to assign to a readonly variable.
-
-f. Fixed a bug that caused some builtin usage messages to not be translated.
-
-g. Fixed a bug that caused the getopts builtin to not return failure if an
- attempt is made to assign to a readonly variable. Now it returns 2.
-
-h. Fixed the cd and pwd builtins to return failure if PWD is readonly and
- cannot be assigned to.
-
-i. Added code to check the return value of access(2) on Solaris systems,
- since it returns success for executable tests (e.g., `test -x') when
- run by root, even if the file permissions don't allow execution.
-
-2. Changes to Readline
-
-a. Fixed a bug that caused directory names in words to be completed to not
- be dequoted correctly.
-
-3. New Features in Bash
-
-4. New Features in Readline
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.2-beta,
-and the previous version, bash-4.2-alpha.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused the \W prompt string escape to not add a closing
- NULL.
-
-b. Fixed a bug that caused partially-quoted words that were not subject to
- word splitting to retained quoted NULLs.
-
-c. Added considerable efficiency speedups when pattern matching in multibyte
- locales by skipping multibyte character functions where possible.
-
-d. Added considerable speedups to variable expansion when in multibyte locales.
-
-e. Fixed a bug that caused the expansion of $* when there are no positional
- parameters to cause the shell to dump core when used in a pattern
- matching context.
-
-f. Fixed a bug that caused variable expansions preceding regular builtins to
- not change the shell environment during their execution.
-
-2. Changes to Readline
-
-a. Fixed a bug that made an explicit argument of 0 to yank-last-arg behave
- as if it were a negative argument.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.2-alpha,
-and the previous version, bash-4.1-release.
-
-1. Changes to Bash
-
-a. Fixed a bug in the parser when processing alias expansions containing
- quoted newlines.
-
-b. Fixed a memory leak in associative array expansion.
-
-c. Fixed a bug that caused quoted here-strings to be requoted when printed.
-
-d. Fixed a bug in arithmetic expansion that caused the index in an array
- expansion to be evaluated twice under certain circumstances.
-
-e. Fixed several bugs with the expansion and display of variables that have
- been given attributes but not values and are technically unset.
-
-f. Fixed a bug that caused core dumps when using filename completion that
- expands to a filename containing a globbing character.
-
-g. Fixed a bug that caused assignment statements preceding a special builtin
- when running in Posix mode to not persist after the builtin completed
- when the special builtin was executed in a shell function without any
- local variables.
-
-h. Fixed a bug that caused a command to remain in the hash table even after
- `hash command' did not find anything if there was already an existing
- hashed pathname.
-
-i. Fixed several bugs caused by executing unsafe functions from a signal
- handler in the cases where a signal handler is executed immediately
- rather than setting a flag for later execution.
-
-j. Fixed a bug that caused some internal flag variables to be set
- incorrectly if `read -t' timed out.
-
-k. Fixed a Posix compatibility issue by making sure that a backslash escaping
- a `}' within a double-quoted ${...} parameter expansion is removed as part
- of the parameter expansion.
-
-l. Fixed a bug that caused execution of a trap to overwrite PIPESTATUS.
-
-m. Fixed a bug that caused here documents to not be displayed correctly
- when attached to commands inside compound commands.
-
-n. Fixed a bug that caused the printf builtin to use the wrong precision
- when using the `*' modifier.
-
-o. Fixed a bug that caused an arriving SIGCHLD to interrupt output functions
- like those invoked by echo or printf.
-
-p. Changed to use a more robust mechanism than eaccess(2) when test is
- checking filenames for execution permission.
-
-q. Fixed a bug that caused spurious semicolons to be added into the command
- history in certain cases.
-
-r. Fixed a bug that caused the shell to free non-allocated memory when
- unsetting element 0 of an associative array after it was assigned
- implicitly.
-
-s. Fixed a bug that could cause the shell to dump core if using the `v'
- vi editing command on a multi-line command.
-
-t. Fixed a bug that left FIFOs opened by process substitutions open long
- enough to potentially cause file descriptor exhaustion when running a
- shell function or shell builtin.
-
-u. Fixed a bug that caused the history expansion functions to not recognize
- process substitution or extended glob patterns as single words.
-
-v. Fixed a bug that caused restricted shells to set a restricted command's
- exit status incorrectly.
-
-w. Fixed a bug that caused bash to ignore the wrong set of filenames when
- completing a command using the `complete-filename' readline command.
-
-x. Fixed a bug that caused a -PID argument following a -s sig or -n sig to
- not be interpreted as a signal specification.
-
-y. Changed posix-mode behavior of a parse error in a `.' script or `eval'
- command to exit the shell under Posix-specified conditions. Previous
- versions printed a warning.
-
-z. Fixed a bug in \W prompt expansion that resulted in incorrect expansion
- in the event of overlapping strings.
-
-aa. Fixed a bug that caused the := parameter expansion operator to return the
- wrong value as the result of the expansion.
-
-bb. When in Posix mode, a single quote is not treated specially in a
- double-quoted ${...} expansion, unless the expansion operator is
- # or % or the non-Posix `//', `^', and `,'. In particular, it does
- not define a new quoting context. This is from Posix interpretation 221.
-
-cc. Fixed a bug that inadvertently allowed program names containing slashes
- to be entered into the command hash table.
-
-dd. Fixed a bug that caused the select builtin to incorrectly compute the
- display width of the arguments in the presence of multibyte characters.
-
-ee. Fixed a bug that caused bash to not change the xtrace file descriptor if
- BASH_XTRACEFD was found in the shell environment at startup.
-
-ff. Fixed a memory leak in the pattern removal parameter expansion.
-
-gg. Fixed a bug that caused SIGINT to fail to interrupt a nested loop if the
- loop was in a pipeline.
-
-hh. Fixed a problem in $(...) parsing that caused the parser to add an extra
- space to a here-document delimiter if the first word contained a `/'.
-
-ii. Fixed a bug that caused functions defined with the `function' reserved
- word to require braces around the function body.
-
-jj. Fixed a bug that caused bash to dump core when a variable expansion being
- used as an array subscript failed.
-
-kk. Fixed a bug that caused bash to dump core if the case-modification
- expansions were used on a variable with a null value.
-
-ll. Fixed a bug that caused partially-quoted strings to be split incorrectly
- if a variable with a null value was expanded within double quotes.
-
-mm. The pattern substitution word expansion has been sped up dramatically
- when running in a locale with multibyte characters.
-
-nn. Fixed a bug that caused history -a to not write the correct lines to
- the history file if all the new lines in the history list were added
- since the last time the history file was read or written.
-
-oo. Fixed a bug that caused completion of a word with an unclosed `` command
- substitution to set the prompt incorrectly.
-
-pp. Fixed a bug that caused extended globbing patterns in $HISTIGNORE or
- $GLOBIGNORE to be incorrectly scanned.
-
-qq. Fixed a bug caused by closing file descriptors 3-20 on shell startup. The
- shell now sets them to close-on-exec.
-
-rr. Fixed a bug that caused the exit status of `exec file' to be set incorrectly
- if `file' was a directory.
-
-ss. Fixed a bug in the `.' builtin to make a non-interactive posix-mode shell
- exit if the file argument to `.' is not found. Prefixing exec with
- `command' makes the shell not exit. Posix requires this behavior.
-
-tt. Fixed a bug that caused `sh -c 'command exec; exit 1' to hang.
-
-uu. Fixed a bug in $(...) command substitution parsing that caused the shell
- to treat backslash-newline incorrectly when parsing a comment.
-
-vv. Fixed bug that caused brace expansion sequence generation to misbehave
- when supplied integers greater than 2**31 - 1.
-
-ww. Fixed a bug that caused failure to save file descriptors for redirections
- to corrupt shell file descriptors.
-
-xx. Fixed a bug that caused bash-forward-shellword to not correctly handle
- quoted strings.
-
-2. Changes to Readline
-
-a. Fixed a bug that caused the unconverted filename to be added to the list of
- completions when the application specified filename conversion functions.
-
-b. Fixed a bug that caused the wrong filename to be passed to opendir when the
- application has specified a filename dequoting function.
-
-c. Fixed a bug when repeating a character search in vi mode in the case where
- there was no search to repeat.
-
-d. When show-all-if-ambiguous is set, the completion routines no longer insert
- a common match prefix that is shorter than the text being completed.
-
-e. The full set of vi editing commands may now be used in callback mode.
-
-f. Fixed a bug that caused readline to not update its idea of the terminal
- dimensions while running in `no-echo' mode.
-
-h. Fixed a bug that caused readline to dump core if an application called
- rl_prep_terminal without setting rl_instream.
-
-i. Fixed a bug that caused meta-prefixed characters bound to incremental
- search forward or backward to not be recognized if they were typed
- subsequently.
-
-j. The incremental search code treats key sequences that map to the same
- functions as (default) ^G, ^W, and ^Y as equivalent to those characters.
-
-k. Fixed a bug in menu-complete that caused it to misbehave with large
- negative argument.
-
-l. Fixed a bug that caused vi-mode yank-last-arg to ring the bell when invoked
- at the end of the line.
-
-3. New Features in Bash
-
-a. `exec -a foo' now sets $0 to `foo' in an executable shell script without a
- leading #!.
-
-b. Subshells begun to execute command substitutions or run shell functions or
- builtins in subshells do not reset trap strings until a new trap is
- specified. This allows $(trap) to display the caller's traps and the
- trap strings to persist until a new trap is set.
-
-c. `trap -p' will now show signals ignored at shell startup, though their
- disposition still cannot be modified.
-
-d. $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
-
-e. declare/typeset has a new `-g' option, which creates variables in the
- global scope even when run in a shell function.
-
-f. test/[/[[ have a new -v variable unary operator, which returns success if
- `variable' has been set.
-
-g. Posix parsing changes to allow `! time command' and multiple consecutive
- instances of `!' (which toggle) and `time' (which have no cumulative
- effect).
-
-h. Posix change to allow `time' as a command by itself to print the elapsed
- user, system, and real times for the shell and its children.
-
-j. $((...)) is always parsed as an arithmetic expansion first, instead of as
- a potential nested command substitution, as Posix requires.
-
-k. A new FUNCNEST variable to allow the user to control the maximum shell
- function nesting (recursive execution) level.
-
-l. The mapfile builtin now supplies a third argument to the callback command:
- the line about to be assigned to the supplied array index.
-
-m. The printf builtin has a new %(fmt)T specifier, which allows time values
- to use strftime-like formatting.
-
-n. There is a new `compat41' shell option.
-
-o. The cd builtin has a new Posix-mandated `-e' option.
-
-p. Negative subscripts to indexed arrays, previously errors, now are treated
- as offsets from the maximum assigned index + 1.
-
-q. Negative length specifications in the ${var:offset:length} expansion,
- previously errors, are now treated as offsets from the end of the variable.
-
-r. Parsing change to allow `time -p --'.
-
-s. Posix-mode parsing change to not recognize `time' as a keyword if the
- following token begins with a `-'. This means no more Posix-mode
- `time -p'. Posix interpretation 267.
-
-t. There is a new `lastpipe' shell option that runs the last command of a
- pipeline in the current shell context. The lastpipe option has no
- effect if job control is enabled.
-
-u. History expansion no longer expands the `$!' variable expansion.
-
-v. Posix mode shells no longer exit if a variable assignment error occurs
- with an assignment preceding a command that is not a special builtin.
-
-w. Non-interactive mode shells exit if -u is enabled and an attempt is made
- to use an unset variable with the % or # expansions, the `//', `^', or
- `,' expansions, or the parameter length expansion.
-
-x. Posix-mode shells use the argument passed to `.' as-is if a $PATH search
- fails, effectively searching the current directory. Posix-2008 change.
-
-4. New Features in Readline
-
-a. The history library does not try to write the history filename in the
- current directory if $HOME is unset. This closes a potential security
- problem if the application does not specify a history filename.
-
-b. New bindable variable `completion-display-width' to set the number of
- columns used when displaying completions.
-
-c. New bindable variable `completion-case-map' to cause case-insensitive
- completion to treat `-' and `_' as identical.
-
-d. There are new bindable vi-mode command names to avoid readline's case-
- insensitive matching not allowing them to be bound separately.
-
-e. New bindable variable `menu-complete-display-prefix' causes the menu
- completion code to display the common prefix of the possible completions
- before cycling through the list, instead of after.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.1-rc,
-and the previous version, bash-4.1-beta.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused printf to not return a partial value when it
- encountered an error while converting an integer argument.
-
-b. Fixed a bug that caused setting one of the compatNN options to not
- turn off the others.
-
-c. The (undocumented) --wordexp option is no longer included by default.
-
-d. Fixed a bug in conditional command execution that caused it to not
- correctly ignore the exit status under certain circumstances.
-
-e. Added a configure-time check for correctly-working asprintf/snprintf.
-
-f. Fixed some problems with line number calculation and display when sourcing
- a file in an interactive shell.
-
-g. Fixed a bug that caused the shell to crash when using `declare -A foo=bar'.
-
-h. Fixed a bug that caused an off-by-one error when calculating the directories
- to display with the PROMPT_DIRTRIM option.
-
-2. Changes to Readline
-
-a. Fixed a bug that caused applications using the callback interface to not
- react to SIGINT (or other signals) until another character arrived.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.1-beta,
-and the previous version, bash-4.1-alpha.
-
-1. Changes to Bash
-
-a. Fixed a bug in mapfile that caused the shell to crash if it was passed the
- name of an associative array.
-
-b. Fixed a bug that caused the shell to incorrectly split case patterns if
- they contained characters in $IFS.
-
-c. Fixed a bug that caused the shell to set $? to the wrong value when using
- a construct ending with a variable assignment with set -x enabled and PS4
- containing a command substitution.
-
-d. Fixed a bug that caused the shell to read commands incorrectly if an
- expansion error occurred under certain conditions in a user-specified
- subshell.
-
-e. Fixed a bug that caused the shell to set $? incorrectly if a parse error
- occurred in an evaluation context ("eval", trap command, dot script, etc.)
-
-f. Fixed a bug that caused the shell to attempt command substitution
- completion within a single-quoted string.
-
-g. Fixed a bug that caused the shell to insert an extra single quote during
- word completion.
-
-h. Fixed a bug that caused the shell to crash if invoked with the environment
- variable EMACS having a null value.
-
-i. Fixed a bug that caused bash to incorrectly report the presence of new
- mail in a `maildir' environment.
-
-j. Fixed a bug that caused the shell to not recognize a here-document ending
- delimiter inside a command substitution.
-
-k. Fixed a bug that caused the shell to crash when a a dynamic array variable
- was assigned a scalar value.
-
-2. Changes to Readline
-
-3. New Features in Bash
-
-a. The mapfile/readarray builtin no longer stores the commands it invokes via
- callbacks in the history list.
-
-b. There is a new `compat40' shopt option.
-
-c. The < and > operators to [[ do string comparisons using the current locale
- only if the compatibility level is greater than 40 (set to 41 by default).
-
-4. New Features in Readline
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.1-alpha,
-and the previous version, bash-4.0-release.
-
-1. Changes to Bash
-
-a. Fixed bugs in the parser involving new parsing of the commands contained
- in command substitution when the substitution is read.
-
-b. Fixed a bug that caused the shell to dump core when performing programmable
- completion using a shell function.
-
-c. Fixed a bug in `mapfile' that caused it to invoke callbacks at the wrong
- time.
-
-d. Fixed a bug that caused the shell to dump core when listing jobs in the
- `exit' builtin.
-
-e. Fixed several bugs encountered when reading subscripts in associative
- array assignments and expansions.
-
-f. Fixed a bug that under some circumstances caused an associative array to
- be converted to an indexed array.
-
-g. Fixed a bug that caused syntax errors and SIGINT interrupts to not set
- $? to a value > 128.
-
-h. Fixed a bug that caused the shell to remove FIFOs associated with process
- substitution inside shell functions.
-
-i. Fixed a bug that caused terminal attributes to not be reset when the
- `read' builtin timed out.
-
-j. Fixed a bug in brace expansion that caused unwanted zero padding of the
- expanded terms.
-
-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
- dereference a NULL pointer.
-
-m. Fixed a bug that caused assignment statements or redirections preceding
- a simple command name to inhibit alias expansion.
-
-n. Fixed the behavior of `set -u' to conform to the latest Posix interpretation:
- every expansion of an unset variable except $@ and $* will cause the
- shell to exit.
-
-o. Fixed a bug that caused double-quoted expansions of $* inside word
- expansions like ${x#$*} to not expand properly when $IFS is empty.
-
-p. Fixed a bug that caused traps to set $LINENO to the wrong value when they
- execute.
-
-q. Fixed a bug that caused off-by-one errors when computing history lines in
- the `fc' builtin.
-
-r. Fixed a bug that caused some terminating signals to not exit the shell
- quickly enough, forcing the kernel to send the signal (e.g., SIGSEGV)
- multiple times.
-
-s. Fixed a bug that caused the shell to attempt to add empty lines to the
- history list when reading here documents.
-
-t. Made some internal changes that dramatically speeds up sequential indexed
- array access.
-
-u. Fixed a bug that caused the shell to write past the end of a string when
- completing a double-quoted string ending in a backslash.
-
-v. Fixed a bug that caused the shell to replace too many characters when a
- pattern match was null in a ${foo//bar} expansion.
-
-w. Fixed bugs in the expansion of ** that caused duplicate directory names
- and the contents of the current directory to be omitted.
-
-x. Fixed a bug that caused $? to not be set correctly when referencing an
- unset variable with set -u and set -e enabled.
-
-y. Fixed a bug caused by executing an external program from the DEBUG trap
- while a pipeline was running. The effect was to disturb the pipeline
- state, occasionally causing it to hang.
-
-z. Fixed a bug that caused the ** glob expansion to dump core if it
- encountered an unsearchable directory.
-
-aa. Fixed a bug that caused `command -v' and `command -V' to not honor the
- path set by the -p option.
-
-bb. Fixed a bug that caused brace expansion to take place too soon in some
- compound array assignments.
-
-cc. Fixed a bug that caused programmable completion functions' changes to
- READLINE_POINT to not be reflected back to readline.
-
-dd. Fixed a bug that caused the shell to dump core if a trap was executed
- during a shell assignment statement.
-
-ee. Fixed an off-by-one error when computing the number of positional
- parameters for the ${@:0:n} expansion.
-
-ff. Fixed a problem with setting COMP_CWORD for programmable completion
- functions that could leave it set to -1.
-
-gg. Fixed a bug that caused the ERR trap to be triggered in some cases where
- `set -e' would not have caused the shell to exit.
-
-hh. Fixed a bug that caused changes made by `compopt' to not persist past the
- completion function in which compopt was executed.
-
-ii. Fixed a bug that caused the list of hostname completions to not be cleared
- when HOSTNAME was unset.
-
-jj. Fixed a bug that caused variable expansion in here documents to look in
- any temporary environment.
-
-kk. Bash and readline can now convert file names between precomposed and
- decomposed Unicode on Mac OS X ("keyboard" and file system forms,
- respectively). This affects filename completion (using new
- rl_filename_rewrite_hook), globbing, and readline redisplay.
-
-ll. The ERR and EXIT traps now see a non-zero value for $? when a parser
- error after set -e has been enabled causes the shell to exit.
-
-mm. Fixed a bug that in brace expansion that caused zero-prefixed terms to
- not contain the correct number of digits.
-
-nn. Fixed a bug that caused the shell to free non-allocated memory when
- unsetting an associative array which had had a value implicitly assigned
- to index "0".
-
-oo. Fixed a memory leak in the ${!prefix@} expansion.
-
-pp. Fixed a bug that caused printf to not correctly report all write errors.
-
-qq. Fixed a bug that caused single and double quotes to act as delimiters
- when splitting a command line into words for programmable completion.
-
-rr. Fixed a bug that caused ** globbing that caused **/path/* to match every
- directory, not just those matching `path'.
-
-ss. Fixed a bug that caused the shell to dump core when running `help' without
- arguments if the terminal width was fewer than 7 characters.
-
-2. Changes to Readline
-
-a. The SIGWINCH signal handler now avoids calling the redisplay code if
- one arrives while in the middle of redisplay.
-
-b. Changes to the timeout code to make sure that timeout values greater
- than one second are handled better.
-
-c. Fixed a bug in the redisplay code that was triggered by a prompt
- containing invisible characters exactly the width of the screen.
-
-d. Fixed a bug in the redisplay code encountered when running in horizontal
- scroll mode.
-
-e. Fixed a bug that prevented menu completion from properly completing
- filenames.
-
-f. Fixed a redisplay bug caused by a multibyte character causing a line to
- wrap.
-
-g. Fixed a bug that caused key sequences of two characters to not be
- recognized when a longer sequence identical in the first two characters
- was bound.
-
-h. Fixed a bug that caused history expansion to be attempted on $'...'
- single-quoted strings.
-
-i. Fixed a bug that caused incorrect redisplay when the prompt contained
- multibyte characters in an `invisible' sequence bracketed by \[ and
- \].
-
-j. Fixed a bug that caused history expansion to short-circuit after
- encountering a multibyte character.
-
-3. 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.
-
-4. 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 document details the changes between this version, bash-4.0-release,
-and the previous version, bash-4.0-rc1.
-
-1. Changes to Bash
-
-a. Changed the message printed when setlocale(3) fails to only include the
- strerror error text if the call changes errno.
-
-b. Changed trap command execution to reset the line number before running a
- trap (except DEBUG and RETURN traps).
-
-c. Fixed behavior of case-modifiying word expansions to not work on
- individual words within a variable's value.
-
-d. Fixed a bug that caused mapfile to not be interruptible when run in an
- interactive shell.
-
-e. Fixed a bug that caused mapfile to not run callbacks for the first line
- read.
-
-f. Fixed a bug that caused mapfile to not honor EOF typed in an interactive
- shell.
-
-g. Fixed the coprocess reaping code to not run straight from a signal handler.
-
-h. Fixed a bug that caused printf -b to ignore the first % conversion specifier
- in the format string on 64-bit systems.
-
-i. Fixed a bug that caused incorrect word splitting when `:', `=', or `~'
- appeared in $IFS.
-
-j. Fixed a bug that caused data corruption in the programmable completion code
- when a shell function called from a completion aborted execution.
-
-k. Fixed a bug that caused the CPU usage reported by the `time' builtin to be
- capped at 100%.
-
-l. Changed behavior of shell when -e option is in effect to reflect consensus
- of Posix shell standardization working group.
-
-m. Fixed a bug introduced in bash-4.0-alpha that caused redirections to not
- be displayed by `type' or `declare' when appearing in functions under
- certain circumstances.
-
-2. Changes to Readline
-
-a. Fixed a bug that caused !(...) extended glob patterns to inhibit later
- history expansion.
-
-b. Reworked the signal handling to avoid calling disallowed functions from a
- signal handler.
-
-3. New Features in Bash
-
-a. `readarray' is now a synonym for `mapfile'.
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.0-rc1,
-and the previous version, bash-4.0-beta2.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused parsing errors when a $()-style command
- substitution was follwed immediately by a quoted newline.
-
-b. Fixed a bug that caused extended shell globbing patterns beginning with
- `*(' to not work when used with pattern substitution word expansions.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.0-beta2,
-and the previous version, bash-4.0-beta.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused failed word expansions to set $? but not
- PIPESTATUS.
-
-b. Changed filename completion to quote the tilde in a filename with a
- leading tilde that exists in the current directory.
-
-c. Fixed a bug that caused a file descriptor leak when performing
- redirections attached to a compound command.
-
-d. Fixed a bug that caused expansions of $@ and $* to not exit the shell if
- the -u option was enabled and there were no posititional parameters.
-
-e. Fixed a bug that resulted in bash not terminating immediately if a
- terminating signal was received while performing output.
-
-f. Fixed a bug that caused the shell to crash after creating 256 process
- substitutions during word completion.
-
-2. Changes to Readline
-
-a. Fixed a bug that caused redisplay errors when using prompts with invisible
- characters and numeric arguments to a command in a multibyte locale.
-
-b. Fixed a bug that caused redisplay errors when using prompts with invisible
- characters spanning more than two physical screen lines.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.0-beta,
-and the previous version, bash-4.0-alpha.
-
-1. Changes to Bash
-
-a. Fixed a typo that caused a variable to be used before initialization
- while parsing Posix-style command substitutions.
-
-b. Fixed a bug that caused stray ^? when the expansion of a parameter used
- as part of a pattern removal expansion is empty, but part of a non-
- empty string.
-
-c. Fixed a bug that could cause strings not converted to numbers by strtol
- to be treated as if the conversion had been successful.
-
-d. The `return' builtin now accepts no options and requires a `--' before
- a negative return value, as Posix requires.
-
-e. Fixed a bug that caused local variables to be created with the empty
- string for a value rather than no value.
-
-f. Changed behavior so the shell now acts as if it received an interrupt
- when a pipeline is killed by SIGINT while executing a list.
-
-g. Fixed a bug that caused `declare var' and `typeset var' to initialize
- `var' to the empty string.
-
-h. Changed `bind' builtin to print a warning but proceed if invoked when
- line editing is not active.
-
-i. Fixed a bug that caused the shell to exit when the `errexit' option is
- set and a command in a pipeline returns a non-zero exit status.
-
-j. Fixed a bug that caused the shell to not run the exit trap in a command
- run with `bash -c' under some circumstances.
-
-k. Fixed a bug that caused parser errors to occasionally not set $? when
- running commands with `eval'.
-
-l. Fixed a bug that caused stray control characters when evaluating compound
- array assignments containing $'\x7f' escapes.
-
-m. Fixed a bug that caused redirections involving file descriptor 10 as the
- target to behave incorrectly.
-
-n. Fixed a bug that could cause memory to be freed multiple times when
- assigning to COMP_WORDBREAKS.
-
-o. Fixed a bug that could cause NULL pointer dereferences when COMP_WORDBREAKS
- was unset.
-
-2. Changes to Readline
-
-3. New Features in Bash
-
-a. A value of 0 for the -t option to `read' now returns success if there is
- input available to be read from the specified file descriptor.
-
-b. CDPATH and GLOBIGNORE are ignored when the shell is running in privileged
- mode.
-
-c. New bindable readline functions shell-forward-word and shell-backward-word,
- which move forward and backward words delimited by shell metacharacters
- and honor shell quoting.
-
-d. New bindable readline functions shell-backward-kill-word and shell-kill-word
- which kill words backward and forward, but use the same word boundaries
- as shell-forward-word and shell-backward-word.
-
-4. New Features in Readline
-
-a. If the kernel supports it, readline displays special characters
- corresponding to a keyboard-generated signal when the signal is received.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-4.0-alpha,
-and the previous version, bash-3.2-release.
-
-1. Changes to Bash
-
-a. Fixed several bugs in old-style `` command substitution parsing, including
- comment parsing and quoted string handling.
-
-b. Fixed problems parsing arguments to the [[ command's =~ regular expression
- matching operator: metacharacter and whitespace parsing.
-
-c. Fixed a bug that caused the shell to inappropriately reuse high-numbered
- file descriptors it used internally.
-
-d. Fixed a bug in pattern replacement word expansions that caused a `/' as
- the first character of an expanded pattern to be mistaken for a global
- replacement specifier.
-
-e. Fixed several problems with the asprintf and snprintf replacement functions
- that caused hangs and crashes.
-
-f. Fixed a bug in the calculation of the current and previous job that caused
- it to refer to incorrect jobs.
-
-g. Fixed a bug in the check for the validity of a hashed command pathname that
- caused unnecessary hash table deletions and additions.
-
-h. Fixed a bug that caused child processes to inherit the wrong value for $!.
-
-i. Fixed a bug that caused `.' to fail to read and execute commands from non-
- regular files such as devices or named pipes.
-
-j. Fixed a bug in printf formatting for the %x and %X expansions that occurred
- on some systems.
-
-k. Fixed a bug that caused the shell to crash when creating temporary files if
- $TMPDIR named a non-writable directory.
-
-l. Fixed a bug that caused the shell to ignore $TMPDIR when creating temporary
- files under some circumstances.
-
-m. Fixed a bug that caused named pipes created by process substitution to not
- be cleaned up.
-
-n. Fixed a bug that caused HISTTIMEFORMAT to not be honored when it appeared
- in the initial shell environment.
-
-o. Fixed several bugs in the expansion of $* and $@ (quoted and unquoted)
- when IFS is null or contains non-whitespace characters; the same changes
- apply to arrays subscripted with * or @.
-
-p. Fixed several problems with pattern substitution expansions on the
- positional parameters and arrays subscripted with * or @ that occurred
- when $IFS was set to the empty string.
-
-q. Made a change to the default locale initialization code that should
- result in better behavior from the locale-aware library functions.
-
-r. Fixed a bug that caused compacting the jobs list to drop jobs.
-
-s. Fixed a bug that caused jumps back to the top-level processing loop from
- a builtin command to leave the shell in an inconsistent state.
-
-t. Fixed a bug that caused characters that would be escaped internally to be
- doubled when escaped with a backslash.
-
-u. Fixed the initialization of mailboxes to not cause maildirs to be read
- (and stat(2) called for every message file) at shell startup.
-
-v. Fixed a bug that caused the shell to not display $PS2 when the read builtin
- reads a line continued with a backslash.
-
-w. Fixed a bug that caused errors in word splitting when $IFS contained
- characters used for internal quoting.
-
-x. Fixed bugs that caused problems with output from shell builtins not being
- completely displayed on some systems.
-
-y. Fixed a bug that caused output to be lost when a redirection is acting on
- the shell's output file descriptor.
-
-z. Fixed bugs caused by shell builtins not checking for all write errors.
-
-aa. Fixed a problem that caused the shell to dump core if expansions on the
- pattern passed to the pattern removal word expansions resulted in expansion
- errors.
-
-bb. Fixed a bug that caused bash to loop infinitely after creating and
- waiting for 4096 jobs.
-
-cc. Fixed a bug that caused bash to lose the status of a background job under
- certain circumstances.
-
-dd. Fixed a bug that caused bash to not look in the temporary environment
- when performing variable lookup under certain circumstances.
-
-ee. Fixed a bug that caused bash to close file descriptors greater than 10
- when they were used in redirections.
-
-ff. Fixed a problem that caused the shell to attempt to read from the standard
- input when called as `bash -i script'.
-
-gg. Fixed a memory leak and variable initialization problems when the -v option
- was supplied to `printf' that could cause incorrect results.
-
-hh. Fixed a bug that caused the `read' builtin to count bytes when the -n option
- was supplied, rather than (possibly multibyte) characters.
-
-ii. Fixed a bug when displaying a function due to not converting the function
- to an external form.
-
-jj. Changed job control initialization to ensure that the shell has a tty
- as its controlling terminal before enabling job control.
-
-kk. Fixed a bug with the `test' builtin that caused it to misinterpret
- arguments beginning with `-' but containing more than one character.
-
-ll. Fixed bug that could cause the shell to dump core in certain cases where
- a command sets the SIGINT disposition to the default.
-
-mm. Fixed a bug in the pattern replacement (affecting both word expansion
- and the `fc' builtin) that occurred when the pattern and replacement
- strings were empty.
-
-nn. Fixed a bug that caused an arithmetic evaluation error to disable all
- further evaluation.
-
-oo. Fixed a bug in pathname expansion that caused it to interpret backslashes
- in the pathname as quoting characters.
-
-pp. Fixed a bug in the replacement getcwd() implementation that could cause
- memory to be overwritten.
-
-qq. When in Posix mode, the `ulimit' builtin now uses a block size of 512 for
- the `-c' and `-f' options.
-
-rr. Brace expansion now allows process substitutions to pass through unchanged.
-
-ss. Fixed a problem in the command name completion code to avoid quoting
- escaped special characters twice when the command name begins with a tilde.
-
-tt. Fixed a problem in the printf builtin that resulted in single-byte
- output for the "'" escape, even when using multibyte characters.
-
-uu. Fixed a bug that caused the failure exit status to be lost when redirections
- attached to a compound command failed.
-
-vv. Fixed a bug that caused the internal random number generator to not be
- re-seeded correctly when creating a subshell.
-
-ww. Fixed a bug that could cause the bash replacement getcwd to overwrite
- memory.
-
-xx. Fixed a bug that caused the shell to not receive SIGINT if it was sent
- while the shell was waiting for a command substitution to terminate, and
- make sure the exit status is correct when it does.
-
-yy. Fixed a bug that resulted in the second and subsequent children spawned
- by a shell begun to run a command substitution being placed into the
- wrong process group.
-
-zz. Fixed a bug that caused the results of successful tilde expansion to be
- subject to pathname expansion and word splitting.
-
-aaa. Fixed a bug that could cause the shell to hang if it encountered an
- error that caused it to jump back to the top processing loop during a
- command substitution or `eval' command.
-
-bbb. Fixed a bug that caused the `read' builtin to use the tty's attributes
- instead of those of the file descriptor passed with the -u option when
- processing the -n and -d options.
-
-ccc. Fixed a bug that caused incorrect expansion of ${array[@]:foo} if the
- first character of $IFS was not whitespace.
-
-ddd. Fixed a bug that occurred when scanning for the ending delimiter of a
- ${parameter/pat/sub} expansion.
-
-eee. Fixed a bug that caused the shell to inappropriately expand command
- substitutions in words when expanding directory names for completion.
-
-fff. Fixed a bug that caused the `fc' builtin to look too far back in the
- history list under certain circumstances.
-
-ggg. Fixed a bug that caused a shell running in Posix mode to search $PWD for
- a file specified as an argument to source/. when the file was not found
- in $PATH.
-
-hhh. Fixed a bug that caused the shell to modify the case of a command word
- found via command completion when the shell was performing case-
- insensitive completion.
-
-iii. Fixed a bug that caused the shell to search $PATH for an argument to
- source/. even when it contained a `/'.
-
-jjj. Fixed a bug that caused brace expansion to misorder expansions when the
- locale did not have a collating order like aAbBcC...zZ.
-
-kkk. Fixed a bug that did not allow `set +o history' to have any effect when
- run in a startup file or from a sourced file.
-
-lll. Fixed a bug with the precedence of the ?: conditional arithmetic operator.
-
-mmm. Fixed a bug that caused side effects of temporary variable assignments
- to persist in the shell environment.
-
-nnn. Fixed a bug that caused the terminal to be left in non-canonical mode
- when using editing commands that invoke the an editor on the current
- command line.
-
-ooo. Fixed a bug that caused globbing characters and characters in $IFS to not
- be quoted appropriately when displaying assignment statements.
-
-ppp. Fixed a bug that caused the `-e' option to be inherited when sourcing a
- file or evaluating a command with `eval' even if the return value of the
- command was supposed to be ignored.
-
-qqq. Fixed a bug that caused the shell to attempt to created variables with
- invalid names if such names appeared in the initial environment.
-
-rrr. Fixed a bug with quote removal in strings where the final character is a
- backslash.
-
-sss. Fixed a bug that caused the effects of special variables to persist even
- when the variables were unset as part of the shell reinitializing itself
- to execute a shell script.
-
-ttt. Fixed a bug that caused the history to not be saved after `history -c' or
- `history -d' was executed until a sufficient number of commands had been
- saved to the history.
-
-uuu. Bash now parses command substitutions according to Posix rules: parsing
- the command contained in $() to find the closing delimiter.
-
-vvv. Fixed a bug that caused traps on SIGCHLD set in a SIGCHLD handler to
- not persist.
-
-www. Fixed a bug that didn't allow SIGCHLD to interrupt the `wait' builtin
- as Posix specifies.
-
-xxx. Invalid numeric arguments to shell builtins no longer cause the shell to
- short-circuit any executing compound command.
-
-yyy. Fixed a bug that caused the exit status to be lost when `break' was
- used to short-circuit a loop's execution.
-
-zzz. Fixed a bug that caused stray ^? characters to be left in expansions of
- "${array[*]}".
-
-aaaa. Bash now prints better error messages for here documents terminated by
- EOF and for identifying the incorrect token in an invalid arithmetic
- expression.
-
-bbbb. Fixed a bug in the variable length word expansion that caused it to
- incorrectly calculate the number of multibyte characters.
-
-cccc. Fixed a race condition that could result in the top-level shell setting
- the terminal's process group to an incorrect value if the process
- group was changed by a child of a child of the shell.
-
-dddd. Fixed a bug that caused here documents belonging to commands within a
- compound command to be displayed in a syntactially-incorrect form, which
- prevented them from being re-read as input.
-
-eeee. The shell displays more warnings about failures to set the locale.
-
-ffff. Fixed a bug that caused the body of a here-document to not be saved to
- the history list.
-
-gggg. Fixed a bug that caused configure to incorrectly conclude that FreeBSD
- had /dev/fd available, resulting in problems with process substitution.
-
-2. Changes to Readline
-
-a. Fixed a number of redisplay errors in environments supporting multibyte
- characters.
-
-b. Fixed bugs in vi command mode that caused motion commands to inappropriately
- set the mark.
-
-c. When using the arrow keys in vi insertion mode, readline allows movement
- beyond the current end of the line (unlike command mode).
-
-d. Fixed bugs that caused readline to loop when the terminal has been taken
- away and reads return -1/EIO.
-
-e. Fixed bugs in redisplay occurring when displaying prompts containing
- invisible characters.
-
-f. Fixed a bug that caused the completion append character to not be reset to
- the default after an application-specified completion function changed it.
-
-g. Fixed a problem that caused incorrect positioning of the cursor while in
- emacs editing mode when moving forward at the end of a line while using
- a locale supporting multibyte characters.
-
-h. Fixed an off-by-one error that caused readline to drop every 511th
- character of buffered input.
-
-i. Fixed a bug that resulted in SIGTERM not being caught or cleaned up.
-
-j. Fixed redisplay bugs caused by multiline prompts with invisible characters
- or no characters following the final newline.
-
-k. Fixed redisplay bug caused by prompts consisting solely of invisible
- characters.
-
-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.
-
-n. Fixed a bug that caused the vi-mode `last command' to be set incorrectly
- and therefore unrepeatable.
-
-o. Fixed a bug that caused readline to disable echoing when it was being used
- with an output file descriptor that was not a terminal.
-
-p. Readline now blocks SIGINT while manipulating internal data structures
- during redisplay.
-
-q. Fixed a bug in redisplay that caused readline to segfault when pasting a
- very long line (over 130,000 characters).
-
-r. Fixed bugs in redisplay when using prompts with no visible printing
- characters.
-
-3. New Features in Bash
-
-a. When using substring expansion on the positional parameters, a starting
- index of 0 now causes $0 to be prefixed to the list.
-
-b. The `help' builtin now prints its columns with entries sorted vertically
- rather than horizontally.
-
-c. There is a new variable, $BASHPID, which always returns the process id of
- the current shell.
-
-d. There is a new `autocd' option that, when enabled, causes bash to attempt
- to `cd' to a directory name that is supplied as the first word of a
- simple command.
-
-e. There is a new `checkjobs' option that causes the shell to check for and
- report any running or stopped jobs at exit.
-
-f. The programmable completion code exports a new COMP_TYPE variable, set to
- a character describing the type of completion being attempted.
-
-g. The programmable completion code exports a new COMP_KEY variable, set to
- the character that caused the completion to be invoked (e.g., TAB).
-
-h. If creation of a child process fails due to insufficient resources, bash
- will try again several times before reporting failure.
-
-i. The programmable completion code now uses the same set of characters as
- readline when breaking the command line into a list of words.
-
-j. The block multiplier for the ulimit -c and -f options is now 512 when in
- Posix mode, as Posix specifies.
-
-k. Changed the behavior of the read builtin to save any partial input received
- in the specified variable when the read builtin times out. This also
- results in variables specified as arguments to read to be set to the empty
- string when there is no input available. When the read builtin times out,
- it returns an exit status greater than 128.
-
-l. The shell now has the notion of a `compatibility level', controlled by
- new variables settable by `shopt'. Setting this variable currently
- restores the bash-3.1 behavior when processing quoted strings on the rhs
- of the `=~' operator to the `[[' command.
-
-m. The `ulimit' builtin now has new -b (socket buffer size) and -T (number
- of threads) options.
-
-n. The -p option to `declare' now displays all variable values and attributes
- (or function values and attributes if used with -f).
-
-o. There is a new `compopt' builtin that allows completion functions to modify
- completion options for existing completions or the completion currently
- being executed.
-
-p. The `read' builtin has a new -i option which inserts text into the reply
- buffer when using readline.
-
-q. A new `-E' option to the complete builtin allows control of the default
- behavior for completion on an empty line.
-
-r. There is now limited support for completing command name words containing
- globbing characters.
-
-s. Changed format of internal help documentation for all builtins to roughly
- follow man page format.
-
-t. The `help' builtin now has a new -d option, to display a short description,
- and a -m option, to print help information in a man page-like format.
-
-u. There is a new `mapfile' builtin to populate an array with lines from a
- given file.
-
-v. If a command is not found, the shell attempts to execute a shell function
- named `command_not_found_handle', supplying the command words as the
- function arguments.
-
-w. There is a new shell option: `globstar'. When enabled, the globbing code
- treats `**' specially -- it matches all directories (and files within
- them, when appropriate) recursively.
-
-x. There is a new shell option: `dirspell'. When enabled, the filename
- completion code performs spelling correction on directory names during
- completion.
-
-y. The `-t' option to the `read' builtin now supports fractional timeout
- values.
-
-z. Brace expansion now allows zero-padding of expanded numeric values and
- will add the proper number of zeroes to make sure all values contain the
- same number of digits.
-
-aa. There is a new bash-specific bindable readline function: `dabbrev-expand'.
- It uses menu completion on a set of words taken from the history list.
-
-bb. The command assigned to a key sequence with `bind -x' now sets two new
- variables in the environment of the executed command: READLINE_LINE_BUFFER
- and READLINE_POINT. The command can change the current readline line
- and cursor position by modifying READLINE_LINE_BUFFER and READLINE_POINT,
- respectively.
-
-cc. There is a new &>> redirection operator, which appends the standard output
- and standard error to the named file.
-
-dd. The parser now understands `|&' as a synonym for `2>&1 |', which redirects
- the standard error for a command through a pipe.
-
-ee. The new `;&' case statement action list terminator causes execution to
- continue with the action associated with the next pattern in the
- statement rather than terminating the command.
-
-ff. The new `;;&' case statement action list terminator causes the shell to
- test the next set of patterns after completing execution of the current
- action, rather than terminating the command.
-
-gg. The shell understands a new variable: PROMPT_DIRTRIM. When set to an
- integer value greater than zero, prompt expansion of \w and \W will
- retain only that number of trailing pathname components and replace
- the intervening characters with `...'.
-
-hh. There are new case-modifying word expansions: uppercase (^[^]) and
- lowercase (,[,]). They can work on either the first character or
- array element, or globally. They accept an optional shell pattern
- that determines which characters to modify. There is an optionally-
- configured feature to include capitalization operators.
-
-ii. The shell provides associative array variables, with the appropriate
- support to create, delete, assign values to, and expand them.
-
-jj. The `declare' builtin now has new -l (convert value to lowercase upon
- assignment) and -u (convert value to uppercase upon assignment) options.
- There is an optionally-configurable -c option to capitalize a value at
- assignment.
-
-kk. There is a new `coproc' reserved word that specifies a coprocess: an
- asynchronous command run with two pipes connected to the creating shell.
- Coprocs can be named. The input and output file descriptors and the
- PID of the coprocess are available to the calling shell in variables
- with coproc-specific names.
-
-4. New Features in Readline
-
-a. A new variable, rl_sort_completion_matches; allows applications to inhibit
- match list sorting (but beware: some things don't work right if
- applications do this).
-
-b. A new variable, rl_completion_invoking_key; allows applications to discover
- the key that invoked rl_complete or rl_menu_complete.
-
-c. The functions rl_block_sigint and rl_release_sigint are now public and
- available to calling applications who want to protect critical sections
- (like redisplay).
-
-d. The functions rl_save_state and rl_restore_state are now public and
- available to calling applications; documented rest of readline's state
- flag values.
-
-e. A new user-settable variable, `history-size', allows setting the maximum
- number of entries in the history list.
-
-f. There is a new implementation of menu completion, with several improvements
- over the old; the most notable improvement is a better `completions
- browsing' mode.
-
-g. The menu completion code now uses the rl_menu_completion_entry_function
- variable, allowing applications to provide their own menu completion
- generators.
-
-h. There is support for replacing a prefix of a pathname with a `...' when
- displaying possible completions. This is controllable by setting the
- `completion-prefix-display-length' variable. Matches with a common prefix
- longer than this value have the common prefix replaced with `...'.
-
-i. There is a new `revert-all-at-newline' variable. If enabled, readline will
- undo all outstanding changes to all history lines when `accept-line' is
- executed.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.2-release,
-and the previous version, bash-3.2-beta.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused the temporary environment passed to a command to
- affect the shell's environment under certain circumstances.
-
-b. Fixed a bug in the printf builtin that caused the %q format specifier to
- ignore empty string arguments.
-
-c. Improved multibyte character environment detection at configuration time.
-
-d. Fixed a bug in the read builtin that left spurious escape characters in the
- input after processing backslashes when assigning to an array variable.
-
-2. Changes to Readline
-
-a. Fixed a redisplay bug that occurred in multibyte-capable locales when the
- prompt was one character longer than the screen width.
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.2-beta,
-and the previous version, bash-3.2-alpha.
-
-1. Changes to Bash
-
-a. Changed the lexical analyzer to treat locale-specific blank characters as
- white space.
-
-b. Fixed a bug in command printing to avoid confusion between redirections and
- process substitution.
-
-c. Fixed problems with cross-compiling originating from inherited environment
- variables.
-
-d. Added write error reporting to printf builtin.
-
-e. Fixed a bug in the variable expansion code that could cause a core dump in
- a multi-byte locale.
-
-f. Fixed a bug that caused substring expansion of a null string to return
- incorrect results.
-
-g. BASH_COMMAND now retains its previous value while executing commands as the
- result of a trap, as the documentation states.
-
-2. Changes to Readline
-
-a. Fixed a bug with prompt redisplay in a multi-byte locale to avoid redrawing
- the prompt and input line multiple times.
-
-b. Fixed history expansion to not be confused by here-string redirection.
-
-c. Readline no longer treats read errors by converting them to newlines, as
- it does with EOF. This caused partial lines to be returned from readline().
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.2-alpha,
-and the previous version, bash-3.1-release.
-
-1. Changes to Bash
-
-a. Fixed a source bug that caused the minimal configuration to not compile.
-
-b. Fixed memory leaks in error handling for the `read' builtin.
-
-c. Changed the [[ and (( compound commands to set PIPESTATUS with their exit
- status.
-
-d. Fixed some parsing problems with compound array assignments.
-
-e. Added additional configuration changes for: NetBSD (incomplete multibyte
- character support)
-
-f. Fixed two bugs with local array variable creation when shadowing a variable
- of the same name from a previous context.
-
-g. Fixed the `read' builtin to restore the correct set of completion functions
- if a timeout occurs.
-
-h. Added code to defer the initialization of HISTSIZE (and its stifling of the
- history list) until the history file is loaded, allowing a startup file to
- override the default value.
-
-i. Tightened up the arithmetic expression parsing to produce better error
- messages when presented with invalid operators.
-
-j. Fixed the cross-compilation support to build the signal list at shell
- invocation rather than compile time if cross-compiling.
-
-k. Fixed multibyte support for non-gcc compilers (or compilers that do not
- allow automatic array variable sizing based on a non-constant value).
-
-l. Several fixes to the code that manages the list of terminated jobs and
- their exit statuses, and the list of active and recently-terminated jobs
- to avoid pid aliasing/wraparound and allocation errors.
-
-m. Fixed a problem that allowed scripts to die due to SIGINT while waiting
- for children, even when started in the background or otherwise ignoring
- SIGINT.
-
-n. Fixed a bug that caused shells invoked as -/bin/bash from not being
- recognized as login shells.
-
-o. Fixed a problem that caused shells in the background to give the terminal
- to a process group other than the foreground shell process group.
-
-p. Fixed a problem with extracting the `varname' in ${#varname}.
-
-q. Fixed the code that handles SIGQUIT to not exit immediately -- thereby
- calling functions that may not be called in a signal handler context --
- but set a flag and exit afterward (like SIGINT).
-
-r. Changed the brace expansion code to skip over braces that don't begin a
- valid matched brace expansion construct.
-
-s. Fixed `typeset' and `declare' to not require that their shell function
- operands to be valid shell identifiers.
-
-t. Changed `test' to use access(2) with a temporary uid/euid swap when testing
- file attributes and running setuid, and access(2) in most other cases.
-
-u. Changed completion code to not attempt command name completion on a line
- consisting solely of whitespace when no_empty_command_completion is set.
-
-v. The `hash' builtin now prints nothing in posix mode when the hash table is
- empty, and prints a message to that effect to stdout instead of stderr
- when not in posix mode.
-
-w. Fixed a bug in the extended pattern matching code that caused it to fail to
- match periods with certain patterns.
-
-x. Fixed a bug that caused the shell to dump core when performing filename
- generation in directories with thousands of files.
-
-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
- on the settings of the `functrace' and `errtrace' shell options, rather
- than whether or not the shell is in debugging mode.
-
-aa. Fixed a problem with $HOME being converted to ~ in the expansion of
- members of the DIRSTACK array.
-
-bb. Fixed a problem with quoted arguments to arithmetic expansions in certain
- constructs.
-
-cc. The command word completion code now no longer returns matching directories
- while searching $PATH.
-
-dd. Fixed a bug with zero-padding and precision handling in snprintf()
- replacement.
-
-ee. Fixed a bug that caused the command substitution code not to take embedded
- shell comments into account.
-
-ff. Fixed a bug that caused $((...);(...)) to be misinterpreted as an
- arithmetic substitution.
-
-gg. Fixed a bug in the prompt expansion code that inappropriately added a
- \001 before a \002 under certain circumstances.
-
-hh. Fixed a bug that caused `unset LANG' to not properly reset the locale
- (previous versions would set the locale back to what it was when bash
- was started rather than the system's "native" locale).
-
-ii. Fixed a bug that could cause file descriptors > 10 to not be closed even
- when closed explicitly by a script.
-
-jj. Fixed a bug that caused single quotes to be stripped from ANSI-C quoting
- inside double-quoted command substitutions.
-
-kk. Fixed a bug that could cause core dumps when `return' was executed as the
- last element of a pipeline inside a shell function.
-
-ll. Fixed a bug that caused DEBUG trap strings to overwrite commands stored in
- the jobs list.
-
-2. Changes to Readline
-
-a. Fixed a problem that caused segmentation faults when using readline in
- callback mode and typing consecutive DEL characters on an empty line.
-
-b. Fixed several redisplay problems with multibyte characters, all having to
- do with the different code paths and variable meanings between single-byte
- and multibyte character redisplay.
-
-c. Fixed a problem with key sequence translation when presented with the
- sequence \M-\C-x.
-
-d. Fixed a problem that prevented the `a' command in vi mode from being
- undone and redone properly.
-
-e. Fixed a problem that prevented empty inserts in vi mode from being undone
- properly.
-
-f. Fixed a problem that caused readline to initialize with an incorrect idea
- of whether or not the terminal can autowrap.
-
-g. Fixed output of key bindings (like bash `bind -p') to honor the setting of
- convert-meta and use \e where appropriate.
-
-h. Changed the default filename completion function to call the filename
- dequoting function if the directory completion hook isn't set. This means
- that any directory completion hooks need to dequote the directory name,
- since application-specific hooks need to know how the word was quoted,
- even if no other changes are made.
-
-i. Fixed a bug with creating the prompt for a non-interactive search string
- when there are non-printing characters in the primary prompt.
-
-j. Fixed a bug that caused prompts with invisible characters to be redrawn
- multiple times in a multibyte locale.
-
-k. Fixed a bug that could cause the key sequence scanning code to return the
- wrong function.
-
-l. Fixed a problem with the callback interface that caused it to fail when
- using multi-character keyboard macros.
-
-m. Fixed a bug that could cause a core dump when an edited history entry was
- re-executed under certain conditions.
-
-n. Fixed a bug that caused readline to reference freed memory when attmpting
- to display a portion of the prompt.
-
-3. New Features in Bash
-
-a. Changed the parameter pattern replacement functions to not anchor the
- pattern at the beginning of the string if doing global replacement - that
- combination doesn't make any sense.
-
-b. When running in `word expansion only' mode (--wordexp option), inhibit
- process substitution.
-
-c. Loadable builtins now work on MacOS X 10.[34].
-
-d. Shells running in posix mode no longer set $HOME, as POSIX requires.
-
-e. The code that checks for binary files being executed as shell scripts now
- checks only for NUL rather than any non-printing character.
-
-f. Quoting the string argument to the [[ command's =~ operator now forces
- string matching, as with the other pattern-matching operators.
-
-4. New Features in Readline
-
-a. Calling applications can now set the keyboard timeout to 0, allowing
- poll-like behavior.
-
-b. The value of SYS_INPUTRC (configurable at compilation time) is now used as
- the default last-ditch startup file.
-
-c. The history file reading functions now allow windows-like \r\n line
- terminators.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.1-release,
-and the previous version, bash-3.1-rc2.
-
-1. Changes to Readline
-
-a. Several changes to the multibyte redisplay code to fix problems with
- prompts containing invisible characters.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.1-rc2,
-and the previous version, bash-3.1-rc1.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused a DEBUG trap to overwrite a command string that's
- eventually attached to a background job.
-
-b. Changed some code so that filenames with leading tildes with spaces in the
- name aren't tilde-expanded by the bash completion code.
-
-c. Fixed a bug that caused the pushd builtin to fail to change to
- directories with leading `-'.
-
-d. Fixed a small memory leak in the programmable completion code.
-
-2. Changes to Readline
-
-a. Fixed a redisplay bug caused by moving the cursor vertically to a line
- with invisible characters in the prompt in a multibyte locale.
-
-b. Fixed a bug that could cause the terminal special chars to be bound in the
- wrong keymap in vi mode.
-
-3. New Features in Bash
-
-a. If compiled for strict POSIX conformance, LINES and COLUMNS may now
- override the true terminal size.
-
-4. New Features in Readline
-
-a. A new external application-controllable variable that allows the LINES
- and COLUMNS environment variables to set the window size regardless of
- what the kernel returns.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.1-rc1,
-and the previous version, bash-3.1-beta1.
-
-1. Changes to Bash
-
-a. Fixed a bug that could cause core dumps due to accessing the current
- pipeline while in the middle of modifying it.
-
-b. Fixed a bug that caused pathnames with backslashes still quoting characters
- to be passed to opendir().
-
-c. Command word completion now obeys the setting of completion-ignore-case.
-
-d. Fixed a problem with redirection that caused file descriptors greater than
- 2 to be inappropriately marked as close-on-exec.
-
-e. In Posix mode, after `wait' is called to wait for a particular process
- explicitly, that process is removed from the list of processes known to
- the shell, and subsequent attempts to wait for it return errors.
-
-f. Fixed a bug that caused extended pattern matching to incorrectly scan
- backslash-escaped pattern characters.
-
-g. Fixed a synchronization problem that could cause core dumps when handling
- a SIGWINCH.
-
-h. Fixed a bug that caused an unmatched backquote to be accepted without an
- error when processing here documents.
-
-i. Fixed a small memory leak in the `cd' builtin.
-
-j. Fix for MacOS X so it gets the values for the HOSTTYPE, MACHTYPE, and
- OSTYPE variables at build time, to support universal binaries.
-
-k. Fixed a bug that could cause an exit trap to return the exit status of
- the trap command rather than the status as it was before the trap was
- run as the shell's exit status.
-
-2. New Features in Bash
-
-3. Changes to Readline
-
-a. Fixed a bug that caused reversing the incremental search direction to
- not work correctly.
-
-b. Fixed the vi-mode `U' command to only undo up to the first time insert mode
- was entered, as Posix specifies.
-
-c. Fixed a bug in the vi-mode `r' command that left the cursor in the wrong
- place.
-
-4. New Features in Readline
-
-a. New application-callable auxiliary function, rl_variable_value, returns
- a string corresponding to a readline variable's value.
-
-b. When parsing inputrc files and variable binding commands, the parser
- strips trailing whitespace from values assigned to boolean variables
- before checking them.
-
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.1-beta1,
-and the previous version, bash-3.1-alpha1.
-
-1. Changes to Bash
-
-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.
-
-c. Fixed a problem with using += to append to index 0 of an array variable
- when not using subscript syntax.
-
-d. A few changes to configure.in to remove calls to obsolete or outdated
- macros.
-
-e. Make sure changes to variables bash handles specially (e.g., LC_ALL) are
- made when the variable is set in the temporary environment to a command.
-
-f. Make sure changes to variables bash handles specially (e.g., LC_ALL) are
- made when the variable is modified using `printf -v'.
-
-g. The export environment is now remade on cygwin when HOME is changed, so
- DLLs bash is linked against pick up the new value. This fixes problems
- with tilde expansion when linking against and already-installed readline.
-
-h. Small fix to the logic for performing tilde expansion in posix mode, so
- expansion on the right-hand side of an assignment statement takes place.
-
-i. Fixed a bug that prevented redirections associated with a shell function
- from being executed when in a subshell.
-
-j. Fixed `source' and `.' builtins to not require an executable file when
- searching $PATH for a file to source.
-
-k. Fixed a bug that caused incorrect word splitting in a function when IFS
- was declared local, then unset.
-
-l. Fixed a problem with the `kill' builtin that prevented sending signals
- to a process group under certain circumstances when providing a pid < 0.
-
-m. When in POSIX mode, `pwd' now checks that the value it prints is the same
- directory as `.', even when displaying $PWD.
-
-n. Fixed a problem with the `read' builtin when reading a script from standard
- input and reading data from the same file.
-
-o. Fixed a problem with the `type' and `command' builtins that caused absolute
- pathnames to be displayed incorrectly.
-
-p. Some changes to the `bg' builtin for POSIX conformance.
-
-q. The `fc' builtin now removes the `fc' command that caused it to invoke an
- editor on specified history entries from the history entirely, rather than
- simply ignoring it.
-
-r. When in POSIX mode, the `v' command in vi editing mode simply invokes vi
- on the current command, rather than checking $FCEDIT and $EDITOR.
-
-s. Fixed a small memory leak in the pathname canonicalization code.
-
-t. Fixed a bug that caused the expanded value of a $'...' string to be
- incorrectly re-quoted if it occurred within a double-quoted ${...}
- parameter expansion.
-
-u. Restored default emacs-mode key binding of M-TAB to dynamic-complete-history.
-
-v. Fixed a bug that caused core dumps when interrupting loops running builtins
- on some systems.
-
-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 are too large.
-
-aa. A small fix to make sure that $HISTCMD is evaluated whenever the shell is
- saving commands to the history list, not just when HISTSIZE is defined.
-
-2. Changes to Readline
-
-a. The `change-case' command now correctly changes the case of multibyte
- characters.
-
-b. Changes to the shared library construction scripts to deal with Windows
- DLL naming conventions for Cygwin.
-
-c. Fixed the redisplay code to avoid core dumps resulting from a poorly-timed
- SIGWINCH.
-
-d. Fixed the non-incremental search code in vi mode to dispose of any current
- undo list when copying a line from the history into the current editing
- buffer.
-
-e. The variable assignment code now ignores whitespace at the end of lines
- when assigning to boolean variables.
-
-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
- build bash to be POSIX conforming by default.
-
-4. New Features in Readline
-
-a. If the rl_completion_query_items is set to a value < 0, readline never
- asks the user whether or not to view the possible completions.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.1-alpha1,
-and the previous version, bash-3.0-release.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused bash to crash if referencing an unset local array.
-
-b. Fixed a problem that caused tilde expansion to not be performed before
- attempting globbing word completion.
-
-c. Fixed an incompatibility so that a first argument to trap that's a valid
- signal number will be trated as a signal rather than a command to execute.
-
-d. Fixed ${#word} expansion to correctly compute the length of a string
- containing multibyte characters.
-
-e. Fixed a bug that caused bash to not pass the correct flags for signal
- disposition to child processes.
-
-f. Fixed a bug that caused `fc -l' to list one too many history entries.
-
-g. Some fixes to `fc' for POSIX conformance.
-
-h. Some fixes to job status display for POSIX conformance.
-
-i. Fixed a bug that caused `command -v' to display output if a command was not
- found -- it should be silent.
-
-j. In POSIX mode, `type' and `command -[vV]' do not report non-executable
- files, even if the shell will attempt to execute them.
-
-k. Fixed a bug that caused the `==' operator to the [[ command to not attempt
- extended pattern matching.
-
-l. Fixed the brace expansion code to handle characters whose value exceeds 128.
-
-m. Fixed `printf' to handle strings with a leading `\0' whose length is
- non-zero.
-
-n. Fixed a couple of problems with brace expansion where `${' was handled
- incorrectly.
-
-o. Fixed off-by-one error when calculating the upper bound of `offset' when
- processing the ${array[@]:offset:length} expansion.
-
-p. System-specific configuration changes for: FreeBSD 5.x, Interix, MacOS X
- 10.4, Linux 2.4+ kernels, Linux 3.x kernels, Dragonfly BSD, QNX 6.x,
- Cygwin
-
-q. Fixed a bug that caused the shell to ignore the status of the rightmost
- command in a pipeline when the `pipefail' option was enabled.
-
-r. Fixed a completion bug that caused core dumps when expanding a directory
- name.
-
-s. Fixed a bug that prevented `hash -d' from removing commands from the hash
- table.
-
-t. Fixed word splitting to avoid really bad quadratic performance when
- expanding long lists.
-
-u. Fixed a bug that caused negative offsets in substring expansion to use the
- wrong values.
-
-v. Fixed a bug in printf that caused it to not return failure on write errors.
-
-w. Fixed a bug that caused commands in subshells to not be properly timed.
-
-x. The shell parser no longer attempts to parse a compound assignment specially
- unless in a position where an assignment statement is acceptable or parsing
- arguments to a builtin that accepts assignment statements.
-
-y. Fixed a problem that caused a `case' statement to be added to the history
- incorrectly as a single command if the `case word' was on one line and the
- `in' on another.
-
-z. Fixed a problem that caused internal shell quoting characters to be
- incorrectly quoted with backslashes under some circumstances.
-
-aa. The shell now performs correct word splitting when IFS contains multibyte
- characters.
-
-bb. The mail checking code now resets the cached file information if the size
- drops to 0, even if the times don't change.
-
-cc. A completed command name that is found in $PATH as well as the name of a
- directory in the current directory no longer has a slash appended in certain
- circumstances: a single instance found in $PATH when `.' is not in $PATH,
- and multiple instances found in $PATH, even when `.' is in $PATH.
-
-dd. Incorporated tilde expansion into the word expansion code rather than as a
- separately-called function, fixing some cases where it was performed
- inappropriately (e.g., after the second `=' in an assignment statement or
- in a double-quoted parameter expansion).
-
-ee. Fixed several bugs encountered when parsing compound assignment statements,
- so that compound assignments appearing as arguments to builtins are no
- longer double-expanded.
-
-ff. Fixed a bug in the command execution code that caused asynchronous commands
- containing command substitutions to not put the terminal in the wrong
- process group.
-
-gg. Bash now handles the case where the WCONTINUED flag causes waitpid() to
- return -1/EINVAL at runtime as well as configuration time.
-
-hh. Fixed parser to generate an error when the pipeline `argument' to `!' or
- `time' is NULL.
-
-ii. The shell now takes a little more care when manipulating file descriptors
- greater than 9 with the `exec' builtin.
-
-jj. Fixed a bug that caused variable assignments preceding the `command' builtin
- preceding a special builtin to be preserved after the command completed in
- POSIX mode.
-
-kk. Fixed a bug that allowed variables beginning with a digit to be created.
-
-ll. Fixed a bug that caused a \<newline> to be removed when parsing a $'...'
- construct.
-
-mm. A shell whose name begins with `-' will now be a restricted shell if the
- remainder of the name indicates it should be restricted.
-
-nn. Fixed a bug that could cause a core dump if FUNCNAME were changed or unset
- during a function's execution.
-
-oo. Fixed a bug that caused executing a `return' in a function to not execute
- a RETURN trap. The RETURN trap is inherited by shell functions only if
- function tracing is globally enabled or has been enabled for that function.
-
-pp. Fixed cases where var[@] was not handled exactly like var, when var is a
- scalar variable.
-
-qq. Fixed a bug that caused the first character after a SIGINT to be discarded
- under certain circumstances.
-
-rr. Fixed exit status code so that a suspended job returns 128+signal as its
- exit status (preventing commands after it in `&&' lists from being
- executed).
-
-ss. Fixed a bug that caused the shell parser state to be changed by executing
- a shell function as a result of word completion.
-
-tt. Fixed a long-standing bug that caused '\177' characters in variable
- values to be discarded when expanded in double-quoted strings.
-
-uu. Fixed a bug that caused $RANDOM to be re-seeded multiple times in a
- subshell environment.
-
-vv. Extensive changes to the job management code to avoid the pid-reuse and
- pid-aliasing problems caused by retaining the exit status of too many jobs,
- but still retain as many background job statuses as POSIX requires.
-
-ww. Fixed a parser bug in processing \<newline> that caused things like
-
- ((echo 5) \
- (echo 6))
-
- to not work correctly.
-
-xx. `pwd -P' now sets $PWD to a directory name containing no symbolic links
- when in posix mode, as POSIX requires.
-
-yy. In posix mode, bash no longer sets $PWD to a name containing no symbolic
- links if a directory is chosen from $CDPATH.
-
-zz. The word splitting code now treats an IFS character that is not space,
- tab, or newline and any adjacent IFS white space as a single delimiter, as
- SUSv3/XPG6 require.
-
-aaa. The `read' builtin now checks whether or not the number of fields read is
- exactly the same as the number of variables instead of just assigning the
- rest of the line (minus any trailing IFS white space) to the last
- variable. This is what POSIX/SUS/XPG all require.
-
-bbb. Fixed a bug that caused `read' to always check whether or not fd 0 was a
- pipe, even when reading from another file descriptor.
-
-ccc. Fixed a bug that caused short-circuiting of execution even if the return
- value was being inverted.
-
-ddd. Fixed a bug that caused a core dump while decoding \W escapes in PS1 if
- PWD was unset.
-
-eee. Fixed a bug in `read' that counted internal quoting characters for the
- purposes of `read -n'.
-
-fff. Fixed a bug so that a function definition in a pipeline causes a child
- process to be forked at the right time.
-
-ggg. Bash will not attempt to link against a readline library that doesn't
- have rl_gnu_readline_p == 1.
-
-hhh. Fixed a bug that caused `read' to consume one too many characters when
- reading a fixed number of characters and the Nth character is a backslash.
-
-iii. Fixed a bug that caused `unset' on variables in the temporary environment
- to leave them set when `unset' completed.
-
-jjj. Fixed a bug that caused bash to close fd 2 if an `exec' failed and the
- shell didn't exit.
-
-kkk. The completion code is more careful to not turn `/' or `///' into `//',
- for those systems on which `//' has special meaning.
-
-lll. Fixed a bug that caused command substitution in asynchronous commands to
- close the wrong file descriptors.
-
-mmm. The shell no longer prints status messages about terminated background
- processes unless job control is active.
-
-nnn. Fixed a bug that prevented multiple consecutive invocations of `history -s'
- from adding all the commands to the history list.
-
-ooo. Added a couple of changes to make arithmetic expansion more consistent in
- all its contexts (still not perfect).
-
-ppp. Fixed a bug that caused the parser to occasionally not find the right
- terminating "`" in an old-style command substitution.
-
-qqq. Fixed a bug that caused core dumps when the shell was reading its non-
- interactive input from fd 0 and fd 0 was duplicated and restored using a
- combination of `exec' (to save) and redirection (to restore).
-
-rrr. Fixed a problem that caused loops in sourced scripts to not be cleaned
- up properly when a `return' is executed.
-
-sss. Change internal command substitution completion function to append a slash
- to directory names in the command.
-
-2. Changes to Readline
-
-a. Fixed a bug that caused multiliine prompts to be wrapped and displayed
- incorrectly.
-
-b. Fixed a bug that caused ^P/^N in emacs mode to fail to display the current
- line correctly.
-
-c. Fixed a problem in computing the number of invisible characters on the first
- line of a prompt whose length exceeds the screen width.
-
-d. Fixed vi-mode searching so that failure preserves the current line rather
- than the last line in the history list.
-
-e. Fixed the vi-mode `~' command (change-case) to have the correct behavior at
- end-of-line when manipulating multibyte characters.
-
-f. Fixed the vi-mode `r' command (change-char) to have the correct behavior at
- end-of-line when manipulating multibyte characters.
-
-g. Fixed multiple bugs in the redisplay of multibyte characters: displaying
- prompts longer than the screen width containing multibyte characters,
-
-h. Fix the calculation of the number of physical characters in the prompt
- string when it contains multibyte characters.
-
-i. A non-zero value for the `rl_complete_suppress_append' variable now causes
- no `/' to be appended to a directory name.
-
-j. Fixed forward-word and backward-word to work when words contained
- multibyte characters.
-
-k. Fixed a bug in finding the delimiter of a `?' substring when performing
- history expansion in a locale that supports multibyte characters.
-
-l. Fixed a memory leak caused by not freeing the timestamp in a history entry.
-
-m. Fixed a bug that caused "\M-x" style key bindings to not obey the setting
- of the `convert-meta' variable.
-
-n. Fixed saving and restoring primary prompt when prompting for incremental
- and non-incremental searches; search prompts now display multibyte
- characters correctly.
-
-o. Fixed a bug that caused keys originally bound to self-insert but shadowed
- by a multi-character key sequence to not be inserted.
-
-p. Fixed code so rl_prep_term_function and rl_deprep_term_function aren't
- dereferenced if NULL (matching the documentation).
-
-q. Extensive changes to readline to add enough state so that commands
- requiring additional characters (searches, multi-key sequences, numeric
- arguments, commands requiring an additional specifier character like
- vi-mode change-char, etc.) work without synchronously waiting for
- additional input.
-
-r. Lots of changes so readline builds and runs on MinGW.
-
-s. Readline no longer tries to modify the terminal settings when running in
- callback mode.
-
-t. The Readline display code no longer sets the location of the last invisible
- character in the prompt if the \[\] sequence is empty.
-
-3. New Features in Bash
-
-a. Bash now understands LC_TIME as a special variable so that time display
- tracks the current locale.
-
-b. BASH_ARGC, BASH_ARGV, BASH_SOURCE, and BASH_LINENO are no longer created
- as `invisible' variables and may not be unset.
-
-c. In POSIX mode, if `xpg_echo' option is enabled, the `echo' builtin doesn't
- try to interpret any options at all, as POSIX requires.
-
-d. The `bg' builtin now accepts multiple arguments, as POSIX seems to specify.
-
-e. Fixed vi-mode word completion and glob expansion to perform tilde
- expansion.
-
-f. The `**' mathematic exponentiation operator is now right-associative.
-
-g. The `ulimit' builtin has new options: -i (max number of pending signals),
- -q (max size of POSIX message queues), and -x (max number of file locks).
-
-h. A bare `%' once again expands to the current job when used as a job
- specifier.
-
-i. The `+=' assignment operator (append to the value of a string or array) is
- now supported for assignment statements and arguments to builtin commands
- that accept assignment statements.
-
-j. BASH_COMMAND now preserves its value when a DEBUG trap is executed.
-
-k. The `gnu_errfmt' option is enabled automatically if the shell is running
- in an emacs terminal window.
-
-l. New configuration option: --single-help-strings. Causes long help text
- to be written as a single string; intended to ease translation.
-
-m. The COMP_WORDBREAKS variable now causes the list of word break characters
- to be emptied when the variable is unset.
-
-n. An unquoted expansion of $* when $IFS is empty now causes the positional
- parameters to be concatenated if the expansion doesn't undergo word
- splitting.
-
-o. Bash now inherits $_ from the environment if it appears there at startup.
-
-p. New shell option: nocasematch. If non-zero, shell pattern matching ignores
- case when used by `case' and `[[' commands.
-
-q. The `printf' builtin takes a new option: -v var. That causes the output
- to be placed into var instead of on stdout.
-
-r. By default, the shell no longer reports processes dying from SIGPIPE.
-
-s. Bash now sets the extern variable `environ' to the export environment it
- creates, so C library functions that call getenv() (and can't use the
- shell-provided replacement) get current values of environment variables.
-
-4. New Features in Readline
-
-a. The key sequence sent by the keypad `delete' key is now automatically
- bound to delete-char.
-
-b. A negative argument to menu-complete now cycles backward through the
- completion list.
-
-c. A new bindable readline variable: bind-tty-special-chars. If non-zero,
- readline will bind the terminal special characters to their readline
- equivalents when it's called (on by default).
-
-d. New bindable command: vi-rubout. Saves deleted text for possible
- reinsertion, as with any vi-mode `text modification' command; `X' is bound
- to this in vi command mode.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.0-release,
-and the previous version, bash-3.0-rc1.
-
-1. Changes to Bash
-
-a. Fixed a boundary overrun that could cause segmentation faults when the
- completion code hands an incomplete construct to the word expansion
- functions.
-
-b. Changed posix mode behavior so that an error in a variable assignment
- preceding a special builtin causes a non-interactive shell to exit.
-
-c. Change the directory expansion portion of the completion code to not
- expand embedded command substitutions if the directory name appears in
- the file system.
-
-d. Fixed a problem that caused `bash -r' to turn on restrictions before
- reading the startup files.
-
-e. Fixed a problem with the default operation of the `umask' builtin.
-
-2. Changes to Readline
-
-a. Fixed a problem with readline saving the contents of the current line
- before beginning a non-interactive search.
-
-b. Fixed a problem with EOF detection when using rl_event_hook.
-
-c. Fixed a problem with the vi mode `p' and `P' commands ignoring numeric
- arguments.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.0-rc1,
-and the previous version, bash-3.0-beta1.
-
-1. Changes to Bash
-
-a. Fixed a bug that caused incorrect behavior when referecing element 0 of
- an array using $array, element 0 was unset, and `set -u' was enabled.
-
-b. System-specific changes for: SCO Unix 3.2, Tandem.
-
-c. Fixed a bug that caused inappropriate word splitting when a variable was
- expanded within a double-quoted string that also included $@.
-
-d. Fixed a bug that caused `pwd' to not display anything in physical mode
- when the file system had changed underneath the shell.
-
-e. Fixed a bug in the pre- and post- increment and decrement parsing in the
- expression evaluator that caused errors when the operands and corresponding
- operators were separated by whitespace.
-
-f. Fixed a bug that caused `history -p' to add an entry to the history list,
- counter to the documentation. (Keeps the history expansions invoked by
- emacs-mode command line editing from doing that as well.)
-
-g. Fixed a bug that could cause a core dump if `cd' is asked to print out a
- pathname longer than PATH_MAX characters.
-
-h. Fixed a bug that caused jobs to be put into the wrong process group under
- some circumstances after enabling job control with `set -m'.
-
-i. `unalias' now returns failure if no alias name arguments are supplied.
-
-j. Documented the characters not allowed to appear in an alias name.
-
-k. $* is no longer expanded as if in double quotes when it appears in the
- body of a here document, as the SUS seems to require.
-
-l. The `bashbug' script now uses a directory in $TMPDIR for exclusive
- access rather than trying to guess how the underlying OS provides for
- secure temporary file creation.
-
-m. Fixed a few problems with `cd' and `pwd' when asked to operate on pathnames
- longer than PATH_MAX characters.
-
-n. Fixed a memory leak caused when creating multiple local array variables
- with identical names.
-
-o. Fixed a problem with calls to getcwd() so that bash now operates better
- when the full pathname to the current directory is longer than PATH_MAX
- bytes.
-
-p. The `trap' builtin now reports an error if a single non-signal argument
- is specified.
-
-q. Fixed a bug that caused `umask' to not work correctly when presented
- with a mask of all 0s.
-
-r. When `getopts' reaches the end of options, OPTARG is unset, as POSIX
- appears to specify.
-
-s. Interactive mode now depends on whether or not stdin and stderr are
- connected to a tty; formerly it was stdin and stdout. POSIX requires
- this.
-
-t. Fixed vi-mode completion to work more as POSIX specifies (e.g., doing the
- right kind of filename generation).
-
-2. Changes to Readline
-
-a. Fixed a problem that could cause readline to refer to freed memory when
- moving between history lines while doing searches.
-
-b. Improvements to the code that expands and displays prompt strings
- containing multibyte characters.
-
-c. Fixed a problem with vi-mode not correctly remembering the numeric argument
- to the last `c'hange command for later use with `.'.
-
-d. Fixed a bug in vi-mode that caused multi-digit count arguments to work
- incorrectly.
-
-e. Fixed a problem in vi-mode that caused the last text modification command
- to not be remembered across different command lines.
-
-f. Fixed problems with changing characters and changing case at the end of
- the line.
-
-3. New Features in Bash
-
-a. The `jobs', `kill', and `wait' builtins now accept job control notation
- even if job control is not enabled.
-
-b. The historical behavior of `trap' that allows a missing `action' argument
- to cause each specified signal's handling to be reset to its default is
- now only supported when `trap' is given a single non-option argument.
-
-4. New Features in Readline
-
-a. When listing completions, directories have a `/' appended if the
- `mark-directories' option has been enabled.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.0-beta1,
-and the previous version, bash-3.0-alpha.
-
-1. Changes to Bash
-
-a. Fixes to build correctly when arrays are not compiled into the shell.
-
-b. Fixed command substitution to run any exit trap defined in the command
- substitution before returning; the exit trap is not inherited from the
- calling shell.
-
-c. Fixes to process group synchronization code so that every child process
- attempts to set the terminal's process group; fixes some synchronization
- problems on Linux kernels that schedule the child to always run before
- the parent.
-
-d. Fixed processing of octal and hex constants in printf builtin for POSIX.2
- compliance.
-
-e. Fixed a couple of core dumps in the pattern removal code.
-
-f. Fixes to the array subrange extraction code to deal better with sparse
- arrays.
-
-g. Parser errors and other errors that result in the shell exiting now cause
- the exit trap to be run.
-
-h. Change the command substitution completion functions to not append any
- closing quote, because it would be inserted a closing "`" or ")".
-
-i. Fix history initialization so assignments to $histchars made in startup
- files are honored.
-
-j. If an exit trap does not contain a call to `exit', the shell now uses
- the exit status of the last command executed before the trap as the exit
- status of the shell.
-
-k. The parser now prompts with $PS2 if it reads a newline while parsing a
- compound array assignment statement.
-
-l. When performing a compound array assignment, the parser doesn't treat
- words of the form [index]=value as assignments if they're the result of
- expansions.
-
-m. Fixed a bug that caused `return' executed in a trap command to make the
- shell think it was still running the trap.
-
-n. Fixed the value of errno set by the pathname canonicalization functions.
-
-o. Changed the grammar so that `time' alone on a line times a null command
- rather than being a syntax error.
-
-p. The pattern substitution code no longer performs quote removal on the
- pattern before trying to match it, as the pattern removal functions do.
-
-q. Fixed a bug that could cause core dumps when checking whether a quoted
- command name was being completed.
-
-r. Fixes to the pattern removal and pattern replacement expansions to deal
- with multibyte characters better (and faster).
-
-s. Fix to the substring expansion (${param:off[:len]}) to deal with (possibly
- multibyte) characters instead of raw bytes.
-
-t. Fixed a bug that caused some key bindings set in an inputrc to be ignored
- at shell startup.
-
-u. Fixed a bug that caused unsetting a local variable within a function to
- not work correctly.
-
-v. Fixed a bug that caused invalid variables to be created when using
- `read -a'.
-
-w. Fixed a bug that caused "$@" to expand incorrectly when used as the right
- hand side of a parameter expansion such as ${word:="$@"} if the first
- character of $IFS was not a space.
-
-x. Fixed a slight cosmetic problem when printing commands containing a
- `>&word' redirection.
-
-y. Fixed a problem that could cause here documents to not be created correctly
- if the system temporary directory did not allow writing.
-
-2. Changes to Readline
-
-a. Change to history expansion functions to treat `^' as equivalent to word
- one, as the documention states.
-
-b. Some changes to the display code to improve display and redisplay of
- multibyte characters.
-
-c. Changes to speed up the multibyte character redisplay code.
-
-d. Fixed a bug in the vi-mode `E' command that caused it to skip over the
- last character of a word if invoked while point was on the word's
- next-to-last character.
-
-e. Fixed a bug that could cause incorrect filename quoting when
- case-insensitive completion was enabled and the word being completed
- contained backslashes quoting word break characters.
-
-f. Fixed a bug in redisplay triggered when the prompt string contains
- invisible characters.
-
-g. Fixed some display (and other) bugs encountered in multibyte locales
- when a non-ascii character was the last character on a line.
-
-h. Fixed some display bugs caused by multibyte characters in prompt strings.
-
-i. Fixed a problem with history expansion caused by non-whitespace characters
- used as history word delimiters.
-
-3. New Features in Bash
-
-a. printf builtin understands two new escape sequences: \" and \?.
-
-b. `echo -e' understands two new escape sequences: \" and \?.
-
-c. The GNU `gettext' package and libintl have been integrated; the shell's
- messages can be translated into different languages.
-
-d. The `\W' prompt expansion now abbreviates $HOME as `~', like `\w'.
-
-e. The error message printed when bash cannot open a shell script supplied
- as argument 1 now includes the name of the shell, to better identify
- the error as coming from bash.
-
-4. New Features in Readline
-
-a. New application variable, rl_completion_quote_character, set to any
- quote character readline finds before it calls the application completion
- function.
-
-b. New application variable, rl_completion_suppress_quote, settable by an
- application completion function. If set to non-zero, readline does not
- attempt to append a closing quote to a completed word.
-
-c. New application variable, rl_completion_found_quote, set to a non-zero
- value if readline determines that the word to be completed is quoted.
- Set before readline calls any application completion function.
-
-d. New function hook, rl_completion_word_break_hook, called when readline
- needs to break a line into words when completion is attempted. Allows
- the word break characters to vary based on position in the line.
-
-e. New bindable command: unix-filename-rubout. Does the same thing as
- unix-word-rubout, but adds `/' to the set of word delimiters.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-3.0-alpha,
-and the previous version, bash-2.05b-release.
-
-1. Changes to Bash
-
-a. Fixes so that the shell will compile without some of the default options
- defined.
-
-b. Fixed an error message that did not pass enough arguments to printf.
-
-c. Fixed a bug that caused input redirection to a builtin inside a script
- being read from standard input to result in the rest of the already-
- read and buffered script to be discarded.
-
-d. Fixed a bug that caused subshell initialization to close the file
- descriptor from which the shell was reading a script under certain
- circumstances.
-
-e. Fixed a bug that caused the shell to not advance a string pointer over
- a null wide character when doing string operations.
-
-f. Fixed the internal logout code so that shells that time out waiting for
- input (using $TMOUT) run ~/.bash_logout.
-
-g. Portability and configuration changes for: cygwin, HP/UX, GNU/FreeBSD.
-
-h. The parser no longer adds implicit double quotes to ((...)) arithmetic
- commands.
-
-i. The ((...)) arithmetic command evaluation code was fixed to not dump core
- when the expanded string is null.
-
-j. The ((...)) arithmetic command evaluation code was fixed to not perform
- variable assignments while expanding the expression.
-
-k. Fixed a bug that caused word splitting to be performed incorrectly when
- IFS is set, but null.
-
-l. Fixed a bug in brace expansion that caused a quoted `$' preceding an
- open brace to inhibit brace expansion.
-
-m. Fixed a bug that caused a leading `-' in the shell's name to cause it to
- not be recognized as a restricted shell.
-
-n. Fixed a bug in the arithmetic evaluation code that could cause longjmps
- to an invalid location and result in a core dump.
-
-o. Fixed a bug in the calculation of how many history lines are new in a
- single shell session when reading new history lines from a file with
- `history -n'.
-
-p. Fixed a bug in pathname canonicalization that caused the shell to dump
- core when presented with a pathname longer than PATH_MAX.
-
-q. Fixed the parser so that it doesn't try to compare a char variable to
- EOF, which fails when chars are unsigned.
-
-r. Fixed a bug in the simple command execution code that caused occasional
- core dumps.
-
-s. The shell does a better job of saving any partial parsing state during
- operations which cause a command to be executed while a line is being
- entered and parsed.
-
-t. The completion code now splits words more like the expansion code when
- $IFS is used to split.
-
-u. The locale code does a better job of recomputing the various locale
- variable values when LC_ALL is unset.
-
-v. The programmable completion code does a better job of dequoting expanded
- word lists before comparing them against the word to be matched.
-
-w. The shell no longer seg faults if the expanded value of $PS4 is null
- and `set -x' is enabled.
-
-x. Fixed a bug that caused core dumps when a here string expanded to NULL.
-
-y. The mail checking code now makes sure the mailbox is bigger before
- reporting the existence of new mail.
-
-z. The parser does not try to expand $'...' and $"..." when the appear
- within double quotes unless the `extquote' option has been enabled with
- `shopt'. For backwards compatibility, it is enabled by default.
-
-aa. Fixed a bug that caused `for x; do ...' and `select x; do ... to use
- $@ instead of "$@" for the implicit list of arguments.
-
-bb. Fixed a bug that caused a subshell of a restricted shell (e.g., one
- spawned to execute a pipeline) to not exit immediately if attempting
- to use a command containing a slash.
-
-cc. Fixed a problem with empty replacements for a pattern that doesn't match
- when performing ${param/word/} expansion.
-
-dd. Word expansions performed while expanding redirections no longer search
- a command's temporary environment to expand variable values.
-
-ee. Improvements to the alias expansion code when expanding subsequent words
- because an aliase's value ends with a space.
-
-ff. `cd -' now prints the current working directory after a successful chdir
- even when the shell is not interactive, as the standard requires.
-
-gg. The shell does a better job of ensuring a child process dies of SIGINT
- before resending SIGINT to itself.
-
-hh. The arithmetic expansion variable assignment code now does the right
- thing when assigning to `special' variables like OPTIND.
-
-ii. When history expansion verification is enabled, the bash readline helper
- functions that do history expansion on the current line don't print
- the results.
-
-jj. Fixed bugs with multiple consecutive alias expansion when one of the
- expansions ends with a space.
-
-kk. Fixed a problem in the programmable completion code that could cause core
- dumps when trying to initialize a set of possible completions from a
- list of variables.
-
-ll. The \[ and \] escape characters are now ignored when decoding the prompt
- string if the shell is started with editing disabled.
-
-mm. Fixed a bug that could leave extra characters in a string when doing
- quoted null character removal.
-
-nn. Command substitution and other subshell operations no longer reset the
- line number (aids the bash debugger).
-
-oo. Better line number management when executing simple commands, conditional
- commands, for commands, and select commands.
-
-pp. The globbing code now uses malloc, with its better failure properties,
- rather than alloca().
-
-qq. Fixed a bug that caused expansions like #{a[2]:=value} to create the
- appropriate array element instead of a variable named `a[2]'.
-
-rr. Fixed a bug in the handling of a `?(...)' pattern immediately following
- a `*' when extglob is enabled.
-
-ss. Fixed a bug that caused a `return' invoked in an exit trap when exit is
- invoked in a function to misbehave.
-
-tt. Fixed a bug that caused CTLESC and CTLNUL characters to not be escaped
- by the internal shell string quoting functions.
-
-uu. Fixed a bug that caused quoted null characters in an expanded word list
- to be inappropriately assigned to an array variable when using `read -a'.
-
-vv. Fixed a bug that caused redirections accompanying a null command to persist
- in the current shell.
-
-ww. Fixed a bug that caused the prompt to be printed when the shell was
- expanding a multiline alias.
-
-xx. Fixed a bug that resulted in core dumps when the completion for a command
- changed the compspec.
-
-yy. Fixed a bug that caused evaluation of programmable completions to print
- notifications of completed jobs.
-
-zz. Bash now disables line editing when $EMACS == `t' and $TERM == `dumb'
- (which is what emacs shell windows do).
-
-aaa. In posix mode, `kill -l' causes signal names to be displayed without
- a leading `SIG'.
-
-bbb. Clear error flag on standard output so it doesn't persist across multiple
- builtin commands.
-
-ccc. In posix mode, `alias' displays alias values without the leading `alias',
- so the output cannot be used as subsequent input.
-
-ddd. In posix mode, the `trap' builtin doesn't check whether or not its
- first argument is a signal specification and revert the signal handling
- to its original disposition if it is.
-
-eee. Fixed several bugs in the handling of "$*" and "${array[*]}" by the
- pattern substitution and removal expansions.
-
-fff. Fixed several problems with the handling of ${array[@]}, ${array[*]},
- $@, and $* by the indirect variable expansion code.
-
-ggg. Fixed a bug that did not allow `time' to be aliased.
-
-hhh. Improved the mail checking code so it won't check (and possibly cause an
- NFS file system mount) until MAILPATH or MAIL is given a value -- there
- is no default if DEFAULT_MAIL_DIRECTORY is not defined at compile time.
- (It is computed by configure, but can be #undef'd in config-bot.h.)
-
-iii. If the `chkwinsize' option is enabled, the shell checks for window size
- changes if a child process exits due to a signal.
-
-jjj. Removed the attempts to avoid adding a slash at the end of a completed
- executable name if there was a directory with the same name in the
- current directory.
-
-kkk. Fixed PATH lookup code so it treats the permission bits separately for
- owner, group, and other, rather than checking them all.
-
-lll. Fixed the locale code to reset the parser's idea of the character class
- <blank>, which controls how it splits tokens, when the locale changes.
-
-mmm. The shell now binds its special readline functions and key bindings only
- if the user's inputrc file has not already bound them.
-
-nnn. The shell now reports on processes that dump core due to signals when
- invoked as `-c command'.
-
-2. Changes to Readline
-
-a. Fixes to avoid core dumps because of null pointer references in the
- multibyte character code.
-
-b. Fix to avoid infinite recursion caused by certain key combinations.
-
-c. Fixed a bug that caused the vi-mode `last command' to be set incorrectly.
-
-d. Readline no longer tries to read ahead more than one line of input, even
- when more is available.
-
-e. Fixed the code that adjusts the point to not mishandle null wide
- characters.
-
-f. Fixed a bug in the history expansion `g' modifier that caused it to skip
- every other match.
-
-g. Fixed a bug that caused the prompt to overwrite previous output when the
- output doesn't contain a newline and the locale supports multibyte
- characters. This same change fixes the problem of readline redisplay
- slowing down dramatically as the line gets longer in multibyte locales.
-
-h. History traversal with arrow keys in vi insertion mode causes the cursor
- to be placed at the end of the new line, like in emacs mode.
-
-i. The locale initialization code does a better job of using the right
- precedence and defaulting when checking the appropriate environment
- variables.
-
-j. Fixed the history word tokenizer to handle <( and >( better when used as
- part of bash.
-
-k. The overwrite mode code received several bug fixes to improve undo.
-
-l. Many speedups to the multibyte character redisplay code.
-
-m. The callback character reading interface should not hang waiting to read
- keyboard input.
-
-n. Fixed a bug with redoing vi-mode `s' command.
-
-o. The code that initializes the terminal tracks changes made to the terminal
- special characters with stty(1) (or equivalent), so that these changes
- are reflected in the readline bindings. New application-callable function
- to make it work: rl_tty_unset_default_bindings().
-
-p. Fixed a bug that could cause garbage to be inserted in the buffer when
- changing character case in vi mode when using a multibyte locale.
-
-q. Fixed a bug in the redisplay code that caused problems on systems
- supporting multibyte characters when moving between history lines when the
- new line has more glyphs but fewer bytes.
-
-r. Undo and redo now work better after exiting vi insertion mode.
-
-s. Make sure system calls are restarted after a SIGWINCH is received using
- SA_RESTART.
-
-t. Improvements to the code that displays possible completions when using
- multibyte characters.
-
-u. Fixed a problem when parsing nested if statements in inputrc files.
-
-v. The completer now takes multibyte characters into account when looking for
- quoted substrings on which to perform completion.
-
-w. The history search functions now perform better bounds checking on the
- history list.
-
-3. New Features in Bash
-
-a. ANSI string expansion now implements the \x{hexdigits} escape.
-
-b. There is a new loadable `strftime' builtin.
-
-c. New variable, COMP_WORDBREAKS, which controls the readline completer's
- idea of word break characters.
-
-d. The `type' builtin no longer reports on aliases unless alias expansion
- will actually be performed.
-
-e. HISTCONTROL is now a colon-separated list of values, which permits
- more extensibility and backwards compatibility.
-
-f. HISTCONTROL may now include the `erasedups' option, which causes all lines
- matching a line being added to be removed from the history list.
-
-g. `configure' has a new `--enable-multibyte' argument that permits multibyte
- character support to be disabled even on systems that support it.
-
-h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV,
- BASH_SOURCE, BASH_LINENO, BASH_SUBSHELL, BASH_EXECUTION_STRING,
- BASH_COMMAND
-
-i. FUNCNAME has been changed to support the debugger: it's now an array
- variable.
-
-j. for, case, select, arithmetic commands now keep line number information
- for the debugger.
-
-k. There is a new `RETURN' trap executed when a function or sourced script
- returns (not inherited child processes; inherited by command substitution
- if function tracing is enabled and the debugger is active).
-
-l. New invocation option: --debugger. Enables debugging and turns on new
- `extdebug' shell option.
-
-m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR
- traps, respectively, to be inherited by shell functions. Equivalent to
- `set -T' and `set -E' respectively. The `functrace' option also controls
- whether or not the DEBUG trap is inherited by sourced scripts.
-
-n. The DEBUG trap is run before binding the variable and running the action
- list in a `for' command, binding the selection variable and running the
- query in a `select' command, and before attempting a match in a `case'
- command.
-
-o. New `--enable-debugger' option to `configure' to compile in the debugger
- support code.
-
-p. `declare -F' now prints out extra line number and source file information
- if the `extdebug' option is set.
-
-q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes
- the next command to be skipped, and a return value of 2 while in a
- function or sourced script forces a `return'.
-
-r. New `caller' builtin to provide a call stack for the bash debugger.
-
-s. The DEBUG trap is run just before the first command in a function body is
- executed, for the debugger.
-
-t. `for', `select', and `case' command heads are printed when `set -x' is
- enabled.
-
-u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1,
- x+2,...,y}. x and y can be integers or single characters; the sequence
- may ascend or descend; the increment is always 1.
-
-v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices)
- of array.
-
-w. New `force_fignore' shopt option; if enabled, suffixes specified by
- FIGNORE cause words to be ignored when performing word completion even
- if they're the only possibilities.
-
-x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu
- style' (filename:lineno:message) format.
-
-y. New `-o bashdefault' option to complete and compgen; if set, causes the
- whole set of bash completions to be performed if the compspec doesn't
- result in a match.
-
-z. New `-o plusdirs' option to complete and compgen; if set, causes directory
- name completion to be performed and the results added to the rest of the
- possible completions.
-
-aa. `kill' is available as a builtin even when the shell is built without
- job control.
-
-bb. New HISTTIMEFORMAT variable; value is a format string to pass to
- strftime(3). If set and not null, the `history' builtin prints out
- timestamp information according to the specified format when displaying
- history entries. If set, bash tells the history library to write out
- timestamp information when the history file is written.
-
-cc. The [[ ... ]] command has a new binary `=~' operator that performs
- extended regular expression (egrep-like) matching.
-
-dd. `configure' has a new `--enable-cond-regexp' option (enabled by default)
- to enable the =~ operator and regexp matching in [[ ... ]].
-
-ee. Subexpressions matched by the =~ operator are placed in the new
- BASH_REMATCH array variable.
-
-ff. New `failglob' option that causes an expansion error when pathname
- expansion fails to produce a match.
-
-gg. New `set -o pipefail' option that causes a pipeline to return a failure
- status if any of the processes in the pipeline fail, not just the last
- one.
-
-4. New Features in Readline
-
-a. History expansion has a new `a' modifier equivalent to the `g' modifier
- for compatibility with the BSD csh.
-
-b. History expansion has a new `G' modifier equivalent to the BSD csh `g'
- modifier, which performs a substitution once per word.
-
-c. All non-incremental search operations may now undo the operation of
- replacing the current line with the history line.
-
-d. The text inserted by an `a' command in vi mode can be reinserted with
- `.'.
-
-e. New bindable variable, `show-all-if-unmodified'. If set, the readline
- completer will list possible completions immediately if there is more
- than one completion and partial completion cannot be performed.
-
-f. There is a new application-callable `free_history_entry()' function.
-
-g. History list entries now contain timestamp information; the history file
- functions know how to read and write timestamp information associated
- with each entry.
-
-h. Four new key binding functions have been added:
-
- rl_bind_key_if_unbound()
- rl_bind_key_if_unbound_in_map()
- rl_bind_keyseq_if_unbound()
- rl_bind_keyseq_if_unbound_in_map()
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05b-release,
-and the previous version, bash-2.05b-beta2.
-
-1. Changes to Bash
-
-a. Fixed an off-by-one error in the function that translates job
- specifications.
-
-b. Note that we're running under Emacs and disable line editing if
- $EMACS == `t'.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05b-beta2,
-and the previous version, bash-2.05b-beta1.
-
-1. Changes to Bash
-
-a. Fixed the /= and %= arithmetic operators to catch division by zero.
-
-b. Added putenv, setenv, unsetenv to getenv replacement for completeness.
-
-c. Fixed a bug that could cause the -O expand_aliases invocation option
- to not take effect.
-
-d. Fixed a problem with process substitution that resulted in incorrect
- behavior when the number of process substitutions in an individual
- command approached 64.
-
-2. Changes to Readline
-
-a. Fixed a problem with backward-char-search when on a system with support
- for multibyte characters when running in a locale without any multibyte
- characters.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05b-beta1,
-and the previous version, bash-2.05b-alpha1.
-
-1. Changes to Bash
-
-a. Fixed a problem when parsing a POSIX.2 character class name while
- evaluating a bracket expression containing multibyte characters.
-
-b. Changed the help text for `bind' to make it clear that any command
- that may be placed in ~/.inputrc is a valid argument to `bind'.
-
-c. Added `help' builtin entries for `((', `[[', and arithmetic for.
-
-d. malloc updated again:
- o slightly better overflow and underflow detection by putting the
- chunk size at the beginning and end of the chunk and making
- sure they match in free/realloc
- o partial page allocated to make things page-aligned no longer
- completely wasted
- o block coalescing now enabled by default
- o splitting and coalescing enabled for 32-byte chunks, the most
- common size requested
- o fixed a problem that resulted in spurious underflow messages and
- aborts
- o bin sizes are precomputed and stored in an array rather than
- being computed at run time
- o malloc will return memory blocks back to the system if the block
- being freed is at the top of the heap and of sufficient size to
- make it worthwhile
- o malloc/free/realloc now inline memset instead of calling the
- libc function; uses Duff's device for good performance
-
-e. Check for getservent(); make the service name completion code dependent
- on its presence.
-
-f. Changed the readline callback that executes a command bound to a key
- sequence to not save the executed command on the history list and to
- save and restore the parsing state.
-
-g. Changes to lib/sh/snprintf.c: fixed some bugs in the `g' and `G'
- floating point format display; implemented the "'" flag character
- that turns on thousands' grouping; fixed behavior on systems where
- MB_CUR_MAX does not evaluate to a constant.
-
-h. The `unset' builtin no longer returns a failure status when asked to
- unset a previously-unset variable or function.
-
-i. Changes to the build system to make it easier to cross-compile bash
- for different systems.
-
-j. Added `,' to the characters that are backslash-escaped during filename
- completion, to avoid problems with complete-into-braces and RCS filenames
- containing commas.
-
-k. Some changes to the multibyte character support code to avoid many calls
- to strlen().
-
-l. Bash now correctly honors setting LANG to some value when LC_ALL does not
- already have a value.
-
-m. Fixed a bug that could cause SIGSEGV when processing nested traps with
- trap handlers.
-
-n. The `source/.' builtin now restores the positional parameters when it
- returns unless they were changed using the `set' builtin during the file's
- execution.
-
-o. Fixed a bug that caused a syntax error when a command was terminated by
- EOF.
-
-2. New Features in Bash
-
-a. There is now support for placing the long help text into separate files
- installed into ${datadir}/bash. Not enabled by default; can be turned
- on with `--enable-separate-helpfiles' option to configure.
-
-b. All builtins that take operands accept a `--' pseudo-option, except
- `echo'.
-
-c. The `echo' builtin now accepts \0xxx (zero to three octal digits following
- the `0') in addition to \xxx (one to three octal digits) for SUSv3/XPG6/
- POSIX.1-2001 compliance.
-
-3. Changes to Readline
-
-a. Fixed a small problem in _rl_insert_char with multibyte characters.
-
-b. Fixes from IBM for line wrapping problems when using multibyte characters.
-
-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
- support for multibyte characters when running in a locale without any
- multibyte characters.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05b-alpha1,
-and the previous version, bash-2.05a-release.
-
-1. Changes to Bash
-
-a. Some changes to work around inlining differences between compilers.
-
-b. Added more prototypes for internal shell typedefs, to catch argument
- passing errors when using pointers to functions.
-
-c. The `cd' builtin now fails in posix mode when a valid directory cannot be
- constructed from a relative pathname argument and the $PWD using pathname
- canonicalization, and the -P option has not been supplied. Previously,
- the shell would attempt to use what the user typed, leading to weird
- values for $PWD and discrepancies between the value of $PWD and the
- actual working directory.
-
-d. The `cd' builtin now resets $PWD when canonicalization fails but a chdir
- to the pathname passed as an argument succeeds (when not in posix mode).
-
-e. The `fc' builtin has been fixed, as POSIX requires, to use the closest
- history position in range when given an out-of-range argument.
-
-f. The history file loading code was changed to allow lines to be saved in
- the history list from the shell startup files.
-
-g. `history -s args' now works better in compound commands.
-
-h. The tilde expansion code was fixed to better recognize when it's being
- invoked in an assignment context, which enables expansion after `='
- and `:'.
-
-i. Fixed the command name completion code so a slash is no longer appended
- to a single match if there happens to be a directory with that name in
- $PWD.
-
-j. Fixed compound array assignment to no longer perform alias expansion, to
- allow reserved words as array members, and to not produce extra output
- when the `-v' option had been enabled.
-
-k. Fixed the programmable completion code to better handle newlines in lists
- of possible completions (e.g., `complete -W').
-
-l. Removed the reserved words from the `bash-builtins' manual page.
-
-m. Parser error reporting now attempts to do a better job of identifying the
- token in error rather than doing straight textual analysis.
-
-n. Fixes for Inf/NaN, locales, wide/multibyte characters and zero-length
- arguments in the library snprintf(3) replacement.
-
-o. `read -e' no longer does command name completion on the first word on
- the line being read.
-
-p. `select' now returns failure if the read of the user's selection fails.
-
-q. Fixed a bug that could cause a core dump when setting $PIPESTATUS.
-
-r. Fixes to not allocate so many job slots when the shell is running a loop
- with job control enabled in a subshell of an interactive shell.
-
-s. Fixed a bug in the trap code that caused traps to be inherited by
- command substitutions in some cases.
-
-t. Fixed a bug that could cause alias expansion to inappropriately expand
- the word following the alias.
-
-u. Fixed a bug in the `kill' builtin that mishandled negative pid arguments.
-
-v. The parser is less lenient when parsing assignment statements where the
- characters before the `=' don't comprise a valid identifier.
-
-w. The arithmetic expression evaluation code now honors the setting of the
- `-u' option when expanding variable names.
-
-x. Fixed the arithmetic evaluation code to allow array subscripts to be
- assigned (`let b[7]=42') and auto-incremented and auto-decremented
- (e.g., b[7]++).
-
-y. Reimplemented the existing prompt string date and time expansions using
- strftime(3), which changed the output of \@ in some locales.
-
-z. Fixed a bug that could cause a core dump when a special shell variable
- (like RANDOM) was converted to an array with a variable assignment.
-
-aa. Fixed a bug that would reset the handler for a signal the user had
- trapped to a function that would exit the shell when setting the exit
- trap in a non-interactive shell.
-
-bb. Changed the execve(2) wrapper code to check whether or not a failing
- command is a directory before looking at whether a `#!' interpreter
- failed for some reason.
-
-cc. Fixed a bug in the command printing code so it no longer inserts a `;'
- after a newline, which produces a syntax error when reused as input.
-
-dd. The code that expands $PS4 no longer inherits the `-x' flag.
-
-ee. The bash-specific completion functions may now take advantage of the
- double-TAB and M-? features of the standard readline completion
- functions.
-
-ff. The mail checking code no longer prints a message if the checked file's
- size has not increased, even if the access time is less than the modification time.
-
-gg. Rewrote the variable symbol table code: there is now a stack of
- contexts, each possibly including a separate symbol table; there can
- be more than one temporary environment supplied to nested invocations
- of `./source'; the temporary environments no longer require so much
- special-case code; shell functions now handle the temporary environment
- and local variables more consistently; function scope exit is faster now
- that the entire symbol table does not have to be traversed to dispose of
- local variables; it is now easier to push vars from the temporary
- environment to the shell's variable table in posix mode; some duplicated
- code has been removed.
-
-hh. Regularized the error message printing code; builtin_error is now called
- more consistently, and common error message strings are handled by small
- functions. This should make eventual message translation easier.
-
-ii. Error messages now include the line number in a script when the shell
- is not interactive.
-
-jj. Array subscript expansion now takes place even when the array variable is
- unset, so side effects will take place.
-
-kk. Fixed a bug in the SICGHLD child-reaping code so that it won't find
- jobs already marked as terminated if the OS reuses pids quickly enough.
-
-ll. Fixed a bug that could cause a signal to not interrupt the `wait'
- builtin while it was waiting for a background process to terminate.
-
-mm. A couple of changes to make it easier for multiple shells to share history
- files using `history -n', `history -r', and `history -w'.
-
-nn. The `getopts' builtin always increments OPTIND to point to the next
- option to be handled when an option is returned, whether it's valid
- or not, as POSIX 1003.x-2001 requires.
-
-oo. Changed some parts of the expansion code to avoid allocating and
- immediately freeing memory without using the results for anything.
-
-pp. The shell now keeps track of $IFS internally, updating its internal map
- each time the variable is assigned a new value (or at local scope exit).
- This saves thousands of hash lookups for IFS, which, while individually
- cheap, add up.
-
-qq. Rewrote the hash table code: searching and insertion are much faster now,
- and it uses a better string hashing function; augmented the function
- interface to simplify other parts of the code and remove duplicated code
-
-rr. The shell now uses a simple, generic `object cache' for allocating and
- caching words and word lists, which were the major users of
- malloc/free.
-
-ss. Fixed the assignment statement parsing code to allow whitespace and
- newlines in subscripts when performing array element assignment.
-
-tt. The shell now issues many fewer calls to sigprocmask and other signal
- masking system calls.
-
-uu. Fixed the `test' and conditional command file comparison operators to
- work right when one file has a non-positive timestamp and the other
- does not exist.
-
-vv. Fixed some cases where the special characters '\001' and '\177' in the
- values of variables or positional parameters caused incorrect expansion
- results.
-
-2. Changes to Readline
-
-a. Fixed output of comment-begin character when listing variable values.
-
-b. Added some default key bindings for common escape sequences produced by
- HOME and END keys.
-
-c. Fixed the mark handling code to be more emacs-compatible.
-
-d. A bug was fixed in the code that prints possible completions to keep it
- from printing empty strings in certain circumstances.
-
-e. Change the key sequence printing code to print ESC as M\- if ESC is a
- meta-prefix character -- it's easier for users to understand than \e.
-
-f. Fixed unstifle_history() to return values that match the documentation.
-
-g. Fixed the event loop (rl_event_hook) to handle the case where the input
- file descriptor is invalidated.
-
-h. Fixed the prompt display code to work better when the application has a
- custom redisplay function.
-
-i. Changes to make reading and writing the history file a little faster, and
- to cope with huge history files without calling abort(3) from xmalloc.
-
-j. The vi-mode `S' and `s' commands are now undone correctly.
-
-3. New Features in Bash
-
-a. If set, TMOUT is the default timeout for the `read' builtin.
-
-b. `type' has two new options: `-f' suppresses shell function lookup, and
- `-P' forces a $PATH search.
-
-c. New code to handle multibyte characters.
-
-d. `select' was changed to be more ksh-compatible, in that the menu is
- reprinted each time through the loop only if REPLY is set to NULL.
- The previous behavior is available as a compile-time option.
-
-e. `complete -d' and `complete -o dirnames' now force a slash to be
- appended to names which are symlinks to directories.
-
-f. There is now a bindable edit-and-execute-command readline command,
- like the vi-mode `v' command, bound to C-xC-e in emacs mode.
-
-g. Added support for ksh93-like [:word:] character class in pattern matching.
-
-h. The $'...' quoting construct now expands \cX to Control-X.
-
-i. A new \D{...} prompt expansion; passes the `...' to strftime and inserts
- the result into the expanded prompt.
-
-j. The shell now performs arithmetic in the largest integer size the
- machine supports (intmax_t), instead of long.
-
-k. If a numeric argument is supplied to one of the bash globbing completion
- functions, a `*' is appended to the word before expansion is attempted.
-
-l. The bash globbing completion functions now allow completions to be listed
- with double tabs or if `show-all-if-ambiguous' is set.
-
-m. New `-o nospace' option for `complete' and `compgen' builtins; suppresses
- readline's appending a space to the completed word.
-
-n. New `here-string' redirection operator: <<< word.
-
-o. When displaying variables, function attributes and definitions are shown
- separately, allowing them to be re-used as input (attempting to re-use
- the old output would result in syntax errors).
-
-p. There is a new configuration option `--enable-mem-scramble', controls
- bash malloc behavior of writing garbage characters into memory at
- allocation and free time.
-
-q. The `complete' and `compgen' builtins now have a new `-s/-A service'
- option to complete on names from /etc/services.
-
-r. `read' has a new `-u fd' option to read from a specified file descriptor.
-
-s. Fix the completion code so that expansion errors in a directory name
- don't cause a longjmp back to the command loop.
-
-t. Fixed word completion inside command substitution to work a little more
- intuitively.
-
-u. The `printf' %q format specifier now uses $'...' quoting to print the
- argument if it contains non-printing characters.
-
-v. The `declare' and `typeset' builtins have a new `-t' option. When applied
- to functions, it causes the DEBUG trap to be inherited by the named
- function. Currently has no effect on variables.
-
-w. The DEBUG trap is now run *before* simple commands, ((...)) commands,
- [[...]] conditional commands, and for ((...)) loops.
-
-x. The expansion of $LINENO inside a shell function is only relative to the
- function start if the shell is interactive -- if the shell is running a
- script, $LINENO expands to the line number in the script. This is as
- POSIX-2001 requires.
-
-y. The bash debugger in examples/bashdb has been modified to work with the
- new DEBUG trap semantics, the command set has been made more gdb-like,
- and the changes to $LINENO make debugging functions work better. Code
- from Gary Vaughan.
-
-z. New [n]<&word- and [n]>&word- redirections from ksh93 -- move fds (dup
- and close).
-
-aa. There is a new `-l' invocation option, equivalent to `--login'.
-
-bb. The `hash' builtin has a new `-l' option to list contents in a reusable
- format, and a `-d' option to remove a name from the hash table.
-
-4. New Features in Readline
-
-a. Support for key `subsequences': allows, e.g., ESC and ESC-a to both
- be bound to readline functions. Now the arrow keys may be used in vi
- insert mode.
-
-b. When listing completions, and the number of lines displayed is more than
- the screen length, readline uses an internal pager to display the results.
- This is controlled by the `page-completions' variable (default on).
-
-c. New code to handle editing and displaying multibyte characters.
-
-d. The behavior introduced in bash-2.05a of deciding whether or not to
- append a slash to a completed name that is a symlink to a directory has
- been made optional, controlled by the `mark-symlinked-directories'
- variable (default is the 2.05a behavior).
-
-e. The `insert-comment' command now acts as a toggle if given a numeric
- argument: if the first characters on the line don't specify a
- comment, insert one; if they do, delete the comment text
-
-f. New application-settable completion variable:
- rl_completion_mark_symlink_dirs, allows an application's completion
- function to temporarily override the user's preference for appending
- slashes to names which are symlinks to directories.
-
-g. New function available to application completion functions:
- rl_completion_mode, to tell how the completion function was invoked
- and decide which argument to supply to rl_complete_internal (to list
- completions, etc.).
-
-h. Readline now has an overwrite mode, toggled by the `overwrite-mode'
- bindable command, which could be bound to `Insert'.
-
-i. New application-settable completion variable:
- rl_completion_suppress_append, inhibits appending of
- rl_completion_append_character to completed words.
-
-j. New key bindings when reading an incremental search string: ^W yanks
- the currently-matched word out of the current line into the search
- string; ^Y yanks the rest of the current line into the search string,
- DEL or ^H deletes characters from the search string.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05a-release,
-and the previous version, bash-2.05a-rc1.
-
-1. Changes to Bash
-
-a. Fixed the `printf' builtin so that the variable name supplied as an
- argument to a %n conversion must be a valid shell identifier.
-
-b. Improved the random number generator slightly.
-
-c. Changes to configuration to not put -I/usr/include into $CFLAGS, since
- it messes up some includes.
-
-d. Corrected description of POSIXLY_CORRECT in man page and info manual.
-
-e. Fixed a couple of cases of incorrect function prototypes that sneaked
- through and caused compilation problems.
-
-f. A few changes to avoid potential core dumps in the programmable completion
- code.
-
-g. Fixed a configure problem that could cause a non-existent file to show
- up in LIBOBJS.
-
-h. Fixed a configure problem that could cause siglist.o to not be built when
- required.
-
-i. Changes to the strtoimax and strtoumax replacement functions to work
- around buggy compilers.
-
-j. Fixed a problem with the snprintf replacement function that could
- potentially cause a core dump.
-
-2. Changes to Readline
-
-a. Fixed a locale-specific problem in the vi-mode `goto mark' command.
-
-b. Fixed Makefile to not put -I/usr/include into CFLAGS, since it can cause
- include file problems.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05a-rc1,
-and the previous version, bash-2.05a-beta1.
-
-1. Changes to Bash
-
-a. Fixed the snprintf replacement to correctly implement the `alternate form'
- of the %g and %G conversions.
-
-b. Fixed snprintf to correctly handle the optional precision with the %g and
- %G conversions.
-
-c. Fixed the arithmetic evaluation code to correct the values of `@' and `_'
- when translating base-64 constants (they were backwards).
-
-d. New library functions for formatting long and long long ints.
-
-e. Fixed a few places where negative array subscripts could have occurred,
- mostly as the result of systems using signed characters.
-
-f. Fixed a few places that assumed a pid_t was no wider than an int.
-
-g. Fixed the `maildir' mail checking code to work on systems where a
- `struct stat' doesn't include an `st_blocks' member.
-
-h. Fixed snprintf to make `unsigned long long' conversion formats (%llu)
- work better.
-
-i. Fixed snprintf to not print a sign when asked to do an unsigned conversion.
-
-j. Made configure changes to avoid compiling empty source files in lib/sh.
-
-k. New replacement functions (if necessary) for strtoull, strtoll, strtoimax,
- strtoumax.
-
-l. The `printf' builtin now handles the `ll' and `j' length modifiers
- directly, since they can affect the type and width of the argument
- 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.
-
-n. Fixed snprintf to handle long doubles and the %a/%A conversions by
- falling back to sprintf, as long as sprintf supports them.
-
-o. Fixed return value from vsnprintf/snprintf to be the number of characters
- that would have been printed, even if that number exceeds the buffer
- size passed as an argument.
-
-p. Bash no longer attempts to define its own versions of some ctype macros
- if they are implemented as functions in libc but not as macros in
- <ctype.h>.
-
-q. Changed the variable printing code (used by `set', `export', etc.) to
- not use the $'...' syntax when in posix mode, since that caused
- interoperability problems with other shells (most notably with autoconf).
- When not in posix mode, it uses $'...' if the string to be printed
- contains non-printing characters and regular single quotes otherwise.
-
-r. snprintf now recognizes the %F conversion.
-
-s. Fixed a bug that could cause the wrong status to be returned by a shell
- function when the shell is compiled without job control and a null
- command containing a command substutition was executed in the function.
-
-t. When in posix mode, the default value for MAILCHECK is 600.
-
-u. Bash only initializes FUNCNAME, GROUPS, and DIRSTACK as special variables
- if they're not in the initial environment.
-
-v. If SECONDS appears in the initial environment with a valid integer value,
- bash uses that as the starting value, as if an assignment had been
- performed.
-
-w. Bash no longer auto-exports HOME, PATH, SHELL, or TERM, even though it
- gives them default values if they don't appear in the initial environment.
-
-x. Bash no longer auto-exports HOSTNAME, HOSTTYPE, MACHTYPE, or OSTYPE,
- even if it assigns them default values.
-
-y. Bash no longer removes the export attribute from SSH_CLIENT or SSH2_CLIENT
- if they appear in the initial environment.
-
-z. Bash no longer attempts to discover if it's being run by sshd in order to
- run the startup files. If the SSH_SOURCE_BASHRC is uncommented in
- config-top.h it will attempt to do so as previously, but that's commented
- out in the distributed version.
-
-aa. Fixed a typo in the code that tests for LC_NUMERIC.
-
-bb. The POSIXLY_CORRECT shell variable and its effects are now documented.
-
-cc. Some changes to several of the support shell scripts included in the
- definitions to try to avoid race conditions and attacks.
-
-dd. Several changes to avoid warnings from `gcc -Wall'.
-
-ee. Fixed a problem with the `unset' builtin that could cause incorrect
- results if asked to unset a variable and an array subscript in the
- same command.
-
-ff. A few changes to the shell's temporary file creation code to avoid
- potential file descriptor leaks and to prefer the system's idea of
- the temporary directory to use.
-
-gg. Fixes to build with the C alloca in lib/malloc/alloca.c if the system
- requires it but the shell has been configured --without-bash-malloc.
-
-hh. Updated the documentation to note that only interactive shells resend
- SIGHUP to all jobs before exiting.
-
-ii. Fixes to only pass unquoted tilde words to tilde_expand, rather than
- rely on tilde_expand or getpwnam(3) to handle the quotes (MacOS 10.x
- will remove backslashes in any login name passed to getpwnam(3)).
-
-jj. Small change from Paul Eggert to make LINENO right in commands run with
- `bash -c'.
-
-2. New Features in Bash
-
-a. The `printf' builtin now handles the %a and %A conversions if they're
- implemented by printf(3).
-
-b. The `printf' builtin now handles the %F conversion (just about like %f).
-
-c. The `printf' builtin now handles the %n conversion like printf(3). The
- corresponding argument is the name of a shell variable to which the
- value is assigned.
-
-3. Changes to Readline
-
-a. Fixed a few places where negative array subscripts could have occurred.
-
-b. Fixed the vi-mode code to use a better method to determine the bounds of
- the array used to hold the marks.
-
-c. Fixed the defines in chardefs.h to work better when chars are signed.
-
-d. Fixed configure.in to use the new names for bash autoconf macros.
-
-e. Readline no longer attempts to define its own versions of some ctype
- macros if they are implemented as functions in libc but not as macros in
- <ctype.h>.
-
-f. Fixed a problem where rl_backward could possibly set point to before
- the beginning of the line.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05a-beta1,
-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
- expanded expression is NULL.
-
-b. Fixed an unassigned variable problem in the redirection printing code.
-
-c. Added more prototypes to extern function declarations in the header
- files and to static function declarations in C source files.
-
-d. Make sure called functions have a prototype in scope, to get the arguments
- and return values right instead of casting. Removed extern function
- declarations from C source files that were already included in header
- files.
-
-e. Changed some function arguments to use function typedefs in general.h so
- the prototypes can be checked. The only use of Function and VFunction
- now is for unwind-protects.
-
-f. More const changes to function arguments and appropriate variables.
-
-g. Changed the mail checking support to handle `maildir'-style mail
- directories.
-
-h. Augmented the bash malloc to pass in the file and line number information
- for each malloc, realloc, and free. This should result in better error
- messages.
-
-i. The `old' gnu malloc is no longer a configuration option.
-
-j. Augmented the bash malloc with optional tracing and registering allocated
- and freed memory.
-
-k. Prompt string decoding now saves and restores the value of $? when it
- expands the prompt string, so command substitutions don't change $?.
-
-i. Array indices are now `long', since shell arithmetic is performed as long,
- and the internal arrayind_t type is used consistently.
-
-j. Some more `unsigned char *' fixes from Paul Eggert.
-
-k. Fixed a bad call to builtin_error that could cause core dumps when making
- local variables.
-
-l. `return' may no longer be used to terminate a `select' command, for
- compatibility with ksh.
-
-m. Changed code that reads octal numbers to do a better job of detecting
- overflows.
-
-n. The time formatting code no longer uses absolute indices into a buffer,
- because the buffer size changes depending on the size of a `time_t'.
-
-o. `umask' now prints four digits when printing in octal mode, for
- compatibility with other shells.
-
-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.
-
-q. Some `time_t' fixes for machines were a time_t is bigger than a long.
-
-r. Replaced some bash-specific autoconf macros with standard equivalents.
-
-s. Improvmed the code that constructs temporary filenames to make the
- generated names a bit more random.
-
-t. Added code that checks for ascii before calling any of the is* ctype
- functions.
-
-u. Changed some places where a `char' was used as an array subscript to use
- `unsigned char', since a `char' can be negative if it's signed by default.
-
-v. Lots of changes to the `ulimit' builtin from Paul Eggert to add support
- for the new POSIX-200x RLIM_SAVED_CUR and RLIM_SAVED_MAX values and
- simplify the code.
-
-w. `ulimit' now prints the description of a resource in any error message
- relating to fetching or setting that resource's limits.
-
-x. The `snprintf' replacement now computes maximum values at compile
- time rather than using huge constants for things like long long.
-
-y. Interactive shells now ignore `set -n'.
-
-z. Changed the malloc bookkeeping information so that it's now 8 bytes
- instead of 12 on most 32-bit machines (saving 4 bytes per allocation),
- restoring 8-byte alignment.
-
-aa. The malloc error reporting code now attempts to print the file and line
- number of the call that caused the error.
-
-bb. Changed the redirection error reporting code to catch EBADF errors and
- report the file descriptor number rather than the file being redirected
- to or from (e.g., things like `exec 4242<x' where 4242 is an out-of-range
- file descriptor).
-
-cc. `printf', `echo -e', and the $'...' code now process only two hex digits
- after a `\x' escape sequence for compatibility with other shells, and
- the documentation was changed to note that the octal and hex escape
- sequences result in an eight-bit value rather than strict ASCII.
-
-2. Changes to Readline
-
-a. The completion code now attempts to do a better job of preserving the
- case of the word the user typed if ignoring case in completions.
-
-b. Readline defaults to not echoing the input and lets the terminal
- initialization code enable echoing if there is a controlling terminal.
-
-c. The key binding code now processes only two hex digits after a `\x'
- escape sequence, and the documentation was changed to note that the
- octal and hex escape sequences result in an eight-bit value rather
- than strict ASCII.
-
-3. New Features in Bash
-
-a. The builtin `ulimit' now takes two new non-numeric arguments: `hard',
- meaning the current hard limit, and `soft', meaning the current soft
- limit, in addition to `unlimited'
-
-b. `ulimit' now prints the option letter associated with a particular
- resource when printing more than one limit.
-
-c. `ulimit' prints `hard' or `soft' when a value is not `unlimited' but is
- one of RLIM_SAVED_MAX or RLIM_SAVED_CUR, respectively.
-
-4. New Features in Readline
-
-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.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05a-alpha1,
-and the previous version, bash-2.05-release.
-
-1. Changes to Bash
-
-a. Better checks in the redirection code for write errors.
-
-b. bashbug now uses $TMPDIR, defaulting to /tmp, and uses mktemp(1) more
- portably.
-
-c. System-specific configuration changes for: Interix, OpenBSD, FreeBSD,
- MacOS X.
-
-d. Some more `const' cleanups through the code.
-
-e. Fixed a typo in the /dev/fd redirection code, better checks for valid
- numeric fds in /dev/fd.
-
-f. Fixed many parts of the shell to handle integer overflow more gracefully
- and to do more stringent checks for valid numbers.
-
-g. Fixed mksignames to include config.h.
-
-h. Fixed an uninitialized variable problem that could cause the shell to core
- dump when replacing characters in a string.
-
-i. New mechanism for updating the patch level when official patches are
- released (patchlevel.h).
-
-j. configure.in changed to no longer require external files _distribution and
- _patchlevel.
-
-k. Fixed non-interactive shell initialization problem when bash started as
- `bash -i filename'.
-
-l. Fixed printf builtin conversion error handling to be POSIX.2-conformant.
-
-m. autoconf-2.52 is now used to build configure; autoconf-2.50 or newer is
- required. Some of the bash-specific macros were removed, since they are
- now standard.
-
-n. Startup files and files read with source or `.' are no longer required to
- be regular files.
-
-o. Fixed core dump in builtin printf when user-supplied precision or field
- width is 0.
-
-p. Fixed builtin printf to treat a negative field width as a positive field
- width with left-justification.
-
-r. New unwind-protect implementation from Paul Eggert.
-
-s. Fixed an inadvertently-unclosed comment in the bash completion code that
- caused programmable completions to not add trailing slashes or spaces to
- completions.
-
-t. Fixed the process substitution code to cope better when stdin is closed.
-
-v. Fixes, mostly from Paul Eggert, for a few possible buffer overflows in
- the shell.
-
-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.
-
-y. Some fixes to the process substition 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
- part of the shell in the future.
-
-aa. The select command no longer terminates on a `return', so it can be used
- to return from an enclosing function (as ksh does it).
-
-bb. Fixed the extended pattern matching code to behave better when presented
- with incorrectly-formed patterns.
-
-cc. Some changes were made with the intent of making cross-compilation easier.
-
-dd. The network code (/dev/tcp and /dev/udp redirections) uses getaddrinfo(3)
- if it's available, which adds support for IPv6.
-
-ee. Subshells of login shells no longer source ~/.bash_logout when they exit.
-
-ff. Fixes so that subshells don't exit inappropriately if the -e option has
- been set.
-
-gg. Restricted shells no longer allow functions to be exported.
-
-hh. Changes to the pattern matching code so extended pattern matching works
- on systems with deficient shared library implementations, like MacOS X.
-
-ii. Better error messages when a script with a leading `#!interp' fails
- to execute because of problems with `interp'.
-
-jj. Fixed `compgen' to handle the `-o default' option better.
-
-kk. Fixed the job control code to force an asynchronous process's standard
- input to /dev/null only if job control is not active.
-
-ll. Fixed a possible infinite recursion problem when `fc ""=abc' (a null
- pattern) is used to re-execute a previous command.
-
-mm. Fixed `declare [-a] var=value' to assign VALUE to element 0 if VAR is an
- array variable. Similarly for `declare [-a] var[N]=value'. This is like
- ksh93.
-
-nn. Fixed a bug that caused `read -a aname' to work even if ANAME had been
- declared readonly.
-
-oo. Fixed a possible integer overflow problem when constructing names for
- temporary files.
-
-2. New Features in Bash
-
-a. Added support for DESTDIR installation root prefix, so you can do a
- `make install DESTDIR=bash-root' and do easier binary packaging.
-
-b. Added support for builtin printf "'" flag character as per latest POSIX
- drafts.
-
-c. Support for POSIX.2 printf(1) length specifiers `j', `t', and `z' (from
- ISO C99).
-
-d. New autoconf macro, RL_LIB_READLINE_VERSION, for use by other applications
- (bash doesn't use very much of what it returns).
-
-e. `set [-+]o nolog' is recognized as required by the latest POSIX drafts,
- but ignored.
-
-f. New read-only `shopt' option: login_shell. Set to non-zero value if the
- shell is a login shell.
-
-g. New `\A' prompt string escape sequence; expands to time in 24 HH:MM format.
-
-h. New `-A group/-g' option to complete and compgen; does group name
- completion.
-
-i. New `-t' option to `hash' to list hash values for each filename argument.
-
-j. New [-+]O invocation option to set and unset `shopt' options at startup.
-
-k. configure's `--with-installed-readline' option now takes an optional
- `=PATH' suffix to set the root of the tree where readline is installed
- to PATH.
-
-l. The ksh-like `ERR' trap has been added. The `ERR' trap will be run
- whenever the shell would have exited if the -e option were enabled.
- It is not inherited by shell functions.
-
-m. `readonly', `export', and `declare' now print variables which have been
- given attributes but not set by assigning a value as just a command and
- a variable name (like `export foo') when listing, as the latest POSIX
- drafts require.
-
-n. `bashbug' now requires that the subject be changed from the default.
-
-o. configure has a new `--enable-largefile' option, like other GNU utilities.
-
-p. `for' loops now allow empty word lists after `in', like the latest POSIX
- drafts require.
-
-3. Changes to Readline
-
-a. More `const' and type casting fixes.
-
-b. Changed rl_message() to use vsnprintf(3) (if available) to fix buffer
- overflow problems.
-
-c. The completion code no longer appends a `/' or ` ' to a match when
- completing a symbolic link that resolves to a directory name, unless
- the match does not add anything to the word being completed. This
- means that a tab will complete the word up to the full name, but not
- add anything, and a subsequent tab will add a slash.
-
-d. Fixed a trivial typo that made the vi-mode `dT' command not work.
-
-e. Fixed the tty code so that ^S and ^Q can be inserted with rl_quoted_insert.
-
-f. Fixed the tty code so that ^V works more than once.
-
-g. Changed the use of __P((...)) for function prototypes to PARAMS((...))
- because the use of __P in typedefs conflicted g++ and glibc.
-
-4. New Features in Readline
-
-a. Added extern declaration for rl_get_termcap to readline.h, making it a
- public function (it was always there, just not in readline.h).
-
-b. New #defines in readline.h: RL_READLINE_VERSION, currently 0x0402,
- RL_VERSION_MAJOR, currently 4, and RL_VERSION_MINOR, currently 2.
-
-c. New readline variable: rl_readline_version, mirrors RL_READLINE_VERSION.
-
-d. New bindable boolean readline variable: match-hidden-files. Controls
- completion of files beginning with a `.' (on Unix). Enabled by default.
-
-e. The history expansion code now allows any character to terminate a
- `:first-' modifier, like csh.
-
-f. The incremental search code remembers the last search string and uses
- it if ^R^R is typed without a search string.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05-release,
-and the previous version, bash-2.05-beta2.
-
-1. Changes to Bash
-
-a. Make sure we note that the first line of a multi-line command was not
- saved in the history if the tests for HISTCONTROL succeed, but the
- HISTIGNORE check fails.
-
-b. Fixed a bug in the pattern matching code that caused `[' to be treated
- as a special character inside a `[...]' bracket expression.
-
-c. Fixed a bug in the pattern matching code that caused `]' to terminate
- a bracket expression even if it was the first character after the `['
- (or a leading `!' or `^').
-
-d. Made a small change to report a more user-friendly error message if
- execve(2) fails because of an error with the interpreter in a script
- with a leading `#! interpreter'.
-
-e. If the OS does not support an exec(2) magic number of `#!', make sure we
- have a non-null interpreter name before attempting to execute it.
-
-f. Fixed a bug that caused the shell process to end up in a different
- process group than the controlling terminal if a job-control shell was
- run with `exec' in the startup files.
-
-g. When started in POSIX mode, either by `bash --posix', `bash -o posix', or
- `sh', $SHELLOPTS includes `posix' and POSIXLY_CORRECT is set.
-
-h. Fixed a problem that caused the `\W' prompt string escape sequence to
- expand to nothing when $PWD was `//'.
-
-i. The `bashbug' shell script no longer uses $(...) command substitution.
-
-j. When `set' is invoked without options in POSIX mode, it no longer prints
- the names and definitions of shell functions.
-
-2. Changes to Readline
-
-a. rl_set_paren_blink_timeout() is now documented.
-
-b. Corrected history.3 man page: `$' is not in the default value of
- history_word_delimiters.
-
-c. If a hook function assigned to rl_event_hook sets rl_done to a non-zero
- value, rl_read_key() now immediately returns '\n' (which is assumed to
- be bound to accept-line).
-
-3. New Features in Bash
-
-a. The `>&word' redirection now works in POSIX mode as it does by default,
- since POSIX.2 leaves it unspecified.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05-beta2,
-and the previous version, bash-2.05-beta1.
-
-1. Changes to Bash
-
-a. Fixed a bug in the arithmetic evaluation code so that a^=b is supported.
-
-b. Fixed startup so posixly_correct is retained across subshells begun to
- execute scripts without a leading `#!'.
-
-c. Fixed a bug that caused $(< file) to not work in a (...) subshell.
-
-d. Added config support for Linux running on the IBM S390.
-
-e. Fixed a bug that caused bash to get its input pointer out of sync when
- reading commands through a pipe and running a command with standard
- input redirected from a file.
-
-f. Made a change so that command completion now makes about half as many
- stat(2) calls when searching the $PATH.
-
-g. Fixed a bug that caused variable assignments preceding `return' to not
- be propagated to the shell environment in POSIX mode.
-
-h. Fixed a bug with ${parameter[:]?word} -- tilde expansion was not performed
- on `word'.
-
-i. In POSIX mode, `break' and `continue' do not complain and return success
- if called when the shell is not executing a loop.
-
-j. Fixed `bash -o posix' to work the same as `bash --posix'.
-
-k. Fixed a bug where variable assignments preceding `eval' or `source/.'
- would not show up in the environment exported to subshells run by the
- commands.
-
-l. In POSIX mode, shells started to execute command substitutions inherit
- the value of the `-e' option from their parent shell.
-
-m. In POSIX mode, aliases are expanded even in non-interactive shells.
-
-n. Changed some of the job control messages to display the text required by
- POSIX.2 when the shell is in POSIX mode.
-
-o. Fixed a bug in `test' that caused it to occasionally return incorrect
- results when non-numeric arguments were supplied to `-t'.
-
-2. Changes to Readline
-
-a. Some changes were made to avoid gcc warnings with -Wall.
-
-b. rl_get_keymap_by_name now finds keymaps case-insensitively, so
- `set keymap EMACS' works.
-
-c. The history file writing and truncation functions now return a useful
- status on error.
-
-d. Fixed a bug that could cause applications to dereference a NULL pointer
- if a NULL second argument was passed to history_expand().
-
-3. New Features in Bash
-
-a. doc/readline.3 has been moved to the readline distribution.
-
-4. New Features in Readline
-
-a. New function, rl_get_screen_size (int *rows, int *columns), returns
- readline's idea of the screen dimensions.
-
-b. The timeout in rl_gather_tyi (readline keyboard input polling function)
- is now settable via a function (rl_set_keyboard_input_timeout()).
-
-c. Renamed the max_input_history variable to history_max_entries; the old
- variable is maintained for backwards compatibility.
-
-d. The list of characters that separate words for the history tokenizer is
- now settable with a variable: history_word_delimiters. The default
- value is as before.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05-beta1,
-and the previous version, bash-2.05-alpha1.
-
-1. Changes to Bash
-
-a. Changes to allow shared library and object building on the GNU Hurd.
-
-b. Fixes to the way exported functions are placed into the environment and
- cached.
-
-c. The globbing library once again respects locales when processing ranges
- in bracket expressions while doing pattern matching.
-
-d. System-specific configuration changes for: Tru 64, Interix
-
-e. Bashbug now uses /usr/bin/editor as one of the editing alternatives, and
- will use mktemp(1) or tempfile(1), if present, for temporary file creation.
-
-f. Bash no longer performs a binary file check on a script argument that's
- really a tty (like /dev/fd/0 or /dev/stdin).
-
-g. Fixed a bug in the execution of shell scripts that caused the effects of
- $BASH_ENV to be undone in some cases.
-
-h. Fixed several bugs that made `bash [-i] /dev/stdin' not work correctly.
-
-i. Several changes to the job control code to avoid some signal state
- manipulation.
-
-j. The Bash malloc no longer blocks signals as often, which should make it
- faster.
-
-k. Fixed a parsing bug that did not allow backslash to escape a single quote
- inside a $'...' construct.
-
-l. Fixed a bug that caused things like ${var:=$'value'} to be parsed
- incorrectly. This showed up in newer versions of autoconf.
-
-m. Fixed a bug in the bash-specific readline initialization that caused
- key bindings to bash-specific function names appearing in .inputrc to
- not be honored.
-
-n. Bash now sets the file descriptor it uses to save the file descriptor
- opened on a shell script to close on exec.
-
-o. Fixed a bug in the prompt string decoding that caused it to misbehave
- when presented an octal sequence of fewer than three characters.
-
-p. Fixed the `test' builtin to return an error if `[' is supplied a single
- argument that is not `]'.
-
-q. Fixed a bug that caused subshells started to run executable shell scripts
- without a leading `#!' to incorrectly inherit an argument list preceding
- a shell builtin (like such a script called from a script sourced with `.',
- where there were variable assignments preceding the `.' command)
-
-r. Fixed a bug that caused changes to variables supplied in an assignment
- statement preceding a shell builtin to not be honored (like a script
- run with `.').
-
-s. HOSTTYPE, OSTYPE, and MACHTYPE are set only if they do not have values
- when the shell is started.
-
-t. Fixed a bug that caused SIGINT to kill shell scripts after the script
- called `wait'.
-
-u. The `fc' builtin now tries to create its temporary files in the directory
- named by $TMPDIR.
-
-v. Bash no longer calls any Readline functions or uses any Readline variables
- not declared in readline.h.
-
-w. Fixed a bug that caused some substitutions involving $@ to not be split
- correctly, especially expansions of the form ${paramterOPword}.
-
-x. SSH2_CLIENT is now treated like SSH_CLIENT and not auto-exported if it
- appears in the initial environment.
-
-y. Fixed a couple of problems with shell scripts without a leading `#!'
- being executed out of shell functions that could cause core dumps if
- such a script attempted to execute `return'.
-
-z. Fixed a problem with the `-nt' and `-ot' binary operators for the
- `test/[' builtin and the `[[' conditional command that caused wrong
- return values if one of the file arguments did not exist.
-
-aa. Fixed a bug that caused non-interactive shells which had previously
- executed `shopt -s expand_aliases' to fail to expand aliases in a
- command like `(command) &'.
-
-2. Changes to Readline
-
-a. Changes to make most (but not yet all -- there is still crlf()) of the
- exported readline functions declared in readline.h have an rl_ prefix.
-
-b. More `const' changes in function arguments, mostly for completion
- functions.
-
-c. Fixed a bug in rl_forward that could cause the point to be set to before
- the beginning of the line in vi mode.
-
-d. Fixed a bug in the callback read-char interface to make it work when a
- readline function pushes some input onto the input stream with
- rl_execute_next (like the incremental search functions).
-
-e. Fixed a file descriptor leak in the history file manipulation code that
- was tripped when attempting to truncate a non-regular file (like
- /dev/null).
-
-f. Some existing variables are now documented and part of the public
- interface (declared in readline.h): rl_explict_arg, rl_numeric_arg,
- rl_editing_mode, rl_last_func.
-
-g. Renamed rltty_set_default_bindings to rl_tty_set_default_bindings and
- crlf to rl_crlf, so there are no public functions declared in readline.h
- without an `rl_' prefix. The old functions still exist for backwards
- compatibility.
-
-3. New Features in Bash
-
-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
- way that allows them to be reused as input. This affects `declare' and
- `declare -p' as well.
-
-4. New Features in Readline
-
-a. New application-callable function rl_set_prompt(const char *prompt):
- expands its prompt string argument and sets rl_prompt to the result.
-
-b. New application-callable function rl_set_screen_size(int rows, int cols):
- public method for applications to set readline's idea of the screen
- dimensions.
-
-c. The history example program (examples/histexamp.c) is now built as one
- of the examples.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.05-alpha1,
-and the previous version, bash-2.04-release.
-
-1. Changes to Bash
-
-a. A fix was made to allow newlines in compond array assignments.
-
-b. configure now checks for real-time signals with unusable values.
-
-c. Interactive shells no longer exit if a substitution fails because of an
- unset variable within a sourced file.
-
-d. Fixed a problem with incorrect matching of extended glob patterns when
- doing pattern substitution.
-
-e. `{' is now quoted by the completion code when it appears in a filename.
-
-f. Fixed an error in pattern matching that caused the matcher to not
- correctly skip the rest of a bracket expression after a character
- matched.
-
-g. Fixed a bug in the IFS word splitting code to make a non-whitespace IFS
- character preceded by IFS whitespace part of the current delimiter rather
- than generating a separate field.
-
-h. The {!prefix@} expansion now generates separate words, analogous to $@,
- when double-quoted.
-
-i. Command substitution now ignores NUL bytes in the command output, and the
- parser ignores them on input.
-
-j. A fix was made to the job control code to prevent hanging processes when
- the shell thinks background processes are running but the kernel returns
- -1/ECHILD from waitpid().
-
-k. `pwd' now prints an error message if the write fails when displaying the
- current directory.
-
-l. When in POSIX mode, the shell prints trap dispostions without a leading
- `SIG' in the signal specification.
-
-m. Fixed a parser bug that caused the current command's line count to be
- messed up by a compound array assignment.
-
-n. Fixed a bug in the unwind-protect code that caused bad behavior on machines
- where ints and pointers are not the same size.
-
-o. System-specific configure changes for: MacOS X.
-
-p. Changes for Cygwin to translate \r\n and \r to \n and to set file
- descriptors used for reading input to text mode in various places.
-
-q. Fixed a bug that caused `!' to occasionally not be honored when in
- a (...) subshell.
-
-r. Bash no longer assumes that getcwd() will return any useful error message
- in the buffer passed as an argument if the call fails.
-
-s. The `source', `.', and `fc' builtins no longer check whether a file is
- binary before reading commands from it.
-
-t. Subshells no longer turn off job control when they exit, since that
- sometimes resulted in the terminal being reset to the wrong process
- group.
-
-u. The history code no longer tries to save the second and subsequent lines
- of a multi-line command if the first line was not saved.
-
-v. The history saving code now does a better job of saving blank lines in a
- multi-line command.
-
-w. Removed a `feature' that made `ulimit' silently translate `unlimited' to
- the current hard limit, which obscured some kernel error returns.
-
-x. Fixed the grammar so that `}' is recognized as a reserved word after
- another reserved word, rather than requiring a `;' or newline. This
- means that constructs like
-
- { { echo a b c ; } }
-
- work as expected.
-
-y. Conditional commands ([[...]]) now perform tilde expansion on their
- arguments.
-
-z. Noted in the documentation that `set -a' will cause functions to be
- exported if they are defined after `set -a' is executed.
-
-aa. When an interactive login shell starts, if $PWD and $HOME refer to the
- same directory but are not the same string, $PWD is set to $HOME.
-
-bb. Fixed `printf' to handle invalid floating point numbers better.
-
-cc. Temporary files are now created with random filenames, to improve security.
-
-dd. The readline initialization code now binds the custom bash functions and
- key bindings after the readline defaults are set up.
-
-ee. Fixed the `source' builtin to no longer overwrite a shell function's
- argument list, even if the sourced file changes the positional parameters.
-
-ff. A bug fix was made in the expansion of `$*' in contexts where it should
- not be split, like assignment statements.
-
-gg. Fixed a bug in the parameter substring expansion to handle conditional
- arithmetic expressions ( exp ? val1 : val2 ) without cutting the expression
- off at the wrong `:'.
-
-hh. The `<>' redirection is no longer subject to the current setting of
- `noclobber', as POSIX.2 specifies.
-
-ii. Fixed a bug in the conditional command parsing code that caused expressions
- in parentheses to occasionally be parsed incorrectly.
-
-jj. Fixed a bug in the ((...)) arithmetic command to allow do...done or
- {...} to follow the )) without an intervening list terminator.
-
-kk. `printf' now treats `\E' the same as `\e' when performing backslash escape
- expansion for the `%b' format specifier.
-
-ll. When in POSIX mode, the shell no longer searches the current directory for
- a file to be sourced with `.' or `source' if `.' is not in $PATH.
-
-mm. Interactive comments are no longer turned off when POSIX mode is disabled.
-
-nn. The UID, EUID, HOSTNAME variables are not set if they are in the shell's
- environment when it starts up.
-
-oo. Fixed a bug in the `command' builtin so the effect of a command like
- `command exec 4<file' is as if the `command' had been omitted.
-
-pp. ${foo[@]} and ${foo[*]} now work as in ksh93 if `foo' is not an array
- variable.
-
-qq. ${#foo[X]}, where X is 0, @, or *, now work as in ksh93 if `foo' is not
- an array variable.
-
-rr. The shell's idea of an absolute pathname now takes into account a
- possible drive specification on Cygwin and other Windows systems.
-
-ss. Fixed a bug which caused incorrect parsing of some multi-character
- constructs if they were split across input lines with backslash-newline
- line continuation.
-
-tt. Fixed a bug that caused restricted shell mode to be set inappropriately
- when trying to execute a shell script without a leading `#!'.
-
-uu. Shell function definitions no longer require that the body be a group
- command ( {...} ), as POSIX.2 requires.
-
-vv. The `cd' and `pwd' builtins now process symlinks in pathnames internally
- and should require many fewer calls to getcwd().
-
-ww. Fixed a bug that caused a pipeline's process group to be set incorrectly
- if one of the pipeline elements contained a command substitution.
-
-xx. Fixed a bug that caused core dumps when expanding the value of HISTIGNORE.
-
-yy. The output of `set' is now quoted using $'...' so invisible characters are
- displayed as escape sequences.
-
-zz. Fixed the help text for `unset', since PATH and IFS may both be unset.
-
-aaa. The shell no longer puts directory names into the command hash table.
-
-bbb. Fixed a bug in `read' that caused it to occasionally free memory twice if
- it was interrupted after reading a large amount of data.
-
-ccc. Assignment statements that attempt to assign values to readonly variables
- now cause the command to return an error status.
-
-ddd. Fixed a bug that could cause incorrect output if a $(<file) construct was
- interrupted.
-
-eee. GROUPS and FUNCNAME now return an error status when assignment is
- attempted, but may be unset (in which case they lose their special
- properties). In all respects except unsetting, they are readonly.
-
-fff. The string-to-integer conversion code now ignores trailing whitespace in
- the string, even if strtol(3) does not.
-
-ggg. The tcsh magic-space function now does a better job of inserting the
- space close to where the point was before the history expansion, rather
- than just appending it.
-
-hhh. Fixed a bug which caused a file sourced from an interactive shell to
- fill up the jobs table if it ran lots of jobs.
-
-iii. Fixed a bug in the parameter pattern substitution code to avoid infinite
- recursion on zero-length matches.
-
-2. Changes to Readline
-
-a. When setting the terminal attributes on systems using `struct termio',
- readline waits for output to drain before changing the attributes.
-
-b. A fix was made to the history word tokenization code to avoid attempts to
- dereference a null pointer.
-
-c. Readline now defaults rl_terminal_name to $TERM if the calling application
- has left it unset, and tries to initialize with the resultant value.
-
-d. Instead of calling (*rl_getc_function)() directly to get input in certain
- places, readline now calls rl_read_key() consistently.
-
-e. Fixed a bug in the completion code that allowed a backslash to quote a
- single quote inside a single-quoted string.
-
-f. rl_prompt is no longer assigned directly from the argument to readline(),
- but uses memory allocated by readline. This allows constant strings to
- be passed to readline without problems arising when the prompt processing
- code wants to modify the string.
-
-g. Fixed a bug that caused non-interactive history searches to return the
- wrong line when performing multiple searches backward for the same string.
-
-h. Many variables, function arguments, and function return values are now
- declared `const' where appropriate, to improve behavior when linking with
- C++ code.
-
-i. The control character detection code now works better on systems where
- `char' is unsigned by default.
-
-j. The vi-mode numeric argument is now capped at 999999, just like emacs mode.
-
-k. The Function, CPFunction, CPPFunction, and VFunction typedefs have been
- replaced with a set of specific prototyped typedefs, though they are
- still in the readline header files for backwards compatibility.
-
-m. Nearly all of the (undocumented) internal global variables in the library
- now have an _rl_ prefix -- there were a number that did not, like
- screenheight, screenwidth, alphabetic, etc.
-
-n. The ding() convenience function has been renamed to rl_ding(), though the
- old function is still defined for backwards compatibility.
-
-o. The completion convenience functions filename_completion_function,
- username_completion_function, and completion_matches now have an rl_
- prefix, though the old names are still defined for backwards compatibility.
-
-p. The functions shared by readline and bash (linkage is satisfied from bash
- when compiling with bash, and internally otherwise) now have an sh_ prefix.
-
-q. Changed the shared library creation procedure on Linux and BSD/OS 4.x so
- that the `soname' contains only the major version number rather than the
- major and minor numbers.
-
-r. Fixed a redisplay bug that occurred when the prompt spanned more than one
- physical line and contained invisible characters.
-
-3. New Features in Bash
-
-a. Added a new `--init-file' invocation argument as a synonym for `--rcfile',
- per the new GNU coding standards.
-
-b. The /dev/tcp and /dev/udp redirections now accept service names as well as
- port numbers.
-
-c. `complete' and `compgen' now take a `-o value' option, which controls some
- of the aspects of that compspec. Valid values are:
-
- default - perform bash default completion if programmable
- completion produces no matches
- dirnames - perform directory name completion if programmable
- completion produces no matches
- filenames - tell readline that the compspec produces filenames,
- so it can do things like append slashes to
- directory names and suppress trailing spaces
-
-4. New Features in Readline
-
-a. The blink timeout for paren matching is now settable by applications.
-
-b. _rl_executing_macro has been renamed to rl_executing_macro, which means
- it's now part of the public interface.
-
-c. Readline has a new variable, rl_readline_state, which is a bitmap that
- encapsulates the current state of the library; intended for use by
- callbacks and hook functions.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.04-release,
-and the previous version, bash-2.04-beta5.
-
-1. Changes to Bash
-
-a. Better compile-time and configure-time checks for the necessity of
- inet_aton().
-
-b. A bug was fixed in the expansion of "${@:-}" when there are positional
- parameters.
-
-c. A typo was fixed in the output of `complete'.
-
-d. The matches generated for a word by the `-W' argument to complete and
- compgen are now matched against the word being completed, and only
- matches are returned as the result.
-
-e. Some fixes were made for systems which do not restart read(2) when a
- signal caught by bash is received.
-
-f. A bug was fixed which caused the umask to be set to 0 when an invalid
- symbolic mode mask was parsed.
-
-g. Fixed a bug that could cause a core dump if a SIGCHLD was received while
- performing an assignment statement using command substitution.
-
-h. Changed the word splitting function for programmable completion so cases
- in which the cursor is between words are handled a bit better.
-
-2. Changes to Readline
-
-a. rl_funmap_names() is now documented.
-
-3. New Features in Bash
-
-a. The LC_NUMERIC variable is now treated specially, and used to set the
- LC_NUMERIC locale category for number formatting, e.g., when `printf'
- displays floating-point numbers.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.04-beta5,
-and the previous version, bash-2.04-beta4.
-
-1. Changes to Bash
-
-a. A couple of changes were made to the Makefiles for easier building on
- non-Unix systems.
-
-b. Fixed a bug where the current prompt would be set to $PS2 at startup.
-
-c. The shell script that tests an already-installed version was changed to
- remove the directory it created its test programs in at exit.
-
-d. Several changes were made to the code that tokenizes an input line for
- the programmable completion code. Shell metacharacters will now appear
- as individual words in the word list passed to the completion functions.
- Some of the example completion shell functions were changed to understand
- redirection operators.
-
-e. A bug was fixed that, under obscure circumstances, could confuse the
- parser when a shell function was run by the programmable completion code.
-
-f. A bug was fixed in the ulimit builtin for systems not using getrlimit().
-
-g. The execution code now propagates the correct exit status back to the rest
- of the code if the return value of a subshell command was being inverted.
- Some new test cases for inverting return values with the `!' reserved
- word have been added.
-
-h. Negative exponents in the arithmetic evaluation of v**e now return an
- evaluation error.
-
-i. A bug that caused bash to check the wrong process in a pipeline for
- abnormal termination (and consequently resetting the terminal attributes)
- was fixed.
-
-j. Fixed a bug that caused $PS2 to be displayed after PROMPT_COMMAND was
- executed.
-
-2. Changes to Readline
-
-1. Fixed a bug in a C preprocessor define that caused the keypad control
- functions to be compiled out for all platforms except DJGPP.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.04-beta4,
-and the previous version, bash-2.04-beta3.
-
-1. Changes to Bash
-
-a. A couple of changes were made to the redirection to attempt to avoid
- race conditions and malicious file replacement.
-
-2. A change was made to the string evaluation code (used for command
- substitution, `eval', and the `.' builtin) to fix an obscure core
- dump on alpha machines.
-
-3. A bug that caused $LINENO to be wrong when executing arithmetic for
- commands was fixed.
-
-4. A couple of memory leaks in the programmable completion code were fixed.
-
-5. A bug that could cause a core dump by freeing memory twice during a call
- to `eval' if `set -u' had been enabled and an undefined variable was
- referenced was fixed.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.04-beta3,
-and the previous version, bash-2.04-beta2.
-
-1. Changes to Bash
-
-a. Bash should run the appropriate startup files when invoked by ssh2.
-
-b. Fixed a bug in the parsing of conditional commands that could cause a
- core dump.
-
-c. Fixed a bug in parsing job specifications that occasionally caused
- core dumps when an out-of-range job was referenced.
-
-d. Fixed the `type' and `command' builtins to do better reporting of
- commands that are not found in $PATH or the hash table.
-
-e. Fixed a POSIX.2 compliance problem in the command builtin -- commands
- are supposed to be reported as full pathnames.
-
-f. The `echo' builtin now returns failure if a write error occurs.
-
-g. Fixed a bug which caused the locale to not be reset correctly when
- LC_ALL was unset.
-
-h. Changed description of `getopts' in man page and reference manual to make
- it clear that option characters may be characters other than letters.
-
-i. If the shell exits while in a function, make sure that any trap on EXIT
- doesn't think the function is still executing.
-
-j. Bashbug now tries harder to find a usable editor if $EDITOR is not set,
- rather than simply defaulting to `emacs'.
-
-k. Changes to the scripts that guess and canonicalize the system type, from
- the latest `automake' distribution via Debian.
-
-l. When using named pipes for process substitution, make sure the file
- descriptors opened for reading are set to non-blocking mode.
-
-m. Fixed a bug that caused termination of pipelines that are killed by a
- signal to not be reported in some cases.
-
-n. When not in literal-history mode, shell comment lines are not added to
- the history list.
-
-o. When running in POSIX.2 mode, bash no longer performs word splitting on
- the expanded value of the word supplied as the filename argument to
- redirection operators.
-
-p. The prompt string decoding code now backslash-quotes only characters that
- are special within double quotes when expanding the \w and \W escape
- sequences.
-
-q. Fixed a bug in the prompt decoding code that could cause a non-interactive
- shell to seg fault if `\u' was used in PS4 and the shell was in xtrace
- mode.
-
-r. Fixed a bug that caused function definitions to be printed with any
- redirections that should be attached to the entire function before the
- closing brace.
-
-s. Changed the tilde expansion code for Cygwin systems to avoid creating
- pathnames beginning with `//' if $HOME == `/'.
-
-t. Fixed a couple of autoconf tests to avoid creating files with fixed names
- in /tmp.
-
-u. The `trap' and `kill' builtins now know the names of the POSIX.1b real-
- time signals on systems which support them.
-
-2. Changes to Readline
-
-a. Fixed a problem with the single-quote quoting function that could cause
- buffer overflows.
-
-b. Fixed a bug that caused incorrect `stat characters' to be printed if
- the files being completed were in the root directory and visible-stats
- was enabled.
-
-3. New Features in Bash
-
-a. There is a new `rbash.1' manual page, from the Debian release.
-
-b. The `--enable-usg-echo-default' option to `configure' has been renamed to
- `--enable-xpg-echo-default'. The old option is still there for backwards
- compatibility.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.04-beta2,
-and the previous version, bash-2.04-beta1.
-
-1. Changes to Bash
-
-a. Fixed a bug that could cause pipes to be closed inappropriately in
- some obscure cases.
-
-b. Fixed a bug that caused creation of the exported environment to clobber
- the current command string if there were any exported shell functions.
-
-c. Some changes were made to reduce bash's memory usage.
-
-d. Fixed a problem with programmable completion and filenames to be
- completed containing quote characters.
-
-e. Changed the code the removes named pipes created for the <(...) and >(...)
- expansions to defer removal until after any current shell function has
- finished executing.
-
-f. Fixed a bug in `select' which caused it to not handle the `continue'
- builtin correctly.
-
-g. Autoconf tests added for cygwin32 and mingw32.
-
-2. New Features in Bash
-
-a. The `--with-bash-malloc' configure option replaces `--with-gnu-malloc'
- (which is still there for backwards compatibility).
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.04-beta1,
-and the previous version, bash-2.04-alpha1.
-
-1. Changes to Bash
-
-a. Fixed a bug in the programmable completion code that occurred when
- trying to complete command lines containing a `;' or `@'.
-
-b. The file descriptor from which the shell is reading a script is now
- moved to a file descriptor above the user-addressible range.
-
-c. Changes to `printf' so that it can handle integers beginning with 0
- or 0x as octal and hex, respectively.
-
-d. Fixes to the programmable completion code so it handles nonsense like
- `compgen -C xyz' gracefully.
-
-e. The shell no longer modifies the signal handler for SIGPROF, allowing
- profiling again on certain systems.
-
-f. The shell checks for a new window size, if the user has requested it,
- after a process exits due to a signal.
-
-g. Fixed a bug with variables with null values in a program's temporary
- environment and the bash getenv() replacement.
-
-h. `declare' and the other builtins that take variable assignments as
- arguments now honor `set -a' and mark modified variables for export.
-
-i. Some changes were made for --dump-po-strings mode when writing strings
- with embedded newlines.
-
-j. The code that caches export strings from the initial environment now
- duplicates the string rather than just pointing into the environment.
-
-k. The filename completion quoting code now uses single quotes by default
- if the filename being completed contains newlines, since \<newline>
- has a special meaning to the parser.
-
-l. Bash now uses typedefs bits32_t and u_bits32_t instead of int32_t and
- u_int32_t, respectively to avoid conflicts on certain Unix versions.
-
-m. Configuration changes were made for: Rhapsody, Mac OS, FreeBSD-3.x.
-
-n. Fixed a problem with hostname-to-ip-address translation in the
- /dev/(tcp|udp)/hostname/port redirection code.
-
-o. The texinfo manual has been reorganized slightly.
-
-p. Filename generation (globbing) range comparisons in bracket expressions
- no longer use strcoll(3) even if it is available, since it has unwanted
- effects in certain locales.
-
-q. Fixed a cosmetic problem in the source that caused the shell to not
- compile if DPAREN_ARITHMETIC was not defined but ARITH_FOR_COMMAND was.
-
-r. Fixed a bug in the here-document code tripped when the file descriptor
- opened to the file containing the text of the here document was the
- same as a redirector specified by the user.
-
-s. Fixed a bug where the INVERT_RETURN flag was not being set for `pipeline'
- in `time ! pipeline'.
-
-t. Fixed a bug with the `wait' builtin which manifested itself when an
- interrupt was received while the shell was waiting for asynchronous
- processes in a shell script.
-
-u. Fixed the DEBUG trap code so that it has the correct value of $?.
-
-v. Fixed a bug in the parameter pattern substitution code that could cause
- the shell to attempt to free unallocated memory if the pattern started
- with `/' and an expansion error occurs.
-
-w. Fixed a bug in the positional parameter substring code that could
- cause the shell to loop freeing freed memory.
-
-x. Fixed a bug in the positional parameter pattern substitution code so
- that it correctly handles null replacement strings with a pattern
- string prefixed with `%' or `#'.
-
-y. The shell no longer attempts to import functions from the environment if
- started with `-n'.
-
-z. Fixed a bug that caused `return' in a command substitution executed in
- a shell function to return from the function in a subshell and continue
- execution.
-
-aa. `hash -p /pathname/with/slashes name' is no longer allowed when the shell
- is restricted.
-
-bb. The wait* job control functions now behave better if called when there
- are no unwaited-for children.
-
-cc. Command substitution no longer unconditionally disables job control in
- the subshell started to run the command.
-
-dd. A bug was fixed that occasionally caused traps to mess up the parser
- state.
-
-ee. `bashbug' now honors user headers in the mail message it sends.
-
-ff. A bug was fixed that caused the `:p' history modifier to not print the
- history expansion if the `histverify' option was set.
-
-2. Changes to Readline
-
-a. Fixed a bug in the redisplay code for lines with more than 256 line
- breaks.
-
-b. A bug was fixed which caused invisible character markers to not be
- stripped from the prompt string if the terminal was in no-echo mode.
-
-c. Readline no longer tries to get the variables it needs for redisplay
- from the termcap entry if the calling application has specified its
- own redisplay function. Readline treats the terminal as `dumb' in
- this case.
-
-d. Fixes to the SIGWINCH code so that a multiple-line prompt with escape
- sequences is redrawn correctly.
-
-3. New Features in Bash
-
-a. `bashbug' now accepts `--help' and `--version' options.
-
-b. There is a new `xpg_echo' option to `shopt' that controls the behavior
- of echo with respect to backslash-escaped characters at runtime.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.04-alpha1,
-and the previous version, bash-2.04-devel.
-
-1. Changes to Bash
-
-a. Fixed a bug that could cause core dumps when performing substring
- expansion.
-
-b. Shared object configuration changes for: Solaris, OSF/1
-
-c. The POSIX_GLOB_LIBRARY code that uses the POSIX.2 globbing facilities
- for pathname expansion now understands GLOBIGNORE.
-
-d. The code that implements `eval' was changed to save the value of the
- current prompt, so an eval in a shell function called by the programmable
- completion code will not change the prompt to $PS2.
-
-e. Restored the undocumented NON_INTERACTIVE_LOGIN_SHELLS #define to
- config-top.h. If this is defined, all login shells will read the
- startup files, not just interactive and non-interactive started with
- the `--login' option.
-
-f. Fixed a bug that caused the expansion code to occasionally dump core if
- IFS contained characters > 128.
-
-g. Fixed a problem with the grammar so that a newline is not required
- after the `))' in the new-style arithmetic for statement; a semicolon
- may be used as expected.
-
-h. Variable indirection may now reference the shell's special variables.
-
-i. The $'...' and $"..." constructs are now added to the history correctly
- if they contain newlines and command-oriented history is enabled.
-
-j. It is now an error to try to assign a value to a function-local copy
- of a readonly shell variable (declared with the `local' builtin).
-
-2. Changes to Readline
-
-a. The history file code now uses O_BINARY mode when reading and writing
- the history file on cygwin32.
-
-3. New Features in Bash
-
-a. A new programmable completion facility, with two new builtin commands:
- complete and compgen.
-
-b. configure has a new option, `--enable-progcomp', to compile in the
- programmable completion features (enabled by default).
-
-c. `shopt' has a new option, `progcomp', to enable and disable programmable
- completion at runtime.
-
-d. Unsetting HOSTFILE now clears the list of hostnames used for completion.
-
-4. New Features in Readline
-
-a. A new variable, rl_gnu_readline_p, always 1. The intent is that an
- application can verify whether or not it is linked with the `real'
- readline library or some substitute.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.04-devel,
-and the previous version, bash-2.03-release.
-
-1. Changes to Bash
-
-a. System-specific configuration and source changes for: Interix, Rhapsody
-
-b. Fixed a bug in execute_cmd.c that resulted in a compile-time error if
- JOB_CONTROL was not defined.
-
-c. An obscure race condition in the trap code was fixed.
-
-d. The string resulting from $'...' is now requoted to avoid any further
- expansion.
-
-e. The $'...' quoting syntax now allows backslash to escape a single quote,
- for ksh-93 compatibility.
-
-f. The $"..." quoting syntax now escapes backslashes and double quotes in
- the translated string when displaying them with the --dump-po-strings
- option.
-
-g. `echo -e' no longer converts \' to '.
-
-h. Fixes were made to the extended globbing code to handle embedded (...)
- patterns better.
-
-i. Some improvements were made to the code that unsets `nodelay' mode on
- the file descriptor from which bash is reading input.
-
-j. Some changes were made to the replacement termcap library for better
- operation on MS-DOS.
-
-k. Some changes were made to the tilde expansion code to handle backslash
- as a pathname separator on MS-DOS.
-
-l. The source has been reorganized a little bit -- there is now an `include'
- subdirectory, and lib/posixheaders has been removed.
-
-m. Improvements were made to the `read' builtin so that it makes many
- fewer read(2) system calls.
-
-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
- now works better when there are unterminated expansions, command
- completion understands quotes better, and completion now works in certain
- unclosed $(... constructs.
-
-p. The arithmetic expansion code was fixed to not need the value of a
- variable being assigned a value (fixes the "ss=09; let ss=10" bug).
-
-q. Some changes were made to make exported environment creation faster.
-
-r. The html documentation will be installed into $(htmldir) if that variable
- has a value when `make install' is run.
-
-s. Fixed a bug that would cause the bashrc file to be sourced inappropriately
- when bash is started by sshd.
-
-t. The SSH_CLIENT environment variable is no longer auto-exported.
-
-u. A bug that caused redirections with (...) subshells to be performed in
- the wrong order was fixed.
-
-v. A bug that occasionally caused inappropriate expansion of assignment
- statements in compound array assignments was fixed.
-
-w. The code that parses the words in a compound array assignment was
- simplified considerably and should work better now.
-
-x. Fixes to the non-job-control code in nojobs.c to make it POSIX.2-compliant
- when a user attempts to retrieve the status of a terminated background
- process.
-
-y. Fixes to the `printf' builtin so that it doesn't try to expand all
- backslash escape sequences in the format string before parsing it for
- % format specifiers.
-
-2. Changes to Readline
-
-a. The history library tries to truncate the history file only if it is a
- regular file.
-
-b. A bug that caused _rl_dispatch to address negative array indices on
- systems with signed chars was fixed.
-
-c. rl-yank-nth-arg now leaves the history position the same as when it was
- called.
-
-d. Changes to the completion code to handle MS-DOS drive-letter:pathname
- filenames.
-
-e. Completion is now case-insensitive by default on MS-DOS.
-
-f. Fixes to the history file manipulation code for MS-DOS.
-
-g. Readline attempts to bind the arrow keys to appropriate defaults on MS-DOS.
-
-h. Some fixes were made to the redisplay code for better operation on MS-DOS.
-
-i. The quoted-insert code will now insert tty special chars like ^C.
-
-j. A bug was fixed that caused the display code to reference memory before
- the start of the prompt string.
-
-k. More support for __EMX__ (OS/2).
-
-l. A bug was fixed in readline's signal handling that could cause infinite
- recursion in signal handlers.
-
-m. A bug was fixed that caused the point to be less than zero when rl_forward
- was given a very large numeric argument.
-
-n. The vi-mode code now gets characters via the application-settable value
- of rl_getc_function rather than calling rl_getc directly.
-
-3. New Features in Bash
-
-a. The history builtin has a `-d offset' option to delete the history entry
- at position `offset'.
-
-b. The prompt expansion code has two new escape sequences: \j, the number of
- active jobs; and \l, the basename of the shell's tty device name.
-
-c. The `bind' builtin has a new `-x' option to bind key sequences to shell
- commands.
-
-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.
-
-f. There are several new arithmetic operators: id++, id-- (variable
- post-increment/decrement), ++id, --id (variabl pre-increment/decrement),
- expr1 , expr2 (comma operator).
-
-g. There is a new ksh-93 style arithmetic for command:
- for ((expr1 ; expr2; expr3 )); do list; done
-
-h. The `read' builtin has a number of new options:
- -t timeout only wait timeout seconds for input
- -n nchars only read nchars from input instead of a full line
- -d delim read until delim rather than newline
- -s don't echo input chars as they are read
-
-i. The redirection code now handles several filenames specially:
- /dev/fd/N, /dev/stdin, /dev/stdout, and /dev/stderr, whether or
- not they are present in the file system.
-
-j. The redirection code now recognizes pathnames of the form
- /dev/tcp/host/port and /dev/udp/host/port, and tries to open a socket
- of the appropriate type to the specified port on the specified host.
-
-k. The ksh-93 ${!prefix*} expansion, which expands to the names of all
- shell variables whose names start with prefix, has been implemented.
-
-l. There is a new dynamic variable, FUNCNAME, which expands to the name of
- a currently-executing function. Assignments to FUNCNAME have no effect.
-
-m. The GROUPS variable is no longer readonly; assignments to it are silently
- discarded. This means it can be unset.
-
-4. New Features in Readline
-
-a. Parentheses matching is now always compiled into readline, and enabled
- or disabled when the value of the `blink-matching-paren' variable is
- changed.
-
-b. MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.
-
-c. MS-DOS systems now use ~/_history as the default history file.
-
-d. history-search-{forward,backward} now leave the point at the end of the
- line when the string to search for is empty, like
- {reverse,forward}-search-history.
-
-e. history-search-{forward,backward} now leave the last history line found
- in the readline buffer if the second or subsequent search fails.
-
-f. New function for use by applications: rl_on_new_line_with_prompt, used
- when an application displays the prompt itself before calling readline().
-
-g. New variable for use by applications: rl_already_prompted. An application
- that displays the prompt itself before calling readline() must set this to
- a non-zero value.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.03-release,
-and the previous version, bash-2.03-beta2.
-
-1. Changes to Bash
-
-a. A file descriptor leak in the `fc' builtin was fixed.
-
-b. A bug was fixed in the `read' builtin that caused occasional spurious
- failures when using `read -e'.
-
-c. The version code needed to use the value of the cpp variable
- CONF_MACHTYPE rather than MACHTYPE.
-
-d. A new test was added to exercise the command printing and copying code.
-
-e. A bug was fixed that caused `time' to be recognized as a reserved word
- if it was the first pattern in a `case' statement pattern list.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.03-beta2,
-and the previous version, bash-2.03-beta1.
-
-1. Changes to Bash
-
-a. Slight additions to support/shobj-conf, mostly for the benefit of AIX 4.2.
-
-b. config.{guess,sub} support added for the NEC SX4.
-
-c. Changed some of the cross-compiling sections of the configure macros in
- aclocal.m4 so that configure won't abort.
-
-d. Slight changes to how the HTML versions of the bash and readline manuals
- are generated.
-
-e. Fixed conditional command printing to avoid interpreting printf `%'-escapes
- in arguments to [[.
-
-f. Don't include the bash malloc on all variants of the alpha processor.
-
-g. Changes to configure to make --enable-profiling work on Solaris 2.x.
-
-h. Fixed a bug that manifested itself when shell functions were called
- between calls to `getopts'.
-
-i. Fixed pattern substitution so that a bare `#'as a pattern causes the
- replacement string to be prefixed to the search string, and a bare
- `%' causes the replacement string to be appended to the search string.
-
-j. Fixed a bug in the command execution code that caused child processes
- to occasionally have the wrong value for $!.
-
-2. Changes to Readline
-
-a. Added code to the history library to catch history substitutions using
- `&' without a previous history substitution or search having been
- performed.
-
-3. New Features in Bash
-
-4. New Features in Readline
-
-a. New bindable variable: `isearch-terminators'.
-
-b. New bindable function: `forward-backward-delete-char' (unbound by default).
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.03-beta1,
-and the previous version, bash-2.03-alpha.
-
-1. Changes to Bash
-
-a. A change was made to the help text for `{...}' to make it clear that a
- semicolon is required before the closing brace.
-
-b. A fix was made to the `test' builtin so that syntax errors cause test
- to return an exit status > 1.
-
-c. Globbing is no longer performed on assignment statements that appear as
- arguments to `assignment builtins' such as `export'.
-
-d. System-specific configuration changes were made for: Rhapsody,
- AIX 4.2/gcc, BSD/OS 4.0.
-
-e. New loadable builtins: ln, unlink.
-
-f. Some fixes were made to the globbing code to handle extended glob patterns
- which immediately follow a `*'.
-
-g. A fix was made to the command printing code to ensure that redirections
- following compound commands have a space separating them from the rest
- of the command.
-
-h. The pathname canonicalization code was changed to produce fewer leading
- `//' sequences, since those are interpreted as network file system
- pathnames on some systems.
-
-i. A fix was made so that loops containing `eval' commands in commands passed
- to `bash -c' would not exit prematurely.
-
-j. Some changes were made to the job reaping code when the shell is not
- interactive, so the shell will retain exit statuses longer for examination
- by `wait'.
-
-k. A fix was made so that `jobs | command' works again.
-
-l. The erroneous compound array assignment var=((...)) is now a syntax error.
-
-m. A change was made to the dynamic loading code in `enable' to support
- Tenon's MachTen.
-
-n. A fix was made to the globbing code so that extended globbing patterns
- will correctly match `.' in a bracket expression.
-
-2. Changes to Readline
-
-a. A fix was made to the completion code in which a typo caused the wrong
- value to be passed to the function that computed the longest common
- prefix of the list of matches.
-
-b. The completion code now checks the value of rl_filename_completion_desired,
- which is set by application-supplied completion functions to indicate
- that filename completion is being performed, to decide whether or not to
- call an application-supplied `ignore completions' function.
-
-3. New Features in Bash
-
-a. A change was made to the startup file code so that any shell begun with
- the `--login' option, even non-interactive shells, will source the login
- shell startup files.
-
-4. New Features in Readline
-
-a. A new variable, rl_erase_empty_line, which, if set by an application using
- readline, will cause readline to erase, prompt and all, lines on which the
- only thing typed was a newline.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.03-alpha,
-and the previous version, bash-2.02.1-release.
-
-1. Changes to Bash
-
-a. System-specific configuration changes were made for: Irix 6.x, Unixware 7.
-
-b. The texi2dvi and texi2html scripts were updated to the latest versions
- from the net.
-
-c. The configure tests that determine which native type is 32 bits were
- changed to not require a compiled program.
-
-d. Fixed a bug in shell_execve that could cause memory to be freed twice
- after a failed exec.
-
-e. The `printf' test uses `diff -a' if it's available to prevent confusion
- due to the non-ascii output.
-
-f. Shared object configuration is now performed by a shell script,
- support/shobj-conf, which generates values to be substituted into
- makefiles by configure.
-
-g. Some changes were made to `ulimit' to avoid the use of RLIM_INVALID as a
- return value.
-
-h. Changes were made to `ulimit' to work around HPUX 9.x's peculiar
- handling of RLIMIT_FILESIZE.
-
-i. Some new loadable builtins were added: id, printenv, sync, whoami, push,
- mkdir. `pushd', `popd', and `dirs' can now be built as regular or
- loadable builtins from the same source file.
-
-j. Changes were made to `printf' to handle NUL bytes in the expanded format
- string.
-
-k. The various `make clean' Makefile targets now descend into lib/sh.
-
-l. The `type' builtin was changed to use the internal `getopt' so that things
- like `type -ap' work as expected.
-
-m. There is a new configuration option, --with-installed-readline, to link
- bash with a locally-installed version of readline. Only readline version
- 4.0 and later releases can support this. Shared and static libraries
- are supported. The installed include files are used.
-
-n. There is a new autoconf macro used to find which basic type is 64 bits.
-
-o. Dynamic linking and loadable builtins should now work on SCO 3.2v5*,
- AIX 4.2 with gcc, Unixware 7, and many other systems using gcc, where
- the `-shared' options works correctly.
-
-p. A bug was fixed in the bash filename completion code that caused memory to
- be freed twice if a directory name containing an unset variable was
- completed and the -u option was set.
-
-q. The prompt expansion code now quotes the `$' in the `\$' expansion so it
- is not processed by subsequent parameter expansion.
-
-r. Fixed a parsing bug that caused a single or double quote after a `$$' to
- trigger ANSI C expansion or locale translation.
-
-s. Fixed a bug in the globbing code that caused quoted filenames containing
- no globbing characters to sometimes be incorrectly expanded.
-
-t. Changes to the default prompt strings if prompt string decoding is not
- compiled into the shell.
-
-u. Added `do', `then', `else', `{', and `(' to the list of keywords that may
- precede the `time' reserved word.
-
-v. The shell may now be cross-built for BeOS as well as cygwin32.
-
-w. The conditional command execution code now treats `=' the same as `=='
- for deciding when to perform pattern matching.
-
-x. The `-e' option no longer causes the shell to exit if a command exits
- with a non-zero status while running the startup files.
-
-y. The `printf' builtin no longer dumps core if a modifier is supplied in
- the format string without a conversion character (e.g. `%h').
-
-z. Array assignments of the form a=(...) no longer show up in the history
- list.
-
-aa. The parser was fixed to obey the POSIX.2 rules for finding the closing
- `}' in a ${...} expression.
-
-bb. The history file is now opened with mode 0600 rather than 0666, so bash
- no longer relies on the user's umask being set appropriately.
-
-cc. Setting LANG no longer causes LC_ALL to be assigned a value; bash now
- relies on proper behavior from the C library.
-
-dd. Minor changes were made to allow quoted variable expansions using
- ${...} to be completed correctly if there is no closing `"'.
-
-ee. Changes were made to builtins/Makefile.in so that configuring the shell
- with `--enable-profiling' works right and builtins/mkbuiltins is
- generated.
-
-2. Changes to Readline
-
-a. The version number is now 4.0.
-
-b. There is no longer any #ifdef SHELL code in the source files.
-
-c. Some changes were made to the key binding code to fix memory leaks and
- better support Win32 systems.
-
-d. Fixed a silly typo in the paren matching code -- it's microseconds, not
- milliseconds.
-
-e. The readline library should be compilable by C++ compilers.
-
-f. The readline.h public header file now includes function prototypes for
- all readline functions, and some changes were made to fix errors in the
- source files uncovered by the use of prototypes.
-
-g. The maximum numeric argument is now clamped at 1000000.
-
-h. Fixes to rl_yank_last_arg to make it behave better.
-
-i. Fixed a bug in the display code that caused core dumps if the prompt
- string length exceeded 1024 characters.
-
-j. The menu completion code was fixed to properly insert a single completion
- if there is only one match.
-
-k. A bug was fixed that caused the display code to improperly display tabs
- after newlines.
-
-3. New Features in Bash
-
-a. New `shopt' option, `restricted_shell', indicating whether or not the
- shell was started in restricted mode, for use in startup files.
-
-b. Filename generation is now performed on the words between ( and ) in
- array assignments (which it probably should have done all along).
-
-c. OLDPWD is now auto-exported, as POSIX.2 seems to require.
-
-d. ENV and BASH_ENV are read-only variables in a restricted shell.
-
-4. New Features in Readline
-
-a. Many changes to the signal handling:
- o Readline now catches SIGQUIT and cleans up the tty before returning;
- o A new variable, rl_catch_signals, is available to application writers
- to indicate to readline whether or not it should install its own
- signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP,
- SIGTTIN, and SIGTTOU;
- o A new variable, rl_catch_sigwinch, is available to application
- writers to indicate to readline whether or not it should install its
- own signal handler for SIGWINCH, which will chain to the calling
- applications's SIGWINCH handler, if one is installed;
- o There is a new function, rl_free_line_state, for application signal
- handlers to call to free up the state associated with the current
- line after receiving a signal;
- o There is a new function, rl_cleanup_after_signal, to clean up the
- display and terminal state after receiving a signal;
- o There is a new function, rl_reset_after_signal, to reinitialize the
- terminal and display state after an application signal handler
- returns and readline continues
-
-b. There is a new function, rl_resize_terminal, to reset readline's idea of
- the screen size after a SIGWINCH.
-
-c. New public functions: rl_save_prompt and rl_restore_prompt. These were
- previously private functions with a `_' prefix.
-
-d. New function hook: rl_pre_input_hook, called just before readline starts
- reading input, after initialization.
-
-e. New function hook: rl_display_matches_hook, called when readline would
- display the list of completion matches. The new function
- rl_display_match_list is what readline uses internally, and is available
- for use by application functions called via this hook.
-
-f. New bindable function, delete-char-or-list, like tcsh.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.02.1-release,
-and the previous version, bash-2.02-release.
-
-1. Changes to Bash
-
-a. A bug that caused the bash readline support to not compile unless aliases
- and csh-style history were configured into the shell was fixed.
-
-b. Fixed a bug that could cause a core dump when here documents contained
- more than 1000 characters.
-
-c. Fixed a bug that caused a CDPATH entry of "" to not be treated the same
- as the current directory when in POSIX mode.
-
-d. Fixed an alignment problem with the memory returned by the bash malloc,
- so returned memory is now 64-bit aligned.
-
-e. Fixed a bug that caused command substitutions executed within pipelines
- to put the terminal in the wrong process group.
-
-f. Fixes to support/config.sub for: alphas, SCO Open Server and Open Desktop,
- Unixware 2, and Unixware 7.
-
-g. Fixes to the pattern matching code to make it work correctly for eight-bit
- characters.
-
-h. Fixed a problem that occasionally caused the shell to display the wrong
- value for the new working directory when changing to a directory found
- in $CDPATH when in physical mode.
-
-i. Fixed a bug that caused core dumps when using conditional commands in
- shell functions.
-
-j. Fixed a bug that caused the printf builtin to loop forever if the format
- string did not consume any of the arguments.
-
-k. Fixed a bug in the parameter expansion code that caused "$@" to be
- incorrectly split if $IFS did not contain a space character.
-
-l. Fixed a bug that could cause a core dump when completing hostnames if
- the number of matching hostnames was an exact multiple of 16.
-
-m. Fixed a bug that caused the shell to fork too early when a command
- such as `%2 &' was given.
-
-2. Changes to Readline
-
-a. Fixed a problem with redisplay that showed up when the prompt string was
- longer than the screen width and the prompt contained invisible characters.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.02-release,
-and the previous version, bash-2.02-beta2.
-
-1. Changes to Bash
-
-a. A bug was fixed that caused the terminal process group to be set
- incorrectly when performing command substitution of builtins in a
- pipeline.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.02-beta2,
-and the previous version, bash-2.02-beta1.
-
-1. Changes to Bash
-
-a. Attempting to `wait' for stopped jobs now generates a warning message.
-
-b. Pipelines which exit due to SIGPIPE in non-interactive shells are now
- not reported if the shell is compiled -DDONT_REPORT_SIGPIPE.
-
-c. Some changes were made to builtins/psize.sh and support/bashbug.sh to
- attempt to avoid some /tmp file races and surreptitious file
- substitutions.
-
-d. Fixed a bug that caused the shell not to compile if configured with
- dparen arithmetic but without aliases.
-
-e. Fixed a bug that caused the input stream to be switched when assigning
- empty arrays with `bash -c'.
-
-f. A bug was fixed in the readline expansion glue code that caused bash to
- dump core when expanding lines with an unclosed single quote.
-
-g. A fix was made to the `cd' builtin so that using a non-empty directory
- from $CDPATH results in an absolute pathname of the new current working
- directory to be displayed after the current directory is changed.
-
-h. Fixed a bug in the variable assignment code that caused the shell to
- dump core when referencing an unset variable with `set -u' enabled in
- an assignment statement preceding a command.
-
-i. Fixed a bug in the exit trap code that caused reserved words to not be
- recognized under certain circumstances.
-
-j. Fixed a bug in the parameter pattern substitution code so that quote
- removal is performed.
-
-k. The shell should now configure correctly on Apple Rhapsody systems.
-
-l. The `kill' builtin now prints a usage message if it is not passed any
- arguments.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.02-beta1,
-and the previous version, bash-2.02-alpha1.
-
-1. Changes to Bash
-
-a. A few compilation bugs were fixed in the new extended globbing code.
-
-b. Executing arithmetic commands now sets the command name to `((' so
- error messages look right.
-
-c. Fixed some build problems with various configuration options.
-
-d. The `printf' builtin now aborts immediately if an illegal format
- character is encountered.
-
-e. The code that creates here-documents now behaves better if the file it's
- trying to create already exists for some reason.
-
-f. Fixed a problem with the extended globbing code that made patterns like
- `x+*' expand incorrectly.
-
-g. The prompt string expansion code no longer quotes tildes with backslashes.
-
-h. The bash getcwd() implementation in lib/sh/getcwd.c now behaves better in
- the presence of lstat(2) failures.
-
-i. Fixed a bug with strsub() that caused core dumps when executing `fc -s'.
-
-j. The mail checking code now ensures that it has a valid default mailpath.
-
-k. A bug was fixed that caused local variables to be unset inappropriately
- when sourcing a script from within another sourced script.
-
-l. A bug was fixed in the history saving code so that functions are saved
- in the history list correctly if `cmdhist' is enabled, but `lithist'
- is not.
-
-m. A bug was fixed that caused printf overflows when displaying error
- messages.
-
-n. It should be easier to build the loadble builtins in examples/loadables,
- though some manual editing of the generated Makefile is still required.
-
-o. The user's primary group is now always ${GROUPS[0]}.
-
-p. Some updates were made to support/config.guess from the GNU master copy.
-
-q. Some changes were made to the autoconf support for Solaris 2.6 large
- files.
-
-r. The `command' builtins now does the right thing when confstr(3) cannot
- find a value for _CS_PATH.
-
-s. Extended globbing expressions like `*.!(c)' are not history expanded if
- `extglob' is enabled.
-
-t. Using the `-P' option to `cd' will force the value that is assigned to
- PWD to not contain any symbolic links.
-
-2. Changes to Readline
-
-a. The code that prints completion listings now behaves better if one or
- more of the filenames contains non-printable characters.
-
-b. The time delay when showing matching parentheses is now 0.5 seconds.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.02-alpha1,
-and the previous version, bash-2.01.1-release.
-
-1. Changes to Bash
-
-a. OS-specific configuration changes for: BSD/OS 3.x, Minix 2.x,
- Solaris 2.6, SINIX SVR4.
-
-b. Changes were made to the generated `info' files so that `install-info'
- works correctly.
-
-c. PWD is now auto-exported.
-
-d. A fix was made to the pipeline code to make sure that the shell forks
- to execute simple commands consisting solely of assignment statements.
-
-e. Changes to the test suite for systems with 14-character filenames.
-
-f. The default sizes of some internal hash tables have been made smaller
- to reduce the shell's memory footprint.
-
-g. The `((...))' arithmetic command is now executed directly instead of
- being translated into `let "..."'.
-
-h. Fixes were made to the expansion code so that "$*", "$@", "${array[@]}",
- and "${array[@]}" expand correctly when IFS does not contain a space
- character, is unset, or is set to NULL.
-
-i. The indirect expansion code (${!var}) was changed so that the only
- valid values of `var' are variable names, positional parameters, `#',
- `@', and `*'.
-
-j. An arithmetic expression error in a $((...)) expansion now causes a
- non-interactive shell running in posix mode to exit.
-
-k. Compound array assignment now splits the words within the parentheses
- on shell metacharacters like the parser would before expansing them
- and performing the assignment. This is for compatibility with ksh-93.
-
-l. The internal shell backslash-quoting code (used in the output of `set'
- and completion) now quotes tildes if they appear at the start of the
- string or after a `=' or `:'.
-
-m. A couple of bugs with `shopt -o' were fixed.
-
-n. `bash +o' now displays the same output as `set +o' before starting an
- interactive shell.
-
-o. A bug that caused command substitution and the `eval' builtin to
- occasionally free memory twice when an error was encountered was fixed.
-
-p. The filename globbing code no longer requires read permission for a
- directory when the filename to be matched does not contain any globbing
- characters, as POSIX.2 specifies.
-
-q. A bug was fixed so that the job containing the last asynchronous
- process is not removed from the job table until a `wait' is executed
- for that process or another asynchronous process is started. This
- satisfies a POSIX.2 requirement.
-
-r. A `select' bug was fixed so that a non-numeric user response is treated
- the same as a numeric response that is out of range.
-
-s. The shell no longer parses the value of SHELLOPTS from the environment
- if it is restricted, running setuid, or running in `privileged mode'.
-
-t. Fixes were made to enable large file support on systems such as
- Solaris 2.6, where the size of a file may be larger than can be held
- in an `int'.
-
-u. The filename hashing code was fixed to not add `./' to the beginning of
- filenames which already begin with `./'.
-
-v. The configure script was changed so that the GNU termcap library is not
- compiled in if `prefer-curses' has been specified.
-
-w. HISTCONTROL and HISTIGNORE are no longer applied to the second and
- subsequent lines of a multi-line command.
-
-x. A fix was made to `disown' so that it does a better job of catching
- out-of-range jobs.
-
-y. Non-interactive shells no longer report the status of processes terminated
- due to SIGINT, even if the standard output is a terminal.
-
-z. A bug that caused the output of `jobs' to have extra carriage returns
- was fixed.
-
-aa. A bug that caused PIPESTATUS to not be set when builtins or shell
- functions were executed in the foreground was fixed.
-
-bb. Bash now attempts to detect when it is being run by sshd, and treats
- that case identically to being run by rshd.
-
-cc. A bug that caused `set -a' to export SHELLOPTS when one of the shell
- options was changed was fixed.
-
-dd. The `kill' builtin now disallows empty or missing process id arguments
- instead of treating them as identical to `0', which means the current
- process.
-
-ee. `var=value declare -x var' now behaves identically to
- `var=value export var'. Similarly for `var=value declare -r var' and
- `var=value readonly var'.
-
-ff. A few memory leaks were fixed.
-
-gg. `alias' and `unalias' now print error messages when passed an argument
- that is not an alias for printing or deletion, even when the shell is
- not interactive, as POSIX.2 specifies.
-
-hh. `alias' and `alias -p' now return a status of 0 when no aliases are
- defined, as POSIX.2 specifes.
-
-ii. `cd -' now prints the pathname of the new working directory if the shell
- is interactive.
-
-jj. A fix was made so that the code that binds $PWD now copes with getcwd()
- returning NULL.
-
-kk. `unset' now checks whether or not a function name it's trying to unset
- is a valid shell identifier only when the shell is running in posix mode.
-
-ll. A change was made to the code that generates filenames for here documents
- to make them less prone to name collisions.
-
-mm. The parser was changed so that `time' is recognized as a reserved word
- only at the beginning of a pipeline.
-
-nn. The pathname canonicalization code was changed so that `//' is converted
- into `/', but all other pathnames beginning with `//' are left alone, as
- POSIX.2 specifies.
-
-oo. The `logout' builtin will no longer exit a non-interactive non-login
- shell.
-
-2. Changes to Readline
-
-a. Fixed a problem in the readline test program rltest.c that caused a core
- dump.
-
-b. The code that handles parser directives in inputrc files now displays
- more error messages.
-
-c. The history expansion code was fixed so that the appearance of the
- history comment character at the beginning of a word inhibits history
- expansion for that word and the rest of the input line.
-
-3. New Features in Bash
-
-a. A new version of malloc, based on the older GNU malloc, that has many
- changes, is more page-based, is more conservative with memory usage,
- and does not `orphan' large blocks when they are freed.
-
-b. A new version of gmalloc, based on the old GLIBC malloc, with many
- changes and range checking included by default.
-
-c. A new implementation of fnmatch(3) that includes full POSIX.2 Basic
- Regular Expression matching, including character classes, collating
- symbols, equivalence classes, and support for case-insensitive pattern
- matching.
-
-d. ksh-88 egrep-style extended pattern matching ([@+*?!](patlist)) has been
- implemented, controlled by a new `shopt' option, `extglob'.
-
-e. There is a new ksh-like `[[' compound command, which implements
- extended `test' functionality.
-
-f. There is a new `printf' builtin, implemented according to the POSIX.2
- specification.
-
-g. There is a new feature for command substitution: $(< filename) now expands
- to the contents of `filename', with any trailing newlines removed
- (equivalent to $(cat filename)).
-
-h. There are new tilde prefixes which expand to directories from the
- directory stack.
-
-i. There is a new `**' arithmetic operator to do exponentiation.
-
-j. There are new configuration options to control how bash is linked:
- `--enable-profiling', to allow bash to be profiled with gprof, and
- `--enable-static-link', to allow bash to be linked statically.
-
-k. There is a new configuration option, `--enable-cond-command', which
- controls whether or not the `[[' command is included. It is on by
- default.
-
-l. There is a new configuration option, `--enable-extended-glob', which
- controls whether or not the ksh extended globbing feature is included.
- It is enabled by default.
-
-m. There is a new configuration #define in config.h.top that, when enabled,
- will cause all login shells to source /etc/profile and one of the user-
- specific login shell startup files, whether or not the shell is
- interactive.
-
-n. There is a new invocation option, `--dump-po-strings', to dump
- a shell script's translatable strings ($"...") in GNU `po' format.
-
-o. There is a new `shopt' option, `nocaseglob', to enable case-insensitive
- pattern matching when globbing filenames and using the `case' construct.
-
-p. There is a new `shopt' option, `huponexit', which, when enabled, causes
- the shell to send SIGHUP to all jobs when an interactive login shell
- exits.
-
-q. `bind' has a new `-u' option, which takes a readline function name as an
- argument and unbinds all key sequences bound to that function in a
- specified keymap.
-
-r. `disown' now has `-a' and `-r' options, to limit operation to all jobs
- and running jobs, respectively.
-
-s. The `shopt' `-p' option now causes output to be displayed in a reusable
- format.
-
-t. `test' has a new `-N' option, which returns true if the filename argument
- has been modified since it was last accessed.
-
-u. `umask' now has a `-p' option to print output in a reusable format.
-
-v. A new escape sequence, `\xNNN', has been added to the `echo -e' and $'...'
- translation code. It expands to the character whose ascii code is NNN
- in hexadecimal.
-
-w. The prompt string expansion code has a new `\r' escape sequence.
-
-x. The shell may now be cross-compiled for the CYGWIN32 environment on
- a Unix machine.
-
-4. New Features in Readline
-
-a. There is now an option for `iterative' yank-last-arg handline, so a user
- can keep entering `M-.', yanking the last argument of successive history
- lines.
-
-b. New variable, `print-completions-horizontally', which causes completion
- matches to be displayed across the screen (like `ls -x') rather than up
- and down the screen (like `ls').
-
-c. New variable, `completion-ignore-case', which causes filename completion
- and matching to be performed case-insensitively.
-
-d. There is a new bindable command, `magic-space', which causes history
- expansion to be performed on the current readline buffer and a space to
- be inserted into the result.
-
-e. There is a new bindable command, `menu-complete', which enables tcsh-like
- menu completion (successive executions of menu-complete insert a single
- completion match, cycling through the list of possible completions).
-
-f. There is a new bindable command, `paste-from-clipboard', for use on Win32
- systems, to insert the text from the Win32 clipboard into the editing
- buffer.
-
-g. The key sequence translation code now understands printf-style backslash
- escape sequences, including \NNN octal escapes. These escape sequences
- may be used in key sequence definitions or macro values.
-
-h. An `$include' inputrc file parser directive has been added.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.01.1-release,
-and the previous version, bash-2.01-release.
-
-1. Changes to Bash
-
-a. The select command was fixed to check the validity of the user's
- input more strenuously.
-
-b. A bug was fixed that prevented `time' from timing commands correctly
- when supplied as an argument to `bash -c'.
-
-c. A fix was made to the mail checking code to keep from adding the same
- mail file to the list of files to check multiple times when parsing
- $MAILPATH.
-
-d. Fixed an off-by-one error in the tilde expansion library.
-
-e. When using the compound array assignment syntax, the old value of
- the array is cleared before assigning the new value.
-
-f. Fixed a bug that could cause a core dump when a trap handler was reset
- to the default in the trap command associated with that signal.
-
-g. Fixed a bug in the locale code that occurred when assigning a value
- to LC_ALL.
-
-h. A change was made to the parser so that words of the form xxx=(...)
- are not considered compound assignment statements unless there are
- characters before the `='.
-
-i. A fix was made to the command tracing code to correctly quote each
- word of output.
-
-j. Some changes were made to the bash-specific autoconf tests to make them
- more portable.
-
-k. Completion of words with globbing characters now correctly quotes the
- result.
-
-l. The directory /var/spool/mail is now preferred to /usr/spool/mail when
- configure is deciding on the default mail directory.
-
-m. The brace completion code was fixed to not quote the `{' and `}'.
-
-n. Some fixes were made to make $RANDOM more random in subshells.
-
-o. System-specific changes were made to configure for: SVR4.2
-
-p. Changes were made so that completion of words containing globbing chars
- substitutes the result only if a single filename was matched.
-
-q. The window size is now recomputed after a job is stopped with SIGTSTP if
- the user has set `checkwinsize' with `shopt'.
-
-r. When doing substring expansion, out-of-range substring specifiers now
- cause nothing to be substituted rather than an expansion error.
-
-s. A fix was made so that you can no longer trap `SIGEXIT' or `SIGDEBUG' --
- only `EXIT' and `DEBUG' are accepted.
-
-t. The display of trapped signals now uses the signal number if signals
- for which bash does not know the name are trapped.
-
-u. A fix was made so that `bash -r' does not turn on restricted mode until
- after the startup files are executed.
-
-v. A bug was fixed that occasionally caused a core dump when a variable
- found in the temporary environment of export/declare/readonly had a
- null value.
-
-w. A bug that occasionally caused unallocated memory to be passed to free()
- when doing arithmetic substitution was fixed.
-
-x. A bug that caused a buffer overrun when expanding a prompt string
- containing `\w' and ${#PWD} exceeded PATH_MAX was fixed.
-
-y. A problem with the completion code that occasionally caused it to
- refer to a character before the beginning of the readline line buffer
- was fixed.
-
-z. A bug was fixed so that the `read' builtin restarts reads when
- interrupted by signals other than SIGINT.
-
-aa. Fixed a bug that caused a command to be freed twice when there was
- an evaluation error in the `eval' command.
-
-2. Changes to Readline
-
-a. Added a missing `extern' to a declaration in readline.h that kept
- readline from compiling cleanly on some systems.
-
-b. The history file is now opened with mode 0600 when it is written for
- better security.
-
-c. Changes were made to the SIGWINCH handling code so that prompt redisplay
- is done better.
-
-d. ^G now interrupts incremental searches correctly.
-
-e. A bug that caused a core dump when the set of characters to be quoted
- when completing words was empty was fixed.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.01-release,
-and the previous version, bash-2.01-beta2.
-
-1. Changes to Bash
-
-a. The `distclean' target should remove the `printenv' executable if it
- has been created.
-
-b. The test suite was changed slightly to ensure that the error messages
- are printed in English.
-
-c. A bug that caused the shell to dump core when a filename containing a
- `/' was passed to `hash' was fixed.
-
-d. Pathname canonicalization now leaves a leading `//' intact, as POSIX.1
- requires.
-
-e. A memory leak when completing commands was fixed.
-
-f. A memory leak that occurred when checking the hash table for commands
- with relative paths was fixed.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.01-beta2,
-and the previous version, bash-2.01-beta1.
-
-1. Changes to Bash
-
-a. The `ulimit' builtin translates RLIM_INFINITY to the hard limit only if
- the current (soft) limit is less than or equal to the hard limit.
-
-b. Fixed a bug that caused the bash emulation of strcasecmp to produce
- incorrect results.
-
-c. A bug that caused memory to be freed twice when a trap handler resets
- the trap more than once was fixed.
-
-d. A bug that caused machines where sizeof (pointer) > sizeof (int) to
- fail (and possibly dump core) when trying to unwind-protect a null
- pointer was fixed.
-
-e. The startup files should not be run with job control enabled. This fix
- allows SIGINT to once again interrupt startup file execution.
-
-f. Bash should not change the SIGPROF handler if it is set to something
- other than SIG_DFL.
-
-g. The completion code that provides bash-specific completions for readline
- now quotes characters that the readline code would treat as word break
- characters if they appear in a file name.
-
-h. The completion code now correctly quotes filenames containing a `!',
- even if the user attempted to use double quotes when attempting
- completion.
-
-i. A bug that caused the shell to dump core when `disown' was called without
- arguments and there was no current job was fixed.
-
-j. A construct like $((foo);bar) is now processed as a command substitution
- rather than as a bad arithmetic substitution.
-
-k. A couple of bugs that caused `fc' to not obey the `cmdhist' and `lithist'
- shell options when editing and re-executing a series of commands were
- fixed.
-
-l. A fix was made to the grammar -- the list of commands between `do' and
- `done' in the body of a `for' command should be treated the same as a
- while loop.
-
-2. Changes to Readline
-
-a. A couple of bugs that caused the history search functions to attempt to
- free a NULL pointer were fixed.
-
-b. If the C library provides setlocale(3), readline does not need to look
- at various environment variables to decide whether or not to go into
- eight-bit mode automatically -- just check whether the current locale
- is not `C' or `POSIX'.
-
-c. If the filename completion function finds that a directory was not closed
- by a previous (interrupted) completion, it closes the directory with
- closedir().
-
-3. New Features in Bash
-
-a. New bindable readline commands: history-and-alias-expand-line and
- alias-expand-line. The code was always in there, there was just no
- way to execute it.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.01-beta1,
-and the previous version, bash-2.01-alpha1.
-
-1. Changes to Bash
-
-a. Fixed a problem that could cause file descriptors used for process
- substitution to conflict with those used explicitly in redirections.
-
-b. Made it easier to regenerate configure if the user changes configure.in.
-
-c. ${GROUPS[0]} should always be the primary group, even on systems without
- multiple groups.
-
-d. Spelling correction is no longer enabled by default.
-
-e. Fixes to quoting problems in `bashbug'.
-
-f. OS-specific configuration changes were made for: Irix 6.
-
-g. OS-specific code changes were made for: QNX.
-
-h. A more meaningful message is now printed when the file in /tmp for a
- here document cannot be created.
-
-i. Many changes to the shell's variable initialization code to speed
- non-interactive startup.
-
-j. Changes to the non-job-control code so that it does not try to open
- /dev/tty.
-
-k. The output of `set' and `export' is once again sorted, as POSIX wants.
-
-l. Fixed a problem caused by a recursive call reparsing the value of
- $SHELLOPTS.
-
-m. The tilde code no longer calls getenv() when it's compiled as part of
- the shell, which should eliminate problems on systems that cannot
- redefine getenv(), like the NeXT OS.
-
-n. Fixed a problem that caused `bash -o' or `bash +o' to not list all
- the shell options.
-
-o. Fixed `ulimit' to convert RLIM_INFINITY to the appropriate hard limit
- only if the hard limit is greater than the current (soft) limit.
-
-p. Fixed a problem that arose when building bash in a different directory
- than the source and y.tab.[ch] were remade with something other than
- bison. This came up most often on NetBSD.
-
-q. Fixed a problem with completion -- it thought that `pwd`/[TAB] indicated
- an unfinished command completion (`/), which generated errors.
-
-r. The bash special tilde expansions (~-, ~+) are now attempted before
- calling the standard tilde expansion code, which should eliminate the
- problems people have been seeing with this on Solaris 2.5.1.
-
-s. Added support for <stdarg.h> to places where it was missing.
-
-t. Changed the code that reads the output of a command substitution to not
- go through stdio. This reduces the memory requirements and is faster.
-
-u. A number of changes to speed up export environment creation were made.
-
-v. A number of memory leaks were fixed as the result of running the test
- scripts through Purify.
-
-w. Fixed a bug that caused subshells forked to interpret executable
- scripts without a leading `#!' to not reinitialize the values of
- the shell options.
-
-2. Changes to Readline
-
-a. History library has less `#ifdef SHELL' code -- abstracted stuff out
- into application-specific function hooks.
-
-b. Readline no longer calls getenv() if it's compiled as part of the shell,
- which should eliminate problems on systems that cannot redefine getenv(),
- like the NeXT OS.
-
-c. Fixed translation of ESC when `untranslating' macro values.
-
-d. The region kill operation now fixes the mark if it ends up beyond the
- boundaries of the line after the region is deleted.
-
-3. New Features in Bash
-
-a. New argument for `configure': `--with-curses'. This can be used to
- override the selection of the termcap library on systems where it is
- deficient.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.01-alpha1,
-and the previous version, bash-2.0-release.
-
-1. Changes to Bash
-
-a. System-specific configuration changes for: FreeBSD, SunOS4, Irix,
- MachTen, QNX 4.2, Harris Night Hawk, SunOS5.
-
-b. System-specific code changes were made for: Linux, 4.4 BSD, QNX 4.2,
- HP-UX, AIX 4.2.
-
-c. A bug that caused the exec builtin to fail because the full pathname of
- the command could not be found was fixed.
-
-d. The code that performs output redirections is now more resistant to
- race conditions and possible security exploits.
-
-e. A bug that caused the shell to dump core when performing pattern
- substitutions on variable values was fixed.
-
-f. More hosts are now recognized by the auto-configuration mechanism
- (OpenBSD, QNX, others).
-
-g. Assignments to read-only variables that attempt to convert them to
- arrays are now errors.
-
-h. A bug that caused shell scripts using array assignments in POSIX mode
- to exit after the assignment was performed was fixed.
-
-i. The substring expansion code is now more careful about running off the
- ends of the expanded variable value.
-
-j. A bug that caused completion to fail if a backquoted command substitution
- appeared anywhere on the line was fixed.
-
-k. The `source' builtin no longer turns off history if it has been enabled
- in a non-interactive shell.
-
-l. A bug that caused the shell to crash when `disown' was given a pid
- instead of a job number was fixed.
-
-m. The `cd' spelling correction code will not try to change to `.' if no
- directory entries match a single-character argument.
-
-n. A bad variable name supplied to `declare', `export', or `readonly' no
- longer causes a non-interactive shell in POSIX mode to exit.
-
-o. Some fixes were made to the test suite to handle peculiarities of
- various Unix versions.
-
-p. The bash completion code now quotes characters that readline would
- treat as word breaks for completion but are not shell metacharacters.
-
-q. Bad options supplied at invocation now cause a usage message to be
- displayed.
-
-r. Fixes were made to the code that handles DEBUG traps so that the trap
- string is not freed inappropriately.
-
-s. Some changes were made to the bash debugger in examples/bashdb -- it
- should be closer to working now.
-
-t. A problem that caused the default filename used for mail checking to be
- wrong was fixed.
-
-u. A fix was made to the `echo' builtin so that NUL characters printed with
- `echo -e' do not cause the output to be truncated.
-
-v. A fix was made to the job control code so that the shell behaves better
- when monitor mode is enabled in a non-interactive shell.
-
-w. Bash no longer catches all of the terminating signals in a non-
- interactive shell until a trap is set on EXIT, which should result in
- quicker startup.
-
-x. A fix was made to the command timing code so that `time' can be used in
- a loop.
-
-y. A fix was made to the parser so that `((cmd); cmd2)' is now parsed as
- a nested subshell rather than strictly as an (erroneous) arithmetic
- command.
-
-z. A fix was made to the globbing code so that it correctly matches quoted
- filenames beginning with a `.'.
-
-aa. A bug in `fc' that caused some multi-line commands to not be stored as
- one command in the history when they were re-executed after editing
- (with `fc -e') was fixed.
-
-bb. The `ulimit' builtin now attempts to catch some classes of integer
- overflows.
-
-cc. The command-oriented-history code no longer attempts to add `;'
- inappropriately when a newline appears while reading a $(...) command
- substitution.
-
-dd. A bug that caused the shell to dump core when `help --' was executed
- was fixed.
-
-ee. A bug that caused the shell to crash when an unset variable appeared
- in the body of a here document after `set -u' had been executed was
- fixed.
-
-ff. Implicit input redirections from /dev/null for asynchronous commands
- are now handled better.
-
-gg. A bug that caused the shell to fail to compile when configured with
- `--disable-readline' was fixed.
-
-hh. The globbing code should now be interruptible.
-
-ii. Bash now notices when the `kill' builtin is used to send SIGCONT to a
- stopped job and adjusts the data structures accordingly, as if `bg' had
- been executed instead.
-
-jj. A bug that caused the shell to crash when mixing calls to `getopts'
- and `shift' on the same set of positional parameters was fixed.
-
-kk. The command printing code now preserves the `-p' flag to `time'.
-
-ll. The command printing code now handles here documents better when there
- are other redirections associated with the command.
-
-mm. The special glibc environment variable (NNN_GNU_nonoption_argv_flags_)
- is no longer placed into the environment of executed commands -- users
- of glibc had too many problems with it.
-
-nn. Reorganized the code that generates signames.h. The signal_names list
- is now more complete but may be slightly different (SIGABRT is favored
- over SIGIOT, for example). The preferred signal names are those
- listed in the POSIX.2 standard.
-
-oo. `bashbug' now uses a filename shorter than 14 characters for its
- temporary file, and asks for confirmation before sending the bug
- report.
-
-pp. A bug that caused TAB completion in vi editing mode to not be turned
- off when `set -o posix' was executed or back on when `set +o posix'
- was executed was fixed.
-
-qq. A bug in the brace expansion code that caused brace expansions appearing
- in new-style $(...) command substitutions to be inappropriately expanded
- was fixed.
-
-rr. A bug in the readline hook shell-expand-line that could cause memory to
- be inappropriately freed was fixed.
-
-ss. A bug that caused some arithmetic expressions containing `&&' and `||'
- to be parsed with the wrong precedence has been fixed.
-
-tt. References to unbound variables after `set -u' has been executed now
- cause the shell to exit immediately, as they should.
-
-uu. A bug that caused the shell to exit inappropriately when `set -e' had
- been executed and a command's return status was being inverted with the
- `!' reserved word was fixed.
-
-vv. A bug that could occasionally cause the shell to crash with a
- divide-by-zero error when timing a command was fixed.
-
-ww. A bug that caused parameter pattern substitution to leave stray
- backslashes in the replacement string when the expression is in
- double quotes was fixed.
-
-xx. The `break' and `continue' builtins now break out of all loops when an
- invalid count argument is supplied.
-
-yy. Fixed a bug that caused PATH to be set to the empty string if
- `command -p' is executed with PATH unset.
-
-zz. Fixed `kill -l signum' to print the signal name without the `SIG' prefix,
- as POSIX specifies.
-
-aaa. Fixed a bug that caused the shell to crash while setting $SHELLOPTS
- if there were no shell options set.
-
-bbb. Fixed `export -p' and `readonly -p' so that when the shell is in POSIX
- mode, their output is as POSIX.2 specifies.
-
-ccc. Fixed a bug in `readonly' so that `readonly -a avar=(...)' actually
- creates an array variable.
-
-ddd. Fixed a bug that prevented `time' from correctly timing background
- pipelines.
-
-2. Changes to Readline
-
-a. A bug that caused an extra newline to be printed when the cursor was on
- an otherwise empty line was fixed.
-
-b. An instance of memory being used after it was freed was corrected.
-
-c. The redisplay code now works when the prompt is longer than the screen
- width.
-
-d. `dump-macros' is now a bindable name, as it should have been all along.
-
-e. Non-printable characters are now expanded when displaying macros and
- their values.
-
-f. The `dump-variables' and `dump-macros' commands now output a leading
- newline if they're called as the result of a key sequence, rather
- than directly by an application.
-
-3. New Features in Bash
-
-a. There is a new builtin array variable: GROUPS, the set of groups to which
- the user belongs. This is used by the test suite.
-
-4. New Features in Readline
-
-a. If a key sequence bound to `universal-argument' is read while reading a
- numeric argument started with `universal-argument', it terminates the
- argument but is otherwise ignored. This provides a way to insert multiple
- instances of a digit string, and is how GNU emacs does it.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.0-release,
-and the previous version, bash-2.0-beta3.
-
-1. Changes to Bash
-
-a. Fix to the `getopts' builtin so that it does the right thing when a
- required option argument is not present.
-
-b. The completion code now updates the common prefix of matched names
- after FIGNORE processing is done, since any names that were removed
- may have changed the common prefix.
-
-c. Fixed a bug that made messages in MAILPATH entries not work correctly.
-
-d. Fixed a serious documentation error in the description of the new
- ${parameter:offset[:length]} expansion.
-
-e. Fixes to make parameter substring expansion ({$param:offset[:length]})
- work when within double quotes.
-
-f. Fixes to make ^A (CTLESC) survive an unquoted expansion of positional
- parameters.
-
-g. Corrected a misspelling of `unlimited' in the output of `ulimit'.
-
-h. Fixed a bug that caused executable scripts without a leading `#!' to
- occasionally pick up the wrong set of positional parameters.
-
-i. Linux systems now have a working `ulimit -v', using RLIMIT_AS.
-
-j. Updated config.guess so that many more machine types are recognized.
-
-k. Fixed a bug with backslash-quoted slashes in the ${param/pat[/sub]}
- expansion.
-
-l. If the shell is named `-su', and `-c command' is supplied, read and
- execute the login shell startup files even though the shell is not
- interactive. This is to support the `-' option to `su'.
-
-m. Fixed a bug that caused core dumps when the DEBUG trap was ignored
- with `trap "" DEBUG' and a shell function was subsequently executed.
-
-n. Fixed a bug that caused core dumps in the read builtin when IFS was
- set to the null string and the input had leading whitespace.
-
-2. Changes to Readline
-
-a. Fixed a bug that caused a numeric argument of 1024 to be ignored when
- inserting text.
-
-b. Fixed the display code so that the numeric argument is displayed as it's
- being entered.
-
-c. Fixed the numeric argument reading code so that `M-- command' is
- equivalent to `M--1 command', as the prompt implies.
-
-3. New Features in Bash
-
-a. `ulimit' now sets both hard and soft limits and reports the soft limit
- by default (when neither -H nor -S is specified). This is compatible
- with versions of sh and ksh that implement `ulimit'.
-
-b. Integer constants have been extended to base 64.
-
-4. New Features in Readline
-
-a. The `home' and `end' keys are now bound to beginning-of-line and
- end-of-line, respectively, if the corresponding termcap capabilities
- are present.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.0-beta3,
-and the previous version, bash-2.0-beta2.
-
-1. Changes to Bash
-
-a. System-specific changes for: AIX 4.2, SCO 3.2v[45], HP-UX.
-
-b. When in POSIX mode, variable assignments preceding a special builtin
- persist in the shell environment after the builtin completes.
-
-c. Changed all calls to getwd() to getcwd(). Improved check for systems
- where the libc getcwd() calls popen(), since that breaks on some
- systems when job control is being used.
-
-d. Fixed a bug that caused seg faults when executing scripts with the
- execute bit set but without a leading `#!'.
-
-e. The environment passed to executed commands is never sorted.
-
-f. A bug was fixed in the code that expands ${name[@]} to the number of
- elements in an array variable.
-
-g. A bug was fixed in the array compound assignment code ( A=( ... ) ).
-
-h. Window size changes now correctly propagate down to readline if
- the shopt `checkwinsize' option is enabled.
-
-i. A fix was made in the code that expands to the length of a variable
- value (${#var}).
-
-j. A fix was made to the command builtin so that it did not turn on the
- `no fork' flag inappropriately.
-
-k. A fix was made to make `set -n' work more reliably.
-
-l. A fix was made to the job control initialization code so that the
- terminal process group is set to the shell's process group if the
- shell changes its own process group.
-
-2. Changes to Readline
-
-a. System-specific changes for: SCO 3.2v[45].
-
-b. The behavior of the vi-mode `.' when redoing an `i' command was changed
- to insert the text previously inserted by the `i' command rather than
- simply entering insert mode.
-
-3. New features in Bash
-
-a. There is a new version of the autoload function package, in
- examples/functions/autoload.v2, that uses arrays and provides more
- functionality.
-
-b. Support for LC_COLLATE and locale-specific sorting of the results of
- pathname expansion if strcoll() is available.
-
-4. New Features in Readline
-
-a. Support for locale-specific sorting of completion possibilities if
- strcoll() is available.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.0-beta2,
-and the previous version, bash-2.0-beta1.
-
-1. Changes to Bash
-
-a. `pushd -' is once again equivalent to `pushd $OLDPWD'.
-
-b. OS-specific changes for: SCO 3.2v[45].
-
-c. A change was made to the fix for the recently-reported security hole
- when reading characters with octal value 255 to make it work better on
- systems with restartable system calls when not using readline.
-
-d. Some changes were made to the test suite so that it works if you
- configure bash with --enable-usg-echo-default.
-
-e. A fix was made to the parsing of conditional arithmetic expressions.
-
-f. Illegal arithmetic bases now cause an arithmetic evaluation error rather
- than being silently reset.
-
-g. Multiple arithmetic bases now cause an arithmetic evaluation error
- instead of being ignored.
-
-h. A fix was made to the evaluation of ${param?word} to conform to POSIX.2.
-
-i. A bug that sometimes caused array indices to be evaluated twice (which
- would cause errors when they contained assignment statements) was fixed.
-
-j. `ulimit' was rewritten to avoid problems with getrlimit(2) returning
- unsigned values and to simplify the code.
-
-k. A bug in the command-oriented-history code that caused it to sometimes
- put semicolons after right parens inappropriately was fixed.
-
-l. The values inserted into the prompt by the \w and \W escape sequences
- are now quoted to prevent further expansion.
-
-m. An interactive shell invoked as `sh' now reads and executes commands
- from the file named by $ENV when it starts up. If it's a login shell,
- it does this after reading /etc/profile and ~/.profile.
-
-n. The file named by $ENV is never read by non-interactive shells.
-
-2. Changes to Readline
-
-a. A few changes were made to hide some macros and functions that should not
- be public.
-
-b. An off-by-one error that caused seg faults in the history expansion code
- was fixed.
-
-3. New Features in Bash
-
-a. The ksh-style ((...)) arithmetic command was implemented. It is exactly
- identical to let "...". This is controlled by a new option to configure,
- `--enable-dparen-arithmetic', which is on by default.
-
-b. There is a new #define available in config.h.top: SYS_BASH_LOGOUT. If
- defined to a filename, bash reads and executes commands from that file
- when a login shell exits. It's commented out by default.
-
-c. `ulimit' has a `-l' option that reports the maximum amount of data that
- may be locked into memory on 4.4BSD-based systems.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.0-beta1,
-and the previous version, bash-2.0-alpha4.
-
-1. Changes to Bash
-
-a. A bug that sometimes caused traps to be ignored on signals the
- shell treats specially was fixed.
-
-b. The internationalization code was changed to track the values of
- LC_* variables and call setlocale() as appropriate. The TEXTDOMAIN
- and TEXTDOMAINDIR variables are also tracked; changes cause calls
- to textdomain() and bindtextdomain(), if available.
-
-c. A bug was fixed that sometimes caused double-quoted strings to be
- parsed incorrectly.
-
-d. Changes were made so that the siglist code compiles correctly on
- Solaris 2.5.
-
-e. Added `:' to the set of characters that cause word breaks for the
- completion code so that pathnames in assignments to $PATH can be
- completed.
-
-f. The `select' command was fixed to print $PS3 to stderr.
-
-g. Fixed an error in the manual page section describing the effect that
- setting and unsetting GLOBIGNORE has on the setting of the `dotglob'
- option.
-
-h. The time conversion code now uses CLK_TCK rather than CLOCKS_PER_SEC
- on systems without gettimeofday() and resources.
-
-i. The getopt static variables are now initialized each time a subshell
- is started, so subshells using `getopts' work right.
-
-j. A sign-extension bug that caused a possible security hole was fixed.
-
-k. The parser now reads characters between backquotes within a double-
- quoted string as a single word, so double quotes in the backquoted
- string don't terminate the enclosing double-quoted string.
-
-l. A bug that caused `^O' to work incorrectly when typed as the first
- thing to an interactive shell was fixed.
-
-m. A rarely-exercised off-by-one error in the code that quotes variable
- values was fixed.
-
-n. Some memory and file descriptor leaks encountered when running a
- shell script that is executable but does not have a leading `#!'
- were plugged.
-
-2. Changes to Readline
-
-a. A bug that sometimes caused incorrect results when trying to read
- typeahead on systems without FIONREAD was fixed.
-
-3. New Features in Bash
-
-a. The command timing code now uses the value of the TIMEFORMAT variable
- to format and display timing statistics.
-
-b. The `time' reserved word now accepts a `-p' option to force the
- POSIX.2 output format.
-
-c. There are a couple of new and updated scripts to convert csh startup
- files to bash format.
-
-d. There is a new builtin array variable: BASH_VERSINFO. The various
- members hold the parts of the version information in BASH_VERSION,
- plus the value of MACHTYPE.
-
-4. New Features in Readline
-
-a. Setting LANG to `en_US.ISO8859-1' now causes readline to enter
- eight-bit mode.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.0-alpha4,
-and the previous version, bash-2.0-alpha3.
-
-1. Changes to Bash
-
-a. There is better detection of rsh connections on Solaris 2.
-
-b. Assignments to read-only variables preceding a command name are now
- variable assignment errors. Variable assignment errors cause
- non-interactive shells running in posix mode to exit.
-
-c. The word tokenizer was rewritten to handle nested quotes and pairs
- ('', "", ``, ${...}, $(...), $[...], $'...', $"...", <(...), >(...))
- correctly. Some of the parameter expansion code was updated as a
- consequence.
-
-d. A fix was made to `test' when given three arguments so that a binary
- operator is checked for first, before checking that the first argument
- is `!'.
-
-e. 2''>/dev/null is no longer equivalent to 2>/dev/null.
-
-f. Parser error messages were regularized, and in most cases the name of
- the shell script being read by a non-interactive shell is not printed
- twice.
-
-g. A fix was made to the completion code so that it no longer removes the
- text the user typed in some cases.
-
-h. The special glibc `getopt' environment variable is no longer put into
- the environment on machines with small values of ARG_MAX.
-
-i. The expansion of ${...} now follows the POSIX.2 rules for finding the
- closing `}'.
-
-j. The shell no longer displays spurious status messages for background
- jobs in shell scripts that complete successfully when the script is
- run from a terminal.
-
-k. `shopt -o' now correctly updates $SHELLOPTS.
-
-l. A bug that caused the $PATH searching code to return a non-executable
- file even when an executable file with the same name appeared later in
- $PATH was fixed.
-
-m. The shell now does tilde expansions on unquoted `:~' in assignment
- statements when not in posix mode.
-
-n. Variable assignment errors when a command consists only of assignments
- now cause non-interactive shells to exit when in posix mode.
-
-o. If the variable in a `for' or `select' command is read-only, or not a
- legal shell identifier, a variable assignment error occurs.
-
-p. `test' now handles `-a' and `-o' as binary operators when three arguments
- are supplied, and correctly parses `( word )' as equivalent to `word'.
-
-q. `test' was fixed so that file names of the form /dev/fd/NN mean the same
- thing on all systems, even Linux.
-
-r. Fixed a bug in the globbing code that caused patterns with multiple
- consecutive `*'s to not be matched correctly.
-
-s. Fixed a bug that caused $PS2 to not be printed when an interactive shell
- not using readline is reading a here document.
-
-t. Fixed a bug that caused history expansion to be performed inappropriately
- when a single-quoted string spanned more than one line.
-
-u. `getopts' now checks that the variable name passed by the user as the
- second argument is a legal shell identifier and that the variable is
- not read-only.
-
-v. Fixed `getopts' to obey POSIX.2 rules for setting $OPTIND when it
- encounters an error.
-
-w. Fixed `set' to display variable values in a form that can be re-read.
-
-x. Fixed a bug in the code that keeps track of whether or not local variables
- have been declared at the current level of function nesting.
-
-y. Non-interactive shells in posix mode now exit if the name in a function
- declaration is not a legal identifier.
-
-z. The job control code now ignores stopped children when the shell is not
- interactive.
-
-aa. The `cd' builtin no longer attempts spelling correction on the directory
- name if the shell is not interactive, regardless of the setting of the
- `cdspell' option.
-
-bb. Some OS-specific changes were made for SCO 3.2v[45] and AIX 4.2.
-
-cc. `time' now prints its output to stderr, as POSIX.2 specifies.
-
-2. Fixes to Readline
-
-a. After printing possible completions, all lines of a multi-line prompt
- are redisplayed.
-
-b. Some changes were made to the terminal handling code in rltty.c to
- work around AIX 4.2 bugs.
-
-3. New Features in Bash
-
-a. There is a new loadable builtin: sprintf, with calling syntax
- sprintf var format [args]
- This provides an easy way to simulate ksh left- and right-justified
- variable values.
-
-b. The expansions of \h and \H in prompt strings were swapped. \h now
- expands to the hostname up to the first `.', as in bash-1.14.
-
-4. New Features in Readline
-
-a. The bash-1.14 behavior when ^M is typed while doing an incremental
- search was restored. ^J may now be used to terminate the search without
- accepting the line.
-
-b. There is a new bindable variable: disable-completion. This inhibits
- word completion and causes the completion character to be inserted as
- if it had been bound to self-insert.
-
-------------------------------------------------------------------------------
-This document details the changes between this version, bash-2.0-alpha3,
-and the previous version, bash-2.0-alpha2.
-
-There is now a file `COMPAT' included in the distribution that lists the
-user-visible incompatibilities between 1.14 and 2.0.
-
-1. Changes to Bash
-
-a. Some work was done so that word splitting of the rhs of assignment
- statements conforms more closely to historical practice.
-
-b. A couple of errant memory frees were fixed.
-
-c. A fix was made to the test builtin so it recognizes `<' and `>' as
- binary operators.
-
-d. The GNU malloc in lib/malloc/malloc.c now scrambles memory as it's
- allocated and freed. This is to catch callers that refer to freed
- memory or assume something about newly-allocated memory.
-
-e. Fixed a problem with conversion to 12-hour time in the prompt
- expansion code.
-
-f. Fixed a problem with configure's argument parsing order. Now you can
- correctly turn on specific options after using --enable-minimal-config.
-
-g. The configure script now automatically disables the use of GNU malloc
- on systems where it's appropriate (better than having people read the
- NOTES file and do it manually).
-
-h. There are new prompt expansions (\v and \V) to insert version information
- into the prompt strings.
-
-i. The default prompt string now includes the version number.
-
-j. Most of the builtins that take no options were changed to use the
- internal getopt so they can produce proper error messages for -?
- and incorrect options.
-
-k. Some system-specific changes were made for SVR4.2 and Solaris 2.5.
-
-l. Bash now uses PATH_MAX instead of MAXPATHLEN and NAME_MAX instead of
- MAXNAMLEN.
-
-m. A couple of problems caused by uninitialized variables were fixed.
-
-n. There are a number of new loadable builtin examples: logname, basename,
- dirname, tty, pathchk, tee, head, and rmdir. All of these conform to
- POSIX.2.
-
-o. Bash now notices changes in TZ and calls tzset() if present, so
- changing TZ will alter the time printed by prompt expansions.
-
-p. The source was reorganized a bit so I don't have to wait so long for
- some files to compile, and to facilitate the creation of a `shell
- library' at some future point.
-
-q. Bash no longer turns off job control if called as `sh', since the
- POSIX.2 spec includes job control as a standard feature.
-
-r. `bash -o posix' now works as intended.
-
-s. Fixed a problem with the completion code: when completing a filename
- that contained globbing characters, if show-all-if-ambiguous was set,
- the completion code would remove the user's text.
-
-t. Fixed ulimit so that (hopefully) the full range of limits is available
- on HPUX systems.
-
-u. A new `shopt' option (`hostcomplete') enables and disables hostname
- completion.
-
-v. The shell no longer attempts to save the history on an abort(),
- which is usually called by programming_error().
-
-w. The `-s' option to `fc' was changed to echo the command to be executed
- to stderr instead of stdout.
-
-x. If the editor invoked by `fc -e' exits with a non-zero status, no
- commands are executed.
-
-y. Fixed a bug that made the shopt `histverify' option work incorrectly.
-
-z. There is a new variable `MACHTYPE' whose value is the GNU-style
- `cpu-company-system' system description as set by configure. (The
- values of MACHTYPE and HOSTTYPE should really be swapped.)
-
-aa. The `ulimit' builtin now allows the maximum virtual memory size to be
- set via setrlimit(2) if RLIMIT_VMEM is defined.
-
-bb. `bash -nc 'command'' no longer runs `command'.
-
-2. Changes to Readline
-
-a. Fixed a typo in the code that checked for FIONREAD in input.c.
-
-b. Fixed a bug in the code that outputs keybindings, so things like C-\
- are quoted properly.
-
-c. Fixed a bug in the inputrc file parsing code to handle the problems
- caused by inputrc files created from the output of `bind -p' in
- previous versions of bash. The problem was due to the bug fixed
- in item b above.
-
-d. Readline no longer turns off the terminal's meta key, and turns it on
- once the first time it's called.
-
-------------------------------------------------------------------------------
-This file documents the changes between this version, bash-2.0-alpha2,
-and the previous version, bash-2.0-alpha.
-
-1. Changes to Bash
-
-a. The shell no longer thinks directories are executable.
-
-b. `disown' has a new option, `h', which inhibits the resending of SIGHUP
- but does not remove the job from the jobs table.
-
-c. The varargs functions in error.c now use ANSI-C `stdarg' if available.
-
-d. The build process now treats the `build version' in .build as local to
- the build directory, so different versions built from the same source
- tree have different `build versions'.
-
-e. Some problems with the grammar have been fixed. (It used `list' in a few
- productions where `compound_list' was needed. A `list' must be terminated
- with a newline or semicolon; a `compound_list' need not be.)
-
-f. A fix was made to keep `wait' from hanging when waiting for all background
- jobs.
-
-g. `bash --help' now writes its output to stdout, like the GNU Coding Standards
- specify, and includes the machine type (the value of MACHTYPE).
-
-h. `bash --version' now prints more information and exits successfully, like
- the GNU Coding Standards specify.
-
-i. The output of `time' and `times' now prints fractional seconds with three
- places after the decimal point.
-
-j. A bug that caused process substitutions to screw up the pipeline printed
- by `jobs' was fixed.
-
-k. Fixes were made to the code that implements $'...' and $"..." so they
- work as documented.
-
-l. The process substitution code now opens named pipes for reading with
- O_NONBLOCK to avoid hanging.
-
-m. Fixes were made to the trap code so the shell cleans up correctly if the
- trap command contains a `return' and we're executing a function or
- sourcing a script with `.'.
-
-n. Fixes to doc/Makefile.in so that it doesn't try to remake all of the
- documentation (ps, dvi, etc.) on a `make install'.
-
-o. Fixed an auto-increment error that caused bash -c args to sometimes dump
- core.
-
-p. Fixed a bug that caused $HISTIGNORE to fail when the history line
- contained globbing characters.
-
-2. Changes to Readline
-
-a. There is a new string variable, rl_library_version, available for use by
- applications. The current value is "2.1".
-
-b. A bug encountered when expand-tilde was enabled and file completion was
- attempted on a word beginning with `~/' was fixed.
-
-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
- the arrow keys and get the behavior they expect.
+++ /dev/null
- 2/14/2011
- ---------
-[bash-4.2 released]
-
- 2/15
- ----
-lib/glob/gmisc.c
- - fix wmatchlen and umatchlen to avoid going past the end of the
- string on an incomplete bracket expression that ends with a
- NUL. Partial fix for bug reported by Clark Wang <dearvoid@gmail.com>
-
- 2/16
- ----
-subst.h
- - new string extract flag value: SX_WORD. Used when calling
- extract_dollar_brace_string to skip over the word in
- ${param op word} from parameter_brace_expand
-
-subst.c
- - change parameter_brace_expand to add SX_WORD to flags passed to
- extract_dollar_brace_string
- - change parameter_brace_expand to use SX_POSIXEXP for all non-posix
- word expansion operators that treat single quotes as special, not
- just % and #
- - change extract_dollar_brace_string to initialize dolbrace_state to
- DOLBRACE_WORD if SX_WORD flag supplied and we shouldn't use
- DOLBRACE_QUOTE. Fixes bug reported by Juergen Daubert <jue@jue.li>
-
-doc/{bash.1,bashref.texi}
- - document the exact expansions here strings undergo
-
- 2/17
- ----
-lib/readline/vi_mode.c
- - make sure that `dd', `cc', and `yy' call vidomove_dispatch from
- rl_domove_read_callback. Fixes bug reported by Clark Wang
- <dearvoid@gmail.com>
-
-lib/readline/callback.c
- - make sure _rl_internal_char_cleanup is called after the
- vi-motion callbacks (rl_vi_domove_callback) in rl_callback_read_char.
- Companion to above fix
-
-doc/{bash.1,bashref.texi}
- - make sure that the text describing the rhs of the == and =~
- operators to [[ states that only the quoted portion of the pattern
- is matched as a string
-
- 2/18
- ----
-lib/glob/gmisc.c
- - better fix for umatchlen/wmatchlen: keep track of the number of
- characters in a bracket expression as the value to increase
- matchlen by if the bracket expression is not well-formed. Fixes
- bug reported by Clark Wang <dearvoid@gmail.com>
-
-subst.c
- - change expand_string_for_rhs so that it sets the W_NOSPLIT2 flag
- in the word flags. We will not perform word splitting or quote
- removal on the result, so we do not want to add quoted nulls if
- we see "" or ''. Fixes bug reported by Mike Frysinger
- <vapier@gentoo.org>
-
- 2/19
- ----
-variables.c
- - new function, int chkexport(name), checks whether variable NAME is
- exported and remakes the export environment if necessary. Returns
- 1 if NAME is exported and 0 if not
- - call chkexport(name) to get tzset to look at the right variable in
- the environment when modifying TZ in sv_tz. Don't call tzset if
- chkexport doesn't indicate that the variable is exported
-
-variables.h
- - new extern declaration for chkexport
-
-
-{parse.y,builtins/printf.def}
- - call sv_tz before calling localtime() when formatting time strings
- in prompt strings or using printf. Fixes bug reported by
- Dennis Williamson <dennistwilliamson@gmail.com>
-
-execute_cmd.c
- - modify fix of 2/9 to add casts when those variables are passed to
- functions; some compilers throw errors instead of warnings. Report
- and fix from Joachim Schmitz <jojo@schmitz-digital.de>
-
-support/shobj-conf
- - add a stanza for nsk on the Tandem from Joachim Schmitz
- <jojo@schmitz-digital.de>
-
-{shell,lib/readline/shell}.c
- - Tandem systems should use getpwnam (getlogin()); for some reason
- they don't do well with using getuid(). Fix from Joachim Schmitz
- <jojo@schmitz-digital.de>
-
- 3/1
- ---
-variables.c
- - make sure that the return value from find_variable is non-null
- before trying to use it in chkexport. Fixes bug reported by
- Evangelos Foutras <foutrelis@gmail.com>
-
- 3/3
- ---
-parse.y
- - when adding $$ to the current token buffer in read_token_word(),
- don't xmalloc a buffer for two characters and then strcpy it, just
- copy the characters directly into the token buffer. Fix from
- Michael Whitten <mfwitten@gmail.com>
-
-execute_cmd.c
- - fix expand_word_unsplit to add the W_NOSPLIT2 flag to the word to
- be expanded, so "" doesn't add CTLNUL. Similar to fix of 2/18 to
- expand_string_for_rhs. Fixes bug reported by Nathanael D. Noblet
- <nathanael@gnat.ca> and Matthias Klose <doko@debian.org>
-
-parse.y
- - fix extended_glob case of read_token_word to allocate an extra
- space in the buffer for the next character read after the extended
- glob specification if it's a CTLESC or CTLNUL. Report and fix from
- Michael Witten <mfwitten@gmail.com>
- - fix shell expansions case of read_token_word to allocate an extra
- space in the buffer for the next character read after the shell
- expansion if it's a CTLESC or CTLNUL. Report and fix from
- Michael Witten <mfwitten@gmail.com>
- - TENTATIVE: fix read_token_word to reduce the amount of buffer space
- required to hold the translated and double-quoted value of $"..."
- strings. Report and fix from Michael Witten <mfwitten@gmail.com>
- - change code around got_character and got_escaped_character labels to
- make sure that we call RESIZE_MALLOCED_BUFFER before adding the
- CTLESC before a CTLESC or CTLNUL, and before adding the character if
- we're not adding a CTLESC. Report and fix from
- Michael Witten <mfwitten@gmail.com>
-
-subst.c
- - new param flags value, PF_ASSIGNRHS, mirrors W_ASSIGNRHS, noting that
- parameter expansion is on rhs of assignment statement. That inhibits
- word splitting
- - change param_expand to call string_list_dollar_at with quoted == 1
- if PF_ASSIGNRHS is set, so it will quote IFS characters in the
- positional parameter before separating them with the first char of
- $IFS. This keeps the rhs from being split inappropriately. Fixes
- bug reported by Andres Perera <andres.p@zoho.com>
-
- 3/4
- ---
-lib/readline/bind.c
- - add a missing free of `names' in rl_function_dumper. Bug report
- and fix from Michael Snyder <msnyder@vmware.com>
-
- 3/5
- ---
-lib/readline/rltty.c
- - change rl_deprep_terminal so it uses fileno (stdin) for the tty fd
- if rl_instream is not set, like rl_prep_terminal
-
- 3/6
- ---
-lib/readline/display.c
- - fix rl_message to use a dynamically-allocated buffer instead of a
- fixed-size buffer of 128 chars for the `local message prompt'. Bug
- report and fix from Micah Cowan <micah@cowan.name>
-
- 3/7
- ---
-jobs.c
- - add sentinel to wait_sigint_handler so it only sets wait_sigint_received
- if waiting_for_child is non-zero; otherwise, it restores the old
- SIGINT handler and sends itself the SIGINT
- - set waiting_for_child around the calls to waitchld that use it to
- synchronously wait for a process
- - change logic that decides whether or not the child process blocked
- or handled SIGINT based on whether or not waitpid returns -1/EINTR
- and the shell receives a SIGINT and the child does not exit. If
- the child later exits due to SIGINT, cancel the assumoption that it
- was handled
- - instead of testing whether or not the child exited due to SIGINT
- when deciding whether the shell should act on a SIGINT it received
- while waiting, test whether or not we think the child caught
- SIGINT. If it did, we let it go (unless the shell has it trapped);
- if it did not catch it, the shell acts on the SIGINT. Fix from
- Linus Torvalds <torvalds@linux-foundation.org>, bug report originally
- from Oleg Nesterov <oleg@redhat.com>
-
- 3/8
- ---
-shell.c
- - initialize no_line_editing to 1 if READLINE is not defined -- we
- can't have line editing without readline
-
- 3/12
- ----
-lib/readline/signals.c
- - add SIGHUP to the set of signals readline handles
-
-lib/readline/doc/rltech.texi
- - document that SIGHUP is now part of the set of signals readline
- handles
-
-lib/readline/input.c
- - if _rl_caught_signal indicates that read() was interrupted by a
- SIGHUP or SIGTERM, return READERR or EOF as appropriate
- - call rl_event_hook, if it's set, if call to read in rl_getc
- returns -1/EINTR. If rl_event_hook doesn't do anything, this
- continues the loop as before. This handles the other fatal
- signals
-
-execute_cmd.c
- - add a couple of QUIT; calls to execute_disk_command and
- execute_simple_command to improve responsiveness to interrupts
- and fatal signals
-
-input.c
- - rearrange getc_with_restart so that the return values from read()
- are handled right
-
-parse.y
- - don't need to set terminate_immediately in yy_stream_get, since
- getc_with_restart checks for terminating signals itself
- - since readline returns READERR on SIGHUP or SIGTERM, don't need
- to set terminate_immediately. Still doesn't handle other
- signals well -- will have to check that some more
-
-bashline.c
- - new function, bash_event_hook, for rl_event_hook. Just checks for
- terminating signals and acts on them using CHECK_TERMSIG.
- - set rl_event_hook to bash_event_hook
-
-builtins/read.def
- - take out setting terminate_immediately; add calls to CHECK_TERMSIG
- after read calls
-
-doc/{bash.1,bashref.texi}
- - move the text describing the effect of negative subscripts used to
- reference indexed array elements to the paragraphs describing
- ${parameter[subscript]}, since that's where they are implemented.
- Pointed out by Christopher F. A. Johnson <cfajohnson@gmail.com>
-
-arrayfunc.[ch],subst.c
- - array_expand_index now takes a new first argument: a SHELL_VAR *
- of the array variable being subscripted. Can be used later to fully
- implement negative subscripts
-
- 3/14
- ----
-lib/glob/glob.c
- - fix mbskipname to not turn the directory entry name into a wide char
- string if the conversion of the pattern to a wide char string fails
- - fix mbskipname to call skipname if either the pattern or the filename
- can't be converted into a wide-char string
-
-lib/glob/xmbsrtowcs.c
- - fix xdupmbstowcs2 to handle return value of 0 from mbsnrtowcs and
- short-circuit with failure in that case. Fixes bug reported by
- Roman Rakus <rrakus@redhat.com>
-
- 3/15
- ----
-bashline.c
- - new variable, bash_filename_quote_characters to store the value
- assigned to rl_filename_quote_characters so it can be restored
- if changed.
- - change bashline_reset and attempt_shell_completion to restore
- rl_filename_quote_characters if not set to default
-
- 3/22
- ----
-lib/glob/glob.c
- - wdequote_pathname falls back to udequote_pathname if xdupmbstowcs
- fails to convert the pathname to a wide-character string
-
-lib/glob/xmbsrtowcs.c
- - xdupmbstowcs2: change to fix problem with leading '\\' (results in
- nms == 0, which causes it to short-circuit with failure right
- away). Fixes bug pointed out by Werner Fink <werner@suse.de>
- - xdupmbstowcs2: compensate for mbsnrtowcs returning 0 by taking the
- next single-byte character and going on
- - xdupmbstowcs2: change memory allocation to increase by WSBUF_INC
- bytes; try to avoid calls to realloc (even if they don't actually
- result in more memory being allocated)
-
- 3/24
- ----
-doc/{bash.1,bashref.texi}
- - slightly modify BASH_SUBSHELL description based on complaint from
- Sam Liddicott <sam@liddicott.com>
-
- 3/25
- ----
-trap.c
- - change free_trap_strings to not call free_trap_string for signals
- that are being ignored, like reset_or_restore_signal_handlers.
- Fixes bug reported by Satoshi Takahashi <blue3waters@gmail.com>
-
- 3/26
- ----
-lib/readline/rltypedefs.h
- - remove old Function/VFunction/CPFunction/CPPFunction typedefs as
- suggested by Tom Tromey <tromey@redhat.com>
-
-lib/readline/rlstdc.h
- - move defines for USE_VARARGS/PREFER_STDARG/PREFER_VARARGS from
- config.h.in to here because declaration of rl_message in
- readline.h uses the defines. This makes it hard for another packages
- to use after the header files are installed, since config.h is not
- one of the installed files. Suggested by Tom Tromey
- <tromey@redhat.com>
-
- 3/27
- ----
-print_cmd.c
- - change indirection_string from a static buffer to a dynamic one
- managed by indirection_level_string(), so we don't end up truncating
- PS4. Suggested by Dennis Williamson <dennistwilliamson@gmail.com>
-
-lib/readline/shell.c
- - change sh_set_lines_and_columns to use static buffers instead of
- allocating the buffers to pass to setenv/putenv
-
-lib/readline/terminal.c
- - change _rl_get_screen_size to not call sh_set_lines_and_columns if
- ignore_env == 0
- - _rl_sigwinch_resize_terminal: new function to just retrieve terminal
- size, ignoring environment
-
-lib/readline/rlprivate.h
- - new external declaration for _rl_sigwinch_resize_terminal() (currently
- unused)
-
-lib/readline/signals.c
- - rl_sigwinch_handler: set _rl_caught_signal to SIGWINCH
- - rl_sigwinch_handler: don't immediately call rl_resize_terminal; just
- leave _rl_caught_signal set for RL_CHECK_SIGNALS to handle
- - _rl_signal_handler: call rl_resize_terminal if sig == SIGWINCH.
- Should fix hang when sending multiple repeated SIGWINCH reported by
- Henning Bekel <h.bekel@googlemail.com>
-
- 3/29
- ----
-lib/sh/snprintf.c
- - include math.h for any defines for isinf/isnan
- - use code from gnulib documentation to implement isinf/isnan if they
- are not defined
-
-configure.in
- - don't check for isinf or isnan; c99 says they're macros anyway
-
-config.h.in
- - remove defines for ISINF_IN_LIBC and ISNAN_IN_LIBC, no longer used
- by snprintf.c
-
- 4/2
- ---
-braces.c
- - brace_gobbler: fix to understand double-quoted command substitution,
- since the shell understands unquoted comsubs. Fixes bug reported
- by Michael Whitten <mfwitten@gmail.com>
-
-lib/readline/display.c
- - include <pc.h> on MDOS
- - get and set screen size using DJGPP-specific calls on MSDOS
- - move cursor up clear screen using DJGPP-specific calls
- - don't call tputs on DJGPP; there is no good terminfo support
-
-lib/readline/terminal.c
- - include <pc.h> on MDOS
- - get and set screen size using DJGPP-specific calls on MSDOS
- - use DJGPP-specific initialization on MSDOS, zeroing all the
- _rl_term_* variables
- - don't call tputs on DJGPP; there is no good terminfo support
- DJGPP support from Eli Zaretskii <eliz@gnu.org>
-
- 4/6
- ---
-
-config-top.h
- - change DEFAULT_PATH_VALUE to something more useful and modern
-
- 4/8
- ---
-tests/printf2.sub
- - make sure LC_ALL and LC_CTYPE are set so LANG assignment takes effect.
- Reported by Cedric Arbogast <arbogast.cedric@gmail.com>
-
- 4/11
- ----
-include/chartypes.h
- - fix a couple of dicey defines (though ones that don't cause any
- compiler warnings) in IN_CTYPE_DOMAIN
-
-doc/{bashref.texi,bash.1}
- - add note referring to duplicating file descriptors in sections
- describing redirecting stdout and stderr and appending to stdout
- and stderr. Suggested by Matthew Dinger <mdinger.bugzilla@gmail.com>
-
-pcomplete.c
- - it_init_helptopics: new function to support completing on help topics,
- not just builtins
- - it_helptopics: new programmable completion list of help topics
- - build list of helptopic completions in gen_action_completions on
- demand
-
-pcomplete.h
- - new extern declaration for it_helptopics
-
-builtins/complete.def
- - the `helptopic' action now maps to CA_HELPTOPIC intead of CA_BUILTIN,
- since there are more help topics than just builtins. Suggested by
- Clark Wang <dearvoid@gmail.com>
-
- 4/12
- ----
-print_cmd.c
- - fix print_arith_for_command to add a call to PRINT_DEFERRED_HEREDOCS
- before ending the body of the command, so heredocs get attached to
- the right command instead of to the loop. From gentoo bug 363371
- http://bugs.gentoo.org/show_bug.cgi?id=363371
-
-execute_cmd.c
- - change coproc_pidchk to unset the appropriate shell variables when
- the (currently single) known coproc pid terminates
- - cleanup and new functions to fully support multiple coprocesses when
- and if I decide to go there
-
- 4/13
- ----
-print_cmd.c
- - fix print_group_command to add a call to PRINT_DEFERRED_HEREDOCS
- after call to make_command_string_internal before printing closing
- `}'
- - fix make_command_string_internal to add a call to
- PRINT_DEFERRED_HEREDOCS after recursive call to
- make_command_string_internal in case cm_subshell before printing
- closing `)'
-
- 4/14
- ----
-print_cmd.c
- - change overlapping strcpy in named_function_string to memmove
-
-sig.h
- - UNBLOCK_SIGNAL: convenience define, same as UNBLOCK_CHILD, just
- restores an old signal mask
-
-trap.c
- - set_signal: instead of setting the signal handler to SIG_IGN while
- installing the new trap handler, block the signal and unblock it
- after the new handler is installed. Fixes bug reported by Roman
- Rakus <rrakus@redhat.com>
-
- 4/15
- ----
-doc/{bash.1,bashref.texi}
- - make it clear that enabling monitor mode means that all jobs run in
- separate process groups
-
- 4/18
- ----
-builtins/fc.def
- - update fix of 4/15/2010 to not take saved_command_line_count into
- account when stepping down the history list to make sure that
- last_hist indexes something that is valid. Fixes bug reported by
- <piuma@piumalab.org>
-
- 4/19
- ----
-builtins/fc.def
- - fc_gethnum: make sure the calculation to decide the last history
- entry is exactly the same as fc_builtin. Fixes bug uncovered by
- fix of 4/18 to stop seg fault
-
- 4/22
- ----
-lib/readline/terminal.c
- - change _rl_enable_meta_key to set a flag indicating that it sent the
- enable-meta sequence
- - _rl_disable_meta_key: new function to turn off meta mode after we
- turned it on with _rl_enable_meta_key
-
-lib/readline/rlprivate.h
- - extern declaration for _rl_disable_meta_key
-
-configure.in
- - if not cross-compiling, set CFLAGS_FOR_BUILD from any CFLAGS inherited
- from the environment. Fixes HP/UX build problem reported by
- "Daniel Richard G." <skunk@iSKUNK.ORG>
-
- 4/26
- ----
-config-top.h
- - define MULTIPLE_COPROCS to 0 so the code is still disabled but easy
- to enable via configure option or editing this file
-
- 4/29
- ----
-lib/sh/eaccess.c
- - freebsd provides faccessat, with the same misfeature as their eaccess
- and access implementations (X_OK returns true for uid==0 regardless
- of the actual file permissions), so reorganize code to check the
- file permissions as with eaccess. Report and fix from Johan Hattne
- <johan.hattne@utsouthwestern.edu>
-
- 5/2
- ---
-doc/{bash.1,bashref.texi}
- - add forward reference to `Pattern Matching' from `Pathname
- Expansion', suggested by Greg Wooledge <wooledg@eeg.ccf.org>
-
- 5/5
- ---
-pcomplib.c
- - the bash_completion project now distributes over 200 completions
- for various programs, with no end in sight, so increase the value
- of COMPLETE_HASH_BUCKETS from 32 to 128
-
-pathexp.c
- - quote_string_for_globbing: make sure CTLESC quoting CTLESC is
- translated into \<CTLESC> even if the flags include QGLOB_REGEXP.
- We don't want to process the second CTLESC as a quote character.
- Fixes bug reported by Shawn Bohrer <sbohrer@rgmadvisors.com>
-
- 5/6
- ---
-builtins/printf.def
- - change PRETURN to not call fflush if ferror(stdout) is true
- - if a call to one of the stdio functions or printstr leaves
- ferror(stdout) true, and PRETURN is going to be called, let PRETURN
- print the error message rather than doubling up the messages. Fixes
- problem reported by Roman Rakus <rrakus@redhat.com>
-
- 5/9
- ---
-doc/{bash.1,bashref.texi}
- - add note to the effect that lists inside compound command can be
- terminated by newlines as well as semicolons. Suggested by
- Roman Byshko <rbyshko@gmail.com>
-
- 5/10
- ----
-subst.c
- - remove_quoted_nulls: fix problem that caused it to skip over the
- character after a CTLNUL, which had the effect of skipping every
- other of a series of CTLNULs. Fixes bug reported by
- Marten Wikstrom <marten.wikstrom@keystream.se>
-
- 5/11
- ----
-subst.c
- - extract_process_subst: add SX_COMMAND flag to call to
- extract_delimited_string, since we're expanding the same sort of
- command as command substitution. Fixes bug reported in Ubuntu
- bug 779848
-
- 5/12
- ----
-configure.in
- - set the prefer_shared and prefer_static variables appropriately
- depending on the value of $opt_static_link
-
-aclocal.m4
- - AC_LIB_LINKFLAGS_BODY: change to not prefer shared versions of the
- libraries it's searching for if the prefer_shared variable is "no".
- Fixes problem reported by Cedric Arbogast <arbogast.cedric@gmail.com>
-
- 5/13
- ----
-lib/readline/readline.c
- - _rl_internal_teardown: add call to _rl_disable_meta_key to make the
- meta key active only for the duration of the call to readline()
- - _rl_internal_setup: move call to _rl_enable_meta_key here from
- readline_initialize_everything so the meta key is active only for
- the duration of the call to readline(). Suggestion from Miroslav
- Lichvar <mlichvar@redhat.com>
-
-builtins/help.def
- - help_builtin: change strncmp to strcmp so that `help read' no longer
- matches `readonly'. Suggested by Clark Wang <dearvoid@gmail.com>
-
-config.h.in
- - add define for GLIBC21, checked using jm_GLIBC21 as part of the tests
- for libintl
-
-lib/malloc/malloc.c
- - internal_free: don't use the cached value of memtop when deciding
- whether or not to adjust the break and give memory back to the kernel
- when using the GNU C library, since glibc uses sbrk for its own
- internal purposes. From Debian bug 614815, reported by Samuel
- Thibault <samuel.thibault@gnu.org>
-
-aclocal.m4
- - BASH_STRUCT_WEXITSTATUS_OFFSET: change AC_RUN_IFELSE to AC_TRY_RUN
- to avoid warning about not using AC_LANG_SOURCE
-
- 5/14
- ----
-bashline.[ch]
- - two new functions, bashline_set_event_hook and bashline_reset_event_hook,
- to set rl_event_hook to bash_event_hook and back to NULL, respectively
- - don't set rl_event_hook unconditionally
-
-sig.c
- - termsig_sighandler: if the shell is currently interactive and
- readline is active, call bashline_set_event_hook to cause
- termsig_handler to be called via bash_event_hook when the shell
- returns from the signal handler
-
- 5/15
- ----
-lib/readline/display.c
- - _rl_col_width: Mac OS X has a bug in wcwidth: it does not return 0
- for UTF-8 combining characters. Added workaround dependent on
- MACOSX. Fixes problem pointed out by Thomas De Contes
- <d.l.tDecontes@free.fr>
-
- 5/16
- ----
-lib/readline/rlmbutil.h
- - WCWIDTH: wrapper for wcwidth that returns 0 for Unicode combining
- characters on systems where wcwidth is broken (e.g., Mac OS X).
-
-lib/readline/{complete,display,mbutil}.c
- - use WCWIDTH instead of wcwidth
-
- 5/17
- ----
-lib/readline/display.c
- - update_line: after computing ofd and nfd, see whether the next
- character in ofd is a zero-width combining character. If it is,
- back ofd and nfd up one, so the base characters no longer compare
- as equivalent. Fixes problem reported by Keith Winstein
- <keithw@mit.edu>
-
-lib/readline/nls.c
- - _rl_utf8locale: new flag variable, set to non-zero if the current
- locale is UTF-8
- - utf8locale(): new function, returns 1 if the passed lspec (or the
- current locale) indicates that the locale is UTF-8. Called from
- _rl_init_eightbit
-
-lib/readline/rlprivate.h
- - extern declaration for _rl_utf8locale
-
-locale.c
- - locale_utf8locale: new flag variable, set to non-zero if the current
- locale is UTF-8 (currently unused)
- - locale_isutf8(): new function, returns 1 if the passed lspec (or the
- current locale) indicates that the locale is UTF-8. Should be called
- whenever the locale or LC_CTYPE value is modified
-
-aclocal.m4
- - BASH_WCWIDTH_BROKEN: new test for whether or not wcwidth returns
- zero-width characters like unicode combining characters as having
- display length 1; define WCWIDTH_BROKEN in this case
-
-config.h.in
- - WCWIDTH_BROKEN: new define
-
-lib/readline/rlmbutil.h
- - change WCWIDTH macro to use _rl_utf8locale and the full range of
- Unicode combining characters (U+0300-U+036F)
-
- 5/19
- ----
-lib/readline/rlprivate.h
- - _rl_search_context: new member, prevc, will hold character read
- prior to lastc
-
-lib/readline/isearch.c
- - _rl_isearch_dispatch: if the character causes us to index into
- another keymap, save that character in cxt->prevc
- - _rl_isearch_dispatch: if we index into another keymap, but don't
- find a function that's special to i-search, and the character that
- caused us to index into that keymap would have terminated the
- search, push back cxt->prevc and cxt->lastc to make it appear as
- if `prevc' terminated the search, and execute lastc as a command.
- We have to push prevc back so we index into the same keymap before
- we read lastc. Fixes bug report from Davor Cubranic
- <cubranic@stat.ubc.ca>
-
- 5/20
- ----
-expr.c
- - expr_bind_variable: pay attention to the return value from
- bind_variable and check whether or not we should error out due to
- a readonly or noassign variable. Fixes bug reported by Eric
- Blake <eblake@redhat.com>
-
- 5/26
- ----
-
-lib/readline/search.c
- - include histlib.h for ANCHORED_SEARCH defines
- - rl_history_search_flags: new variable, holds ANCHORED_SEARCH flag for
- the duration of a history search
- - rl_history_search_reinit: takes a new flags variable, defines whether
- or not the search is anchored; assigned to rl_history_search_flags
- - rl_history_serarch_reinit: if ANCHORED_SEARCH flag passed, add ^ to
- beginning of search string; otherwise search string is unmodified
- - rl_history_search_internal: set rl_point appropriately based on
- whether or not rl_history_search_flags includes ANCHORED_SEARCH
- - rl_history_substr_search_forward: new function, for non-anchored
- substring search forward through history for string of characters
- preceding rl_point
- - rl_history_substr_search_backward: new function, for non-anchored
- substring search backward through history for string of characters
- preceding rl_point. Original code from Niraj Kulkarni
- <kulkarniniraj14@gmail.com>
-
-lib/readline/readline.h
- - extern declarations for rl_history_substr_search_{for,back}ward
-
-lib/readline/funmap.c
- - history-substring-search-forward: new bindable command, invokes
- rl_history_substr_search_forward
- - history-substring-search-backward: new bindable command, invokes
- rl_history_substr_search_backward
-
-lib/readline/doc/{rluser.texi,readline.3}
- - document history-substring-search-forward and
- history-substring-search-backward
-
- 5/27
- ----
-{nojobs,jobs}.c
- - add support for DONT_REPORT_SIGTERM so that the shell doesn't print
- a message when a job exits due to SIGTERM since that's the default
- signal sent by the kill builtin. Suggested by Marc Herbert
- <mark.herbert@gmail.com>
-
-config-top.h
- - DONT_REPORT_SIGTERM: new user-modifiable setting. Commented out
- by default
-
- 5/28
- ----
-lib/readline/bind.c
- - _rl_skip_to_delim: skip to a closing double quote or other delimiter,
- allowing backslash to quote any character, including the delimiter
- - rl_parse_and_bind: call _rl_skip_to_delim instead of using inline
- code
- - rl_parse_and_bind: allow quoted strings as the values of string
- variables. Variable values without double quotes have trailing
- whitespace removed (which still allows embedded whitespace, for
- better or worse). Fixes problem with string variables not matching
- in `set' command if values happen to have trailing spaces or tabs
- (debian bash bug #602762), but introduces slight incompatibility.
-
- 5/29
- ----
-doc/{bash.1,bashref.texi}
- - clarify unset description to specify that without options, a
- variable, then a shell function if there is no variable by that
- name, is unset. Fixes discrepancy reported by Mu Qiao
- <qiaomuf@gentoo.org>
-
- 6/4
- ----
-doc/{bash.1,bashref.texi}
- - clarify description of LINES and COLUMNS (and checkwinsize shopt
- option) to make it clear that only interactive shells set a
- handler for SIGWINCH and update LINES and COLUMNS. Original
- report submitted by Jonathan Nieder <jrnieder@gmail.com>
-
-arrayfunc.c
- - expand_compound_array_assignment: defer expansion of words between
- parens when performing compound assignmnt to an associative array
- variable
- - assign_compound_array_list: perform the same expansions when doing
- a compound array assignment to an associative array variable as
- when doing a straight array index assignment. The idea is that
- foo=( [ind1]=bar [ind2]=quux)
- is the same as
- foo[ind1]=bar ; foo[ind2]=quux
-
- This fixes problems with double-expansion and quote removal being
- performed on the array indices
-
- 6/13
- ----
-doc/{bash.1,bashref.texi}
- - Add a little text to make it clear that the locale determines how
- range expressions in glob patterns are handled.
-
-
- 6/21
- ----
-builtins/read.def
- - display a message and return error status if -a is used with an
- existing associative array. Fixes bug reported by Curtis Doty
- <curtis@greenkey.net>
-
- 6/24
- ----
-{jobs,nojobs}.c
- - non-interactive shells now react to the setting of checkwinsize
- and set LINES and COLUMNS after a foreground job exits. From a
- suggestion by Leslie Rhorer <lrhorer@satx.rr.com>
-
-doc/{bash.1,bashref.texi}
- - checkwinsize: remove language saying that only interactive shells
- check the window size after each command
-
-lib/readline/histfile.c
- - history_backupfile: new file, creates a backup history file name
- given a filename (appending `-')
- - history_do_write: when overwriting the history file, back it up
- before writing. Restore backup file on a write error. Suggested
- by chkno@chkno.net
-
-bashline.c
- - find_cmd_name: two new arguments, return the start and end of the
- actual text string used to find the command name, without taking
- whitespace into account
- - attempt_shell_completion: small changes to make sure that completion
- attempted at the beginning of a non-empty line does not find a
- programmable completion, even if the command name starts at point
- - attempt_shell_completion: small change to make sure that completion
- does not find a progcomp when in whitespace before the command
- name
- - attempt_shell_completion: small change to make sure that completion
- does not find a progcomp when point is at the first character of a
- command name, even when there is leading whitespace (similar to
- above). Fixes problems noted by Ville Skytta <ville.skytta@iki.fi>
-
-subst.c
- - brace_expand_word_list: since the individual strings in the strvec
- returned by brace_expand are already allocated, don't copy them to
- newly-allocated memory when building the WORD_LIST, just use them
- intact
-
-locale.c
- - locale_mb_cur_max: cache value of MB_CUR_MAX when we set or change
- the locale to avoid a function call every time we need to read it
-
-shell.h
- - new struct to save shell_input_line and associated variables:
- shell_input_line_state_t
- - add members of sh_parser_state_t to save and restore token and the
- size of the token buffer
-
-parse.y
- - {save,restore}_input_line_state: new functions to save and restore
- shell_input_line and associated variables
- - {save,restore}_parser_state: add code to save and restore the token
- and token buffer size
- - xparse_dolparen: call save_ and restore_input_line_state to avoid
- problems with overwriting shell_input_line when we recursively
- call the parser to parse a command substitution. Fixes bug
- reported by Rui Santos <rsantos@grupopie.com>
-
-include/shmbutil.h
- - use locale_mb_cur_max instead of MB_CUR_MAX in ADVANCE_CHAR and
- similar macros
-
-lib/glob/smatch.c
- - rangecmp,rangecmp_wc: change to take an additional argument, which
- forces the use of strcoll/wscoll when non-zero. If it's 0, a new
- variable `glob_asciirange' controls whether or not we use strcoll/
- wscoll. If glob_asciirange is non-zero, we use straight
- C-locale-like ordering. Suggested by Aharon Robbins
- <arnold@skeeve.com>
-
- 6/30
- ----
-execute_cmd.c
- - execute_pipeline: make sure the lastpipe code is protected by
- #ifdef JOB_CONTROL. Fixes problem reported by Thomas Cort
- <tcort@minix3.org>
-
- 7/2
- ---
-lib/readline/complete.c
- - EXPERIMENTAL: remove setting of _rl_interrupt_immediately around
- completion functions that touch the file system. Idea from Jan
- Kratochvil <jan.ktratochvil@redhat.com> and the GDB development
- team
-
-lib/readline/signals.c
- - rl_signal_handler: if we're in callback mode, don't interrupt
- immediately on a SIGWINCH
-
- 7/3
- ---
-bashline.c
- - set_directory_hook: and its siblings are a new set of functions to
- set, save, and restore the appropriate directory completion hook
- - change callers to use {set,save,restore}_directory_hook instead of
- manipulating rl_directory_rewrite_hook directly
- - dircomplete_expand: new variable, defaults to 0, if non-zero causes
- directory names to be word-expanded during word and filename
- completion
- - change {set,save,restore}_directory_hook to look at dircomplete_expand
- and change rl_directory_completion_hook or rl_directory_rewrite_hook
- appropriately
-
-bashline.h
- - extern declaration for set_directory_hook so shopt code can use it
-
- 7/6
- ---
-builtins/shopt.def
- - globasciiranges: new settable shopt option, makes glob ranges act
- as if in the C locale (so b no longer comes between A and B).
- Suggested by Aharon Robbins <arnold@skeeve.com>
-
- 7/7
- ---
-doc/{bash.1,bashref.texi}
- - document new `globasciiranges' shopt option
-
- 7/8
- ---
-builtins/shopt.def
- - direxpand: new settable option, makes filename completion expand
- variables in directory names like bash-4.1 did.
- - shopt_set_complete_direxpand: new function, does the work for the
- above by calling set_directory_hook
-
-doc/{bash.1,bashref.texi}
- - document new `direxpand' shopt option
-
- 7/15
- ----
-lib/readline/isearch.c
- - _rl_isearch_dispatch: when adding character to search string, use
- cxt->lastc (which we use in the switch statement) instead of c,
- since lastc can be modified earlier in the function
-
- 7/18
- ----
-lib/readline/rlprivate.h
- - _rl_search_context: add another member to save previous value of
- (multibyte) lastc: pmb is to mb as prevc is to lastc
-
-lib/readline/isearch.c:
- - _rl_isearch_dispatch: if a key sequence indexes into a new keymap,
- but doesn't find any bound function (k[ind].function == 0) or is
- bound to self-insert (k[ind].function == rl_insert), back up and
- insert the previous character (the one that caused the index into a
- new keymap) and arrange things so the current character is the next
- one read, so both of them end up in the search string. Fixes bug
- reported by Clark Wang <dearvoid@gmail.com>
- - _rl_isearch_dispatch: a couple of efficiency improvements when adding
- characters to the isearch string
-
- 7/24
- ----
-lib/readline/isearch.c
- - _rl_isearch_dispatch: save and restore cxt->mb and cxt->pmb
- appropriately when in a multibyte locale
-
-doc/{bash.1,bashref.texi}
- - correct description of {x}>file (and other redirection operators
- that allocate a file descriptor) to note the the fd range is
- greater than or equal to 10. Fixes problem reported by
- Christian Ullrich
-
-lib/readline/signals.c
- - rl_signal_handler: don't interrupt immediately if in callback mode
-
-lib/readline/callback.c
- - rl_callback_read_char: install signal handlers only when readline
- has control in callback mode, so readline's signal handlers aren't
- called when the application is active (e.g., between the calls to
- rl_callback_handler_install and rl_callback_read_char). If the
- readline signal handlers only set a flag, which the application
- doesn't know about, the signals will effectively be ignored until
- the next time the application calls into the readline callback
- interface. Fixes problem of calling unsafe functions from signal
- handlers when in callback mode reported by Jan Kratochvil
- <jan.kratochvil@redhat.com>
-
-execute_cmd.c
- - fix_assignment_words: when in Posix mode, the `command' builtin
- doesn't change whether or not the command name it protects is an
- assignment builtin. One or more instances of `command'
- preceding `export', for instance, doesn't make `export' treat its
- assignment statement arguments differently. Posix interpretation
- #351
-
-doc/{bash.1,bashref.texi}
- - document new Posix-mode behavior of `command' when preceding builtins
- that take assignment statements as arguments
-
-builtins/printf.def
- - printstr: if fieldwidth or precision are < 0 or > INT_MAX when
- supplied explicitly (since we take care of the `-' separately),
- clamp at INT_MAX like when using getint(). Fixes issue reported
- by Ralph Coredroy <ralph@inputplus.co.uk>
-
- 7/25
- ----
-lib/readline/chardefs.h
- - isxdigit: don't define if compiling with c++; declared as a c++
- template function. Fixes bug reported by Miroslav Lichvar
- <mlichvar@redhat.com>
-
-builtins/printf.def
- - getint: if garglist == 0, return whatever getintmax returns (0).
- Fixes bug reported by Ralph Coredroy <ralph@inputplus.co.uk>
-
- 7/28
- ----
-doc/{bash.1,bashref.texi}
- - minor changes to the descriptions of the cd and pushd builtins
-
-lib/sh/zread.c
- - zsyncfd: change variable holding return value from lseek to
- off_t. Bug report and fix from Gregory Margo <gmargo@pacbell.net>
-
- 8/1
- ---
-expr.c
- - don't check for division by 0 when in a context where no evaluation
- is taking place. Fixes bug reported by dnade.ext@orange-ftgroup.com
-
- 8/6
- ---
-execute_cmd.c
- - execute_command_internal: the parent branch of the subshell code
- (where the child calls execute_in_subshell) should not close all
- open FIFOs with unlink_fifo_list if it's part of a shell function
- that's still executing. Fixes bug reported by Maarten Billemont
- <lhunath@lyndir.com>
-
- 8/9
- ---
-builtins/common.c
- - get_exitstat: return EX_BADUSAGE (2) on a non-numeric argument
-
-builtins/return.def
- - return_builtin: just call get_exitstat to get the return status,
- let it handle proper parsing and handling of arguments. Fixes
- issue most recently raised by Linda Walsh <bash@tlinx.org>.
- Reverses change from 9/11/2008 (see above)
-
- 8/16
- ----
-doc/{bash.1,bashref.texi}
- - clean up `set -e' language to make it clearer that any failure of
- a compound command will cause the shell to exit, not just subshells
- and brace commands
-
- 8/17
- ----
-configure.in
- - make the various XXX_FOR_BUILD variables `precious' to autoconf to
- avoid stale data
- - change how CC_FOR_BUILD is initialized when cross-compiling and not,
- but do not change behavior
- - initialize CFLAGS_FOR_BUILD to -g when cross-compiling
- - initialize LIBS_FOR_BUILD to $(LIBS) when not cross-compiling, empty
- when cross-compiling
- - create AUTO_CFLAGS variable to hold basic CFLAGS defaults; used when
- CFLAGS not inherited from environment (like effect of old
- auto_cflags variable)
- - substitute LIBS_FOR_BUILD into output Makefiles
- [changes inspired by bug report from Nathan Phillip Brink
- <ohnobinki@ohnopublishing.net> -- gentoo bug 378941]
-
-builtins/Makefile.in
- - substitute LIBS_FOR_BUILD from configure, not strictly initialized
- to $(LIBS)
-
- 8/27
- ----
-doc/{bash.1,bashref.texi}
- - minor changes to the here string description to clarify the
- expansions performed on the word
-
-support/shobj-conf
- - handle compilation on Lion (Mac OS X 10.7/darwin11) with changes
- to darwin stanzas. Fixes readline bug reported by Vincent
- Sheffer <vince.sheffer@apisphere.com>
-
-lib/sh/strtrans.c
- - ansic_wshouldquote: check a string with multi-byte characters for
- characters that needs to be backslash-octal escaped for $'...'
- - ansic_shouldquote: if is_basic fails for one character, let
- ansic_wshouldquote examine the rest of the string and return what
- it returns. From a patch sent by Roman Rakus <rrakus@redhat.com>
-
- 8/30
- ----
-lib/sh/strtrans.c
- - ansic_quote: changes to quote (or not) multibyte characters. New
- code converts them to wide characters and uses iswprint to check
- valid wide chars. From a patch sent by Roman Rakus
- <rrakus@redhat.com>
-
- 9/7
- ---
-lib/sh/shquote.c
- - sh_backslash_quote: change to be table-driven so we can use a
- different table if we want to
- - sh_backslash_quote: takes a second char table[256] argument;
-
-externs.h
- - sh_backslash_quote: add second argument to function prototype
-
-bashline.c,braces.c,parse.y,builtins/printf.def
- - change callers of sh_backslash_quote to add second argument
-
-bashline.c
- - filename_bstab: table of characters to pass to sh_backslash_quote;
- characters with value 1 will be backslash-quoted
- - set_filename_bstab: turn on characters in filename backslash-quote
- table according to passed string argument
- - call set_filename_bstab every time rl_filename_quote_characters is
- assigned a value
- - bash_quote_filename: call sh_backslash_quote with filename_bstab
- as second argument. This allows other characters in filenames to
- be quoted without quoting, for instance, a dollar sign in a shell
- variable reference
-
- 9/8
- ---
-bashline.c
- - complete_fullquote: new variable, controls table passed to
- sh_backslash_quote. If non-zero (the default), the standard set
- of shell metacharacters -- as in bash versions up to and including
- bash-4.2 -- gets backslash-quoted by the completion code. If zero,
- sh_backslash_quote gets the table with the characters in the
- variable reference removed, which means they are removed from the
- set of characters to be quoted in filenames
-
- 9/10
- ----
-bashline.c
- - bash_filename_stat_hook: new function, designed to expand variable
- references in filenames before readline passes them to stat(2)
- to determine whether or not they are a directory
-
- 9/15
- ----
-builtins/declare.def
- - if assign_array_element fails due to a bad (or empty) subscript, mark
- it as an assignment error and don't attempt any further processing
- of that declaration. Fixes segfault bug reported by Diego Augusto
- Molina <diegoaugustomolina@gmail.com>
-
- 9/19
- ----
-expr.c
- - exppower: replace the simple exponentiation algorithm with an
- implementation of exponentiation by squaring. Inspired by report
- from Nicolas ARGYROU <nargy@yahoo.com>
-
-bashline.c
- - bash_quote_filename: check for rtext being non-null before
- dereferencing it
- - set_saved_history: operate_and_get_next assumes that the previous
- line was added to the history, even when the history is stifled and
- at the max number of entries. If it wasn't, make sure the history
- number is incremented properly. Partial fix for bug reported by
- gregrwm <backuppc-users@whitleymott.net>
-
-doc/{bash.1,bashref.texi},lib/readline/doc/{hsuser,rluser}.texi
- - minor editorial changes inspired by suggestions from
- Roger Zauner <rogerx.oss@gmail.com>
-
- 9/20
- ----
-lib/intl/localealias.c
- - read_alias_file: close resource leak (fp) when returning on error
-
- 9/22
- ----
-execute_command.c
- - execute_intern_function: implement Posix interpretation 383 by making
- it an error to define a function with the same name as a special
- builtin when in Posix mode.
- http://austingroupbugs.net/view.php?id=383#c692
-
- 9/25
- ----
-doc/{bash.1,bashref.texi}
- - formatting and some content changes from Benno Schulenberg
- <bensberg@justemail.net>
- - document new posix-mode behavior from interp 383 change of 9/22
-
- 9/30
- ----
-execute_cmd.c
- - shell_execve: add strerror to error message about executable file
- that shell can't execute as a shell script. From suggestion by
- daysleeper <daysleeper@centrum.cz>
-
- 10/1
- ----
-bashhist.c
- - maybe_add_history: act as if literal_history is set when parser_state
- includes PST_HEREDOC, so we save the bodies of here-documents just
- as they were entered. Fixes bug reported by Jonathan Wakely
- <bugs@kayari.org>
- - bash_add_history: make sure that the second and subsequent lines of
- a here document don't have extra newlines or other delimiting
- chars added, since they have the trailing newline preserved, when
- `lithist' is set and history_delimiting_chars isn't called
-
-execute_cmd.c
- - execute_command_internal: avoid fd exhaustion caused by using
- process substitution in loops inside shell functions by using
- copy_fifo_list and close_new_fifos (). Fixes debian bash bug
- 642504
-
-lib/readline/complete.c
- - new variable, rl_filename_stat_hook, used by append_to_match. If
- filename completion is desired, and rl_filename_stat_hook points
- to a function, call that function to expand the filename in an
- application-specific way before calling stat.
-
-bashline.c
- - bash_default_completion: if variable completion returns a single
- match, use bash_filename_stat_hook and file_isdir to determine
- whether or not the variable name expands to a directory. If it
- does, set the filename_append_character to `/'. This is not
- perfect, so we will see how it works out. Adds functionality
- requested by Peter Toft <pto@linuxbog.dk> and Patrick Pfeifer
- <patrick@pfeifer.de>
- - rl_filename_stat_hook: assigned bash_filename_stat_hook, so things
- like $HOME/Downloads (after completion) have a slash appended.
- In general, this causes the stat hook to be called whenever
- filename completion is appended. Adds functionality requested by
- Patrick Pfeifer <patrick@pfeifer.de>
-
-lib/readline/readline.h
- - new extern declaration for rl_filename_stat_hook
-
-lib/readline/doc/rltech.texi
- - rl_directory_rewrite_hook: now documented
- - rl_filename_stat_hook: document
-
-pcomplete.c
- - gen_action_completions: in the CA_DIRECTORY case, turn off
- rl_filename_completion_desired if it was off before we called
- rl_filename_completion_function and we didn't get any matches.
- Having it on causes readline to quote the matches as if they
- were filenames. Adds functionality requested by many,
- including Clark Wang <dearvoid@gmail.com>
-
-assoc.[ch]
- - assoc_replace: new function, takes the same arguments as
- assoc_insert, but returns the old data instead of freeing it
- - assoc_insert: if the object returned by hash_insert doesn't have
- the same value for its key as the key passed as an argument, we
- are overwriting an existing value. In this case, we can free the
- key. Fixes bug reported by David Parks <davidparks21@yahoo.com>
-
- 10/5
- ----
-print_cmd.c
- - indirection_level_string: small change to only re-enable `x'
- option after calling decode_prompt_string if it was on before. In
- normal mode, it will be, but John Reiser <jreiser@bitwagon.com>
- has a novel use for that code in conjunction with a pre-loaded
- shared library that traces system call usage in shell scripts
-
- 10/10
- -----
-Makefile.in
- - Fix from Mike Frysinger <vapier@gentoo.org> to avoid trying to
- build y.tab.c and y.tab.h with two separate runs of yacc if
- parse.y changes. Problem with parallel makes
- - Fix from Mike Frysinger <vapier@gentoo.org> to avoid subdirectory
- builds each trying to make version.h (and all its dependencies)
-
-lib/sh/Makefile.in
- - remove some dependencies on version.h where it doesn't make sense
-
-variables.c
- - initialize_shell_variables: while reading the environment, a shell
- running in posix mode now checks for SHELLOPTS being readonly (it
- gets set early on in main()) before trying to assign to it. It
- saves an error message and the variable gets parsed as it should.
- Fixes bug reported by Len Giambrone <Len.Giambrone@intersystems.com>
-
- 10/14
- -----
-doc/{bash.1,bashref.texi}
- - add to the "duplicating file descriptors" description that >&word
- doesn't redirect stdout and stderr if word expands to `-'
- - add to the "appending standard output and standard error"
- description a note that >&word, where word is a number or `-',
- causes other redirection operators to apply for sh and Posix
- compatibility reasons. Suggested by Greg Wooledge
- <wooledg@eeg.ccf.org>
-
- 10/15
- -----
-pcomplete.c
- - change pcomp_filename_completion_function to only run the filename
- dequoting function in the cases (as best as it can figure) where
- readline won't do it via rl_filename_completion_function. Based
- on reports from <lolilolicon@gmail.com>
-
- 10/19
- -----
-bashline.c
- - attempt_shell_completion: add call to set_directory_hook() to make
- sure the rewrite functions are correct. It's cheap and doesn't
- hurt
- - command_word_completion_function: if completing a command name that
- starts with `.' or `..', temporarily suppress the effects of the
- `direxpand' option and restore the correct value after calling
- rl_filename_completion_function. If it's enabled, the directory
- name will be rewritten and no longer match `./' or `../'. Fixes
- problem reported by Michael Kalisz <michael@kalisz.homelinux.net>
-
- 10/22
- -----
-builtins/history.def
- - push_history: make sure remember_on_history is enabled before we
- try to delete the last history entry -- the `history -s' command
- might not have been saved. Fixes bug reported by
- lester@vmw-les.eng.vmware.com
-
-lib/readline/complete.c
- - rl_callback_read_char: add calls to a macro CALLBACK_READ_RETURN
- instead of straight return; add same call at end of function.
- Placeholder for future work in deinstalling signal handlers when
- readline is not active
-
- 10/25
- -----
-expr.c
- - exp2: catch arithmetic overflow when val1 == INTMAX_MIN and val2 == -1
- for DIV and MOD and avoid SIGFPE. Bug report and pointer to fix
- from Jaak Ristioja <jaak.ristioja@cyber.ee>
- - expassign: same changes for arithmetic overflow for DIV and MOD
-
- 10/28
- -----
-subst.c
- - parameter_brace_expand: allow pattern substitution when there is an
- expansion of the form ${var/} as a no-op: replacing nothing with
- nothing
- - parameter_brace_patsub: don't need to check for PATSUB being NULL;
- it never is
-
-flags.c
- - if STRICT_POSIX is defined, initialize history_expansion to 0, since
- history expansion (and its treatment of ! within double quotes) is
- not a conforming posix environment. From austin-group issue 500
-
-lib/readline/histexpand.c
- - history_expand: when processing a string within double quotes
- (DQUOTE == 1), make the closing double quote inhibit history
- expansion, as if the word were outside double quotes. In effect,
- we assume that the double quote is followed by a character in
- history_no_expand_chars. tcsh and csh seem to do this. This
- answers a persistent complaint about history expansion
-
- 10/29
- -----
-make_cmd.c
- - make_arith_for_command: use skip_to_delim to find the next `;'
- when breaking the string between the double parens into three
- separate components instead of a simple character loop. Fixes
- bug reported by Dan Douglas <ormaaj@gmail.com>
-
- 11/2
- ----
-Makefile.in
- - make libbuiltins.a depend on builtext.h to serialize its creation
- and avoid conflict between multiple invocations of mkbuiltins.
- Fix from Mike Frysinger <vapier@gentoo.org>
-
- 11/5
- ----
-findcmd.c
- - user_command_matches: if stat(".", ...) returns -1, set st_dev
- and st_ino fields in dotinfo to 0 to avoid same_file matches
- - find_user_command_in_path: check stat(2) return the same way
-
-lib/glob/glob.c
- - glob_vector: don't call strlen(pat) without checking pat == 0
- - glob_dir_to_array: make sure to free `result' and all allocated
- members before returning error due to malloc failure
- - glob_vector: make sure to free `nextname' and `npat' on errors
- (mostly when setting lose = 1)
- - glob_vector: if flags & GX_MATCHDIRS but not GX_ALLDIRS, make
- sure we free `subdir'
- - glob_filename: when expanding ** (GX_ALLDIRS), make sure we
- free temp_results (return value from glob_vector)
-
-lib/glob/xmbsrtowcs.c
- - xdupmbstowcs: fix call to realloc to use sizeof (char *) instead
- of sizeof (char **) when assigning idxtmp
-
-execute_cmd.c
- - print_index_and_element: return 0 right away if L == 0
- - is_dirname: fix memory leak by freeing `temp'
- - time_command: don't try to deref NULL `command' when assigning
- to `posix_time'
- - shell_execve: null-terminate `sample' after READ_SAMPLE_BUF so it's
- terminated for functions that expect that
-
-builtins/read.def
- - read_builtin: don't call bind_read_variable with a potentially-null
- string
-
-pcomplete.c
- - gen_command_matches: don't call dispose_word_desc with a NULL arg
- - gen_compspec_completions: fix memory leak by freeing `ret' before
- calling gen_action_completions (tcs, ...). happens when
- performing directory completion as default and no completions
- have been generated
- - gen_progcomp_completions: make sure to set foundp to 0 whenever
- returning NULL
- - it_init_aliases: fix memory leak by freeing alias_list before
- returning
-
-bashline.c
- - command_word_completion_function: don't call restore_tilde with a
- NULL directory_part argument
- - bash_directory_expansion: bugfix: don't throw away results of
- rl_directory_rewrite_hook if it's set and returns non-zero
- - bind_keyseq_to_unix_command: free `kseq' before returning error
-
-arrayfunc.c
- - assign_array_element_internal: make sure `akey' is freed if non-null
- before returning error
- - assign_compound_array_list: free `akey' before returning error
- - array_value_internal: free `akey' before returning error
- - unbind_array_element: free `akey' before returning error
-
-subst.c
- - array_length_reference: free `akey' before returning error in case
- of expand_assignment_string_to_string error
- - array_length_reference: free `akey' after call to assoc_reference
- - skip_to_delim: if skipping process and command substitution, free
- return value from extract_process_subst
- - parameter_brace_substring: free `val' (vtype == VT_VARIABLE) before
- returning if verify_substring_values fails
- - parameter_brace_expand: remove two duplicate lines that allocate
- ret in parameter_brace_substring case
- - parameter_brace_expand: convert `free (name); name = xmalloc (...)'
- to use `xrealloc (name, ...)'
- - parameter_brace_expand: free `name' before returning when handling
- ${!PREFIX*} expansion
- - split_at_delims: fix memory leak by freeing `d2' before returning
-
-redir.c
- - redirection_error: free `filename' if the redirection operator is
- REDIR_VARASSIGN by assigning allocname
-
-eval.c
- - send_pwd_to_eterm: fix memory leak by freeing value returned by
- get_working_directory()
-
-builtins/cd.def
- - change_to_directory: fix memory leak by freeing return value from
- resetpwd()
- - cd_builtin: fix memory leak by freeing value returned by dirspell()
- - cd_builtin: fix memory leak by freeing `directory' if appropriate
- before overwriting with return value from resetpwd()
-
-builtins/type.def
- - describe_command: free `full_path' before overwriting it with return
- value from sh_makepath
-
-builtins/complete.def
- - compgen_builtin: fix memory leak by calling strlist_dispose (sl)
- before overwriting sl with return value from completions_to_stringlist
-
-builtins/hash.def
- - list_hashed_filename_targets: fix memory leak by freeing `target'
-
-make_cmd.c
- - make_arith_for_command: free `init', `test', and `step' before
- returning error on parse error
-
-jobs.c
- - initialize_job_control: don't call move_to_high_fd if shell_tty == -1
-
-general.c
- - check_dev_tty: don't call close with an fd < 0
- - legal_number: deal with NULL `string' argument, return invalid
-
-lib/sh/fmtulong.c
- - fmtulong: if the `base' argument is invalid, make sure we index
- buf by `len-1' at maximum
-
-print_cmd.c
- - print_deferred_heredocs: don't try to dereference a NULL `cstring'
- - cprintf: make sure to call va_end (args)
-
-variables.c
- - push_dollar_vars: fix call to xrealloc to use sizeof (WORD_LIST *)
- instead of sizeof (WORD_LIST **)
-
-lib/sh/zmapfd.c
- - zmapfd: if read returns error, free result and return -1 immediately
- instead of trying to reallocate it
-
- 11/6
- ----
-execute_cmd.c
- - cpl_reap: rewrote to avoid using pointer after freeing it; now builds
- new coproc list on the fly while traversing the old one and sets the
- right values for coproc_list when done
-
- 11/12
- -----
-builtins/set.def
- - if neither -f nor -v supplied, don't allow a readonly function to
- be implicitly unset. Fixes bug reported by Jens Schmidt
- <jens.schmidt35@arcor.de>
-
-lib/readline/callback.c
- - change CALLBACK_READ_RETURN to clear signal handlers before returning
- from rl_callback_read_char so readline's signal handlers aren't
- installed when readline doesn't have control. Idea from Jan
- Kratochvil <jan.ktratochvil@redhat.com> and the GDB development
- team
-
-pcomplete.h
- - COPT_NOQUOTE: new complete/compgen option value
-
-builtins/complete.def
- - noquote: new complete/compgen option; will be used to disable
- filename completion quoting
-
-pcomplete.c
- - pcomp_set_readline_variables: pay attention to COPT_NOQUOTE; turns
- of rl_filename_quoting_desired if set; turns it on if unset (value
- is inverted, since default is on)
-
-doc/bash.1,lib/readline/doc/rluser.texi
- - document new -o noquote option to complete/compgen/compopt
-
-pathexp.c
- - quote_string_for_globbing: if QGLOB_REGEXP, make sure characters
- between brackets in an ERE bracket expression are not inappropriately
- quoted with backslashes. This is a pretty substantial change,
- should be stressed when opening bash up for alpha and beta tests.
- Fixes bug pointed out by Stephane Chazleas
- <stephane_chazelas@yahoo.fr>
-
-doc/{bash.1,bashref.texi}
- - document that regexp matches can be inconsistent when quoting
- characters in bracket expressions, since usual quoting characters
- lose their meaning within brackets
- - note that regular expression matching when the pattern is stored
- in a shell variable which is quoted for expansion causes string
- matching
-
-redir.h
- - RX_SAVEFD: new flag value; notes that a redirection denotes an
- fd used to save another even if it's not >= SHELL_FD_BASE
-
-redir.c
- - do_redirection_internal: when deciding whether or not to reset the
- close-on-exec flag on a restored file descriptor, trust the value
- of redirect->flags & RX_SAVCLEXEC even if the fd is < SHELL_FD_BASE
- if the RX_SAVEFD flag is set
- - add_undo_redirect: set the RX_SAVEFD flag if the file descriptor
- limit is such that the shell can't duplicate to a file descriptor
- >= 10. Fixes a limitation that tripped a coreutils test reported
- by Paul Eggert <eggert@cs.ucla.edu>
-
- 11/19
- -----
-doc/{bash.1,bashref.texi},lib/readline/doc/hsuser.texi
- - make it clear that bash runs HISTFILESIZE=$HISTSIZE after reading
- the startup files
- - make it clear that bash runs HISTSIZE=500 after reading the
- startup files
- - make it clear that setting HISTSIZE=0 causes commands to not be
- saved in the history list
- - make it clear that setting HISTFILESIZE=0 causes the history file
- to be truncated to zero size
-
-variables.c
- - sv_histsize: change so setting HISTSIZE to a value less than 0
- causes the history to be `unstifled'
- - sv_histsize: change so setting HISTFILESIZE to a value less than 0
- results in no file truncation
- - make it clear that numeric values less than 0 for HISTFILESIZE or
- HISTSIZE inhibit the usual functions
-
- 11/23
- -----
-parse.y
- - save_input_line_state: add missing `return ls' at the end, since the
- function is supposed to return its argument. Pointed out by
- Andreas Schwab <schwab@linux-m68k.org>
-
-builtins/read.def
- - skip over NUL bytes in input, as most modern shells seem to. Bug
- report by Matthew Story <matt@tablethotels.com>
-
-lib/readline/vi_mode.c
- - rl_vi_replace: set _rl_vi_last_key_before_insert to invoking key
-
- 11/25
- -----
-builtins/read.def
- - read_builtin: if xrealloc returns same pointer as first argument,
- don't bother with the remove_unwind_protect/add_unwind_protect pair
- - read_builtin: set a flag (`reading') around calls to zread/zreadc
- and readline()
- - sigalrm: change to set flag (`sigalrm_seen') and only longjmp if
- currently in read(2) (reading != 0)
- - CHECK_ALRM: new macro, checks sigalrm_seen and longjmps if non-zero,
- behavior of old SIGALRM catching function
- - read_builtin: call CHECK_ALRM in appropriate places while reading
- line of input. Fixes bug reported by Pierre Gaston
- <pierre.gaston@gmail.com>
-
-lib/readline/vi_mode.c
- - rl_vi_replace: initialize characters before printing characters in
- vi_replace_keymap to their default values in vi_insertion_keymap,
- since we're supposed to be in insert mode replacing characters
- - rl_vi_replace: call rl_vi_start_inserting to set last command to
- `R' for undo
- - rl_vi_replace: set _rl_vi_last_key_before_insert to `R' for future
- use by _rl_vi_done_inserting
- - vi_save_insert_buffer: new function, broke out code that copies text
- into vi_insert_buffer from _rl_vi_save_insert
- - _rl_vi_save_replace: new function, saves text modified by
- rl_vi_replace (using current point and vi_replace_count to figure
- it out) to vi_replace_buffer
- - _rl_vi_save_insert: call vi_save_insert_buffer
- - _rl_vi_done_inserting: if _rl_vi_last_key_before_insert == 'R', call
- _rl_vi_save_replace to save text modified in replace mode (uses
- vi_save_insert_buffer)
- - _rl_vi_replace_insert: new function, replaces the number of chars
- in vi_insert_buffer after rl_point with contents ov vi_insert_buffer
- - rl_vi_redo: call _rl_vi_replace_insert if last command == 'R' and
- there's something in vi_insert_buffer. Fixes bug with `.' not
- redoing the most recent `R' command, reported by Geoff Clare
- <g.clare@opengroup.org> in readline area on savannah
-
- 11/26
- -----
-lib/readline/rlprivate.h
- - RL_SIG_RECEIVED(): evaluate to non-zero if there is a pending signal
- to be handled
- - RL_SIGINT_RECEIVED(): evaluate to non-zero if there is a pending
- SIGINT to be handled
-
-lib/readline/complete.c
- - remove all mention of _rl_interrupt_immediately
- - rl_completion_matches: check RL_SIG_RECEIVED after each call to
- the entry function, call RL_CHECK_SIGNALS if true to handle the
- signal
- - rl_completion_matches: if RL_SIG_RECEIVED evaluates to true, free
- and zero out the match_list this function allocated
- - rl_completion_matches: if the completion entry function is
- rl_filename_completion_function, free the contents of match_list,
- because that function does not keep state and will not free the
- entries; avoids possible memory leak pointed out by
- Garrett Cooper <yanegomi@gmail.com>
- - gen_completion_matches: if RL_SIG_RECEIVED evalutes to true after
- calling rl_attempted_completion_function, free the returned match
- list and handle the signal with RL_CHECK_SIGNALS; avoids
- possible memory leak pointed out by Garrett Cooper
- <yanegomi@gmail.com>
- - gen_completion_matches: if RL_SIG_RECEIVED evaluates to true after
- calling rl_completion_matches, free the returned match list and
- handle the signal with RL_CHECK_SIGNALS
-
-lib/readline/util.c
- - rl_settracefp: new utility function to set the tracing FILE *
-
-lib/readline/signals.c
- - _rl_sigcleanup: pointer to a function that will be called with the
- signal and a void * argument from _rl_handle_signal
- - _rl_sigcleanarg: void * that the rest of the code can set to have
- passed to the signal cleanup function
- - _rl_handle_signal: if _rl_sigcleanup set, call as
- (*_rl_sigcleanup) (sig, _rl_sigcleanarg)
-
-lib/readline/rlprivate.h
- - extern declarations for _rl_sigcleanup and _rl_sigcleanarg
-
-lib/readline/complete.c
- - _rl_complete_sigcleanup: signal cleanup function for completion code;
- calls _rl_free_match_list on _rl_sigcleanarg if signal == SIGINT
- - rl_complete_internal: before calling display_matches if what_to_do
- == `?', set _rl_sigcleanup to _rl_complete_sigcleanup so the match
- list gets freed on SIGINT; avoids possible memory leak pointed out
- by Garrett Cooper <yanegomi@gmail.com>
- - rl_complete_internal: in default switch case, call _rl_free_match_list
- before returning to avoid memory leak
-
-doc/bashref.texi
- - start at a set of examples for the =~ regular expression matching
- operator, touching on keeping the pattern in a shell variable and
- quoting portions of the pattern to remove their special meaning
-
- 12/1
- ----
-lib/glob/gmisc.c
- - extglob_pattern: new function, returns 1 if pattern passed as an
- argument looks like an extended globbing pattern
-
-lib/glob/glob.c
- - skipname: return 0 immediately if extglob_pattern returns non-zero,
- let the extended globbing code do the right thing with skipping
- names beginning with a `.'
- - mbskipname: return 0 immediately if extglob_pattern returns non-zero,
- let the extended globbing code do the right thing with skipping
- names beginning with a `.'. Fixes bug reported by Yongzhi Pan
- <panyongzhi@gmail.com>
-
- 12/2
- ----
-lib/glob/smatch.c
- - patscan, patscan_wc: no longer static so other parts of the glob
- library can use them, renamed to glob_patscan, glob_patscan_wc
-
-lib/glob/glob.c
- - extern declarations for glob_patscan, glob_patscan_wc
- - wchkname: new function, does skipname on wchar_t pattern and dname,
- old body of mbskipname after converting to wide chars
- - extglob_skipname: new function, checks all subpatterns in an extglob
- pattern to determine whether or not a filename should be skipped.
- Calls skipname for each subpattern. Dname is only skipped if all
- subpatterns indicate it should be. Better fix for bug reported by
- Yongzhi Pan <panyongzhi@gmail.com>
- - wextglob_skipname: wide-char version of extglob_skipname, calls
- wchkname instead of calling back into mbskipname for each
- subpattern to avoid problems with char/wchar_t mismatch
- - skipname: call extglob_skipname if extglob_pattern returns non-zero
- - mbskipname: call wextglob_skipname if extglob_pattern returns non-zero
- - mbskipname: short-circuit immediately if no multibyte chars in
- pattern or filename
-
-execute_cmd.c
- - execute_cond_node: added parens to patmatch assignment statement to
- make intent clearer
-
- 12/3
- ----
-configure.in,config.h.in
- - check for imaxdiv, define HAVE_IMAXDIV if present
-
-expr.c
- - expassign, exp2: use imaxdiv if available. Doesn't help with checks
- for overflow from 10/25
-
- 12/6
- ----
-lib/readline/complete.c
- - compute_lcd_of_matches: if we're ignoring case in the matches, only
- use what the user typed as the lcd if it matches the first match
- (after sorting) up to the length of what was typed (if what the
- user typed is longer than the shortest of the possible matches, use
- the shortest common length of the matches instead). If it doesn't
- match, use the first of the list of matches, as if case were not
- being ignored. Fixes bug reported by Clark Wang
- <dearvoid@gmail.com>
-
- 12/7
- ----
-builtins/cd.def
- - cd_builtin: add code to return error in case cd has more than one
- non-option argument, conditional on CD_COMPLAINS define (which is
- not defined anywhere)
-
-doc/{bash.1,bashref.texi}
- - note that additional arguments to cd following the directory name
- are ignored. Suggested by Vaclav Hanzl <hanzl@noel.feld.cvut.cz>
-
- 12/10
- -----
-lib/readline/input.c
- - rl_read_key: don't need to increment key sequence length here; doing
- it leads to an off-by-one error
-
-lib/readline/macro.c
- - rl_end_kbd_macro: after off-by-one error with rl_key_sequence_length
- fixed, can decrement current_macro_index by rl_key_sequence_length
- (length of key sequence that closes keyboard macro)
-
-lib/readline/readline.c
- - _rl_dispatch_subseq: fix extra increment of rl_key_sequence_length
- when ESC maps to a new keymap and we're converting meta characters
- to ESC+key
- - _rl_dispatch_subseq: better increment of rl_key_sequence_length
- before we dispatch to a function in the ISFUNC case (where the
- second increment above should have happened)
- - rl_executing_keyseq: the full key sequence that ended up executing
- a readline command. Available to the calling application, maintained
- by _rl_dispatch_subseq, indexed by rl_key_sequence_length
- - rl_executing_key: the key that was bound to the currently-executing
- readline command. Same as the `key' argument to the function
-
-lib/readline/readline.h
- - rl_executing_keyseq: extern declaration
- - rl_executing_key: extern declaration
- - rl_key_sequence_length: declaration moved here from rlprivate.h,
- now part of public interface
-
-lib/readline/rlprivate.h
- - new extern declaration for _rl_executing_keyseq_size, buffer size
- for rl_executing_keyseq
-
-lib/readline/doc/rltech.texi
- - documented new variables: rl_executing_key, rl_executing_keyseq,
- rl_key_sequence_length
-
- 12/13
- -----
-bashline.c
- - bash_execute_unix_command: replace ad-hoc code that searches
- cmd_xmap for correct command with call to rl_function_of_keyseq
- using rl_executing_keyseq; now supports key sequences longer
- than two characters. Fixes bug reported by Michael Kazior
- <kazikcz@gmail.com>
-
- 12/15
- -----
-make_cmd.c
- - make_function_def: don't null out source_file before calling
- make_command so it can be used later on when the function definition
- is executed
-
-execute_cmd.c
- - execute_intern_function: second argument is now FUNCTION_DEF *
- instead of COMMAND *
- - execute_command_internal: call execute_intern_function with the
- new second argument (the entire FUNCTION_DEF instead of just the
- command member)
- - execute_intern_function: if DEBUGGER is defined, call
- bind_function_def before calling bind_function, just like
- make_function_def does (might be able to take out the call in
- make_function_def depending on what the debugger does with it).
- Fixes bug reported by <dethrophes@motd005>
-
-expr.c
- - more minor changes to cases of INTMAX_MIN % -1 and INTMAX_MIN / 1;
- fix typos and logic errors
-
- 12/16
- -----
-bashline.c
- - find_cmd_start: change flags to remove SD_NOSKIPCMD so it skips over
- command substitutions and doesn't treat them as command separators
- - attempt_shell_completion: instead of taking first return from
- find_cmd_name as command name to use for programmable completion,
- use loop to skip over assignment statements. Fixes problem reported
- by Raphael Droz <raphael.droz+floss@gmail.com>
- - attempt_shell_completion: if we don't find a command name but the
- command line is non-empty, assume the other words are all assignment
- statements and flag that point is in a command position so we can
- do command name completion
- - attempt_shell_completion: if the word being completed is the first
- word following a series of assignment statements, and the
- command line is non-empty, flag that point is in a command position
- so we can do command name completion
-
-lib/readline/history.c
- - history_get_time: atol -> strtol
-
- 12/18
- -----
-parse.y
- - parser_in_command_position: external interface to the
- command_token_position macro for use by other parts of the shell,
- like the completion mechanism
-
-externs.h
- - extern declaration for parser_in_command_position
-
- 12/19
- -----
-
-builtins/read.def
- - read_builtin: make sure all calls to bind_read_variable are passed
- a non-null string. Fixes bug reported by Dan Douglas
- <ormaaj@gmail.com>
-
-bashline.c
- - attempt_shell_completion: mark that we're in a command position if
- we're at the start of the line and the parser is ready to accept
- a reserved word or command name. Feature most recently suggested
- by Peng Yu <pengyu.ut@gmail.com>
-
- 12/21
- -----
-lib/readline/bind.c
- - _rl_escchar: return the character that would be backslash-escaped
- to denote the control character passed as an argument ('\n' -> 'n')
- - _rl_isescape: return 1 if character passed is one that has a
- backslash escape
- - _rl_untranslate_macro_value: new second argument: use_escapes, if
- non-zero translate to backslash escapes where possible instead of
- using straight \C-x for control character `x'. Change callers
- - _rl_untranslate_macro_value: now global
-
-lib/readline/rlprivate.h
- - _rl_untranslate_macro_value: extern declaration
-
-lib/readline/{macro.c,readline.h}
- - rl_print_last_kbd_macro: new bindable function, inspired by patch
- from Mitchel Humpherys
-
-lib/readline/funmap.c
- - print-last-kbd-macro: new bindable command, bound to
- rl_print_last_kbd_macro
-
-lib/readline/doc/{rluser.texi,readline.3},doc/bash.1
- - print-last-kbd-macro: document.
-
-lib/readline/text.c
- - _rl_insert_next: if we're defining a macro, make sure the key gets
- added to the macro text (should really audit calls to rl_read_key()
- and make sure the right thing is happening for all of them)
-
-bashline.[ch]
- - print_unix_command_map: new function, prints all bound commands in
- cmd_xmap using rl_macro_dumper in a reusable format
-
-builtins/bind.def
- - new -X option: print all keysequences bound to Unix commands using
- print_unix_command_map. Feature suggested by Dennis Williamson
- (2/2011)
-
-doc/{bash.1,bashref.texi}
- - document new `bind -X' option
-
- 12/24
- -----
-
-doc/{bash.1,bashref.texi}
- - add a couple of sentences to the description of the case modification
- operators making it clearer that each character of parameter is
- tested against the pattern, and that the pattern should only attempt
- to match a single character. Suggested by Bill Gradwohl
- <bill@ycc.com>
-
- 12/28
- -----
-shell.c
- - init_noninteractive: instead of calling set_job_control(0) to
- unconditionally turn off job control, turn on job control if
- forced_interactive or jobs_m_flag is set
- - shell_initialize: call initialize_job_control with jobs_m_flag as
- argument so `bash -m script' enables job control while running the
- script
-
-jobs.c
- - initialize_job_control: if the `force' argument is non-zero, turn on
- job control even if the shell is not currently interactive
- (interactive == 0)
-
- 12/29
- -----
-
-flags.h
- - new extern declaration for jobs_m_flag
-
-builtins/{cd,set}.def,doc/{bash.1,bashref.texi}
- - added text clarifying the descriptions of cd -L and -P, suggested by
- Padraig Brady <p@draigbrady.com>
- - slight change to the description of `set -P' about resolving symbolic
- links
-
-lib/readline/doc/rluser.texi
- - Added an example to the programmable completion section: _comp_cd,
- a completion function for cd, with additional verbiage. Text
- includes a reference to the bash_completion project
-
- 1/1/2012
- --------
-jobs.c
- - set_job_status_and_cleanup: note that a job is stopped due to
- SIGTSTP (any_tstped) if job_control is set; there's no need to
- test interactive
-
- 1/5
- ---
-quit.h
- - LASTSIG(): new macro, expands to signal number of last terminating
- signal received (terminating_signal or SIGINT)
-
-trap.c
- - first_pending_trap: returns lowest signal number with a trap pending
- - trapped_signal_received: set to the last trapped signal the shell
- received in trap_handler(); reset to 0 in run_pending_traps
-
-builtins/read.def
- - read_builtin: changes to posix-mode (posixly_correct != 0) to make
- `read' interruptible by a trapped signal. After the trap runs,
- read returns 128+sig and does not assign the partially-read line
- to the named variable(s). From an austin-group discussion started
- by David Korn
-
- 1/11
- ----
-doc/{bash.1,bashref.texi}
- - slight changes to the descriptions of the compat32 and compat40 shell
- options to clarify their meaning
-
- 1/12
- ----
-lib/readline/{colors.[ch],parse-colors.[ch]}
- - new files, part of color infrastructure support
-
-Makefile.in,lib/readline/Makefile.in
- - arrange to have colors.o and parse-colors.o added to readline
- library
-
-{configure,config.h}.in
- - check for stdbool.h, define HAVE_STDBOOL_H if found
-
- 1/14
- ----
-lib/readline/bind.c
- - colored_stats: new bindable variable, enables using colors to
- indicate file type when listing completions
-
-lib/readline/complete.c
- - _rl_colored_stats: new variable, controlled by colored-stats bindable
- variable
- - colored_stat_start, colored_stat_end: new functions to set and reset
- the terminal color appropriately depending on the type of the
- filename to be printed
- - print_filename: changes to print colors if `colored-stats' variable
- set. Changes contributed by Raphael Droz
- <raphael.droz+floss@gmail.com>
-
-lib/readline/readline.c
- - rl_initialize_everything: add call to _rl_parse_colors to parse
- color values out of $LS_COLORS. May have to add to rl_initialize
- to make more dynamic if LS_COLORS changes (which doesn't happen
- very often, if at all)
-
-lib/readline/rlprivate.h
- - _rl_colored_stats: new extern declaration
-
-lib/readline/doc/{readline.3,rluser.texi},doc/bash.1
- - colored-stats: document new bindable readline variable
-
-lib/readline/colors.c
- - _rl_print_color_indicator: call rl_filename_stat_hook before calling
- lstat/stat so we can get color indicators for stuff like
- $HOME/Applications
-
-lib/readline/complete.c
- - stat_char: call rl_filename_stat_hook before calling lstat/stat
-
-findcmd.[ch],execute_cmd.c
- - search_for_command: now takes a second `flags' argument; changed
- header function prototype and callers
- - search_for_command: if (flags & 1), put the command found in $PATH
- into the command hash table (previous default behavior)
-
-execute_cmd.c
- - is_dirname: call search_for_command with flags argument of 0 so it
- doesn't try to put something in the command hash table
-
-bashline.c
- - bash_command_name_stat_hook: a hook function for readline's
- filename_stat_hook that does $PATH searching the same way that
- execute_cmd.c:execute_disk_command() does it, and rewrites the
- passed filename if found. Does not put names into command hash
- table. This allows command name completion to take advantage
- of `visible-stats' and `colored-stats' settings.
- - executable_completion: new function, calls the directory completion
- hook to expand the filename before calling executable_file or
- executable_or_directory; change command_word_completion_function to
- call executable_completion. This allows $HOME/bin/[TAB] to do
- command completion and display alternatives
-
- 1/17
- ----
-pcomplete.c
- - gen_command_matches: now takes a new second argument: the command
- name as deciphered by the programmable completion code and used
- to look up the compspec; changed callers (gen_compspec_completions)
- - gen_shell_function_matches: now takes a new second argument: the
- command that originally caused the completion function to be
- invoked; changed callers (gen_compspec_completions))
- - build_arg_list: now takes a new second argument: the command name
- corresponding to the current compspec; changed callers
- (gen_command_matches, gen_shell_function_matches)
- - build_arg_list: now uses `cmd' argument to create $1 passed to
- invoked command or shell function
- - gen_compspec_completions: if we skipped a null command at the
- beginning of the line (e.g., for completing `>'), add a new word for
- it at the beginning of the word list and increment nw and cw
- appropriately. This is all a partial fix for the shortcoming
- pointed out by Sung Pae <sungpae@gmail.com>
-
- 1/18
- ----
-
-{configure,config.h}.in
- - new check: check for AUDIT_USER_TTY defined in <linux/audit.h>,
- define HAVE_DECL_AUDIT_USER_TTY if both are found
-
-lib/readline/rlconf.h
- - ENABLE_TTY_AUDIT_SUPPORT: new define, allows use of the Linux kernel
- tty auditing system if it's available and enabled
-
-lib/readline/util.c
- - _rl_audit_tty: new function, send a string to the kernel tty audit
- system
-
-lib/readline/rlprivate.h
- - _rl_audit_tty: new extern declaration
-
-lib/readline/readline.c
- - readline: call _rl_audit_tty with line to be returned before returning
- it if the Linux tty audit system is available and it's been enabled
- in rlconf.h Original patch from Miroslav Trmac; recent request
- from Miroslav Lichvar <mlichvar@redhat.com>
-
- 1/21
- ----
-
-lib/readline/readline.c:
- - _rl_dispatch_subseq: add an inter-character timeout for multi-char
- key sequences. Suggested by <rogerx.oss@gmail.com>. Still needs
- work to make a user-settable variable
-
-parse.y
- - shell_getc: make code that uses the pop_alias dependent on ALIAS
- define
-
-variables.h
- - sv_tz: extern define should only depend on HAVE_TZSET
-
-expr.c
- - expr_streval: if ARRAY_VARS is not defined, set lvalue->ind to -1;
- move assignment to `ind' inside define
- - expr_bind_array_element: declaration and uses need to be #ifdef
- ARRAY_VARS
-
-arrayfunc.h
- - AV_ALLOWALL, AV_QUOTED, AV_USEIND: define to 0 if ARRAY_VARS not
- defined; used in subst.c unconditionally
-
-sig.h
- - make the signal blocking functions not dependent on JOB_CONTROL
-
-sig.c
- - sigprocmask: make the replacement definition not dependent on
- JOB_CONTROL
-
-trap.c
- - use BLOCK_SIGNAL/UNBLOCK_SIGNAL instead of code dependent on
- HAVE_POSIX_SIGNALS and BSD signals
-
- 1/24
- ----
-
-print_cmd.c
- - print_redirection_list: change the conditions under which
- r_duplicating_output_word is mapped to r_err_and_out to more or
- less match those used in redir.c. Fixes bug pointed out by
- Dan Douglas <ormaaj@gmail.com>
-
-
- 1/29
- ----
-lib/readline/signals.c
- - _rl_block_sigwinch,_rl_release_sigwinch: don't compile in bodies
- unless SIGWINCH is defined. Fixes bug reported by Pierre Muller
- <pierre.muller@ics-cnrs.unistra.fr>
-
-doc/{bash.1,bashref.texi}
- - small modifications to the introduction to the REDIRECTION section
- to describe how redirections can modify file handles
- - small modification to the section describing base#n to make it
- clearer that n can be denoted using non-numerics. From a posting
- by Linda Walsh <bash@tlinx.org>
-
- 2/2
- ---
-builtins/printf.def
- - printf_builtin: make sure vbuf is intialized and non-null when -v
- is supplied, since other parts of the code assume that it's not
- null (e.g., bind_printf_variable()). Fixes bug reported by Jim
- Avera <james_avera@yahoo.com>
-
- 2/4
- ---
-lib/readline/undo.c
- - _rl_free_undo_list: new function, old body of rl_free_undo_list,
- frees undo entries in UNDO_LIST * passed as argument
- - rl_free_undo_list: call _rl_free_undo_list
-
-lib/readline/rlprivate.h
- - _rl_free_undo_list: new extern declaration
- - _rl_keyseq_timeout: new extern declaration (see below)
-
-lib/readline/misc.c
- - rl_clear_history: new function. Clears the history list and frees
- all associated data similar to history.c:clear_history(), but
- takes rl_undo_list into account and frees and UNDO_LISTs saved as
- `data' members of a history list entry
-
-lib/readline/doc/rltech.texi
- - rl_clear_history: documented
-
-lib/readline/readline.c
- - _rl_keyseq_timeout: new variable to hold intra-key timeout value
- from 1/21 fix; specified in milliseconds. Default value is 500
- - _rl_dispatch_subseq: change to use _rl_keyseq_timeout as intra-key
- timeout if it's greater than 0; no timeout if <= 0
- - _rl_dispatch_subseq: don't check for queued keyboard input if we have
- pushed or pending input, or if we're reading input from a macro
-
-lib/readline/bind.c
- - keyseq-timeout: new bindable variable, shadows _rl_keyseq_timeout
- - string_varlist: add keyseq-timeout
- - sv_seqtimeout: new function to modify value of _rl_keyseq_timeout;
- clamps negative values at 0 for now
- - _rl_get_string_variable_value: return value for keyseq-timeout
-
-doc/bash.1,lib/readline/doc/{rluser.texi,readline.3}
- - keyseq-timeout: documented
-
-lib/readline/isearch.c
- - _rl_isearch_dispatch: modification to fix from 7/18 to not use
- cxt->keymap and cxt->okeymap, since by the time this code is
- executed, they are equal. Use `f' to check for rl_insert or
- unbound func
- - _rl_isearch_dispatch: if we're switching keymaps, not in
- callback mode, and don't have pending or pushed input, use
- _rl_input_queued to resolve a potentially ambiguous key sequence.
- Suggested by Roger Zauner <rogerx.oss@gmail.com>
- - _rl_isearch_dispatch: if we have changed keymaps and resolved to
- an editing function (not self-insert), make sure we stuff the
- right characters back onto the input after changing the keymap
- back so the right editing function is executed after the search
- is terminated. Rest of fix for bug reported by Roger Zauner
- <rogerx.oss@gmail.com>
-
- 2/5
- ---
-builtins/gen-helpfiles.c
- - new file: reads struct builtin and writes the long docs to files
- in the `helpdirs' subdirectory. The filename is given in the
- previously-unused `handle' member of the struct builtin. Links
- with `tmpbuiltins.o', which is created by Makefile to have the
- right long documentation. When not cross-compiling, gets the
- right #defines based on configuration options from config.h instead
- of trying to parse conditional parts of def files. Fixes
- shortcoming pointed out by Andreas Schwab <schwab@linux-m68k.org>
-
-builtins/Makefile.in
- - tmpbuiltins.c: new generated file, created to enable creation of
- separate helpfiles based on correct #defines instead of trying to
- parse conditional parts of def files
- - gen-helpfiles: new program to generate helpfiles, links with
- tmpbuiltins.o
- - HELPFILES_TARGET: new target, substituted by configure to `helpdoc'
- if separate helpfiles requested
- - targets: new target, libbuiltins.a and $(HELPFILES_TARGET)
- - CREATED_OBJECTS: new variable, holds created object files for
- make clean; changed make clean to remove created objects
- - helpdoc: changed to call gen-helpfiles instead of mkbuiltins
-
-Makefile.in
- - when building libbuiltins.a, recursively call make with `targets'
- argument to make sure separate helpfiles get built
-
-configure.in
- - substitute `helpdoc' as value of HELPFILES_TARGET if
- --enable-separate-helpfiles supplied as configure argument
-
-builtins/mkbuiltins.c
- - `-nofunctions': new argument, causes mkbuiltins to not write value
- for function implementing a particular builtin to struct builtin
- and to write document file name to `handle' member of struct builtin
- - no longer writes separate helpfiles; that is left to gen-helpfiles
-
- 2/8
- ---
-subst.c
- - make sure last_command_exit_value is set to a non-zero value before
- any calls to report_error, since `-e' set will short-circuit
- report_error. Fixes bug reported by Ewan Mellor
- <Ewan.Mellor@eu.citrix.com>
-
-variables.c
- - make_local_array_variable: added second argument; if non-zero,
- function will return an existing local associative array variable
- instead of insisting on an indexed array
-
-variable.h,subst.c
- - make_local_array_variable: changed prototype and caller
-
-builtins/declare.def
- - declare_internal: add second arg to call to make_local_array_variable;
- making_array_special, which indicates we're processing an
- assignment like declare a[b]=c. Fixes seg fault resulting from
- a being an already-declared local associative array variable in a
- function. Ubuntu bash bug 928900.
-
- 2/14
- ----
-
-execute_cmd.c
- - execute_command_internal: if redirections into or out of a loop fail,
- don't try to free ofifo_list unless saved_fifo is non-zero. It's
- only valid if saved_fifo is set
-
- 2/15
- ----
-{arrayfunc,braces,variables}.c
- - last_command_exit_value: make sure it's set before any calls to
- report_error, since -e will cause that to exit the shell
-
-builtins/common.c
- - get_job_by_name: call internal_error instead of report_error so this
- doesn't exit the shell
-
- 2/18
- ----
-builtins/evalstring.c
- - parse_and_execute: make sure the file descriptor to be redirected to
- is 1 before calling cat_file. One fix for bug reported by Dan Douglas
- <ormaaj@gmail.com>
-
-parse.y
- - read_token_word: don't return NUMBER if a string of all digits
- resolves to a number that overflows the bounds of an intmax_t.
- Other fix for bug reported by Dan Douglas <ormaaj@gmail.com>
-
- 2/19
- ----
-lib/sh/strtrans.c
- - ansicstr: use 0x7f as the boundary for characters that translate
- directly from ASCII to unicode (\u and \U escapes) instead of
- UCHAR_MAX, since everything >= 0x80 requires more than one byte.
- Bug and fix from John Kearney <dethrophes@web.de>
-
-builtins/printf.def
- - tescape: ditto for printf \u and \U escape sequences
-
- 2/20
- ----
-lib/sh/unicode.c
- - u32toutf8: fix to handle encodings up to six bytes long correctly
- (though technically UTF-8 only has characters up to 4 bytes long).
- Report and fix from John Kearney <dethrophes@web.de>
- - u32toutf8: first argument is now an unsigned 32-bit quantity,
- changed callers (u32cconv) to pass c instead of wc
- - u32reset: new function, resets local static state to uninitialized
- (locale information, currently)
-
-locale.c
- - call u32reset whenever LC_CTYPE/LC_ALL/LANG is changed to reset the
- cached locale information used by u32cconv. From a report from
- John Kearney <dethrophes@web.de>
-
- 2/21
- ----
-doc/{bash,builtins}.1
- - minor changes from Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
-
-lib/sh/unicode.c
- - u32cconv: only assume you can directly call wctomb on the passed
- value if __STDC_ISO_10646__ is defined and the value is <=
- 0x7fffffff
- - stub_charset: return locale as default instead of "ASCII", let
- rest of code decide what to do with it
-
-lib/readline/parens.c
- - _rl_enable_paren_matching: make paren matching work in vi insert
- mode. Bug report from <derflob@derflob.de>
-
- 2/22
- ----
-lib/sh/shquote.c
- - sh_backslash_quote: quote tilde in places where it would be
- expanded. From a report from John Kearney <dethrophes@web.de>
-
- 2/23
- ----
-execute_cmd.c
- - execute_pipeline: wrap the discard_unwind_frame call in #ifdef
- JOB_CONTROL, since the frame is only created if JOB_CONTROL is
- defined. Bug and fix from Doug Kehn <rdkehn@yahoo.com>
-
- 2/25
- ----
-error.c
- - report_error: make sure last_command_exit_value is non-zero before
- we call exit_shell, since the exit trap may reference it. Call
- exit_shell with last_command_exit_value to allow exit statuses
- other than 1
-
-unicode.c
- - stub_charset: use local static buffer to hold charset, don't change
- value returned by get_locale_var. Based on idea and code from
- John Kearney <dethrophes@web.de>
- - u32toutf16: function to convert unsigned 32-bit value (unicode) to
- UTF-16. From John Kearney <dethrophes@web.de>
- - u32cconv: call u32toutf16 if __STDC_ISO_10646__ defined and wchar_t
- is two bytes, send result to wcstombs, return if not encoding error.
- From John Kearney <dethrophes@web.de>
- - u32cconv: return UTF-8 conversion if iconv conversion to local
- charset is unsupported
-
- 3/2
- ---
-lib/readline/complete.c
- - print_filename: if there is no directory hook, but there is a stat
- hook, and we want to append a slash to directories, call the stat
- hook before calling path_isdir on the expanded directory name.
- Report and pointer to fix from Steve Rago <sar@nec-labs.com>
-
- 3/3
- ---
-builtins/evalstring.c
- - parse_and_execute: fix to change of 2/18: make sure the file
- descriptor being redirected to is 0 before calling cat_file when
- we see something like $(< file). Real fix for bug reported by
- Dan Douglas <ormaaj@gmail.com>
-
-subst.c
- - parameter_brace_patsub: run the replacement string through quote
- removal even if the expansion is within double quotes, because
- the parser and string extract functions treat the quotes and
- backslashes as special. If they're treated as special, quote
- removal should remove them (this is the Posix position and
- compatible with ksh93). THIS IS NOT BACKWARDS COMPATIBLE.
-
- 3/4
- ---
-lib/readline/complete.c
- - rl_menu_complete: fix to make show-all-if-ambiguous and
- menu-complete-display-prefix work together if both are set. Fix
- from Sami Pietila <sami.pietila@gmail.com>
-
- 3/5
- ---
-bashline.c
- - dircomplete_expand_relpath: new variable, if non-zero, means that
- `shopt -s direxpand' should expand relative pathnames. Zero by
- default, not user-settable yet
- - bash_directory_completion_hook: if we have a relative pathname that
- isn't changed by canonicalization or spell checking after being
- appended to $PWD, then don't change what the user typed. Controlled
- by dircomplete_expand_relpath
-
- 3/7
- ---
-m4/timespec.m4
- - new macros, cribbed from gnulib and coreutils: find out whether we
- have `struct timespec' and what file includes it
-
-m4/stat-time.m4
- - new macros, cribbed from gnulib and coreutils: find out whether the
- mtime/atime/ctime/etctime fields of struct stat are of type
- struct timespec, and what the name is
-
-include/stat-time.h
- - new file, cribbed from gnulib, with additions from coreutils: include
- the right file to get the struct timespec define, or provide our own
- replacement. Provides a bunch of inline functions to turn the
- appropriate members of struct stat into `struct timespec' values,
- zeroing out the tv_nsec field if necessary
-
-test.c
- - include "stat-time.h" for the nanosecond timestamp resolution stuff
- - stat_mtime: new function, returns struct stat and the mod time
- normalized into a `struct timespec' for the filename passed as the
- first argument
- - filecomp: call stat_mtime instead of sh_stat for each filename
- argument to get the mtime as a struct timespec
- - filecomp: call timespec_cmp instead of using a straight arithmetic
- comparison for the -nt and -ot operators, using timespec returned by
- stat_mtime. Added functionality requested by by Werner Fink
- <werner@suse.de> for systems that can support it
-
- 3/10
- ----
-include/posixdir.h
- - REAL_DIR_ENTRY: remove dependency on _POSIX_SOURCE, only use feature
- test macros to decide whether dirent.d_ino is present and usable;
- define D_INO_AVAILABLE. Report and fix from Fabrizion Gennari
- <fabrizio.ge@tiscali.it>
- - D_FILENO_AVAILABLE: define if we can use dirent.d_fileno
-
-lib/sh/getcwd.c
- - use D_FILENO_AVAILABLE to decide whether or not to compile in
- _path_checkino and whether or not to call it. Report and initial
- fix from Fabrizion Gennari <fabrizio.ge@tiscali.it>
-
-lib/readline/signals.c
- - make sure all occurrences of SIGWINCH are protected by #ifdef
-
-sig.c
- - make sure all occurrences of SIGCHLD are protected by #ifdef
-
-nojobs.c
- - make sure SA_RESTART is defined to 0 if the OS doesn't define it
-
-version.c
- - show_shell_version: don't use string literals in printf, use %s.
- Has added benefit of removing newline from string to be translated
-
-trap.c
- - queue_sigchld_trap: new function, increments the number of pending
- SIGCHLD signals by the argument, which is by convention the number
- of children reaped in a call to waitchld()
-
-trap.h
- - queue_sigchld_trap: new extern declaration
-
-jobs.c
- - waitchld: if called from the SIGCHLD signal handler (sigchld > 0),
- then call queue_sigchld_trap to avoid running the trap in a signal
- handler context. Report and original fix from Siddhesh Poyarekar
- <siddhesh@redhat.com>
-
-lib/sh/unicode.c
- - u32tocesc: take an unsigned 32-bit quantity and encode it using
- ISO C99 string notation (\u/\U)
- - u32cconv: call u32tocesc as a fallback instead of u32cchar
- - u32cconv: call u32tocesc if iconv cannot convert the character.
- Maybe do the same thing if iconv_open fails
- - u32reset: call iconv_close on localconv if u32init == 1
-
- 3/11
- ----
-config-top.h
- - CHECKWINSIZE_DEFAULT: new define, set to initial value of
- check_window_size (shopt checkwinsize): 0 for off, 1 for on.
- Default is 0
-
-{jobs,nojobs}.c
- - check_window_size: default initial value to CHECKWINSIZE_DEFAULT
-
- 3/13
- ----
-doc/bashref.texi
- - change text referring to the copying restrictions to that
- recommended by the FSF (no Front-Cover Texts and no Back-Cover
- Texts)
-
-lib/readline/doc/{history,rlman,rluserman}.texi
- - change text referring to the copying restrictions to that
- recommended by the FSF (no Front-Cover Texts and no Back-Cover
- Texts)
-
- 3/15
- ----
-array.c
- - LASTREF_START: new macro to set the starting position for an array
- traversal to `lastref' if that's valid, and to the start of the array
- if not. Used in array_reference, array_insert, array_remove
- - array_remove: try to be a little smarter with lastref instead of
- unconditionally invalidating it
-
- 3/16
- ----
-array.c
- - array_insert: fix memory leak by deleting element to be added in the
- case of an error
-
- 3/18
- ----
-lib/sh/mbschr.c
- - mbschr: don't call mbrlen unless is_basic is false; devolves to a
- straight character-by-character run through the string
-
- 3/19
- ----
-stringlib.c
- - substring: use memcpy instead of strncpy, since we know the length
- and are going to add our own NUL terminator
-
- 3/20
- ----
-subst.c
- - parameter_brace_expand_rhs: if expand_string_for_rhs returns a quoted
- null string (a list with one element for which
- QUOTED_NULL(list->word->word) returns true), return the quoted null
- and set the flags in the returned word to indicate it. Fixes bug
- reported by Mark Edgar <medgar123@gmail.com>
-
-lib/sh/tmpfile.c
- - use random(3) instead of get_random_number to avoid perturbing the
- random sequence you get using $RANDOM. Bug report and fix from
- Jurij Mihelic <jurij.mihelic@fri.uni-lj.si>
-
- 3/21
- ----
-config-top.h
- - OPTIMIZE_SEQUENTIAL_ARRAY_ASSIGNMENT: define to 1 to optimize
- sequential indexed array assignment patterns. Defined to 1 by
- default
-
-array.c
- - array_insert: if OPTIMIZE_SEQUENTIAL_ARRAY_ASSIGNMENT is defined,
- start the search at lastref (see change from 3/15)
-
- 3/27
- ----
-print_cmd.c
- - debug_print_word_list: new debugging function, prints a word list
- preceded by an optional string and using a caller-specified
- separator
-
- 4/1
- ---
-command.h
- - W_ASSNGLOBAL: new flag, set to indicate declare -g
-
-execute_cmd.c
- - fix_assignment_words: note that we have a -g argument to an assignment
- builtin and set the W_ASSNGLOBAL flag in the variable word
-
-subst.c
- - dump_word_flags: print out W_ASSNGLOBAL if present
- - do_assignment_internal: only set ASS_MKLOCAL if W_ASSIGNARG is set
- and W_ASSNGLOBAL is not. Don't want to create a local variable even
- if variable_context is non-zero if ASSNGLOBAL is set. Fixes bug
- reported by Bill Gradwohl <bill@ycc.com>
-
- 4/7
- ---
-lib/readline/readline.c
- - _rl_dispatch_subseq: make the `keyseq-timeout' variable apply to
- ESC processing when in vi mode. After hitting ESC, readline will
- wait up to _rl_keyseq_timeout*1000 microseconds (if set) for
- additional input before dispatching on the ESC and switching to
- command/movement mode. Completes timeout work suggested by
- <rogerx.oss@gmail.com>; this prompted by report from Barry Downes
- <barry.downes@gmail.com>
-
-lib/sh/shmbchar.c
- - sh_mbsnlen: new function, returns the number of (possibly multibyte)
- characters in a passed string with a passed length, examining at most
- maxlen (third argument) bytes
-
-externs.h
- - sh_mbsnlen: extern declaration for new function
-
-shell.c
- - exit_shell: call maybe_save_shell_history if remember_on_history is
- set, not just in interactive shells. That means the history is
- saved if history is enabled, regardless of whether or not the shell
- is interactive
-
-doc/{bash.1,bashref.texi}
- - TMOUT: fix description to make it explicit that TMOUT is the timeout
- period for a complete line of input, not just any input. Fixes
- problem reported in Ubuntu bug 957303:
- https://bugs.launchpad.net/ubuntu/+source/bash/+bug/957303
- - HISTFILE: document change to write history list to history file in
- any shell with history enabled, not just interactive shells. This
- seems to be more logical behavior. Suggested by Greg Wooledge
- <wooledg@eeg.ccf.org>
-
- 4/12
- ----
-lib/readline/colors.h
- - only include stdbool.h if HAVE_STDBOOL_H is defined
- - if HAVE_STDBOOL_H is not defined, provide enough definition for the
- library to use `bool', `true', and `false'
-
-lib/readline/parse-colors.[ch]
- - don't try to include <stdbool.h> at all; rely on colors.h to do it
-
-lib/sh/snprintf.c
- - vsnprintf_internal: only treat '0' as a flag to indicate zero padding
- if `.' hasn't been encountered ((flags&PF_DOT) == 0); otherwise treat
- it as the first digit of a precision specifier. Fixes bug reported
- by Petr Sumbera <petr.sumbera@sun.com>
-
- 4/15
- ----
-lib/sh/snprintf.c
- - vsnprintf_internal: if the '0' and '-' flags both occur, the '0'
- flag is ignored -- Posix. Start of a series of fixes based on
- tests and patches from Petr Sumbera <petr.sumbera@sun.com>
- - PUT_PLUS: make sure PF_PLUS flag is specified before putting the `+'
- - vsnprintf_internal: when '+' is read as a flag, don't set right-
- justify flag if the LADJUST (`-') flag has already been supplied
- - floating: make sure to output space padding before the `+', zero
- padding after
- - exponent: make sure to output space padding before the `+', zero
- padding after
- - exponent: only subtract one from the width for the decimal point
- if we're really going to print one
- - floating: use presence of PF_PLUS flag to decide whether to account
- for the `+' in the padded field width. Ditto for exponent()
-
- 4/16
- ----
-lib/sh/snprintf.c
- - vsnprint_internal: only reduce precision by 1 when processing the `g'
- format if it's > 0. A precision of 0 should stay 0; otherwise it
- gets set to -1 (NOT_FOUND) and converted to the default
- - number, lnumber: if an explicit precision is supplied, turn off the
- zero-padding flag and set the pad character back to space
- - number, lnumber: only account for a `+' when performing the field
- width calculation if the coversion is base 10; we don't add a `+'
- for other bases
-
- 4/18
- ----
-tests/printf3.sub
- - try using "perl -e 'print time'" to get the current time in seconds
- since the epoch if "date +%s" is not available (solaris 8-10)
-
- 4/19
- ----
-tests/run-printf
- - use cat -v instead of relying on diff -a being available to convert
- control characters to ascii and avoid the dreaded "Binary files
- /tmp/xx and printf.right differ"
-
- 4/20
- ----
-lib/sh/strftime.c
- - incoporated new version from Aharon Robbins <arnold@skeeve.com>
-
- 4/22
- ----
-doc/{bash.1,bashref.texi}
- - slight change to the description of /dev/tcp and /dev/udp
-
-subst.c
- - match_wpattern: logic fix to the calculation of `simple' (was |=,
- needs to be &=). Bug report from Mike Frysinger <vapier@gentoo.org>,
- fix from Andreas Schwab <schwab@linux-m68k.org>
-
-bashline.c
- - bash_filename_stat_hook: add code from bash_directory_completion_hook
- that performs pathname canonicalization in the same way that cd and
- other builtins will do
-
- 4/25
- ----
-execute_cmd.c
- - execute_pipeline: change the call to move_to_high_fd to make it use
- getdtablesize() and to not stomp on existing open file descriptors,
- like the fd the shell is using to read a script. Bug report from
- Greg Wooledge <wooledg@eeg.ccf.org>
-
- 5/6
- ---
-subst.c
- - expand_word_internal: case '$': after calling param_expand and
- setting had_quoted_null, set TEMP to null. The code that builds the
- returned string at the end of the function will take care of making
- and returning a quoted null string if there's nothing else in
- ISTRING. If there is, the quoted null should just go away. Part of
- fix for bug reported by Ruediger Kuhlmann <RKuhlmann@orga-systems.com>
- - expand_word_internal: when processing ISTRING to build return value,
- only set W_HASQUOTEDNULL in the returned word flags if the word is
- a quoted null string AND had_quoted_null is set. Rest of fix
-
- 5/9
- ---
-variables.c
- - bind_variable_internal: if we get an array variable here (implicit
- assignment to index 0), call make_array_variable_value, which
- dummies up a fake SHELL_VAR * from array[0]. This matters when
- we're appending and have to use the current value
- - bind_variable_internal: after computing the new value, treat assoc
- variables with higher precedence than simple array variables; it
- might be that a variable has both attributes set
-
-arrayfunc.c
- - bind_array_var_internal: break code out that handles creating the
- new value to be assigned to an array variable index into a new
- function, make_array_variable_value. This handles creating a
- dummy SHELL_VAR * for implicit array[0] assignment. Fixes bug
- reported by Dan Douglas <ormaaj@gmail.com>
-
-arrayfunc.h
- - make_array_variable_value: new extern declaration
-
- 5/19
- ----
-variables.c
- - bind_int_variable: if an assignment statement like x=y comes in
- from the expression evaluator, and x is an array, handle it like
- x[0]=y. Fixes bug reported by Dan Douglas <ormaaj@gmail.com>
-
- 5/24
- ----
-
-braces.c
- - mkseq: handle possible overflow and break the sequence generating
- loop if it occurs. Fixes OpenSUSE bug 763591:
- https://bugzilla.novell.com/show_bug.cgi?id=763591
-
- 5/25
- ----
-Makefile.in
- - LDFLAGS_FOR_BUILD: add to compilation recipes for build tools
- buildversion, mksignames, mksyntax
- - LDFLAGS_FOR_BUILD: add to compilation recipes for test tools
- recho, zecho, printenv, xcase
-
-builtins/Makefile.in
- - LDFLAGS_FOR_BUILD: add to compilation recipes for build tools
- gen-helpfiles, psize.aux
-
-variables.c
- - bind_int_variable: if LHS is a simple variable name without an array
- reference, but resolves to an array variable, call
- bind_array_variable with index 0 to make x=1 equivalent to x[0]=1.
- Fixes bug reported by Dan Douglas <ormaaj@gmail.com>
-
- 5/27
- ----
-subst.c
- - expand_word_internal: make sure has_dollar_at doesn't get reset before
- recursive calls to param_expand or expand_word_internal, since it has
- to save state of what came before. Use temp variable and make sure
- has_dollar_at is incremented if recursive call processes "$@".
- Fixes bug reported by gregrwm <backuppc-users@whitleymott.net> and
- supplemented by Dan Douglas <ormaaj@gmail.com>
-
-doc/{bash.1,bashref.texi}
- - changes to the description of substring expansion inspired by
- suggestions from Bill Gradwohl <bill@ycc.com>
-
-doc/bashref.texi
- - added substring expansion examples inspired by suggestions from
- Bill Gradwohl <bill@ycc.com>
-
-variables.c
- - find_shell_variable: search for a variable in the list of shell
- contexts, ignore the temporary environment
- - find_variable_tempenv: search for a variable in the list of shell
- contexts, force search of the temporary environment
- - find_variable_notempenv: search for a variable in the list of shell
- contexts, don't force search of the temporary environment
-
-variables.h
- - find_shell_variable: extern declaration
- - find_variable_tempenv: extern declaration
- - find_variable_notempenv: extern declaration
-
-arrayfunc.c
- - bind_array_variable: call find_shell_variable instead of calling
- var_lookup directly
-
-findcmd.c
- - search_for_command: call find_variable_tempenv instead of
- find_variable_internal directly
- - _find_user_command_internal: call find_variable_tempenv instead of
- find_variable_internal directly
-
-builtins/setattr.def
- - set_var_attribute: call find_variable_notempenv instead of
- find_variable_internal directly
- - show_name_attributes: call find_variable_tempenv instead of
- find_variable_internal directly
-
- 6/1
- ---
-sig.c
- - termsig_handler: don't try to save the shell history on a terminating
- signal any more, since it just causes too many problems on Linux
- systems using glibc and glibc malloc
-
-lib/readline/vi_mode.c
- - rl_vi_change_to: change to correctly redo `cc', since `c' is not a vi
- motion character. From Red Hat bug 813289
- - rl_vi_delete_to: change to correctly redo `dd', since `d' is not a vi
- motion character
- - rl_vi_yank_to: change to correctly redo `yy', since `y' is not a vi
- motion character
-
- 6/4
- ---
-lib/sh/mktime.c
- - current versions of VMS do not need to include <stddef.h>. Fix from
- John E. Malmberg <wb8tyw@qsl.net>
-
- 6/5
- ---
-lib/sh/eaccess.c
- - sh_stat: instead of using a static buffer to do the DEV_FD_PREFIX
- translation, use a dynamically-allocated buffer that we keep
- resizing. Fixes potential security hole reported by David Leverton
- <levertond@googlemail.com>
-
- 6/5
- ---
-braces.c
- - expand_seqterm: check errno == ERANGE after calling strtoimax for
- rhs and incr. Part of a set of fixes from Scott McMillan
- <scotty.mcmillan@gmail.com>
- - expand_seqterm: incr now of type `intmax_t', which changes
- arguments to mkseq
- - mkseq: a better fix for detecting overflow and underflow since it's
- undefined in C and compilers `optimize' out overflow checks. Uses
- ADDOVERFLOW and SUBOVERFLOW macros
- - mkseq: use sh_imaxabs (new macro) instead of abs() for intmax_t
- variables
- - mkseq: don't allow incr to be converted to -INTMAX_MIN
- - mkseq: make sure that strvec_create isn't called with a size argument
- greater than INT_MAX, since it only takes an int
-
- 6/6
- ---
-braces.c
- - mkseq: try and be smarter about not overallocating elements in
- the return array if the increment is not 1 or -1
-
- 6/7
- ---
-parse.y
- - history_delimiting_chars: if the parser says we're in the middle of
- a compound assignment (PST_COMPASSIGN), just return a space to avoid
- adding a stray semicolon to the history entry. Fixes bug reported
- by "Davide Brini" <dave_br@gmx.com>
-
- 6/8
- ---
-bashline.c
- - bash_directory_completion_hook: don't attempt spelling correction
- on the directory name unless the direxpand option is set and we are
- going to replace the directory name with the corrected one in the
- readline line. Suggested by Linda Walsh <bash@tlinx.org>
-
-lib/sh/shquote.c
- - sh_backslash_quote: now takes a third argument: flags. If non-zero,
- tildes are not backslash-escaped. Have to handle both printf %q,
- where they should be escaped, and filename completion, where they
- should not when used as usernames
-
-externs.h
- - sh_backslash_quote: declaration now takes a third argument
-
-builtins/printf.def
- - printf_builtin: call sh_backslash_quote with 1 as third argument
- so tildes get escaped
-
-{bashline,bracecomp}.c
- - call sh_backslash_quote with 0 as third argument so tildes are not
- escaped in completed words
-
-doc/bash.1
- - add `coproc' to the list of reserved words. From a report by
- Jens Schweikhardt <schweikh@schweikhardt.net>
-
- 6/10
- ----
-execute_cmd.c
- - line_number_for_err_trap: now global, so parse_and_execute can save
- and restore it with unwind-protect
-
-builtins/evalstring.c
- - parse_prologue: save and restore line_number_for_err_trap along
- with line_number
- - restore_lastcom: new function, unwind-protect to restore
- the_printed_command_except_trap
- - parse_prologue: use restore_lastcom to save and restore the value
- of the_printed_command_except_trap around calls to parse_and_execute
- (eval/source/.)
-
- 6/15
- ----
-lib/readline/complete.c
- - complete_fncmp: change filename comparison code to understand
- multibyte characters, even when doing case-sensitive or case-mapping
- comparisons. Fixes problem reported by Nikolay Shirokovskiy
- <nshyrokovskiy@gmail.com>
-
- 6/20
- ----
-builtins/mapfile.def
- - mapfile: move the line count increment and check for having read
- the specified number of lines to the end of the loop to avoid
- reading an additional line with zgetline. Fixes bug reported by
- Dan Douglas <ormaaj@gmail.com>
-
- 6/21
- ----
-
-execute_cmd.c
- - execute_pipeline: make sure `lastpipe_flag' is initialized to 0 on
- all systems, since it's tested later in the function. Fixes bug
- reported by John E. Malmberg <wb8tyw@qsl.net>
-
- 6/22
- ----
-mailcheck.c
- - file_mod_date_changed: return 0 right away if mailstat() does not
- return success. Fixes bug with using uninitialized values reported
- by szymon.kalasz@uj.edu.pl
-
-builtins/set.def
- - the `monitor' option is not available when the shell is compiled
- without job control, since the underlying `m' flag is not available
-
-nojobs.c
- - job_control: now declared as int variable, initialized to 0, never
- modified
-
-jobs.h
- - job_control: extern declaration no longer dependent on JOB_CONTROL
-
-execute_cmd.c
- - execute_pipeline: made necessary changes so `lastpipe' shell option
- is now available in all shells, even those compiled without
- JOB_CONTROL defined
-
- 6/23
- ----
-lib/glob/glob.c
- - glob_filename: check for interrupts before returning if glob_vector
- returns NULL or an error. Bug reported by Serge van den Boom
- <svdb@stack.nl>, fix from Andreas Schwab <schwab@linux-m68k.org>
- - call run_pending_traps after each call to QUIT or test of
- interrupt_state, like we do in mainline shell code
- - glob_vector: don't call QUIT; in `if (lose)' code block; just free
- memory, return NULL, and let callers deal with interrupt_state or
- other signals and traps
-
- 6/25
- ----
-lib/readline/input.c
- - rl_read_key: restructure the loop that calls the event hook a little,
- so that the hook is called only after rl_gather_tyi returns no input,
- and any pending input is returned first. This results in better
- efficiency for processing pending input without calling the hook
- on every input character as bash-4.1 did. From a report from
- Max Horn <max@quendi.de>
-
- 6/26
- ----
-trap.c
- - signal_is_pending: return TRUE if SIG argument has been received and
- a trap is waiting to execute
-
-trap.h
- - signal_is_pending: extern declaration
-
-lib/glob/glob.c
- - glob_vector: check for pending SIGINT trap each time through the loop,
- just like we check for interrupt_state or terminating_signal, and
- set `lose = 1' so we clean up after ourselves and interrupt the
- operation before running the trap. This may require a change later,
- maybe call run_pending_traps and do that if run_pending_traps returns?
-
-variables.c
- - sv_histtimefmt: set history_comment_character to default (`#') if
- it's 0 when we're turning on history timestamps. The history code
- uses the history comment character to prefix timestamps, and
- leaving it at 0 effectively removes them from the history. From a
- report to help-bash by Dennis Williamson <dennistwilliamson@gmail.com>
-
- 6/27
- ----
-lib/readline/signals.c
- - rl_maybe_restore_sighandler: new function, sets handler for SIG to
- HANDLER->sa_handler only if it's not SIG_IGN. Needs to be called
- on same signals set using rl_maybe_set_sighandler, which does not
- override an existing SIG_IGN handler (SIGALRM is ok since it does
- the check inline; doesn't mess with SIGWINCH)
-
- 6/30
- ----
-variables.h
- - additional defines for the new `nameref' variable attribute
- (att_nameref): nameref_p, nameref_cell, var_setref
-
-variables.c
- - find_variable_nameref: resolve SHELL_VAR V through chain of namerefs
- - find_variable_last_nameref: resolve variable NAME until last in a
- chain of possibly more than one nameref starting at shell_variables
- - find_global_variable_last_nameref: resolve variable NAME until last
- in a chain of possibly more than one nameref starting at
- global_variables
- - find_nameref_at_context: resolve SHELL_VAR V through chain of namerefs
- in a specific variable context (usually a local variable hash table)
- - find_variable_nameref_context: resolve SHELL_VAR V through chain of
- namerefs following a chain of varible contexts
- - find_variable_last_nameref_context: resolve SHELL_VAR V as in
- find_variable_last_context, but return the final nameref instead of
- what the final nameref resolves to
- - find_variable_tempenv, find_variable_notempenv, find_global_variable,
- find_shell_variable, find_variable: modified to follow namerefs
- - find_global_variable_noref: look up a global variable without following
- any namerefs
- - find_variable_noref: look up a shell variable without following any
- namerefs
- - bind_variable_internal: modify to follow a chain of namerefs in the
- global variables table; change to handle assignments to a nameref by
- following nameref chain
- - bind_variable: modify to follow chain of namerefs when binding to a
- local variable
- - unbind_variable: changes to unset nameref variables (unsets both
- nameref and variable it resolves to)
-
-subst.c
- - parameter_brace_expand_word: change to handle expanding nameref whose
- value is x[n]
- - parameter_brace_expand_indir: change to expand in ksh93-compatible
- way if variable to be indirected is nameref and a simple (non-array)
- expansion
- - param_expand: change to expand $foo where foo is a nameref whose value
- is x[n]
-
-execute_cmd.c
- - execute_for_command: changes to implement ksh93 semantics when index
- variable is a nameref
-
-builtins/setattr.def
- - show_var_attributes: change to add `n' to flags list if att_nameref
- is set
-
-builtins/set.def
- - unset_builtin: changes to error messages to follow nameref variables
-
-builtins/declare.def
- - document new -n option
- - declare_internal: new `-n' and `+n' options
- - declare_internal: handle declare -n var[=value] and
- declare +n var[=value] for existing and non-existant variables.
- Enforce restriction that nameref variables cannot be arrays.
- Implement semi-peculiar ksh93 semantics for typeset +n ref=value
-
- 7/5
- ---
-variables.c
- - unbind_variable: unset whatever a nameref resolves to, leaving the
- nameref variable itself alone
- - unbind_nameref: new function, unsets a nameref variable, not the
- variable it references
-
-variables.h
- - unbind_nameref: extern declaration
-
-builtins/set.def
- - unset_builtin: modify to add -n option, which calls unbind_nameref
- leaving unbind_variable for the usual case. This required slight
- changes and additions to the test suite
-
-doc/{bash.1,bashref.texi}
- - document namerefs and typeset/declare/local/unset -n
-
- 7/13
- ----
-lib/sh/casemod.c
- - include shmbchar.h for is_basic and supporting pieces
- - sh_casemod: use _to_wupper and _to_wlower to convert wide character
- case instead of TOUPPER and TOLOWER. Fixes bug reported by
- Dennis Williamson <dennistwilliamson@gmail.com>, fix from
- Andreas Schwab <schwab@linux-m68k.org>
- - cval: short-circuit and return ascii value if is_basic tests true
- - sh_casemod: short-circuit and use non-multibyte case modification
- and toggling code if is_basic tests true
-
-lib/readline/signals.c
- - _rl_{block,release}_sigint: remove the code that actually blocks and
- releases the signals, since we defer signal handling until calls to
- RL_CHECK_SIGNALS()
-
-lib/readline/{callback,readline,util}.c
- - if HAVE_POSIX_SIGSETJMP is defined, use sigsetjmp/siglongjmp without
- saving and restoring the signal mask instead of setjmp/longjmp
-
-lib/readline/rltty.c
- - prepare_terminal_settings: don't mess with IXOFF setting if
- USE_XON_XOFF defined
-
-doc/{bash.1,bashref.texi}
- - add some text to the description of set -e clarifying its effect
- on shell functions and shell function execution. Suggested by
- Rainer Blome <rainer.blome@gmx.de>
-
-bashline.c
- - edit_and_execute_command: increment current_command_line_count before
- adding partial line to command history (for command-oriented-history
- because of rl_newline at beginning of function), then reset it to 0
- before adding the dummy history entry to make sure the dummy entry
- doesn't get added to previous incomplete command. Partial fix for
- problem reported by Peng Yu <pengyu.ut@gmail.com>
-
- 7/24
- ----
-configure.in
- - interix: define RECYCLES_PIDS. Based on a report from Michael
- Haubenwallner <michael.haubenwallner@salomon.at>
-
- 7/26
- ----
-jobs.c
- - make_child: call bgp_delete on the newly-created pid unconditionally.
- Some systems reuse pids before cycling through an entire set of
- CHILD_MAX/_SC_CHILD_MAX unique pids. This is no longer dependent
- on RECYCLES_PIDS. Based on a report from Michael Haubenwallner
- <michael.haubenwallner@salomon.at>
-
-support/shobj-conf
- - Mac OS X: drop MACOSX_DEPLOYMENT_TARGET=10.3 from the LDFLAGS. We
- can finally kill Panther
-
- 7/28
- ----
-subst.c
- - command_substitute: make sure last_made_pid gets reset if make_child
- fails
-
-execute_cmd.c
- - execute_command_internal: case cm_simple: decide whether or not to
- wait_for a child if already_making_children is non-zero, indicates
- that there is an unwaited-for child. More of fix for bug report
- from Michael Haubenwallner <michael.haubenwallner@salomon.at>
-
-jobs.c
- - make_child: call delete_old_job (new_pid) unconditionally, don't
- bother to check whether or not pid wrap occurred. Rest of fix for
- bug report from Michael Haubenwallner
- <michael.haubenwallner@salomon.at>
-
- 7/29
- ----
-shell.c
- - subshell_exit: new function, exits the shell (via call to sh_exit())
- after calling any defined exit trap
-
-externs.h
- - subshell_exit: new extern declaration
-
-execute_cmd.c
- - execute_command_internal: make sure to call subshell_exit for
- {} group commands executed asynchronously (&). Part of fix for
- EXIT trap bug reported by Maarten Billemont <lhunath@lyndir.com>
-
-sig.c
- - reset_terminating_signals: make sure to set termsigs_initialized back
- to 0, so a subsequent call to initialize_terminating_signals works
- right. Rest of fix for bug reported by Maarten Billemont
- <lhunath@lyndir.com>
-
-{execute_cmd,general,jobs,mailcheck,mksyntax,test}.c
-builtins/{cd,fc,pushd,ulimit}.def
-lib/malloc/getpagesize.h
-lib/sh/{clktck,fpurge,inet_aton,mailstat,oslib,pathcanon,pathphys,spell,strerror}.c
- - make inclusion of <sys/param.h> dependent on HAVE_SYS_PARAM_H
- consistently
-
- 8/6
- ---
-lib/readline/histexpand.c
- - history_expand_internal: now takes an additional argument saying
- whether the history expansion occurs within a quoted string, set to
- the open quote character
- - history_expand_internal: use new argument instead of checking prev
- char and initializing quoted_search_delimiter, pass qc directly to
- get_history_event, where it allows a matching quote to terminate a
- string defining an event
- - history_expand: change single-quote handling code so that if
- history_quotes_inhibit_expansion is 0, single quotes are treated
- like double quotes
- - history_expand: change call to history_expand_internal to pass new
- argument of `"' if double-quoted string, `'' if single-quoted string;
- this lets history_expand decide what is a quoted string and what
- is not
-
- 8/7
- ---
-configure.in
- - AC_CANONICAL_BUILD: invoke for later use
-
-lib/readline/macro.c
- - _rl_prev_macro_key: new function, inverse of _rl_next_macro_key:
- backs up the index into the current macro by 1
-
-lib/readline/rlprivate.h
- - _rl_prev_macro_key: extern declaration
-
-
-lib/readline/readline.c
- - _rl_dispatch_subseq, _rl_subseq_result: don't call _rl_unget_char
- if we're currently reading from a macro; call _rl_prev_macro_key
- instead. Fixes bug reported by Clark Wang <clark.wang@oracle.com>
-
- 8/13
- ----
-builtins/evalstring.c
- - evalstring(): new function, wrapper around parse_and_execute.
- make sure we handle cases where parse_and_execute can call `return'
- and short-circuit without cleaning up properly. We call
- parse_and_execute_cleanup() then jump to the previous-saved return
- location
-
-builtins/common.h
- - extern declaration for evalstring()
-
-builtins/eval.def
- - eval_builtin: make sure we handle `eval " ... return"' in contexts
- where `return' is valid by calling evalstring(). Fixes bug with
- `eval return' in sourced files reported by Clark Wang
- <dearvoid@gmail.com>
-
-trap.c
- - run_pending_traps: call evalstring instead of parse_and_execute.
- XXX - still needs to handle saving and restoring token state in the
- presence of `return'; could use unwind_protects for that
-
-builtins/mapfile.def
- - run_callback: call evalstring instead of parse_and_execute
-
- 8/15
- ----
-bashline.c
- - bash_filename_stat_hook: make sure we don't free local_dirname
- before using it to canonicalize any expanded filename. Make sure
- it always points to *dirname and only free it if we're replacing
- it.
-
-lib/readline/complete.c
- - append_to_match: make sure we call rl_filename_stat_hook with
- newly-allocated memory to avoid problems with freeing it twice
-
- 8/17
- ----
-variables.c,config-top.h
- - if ARRAY_EXPORT is defined to 1 when variables.c is compiled, the
- code that allows indexed arrays to be exported is enabled and
- included
-
- 8/19
- ----
-shell.c
- - call start_debugger from main() only if dollar_vars[1] != 0 (close
- enough to a non-interactive shell, since we can be interactive with
- -i while running a shell script). Fixes oddity reported by
- Techlive Zheng <techlivezheng@gmail.com>
-
- 8/20
- ----
-arrayfunc.c
- - quote_array_assignment_chars: don't bother quoting if the word has
- not been marked as an assignment (W_ASSIGNMENT)
- - quote_array_assignment_chars: turn on W_NOGLOB in the word flags
- so assignment statements don't undergo globbing. Partial fix for
- problems reported by Dan Douglas <ormaaj@gmail.com>
-
- 8/21
- ----
-command.h
- - W_NOBRACE: new word flag that means to inhibit brace expansion
-
-subst.c
- - brace_expand_word_list: suppress brace expansion for words with
- W_NOBRACE flag
-
- 8/22
- ----
-builtins/read.def
- - read_builtin: don't call dequote_string on what we've read, even if
- we saw an escape character, unless (input_string && *input_string).
- We may have escaped an IFS whitespace character. Fixes seg fault
- reported by <armandsl@gmail.com>
-
-execute_cmd.c
- - execute_command_internal: set the_printed_command_except trap when
- about to execute a ( ... ) user subshell. For now, set it only if
- ERR is trapped; can relax that later. Fixes bug reported by
- Mike Frysinger <vapier@gentoo.org>
-
- 8/23
- ----
-jobs.c
- - remove references to first_pid and pid_wrap, since we're not using
- them for anything anymore
-
- 8/24
- ----
-subst.c
- - changes for W_NOBRACE everywhere appropriate: so it can be displayed
- for debugging, and passed out of expand_word_internal
-
-doc/{bash.1,bashref.texi}
- - small changes to make it clearer that the = and == operators are
- equivalent, and will cause pattern matching when used with [[.
- From a question from Michal Soltys <soltys@ziu.info>
-
-doc/bashref.texi
- - some small formatting changes from Karl Berry <karl@freefriends.org>
-
- 8/27
- ----
-lib/readline/doc/{history,rlman,rluserman}.texi
- - some small formatting changes from Karl Berry <karl@freefriends.org>
-
-arrayfunc.c
- - assign_array_element_internal, assign_compound_array_list,
- unbind_array_element, array_value_internal: changes to make
- assignment statements to negative indices (a[-1]=2) and unsetting
- array elements using negative indices (unset 'a[-1]') work.
- From suggestions by Dennis Williamson <dennistwilliamson@gmail.com>
- and Chris F. A. Johnson <chris@cfajohnson.com>
-
-subst.c
- - array_length_reference: changes to make length references to array
- elements using negative indices (${#a[-1]}) work
-
- 8/28
- ----
-doc/{bash.1,bashref.texi}
- - document new treatment of negative indices to indexed arrays when
- assigning, referencing, calculating length, and unsetting
-
- 8/29
- ----
-shell.c
- - show_shell_usage: add -l to list of shell invocation options (short
- for --login). From Red Hat bug 852469
-
-configure.ac
- - renamed from configure.in, as latest autoconf versions want. Patches
- Stefano Lattarini <stefano.lattarini@gmail.com>
-
-MANIFEST,Makefile.in,doc/bashref.texi,support/mkconffiles
- - configure.in -> configure.ac
-
- 9/1
- ---
-
-parse.y
- - read_token_word: allow words like {array[ind]} to be valid redirection
- words for constructs like {x}<file
-
-redir.c
- - redir_varassign: bind_var_to_int already handles array assignments,
- so don't need to do anything more for things like {a[i]}<file
- - redir_varvalue: changes to allow references to {a[i]} when
- performing redirections using valid_array_reference and
- get_array_value. Adds functionality requested most recently by
- <unknown@vmw-les.eng.vmware.com>
-
-lib/readline/display.c
- - update_line: if the first difference between the old and new lines
- is completely before any invisible characters in the prompt, we
- should not adjust _rl_last_c_pos, since it's before any invisible
- characters. Fixed in two places
- - prompt_modechar: return a character indicating the editing mode:
- emacs (@), vi command (:), or vi insert (+)
- - _rl_reset_prompt: new function, just calls rl_expand_prompt. Will be
- inlined, placeholder for more changes
- - expand_prompt: if show-mode-in-prompt is enabled, add a character to
- the front of the prompt indicating the editing mode, adjusting the
- various variables as appropriate to keep track of the number of
- visible characters and number of screen positions
-
-lib/readline/bind.c
- - show-mode-in-prompt: new bindable boolean variable, shadowed by
- _rl_show_mode_in_prompt variable
- - hack_special_boolean_var: call _rl_reset_prompt when toggling or
- setting show-mode-in-prompt
-
-lib/readline/readline.c
- - readline_internal_setup: make sure the correct vi mode keymap is set
- before expanding the prompt string for the first time
-
-lib/readline/misc.c
- - rl_emacs_editing_mode: make sure to call _rl_reset_prompt if we're
- showing the editing mode in the prompt
-
-lib/readline/rlprivate.h
- - _rl_reset_prompt, _rl_show_mode_in_prompt: extern declarations
-
-lib/readline/vi_mode.c
- - rl_vi_insertion_mode: call _rl_reset_prompt
- - rl_vi_movement_mode: call _rl_reset_prompt. Finishes changes for
- showing mode in prompt string, originally requested by Miroslav
- Koskar <mkoskar@gmail.com> and most recently by Jordan Michael
- Ziegler <jziegler@bnl.gov>
-
-doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
- - document new show-mode-in-prompt variable, off by default
-
- 9/3
- ---
-
-jobs.c
- - set_childmax: new function, external mechanism for other parts of
- the shell to set js.c_childmax, the number of saved exited child
- statuses to remember
-jobs.h
- - set_childmax: extern declaration
-
-variables.c
- - CHILD_MAX: new special variable, with sv_childmax function to
- run when it changes. Setting CHILD_MAX to a value greater than
- zero but less than some maximum (currently 8192) sets the number of
- exited child statuses to remember. set_childmax (jobs.c) ensures
- that the number does not drop below the posix-mandated minimum
- (CHILD_MAX)
-
-doc/{bash.1,bashref.texi}
- - CHILD_MAX: document new meaning and action when variable is set
-
- 9/5
- ---
-redir.c
- - redir_varassign: call stupidly_hack_special_variables after
- assigning fd number to specified variable, so we can use constructs
- like {BASH_XTRACEFD}>foo. Suggested by Pierre Gaston
- <pierre.gaston@gmail.com>
-
- 9/8
- ---
-expr.c
- - readtok: invalidate previous contents of `curlval' before freeing
- and reallocating tokstr (which, chances are, will get the same
- pointer as before and render curlval inconsistent). Fixes other
- bug reported by Dan Douglas <ormaaj@gmail.com>
-
- 9/9
- ---
-lib/readline/complete.c
- - rl_username_completion_function: protect call to setpwent() with
- #ifdef (HAVE_GETPWENT)/#endif. Fixes bug reported by
- Gerd Hofmann <gerd.hofmann.nbg@googlemail.com>
-
-lib/readline/display.c
- - rl_message: second and subsequent calls to rl_message can result in
- local_prompt being overwritten with new values (e.g., from the
- successive calls displaying the incremental search string). Need
- to free before overwriting if it's not the same as the value saved
- in saved_local_prompt. Fixes memory leak reported by
- Wouter Vermaelen <vermaelen.wouter@gmail.com>
-
-lib/readline/{terminal.c,rlprivate.h}
- - move CUSTOM_REDISPLAY_FUNC and CUSTOM_INPUT_FUNC defines from
- terminal.c to rlprivate.h so other files can use them
-
-expr.c
- - expr_streval: if noeval is non-zero, just return 0 right away,
- short-circuiting evaluation completely. readtok will leave curtok
- set correctly without re-entering the evaluator at all. Rest of
- fix for bug reported by Dan Douglas <ormaaj@gmail.com>
-
- 9/11
- ----
-
-parse.y
- - parse_comsub: make sure the `reserved word ok in this context' flag
- is preserved after we read `do' followed by whitespace. Fixes bug
- reported by Benoit Vaugon <benoit.vaugon@gmail.com>
-
- 9/13
- ----
-configure.ac,config.h.in
- - enable-direxpand-default: new configure option, turns the `direxpand'
- shell option on by default
-
-bashline.c
- - dircomplete_expand, dircomplete_expand_relpath: initialize to 1 if
- DIRCOMPLETE_EXPAND_DEFAULT is defined and non-zero
-
-doc/bashref.texi
- - enable-direxpand-default: document new configure option
-
- 9/14
- ----
-shell.c
- - --protected: make option valid only when wordexp is compiled into
- the shell. Fix from Roman Rakus <rrakus@redhat.com>
-
-configure.ac
- - HP NonStop (*-nsk*): compile --without-bash-malloc. Change from
- Joachim Schmitz <jojo@schmitz-digital.de>
-
- 9/16
- ----
-subst.c,execute_cmd.c,lib/glob/sm_loop.c,lib/sh/shquote.c
- - minor code cleanups from Joachim Schmitz <jojo@schmitz-digital.de>
-
-lib/readline/colors.h
- - workaround for HP NonStop compiler issue with <stdbool.h> from
- Joachim Schmitz <jojo@schmitz-digital.de>
-
- 9/17
- ----
-builtins/printf.def
- - printf_builtin: handle localtime returning NULL, as can happen when
- encountering overflow. Bug report and initial fix from
- Eduardo A. Bustamante López <dualbus@gmail.com>
-
-doc/{bash.1,bashref.texi}
- - emphasize that brace expansion using character ranges ({a..c}) acts
- as if the C locale were in use. Prompted by message from
- Marcel Giannelia <info@skeena.net>
-
- 9/20
- ----
-lib/sh/wcsnwidth.c
- - wcsnwidth: new function, variant of wcwidth, returns the number of
- wide characters from a string that will be displayed to not exceed
- a specified max column position
-
- 9/21
- ----
-builtins/help.def
- - show_builtin_command_help: break code that displays the short-doc
- for each builtin in two columns into a new function: dispcolumn
- - wdispcolumn: multibyte-char version of dispcolumn; uses wide
- chars and printf "%ls" format. Fixes problem reported by
- Nguyá»n Thái Ngá»c Duy <pclouds@gmail.com>
-
- 9/22
- ----
-execute_cmd.c
- - execute_disk_command: before running the command-not-found hook,
- call kill_current_pipeline() to make sure we don't add processes
- to an existing pipeline or wait for processes erroneously
-
- 9/23
- ----
-lib/readline/input.c
- - rl_input_available_hook: new hook function, called from
- _rl_input_available (or _rl_input_queued) to return whether or not
- input is available wherever the input source is
-
-lib/readline/doc/rltech.texi
- - rl_input_available_hook: document
-
- 9/27
- ----
-lib/glob/sm_loop.c:
- - GMATCH: after one or more `*', an instance of ?(x) can match zero or
- 1 times (unlike ?, which has to match one character). The old code
- failed if it didn't match at least once. Fixes `a*?(x)' bug.
- - GMATCH: if we hit the end of the search string, but not the end of
- the pattern, and the rest of the pattern is something that can
- match the NUL at the end of the search string, we should successfully
- match. Fixes `a*!(x)' bug reported by <hans1worst@gmail.com>
-
- 10/2
- ----
-command.h
- - add c_lock member to coproc structure for future use to tell who is
- manipulating it
-
-execute_cmd.c
- - execute_coproc: block SIGCHLD while parent is forking coproc
- process and adding pid to sh_coproc struct to avoid race condition
- where child is reaped before the pid is assigned and the coproc is
- never marked as having died. Fixes race condition identified by
- Davide Baldini <baldiniebaldini@gmail.com>
- - add assignments to c_lock member of struct coproc in various
- functions that manipulate it; was used to identify race condition
- - coproc_pidchk: don't call coproc_dispose to avoid using malloc and
- other functions in a signal handler context
- - coproc_dispose: call BLOCK_SIGNAL/UNBLOCK_SIGNAL for SIGCHLD while
- manipulating the sh_coproc struct
-
- 10/6
- ----
-lib/readline/complete.c
- - rl_display_match_list: if printing completions horizontally, don't
- bother with spacing calculations if limit == 1, which means we are
- printing one completion per line no matter what. Fixes bug
- reported by David Kaasen <kaasen@nvg.ntnu.no>
-
- 10/7
- ----
-builtins/declare.def
- - declare_internal: add error checking for nameref attribute and
- variable assignments: self-references, attempts to make an array
- variable a nameref
-
-subst.c
- - parameter_brace_expand: handle parameter_brace_expand_word returning
- &expand_param_fatal or &expand_param_error and return the appropriate
- error value
- - parameter_brace_expand_word: if a nameref variable's value is not a
- valid identifier, return an error
- - param_expand: if a nameref variable's value is not a valid identifier,
- return an error
-
-test.c
- - unary_operator: add new -R variable, returns true if variable is set
- and has the nameref attribute. From ksh93
-
-builtins/test.def
- - add -R to description of conditional commands for help test
-
-doc/{bash.1,bashref.texi}
- - document new -R unary conditional operator
-
- 10/13
- -----
-trap.c
- - check_signals_and_traps: new function, convenience function for the
- rest of the shell to check for pending terminating and interrupt
- signals, and to check for and process any pending traps
- - any_signals_trapped: new function, returns non-zero if any signals
- are trapped and -1 if not
-
-trap.h
- - extern declaration for check_signals_and_traps
-
-bashline.c
- - bashline_reset: make sure we reset the event hook
- - bash_event_hook: call check_signals_and_traps instead of just
- checking for terminating signals so we can run pending traps and
- react to interrupts, and reset the event hook when we're done
-
-
- 10/14
- -----
-trap.c
- - trap_handler: if executing in a readline signal handler context,
- call bashline_set_event_hook to install bash_event_hook to process
- the signal (if bash cares about it)
-
-sig.c
- - sigint_sighandler: call bashline_set_event_hook to set the event
- hook if we're executing in a readline signal handler context
-
-lib/readline/input.c
- - rl_getc: call RL_CHECK_SIGNALS if read returns -1/EINTR and the caught
- signal is SIGINT or SIGQUIT rather than waiting until the next time
- around the loop
- - rl_getc: call rl_event_hook after calling RL_CHECK_SIGNALS to allow
- an application signal handler to set the event hook in its own
- signal handler (e.g., like bash trap_handler or sigint_sighandler)
-
-
-parse.y
- - yy_readline_get: don't set interrupt_immediately before we call
- readline(). Inspired by report from lanshun zhou
- <zls.sogou@gmail.com>
-
-input.c
- - getc_with_restart: add call to run_pending_traps after call to
- CHECK_TERMSIG
-
-lib/sh/zread.c
- - zread: call check_signals_and_traps if read() returns -1/EINTR
- instead of just ignoring the EINTR and deferring handling any
- signal that generated it
-
-builtins/mapfile.def
- - mapfile: don't set interrupt_immediately before calling zgetline()
- (which uses zread internally)
-
-builtins/read.def
- - read_builtin: don't set interrupt_immediately before calling zread
- (moved code around so that it was only being set right around calls
- to zread to avoid signal handler conflicts). Inspired by report
- from lanshun zhou <zls.sogou@gmail.com>
- - edit_line: don't set interrupt_immediately around call to readline()
- - include shmbutil.h
- - read_builtin: don't call read_mbchar unless is_basic(c) returns
- false for the character we just read
-
- 10/15
- -----
-sig.c
- - throw_to_top_level: if interrupt_state is non-zero, make sure that
- last_command_exit_value reflects 128+SIGINT if it's not already
- greater than 128
-
- 10/20
- -----
-builtins/wait.def
- - WAIT_RETURN: set wait_signal_received back to 0 for the potential
- next call to wait
-
-quit.h
- - CHECK_WAIT_INTR: macro to check whether trap_handler handled a
- signal and set wait_signal_received; longjmp to wait_intr_buf in
- that case
-
-jobs.c
- - wait_for, waitchld: call CHECK_WAIT_INTR at the same places we call
- CHECK_TERMSIG to check for terminating signals
- - wait_sigint_handler: don't longjmp out of the wait builtin unless
- interrupt_immediately is set; otherwise just SIGRETURN from the
- handler
- - wait_sigint_handler: if interrupt_immediately not set, but we are
- executing in the wait builtin and SIGINT is not trapped, treat it
- as a `normally received' SIGINT: restore the signal handler and
- send SIGINT to ourselves
- - waitchld: when in posix mode and running SIGCHLD traps, don't longjmp
- to wait_intr_buf (and let wait be interrupted) if we're running from
- a signal handler. Wait for CHECK_WAIT_INTR to do the longjmp.
- run_pending_traps will run the SIGCHLD trap later
-
-nojobs.c
- - reap_zombie_children, wait_for_single_pid, wait_for: call
- CHECK_WAIT_INTR where we call CHECK_TERMSIG
- - wait_sigint_handler: don't longjmp out of the wait builtin unless
- interrupt_immediately is set; otherwise just SIGRETURN from the
- handler
-
-trap.c
- - trap_handler: make sure wait_signal_received is set if the wait
- builtin is executing, and only longjmp if interrupt_immediately is
- set. This whole set of fixes was prompted by report from
- lanshun zhou <zls.sogou@gmail.com>
-
- 10/24
- -----
-lib/glob/glob.c
- - glob_filename: only check directory_name for globbing chars if
- it's of non-zero length
-
-lib/sh/strchrnul.c
- - new simpler implementation
-
-subst.c
- - command_substitute: call set_shellopts after turning off errexit
- in subshells so it's reflected in $SHELLOPTS
-
- 11/7
- ----
-builtins/evalstring.c
- - parse_and_execute: treat ERREXIT case like reader_loop does: set
- variable_context to 0 before longjmping back to top_level. Don't
- run the unwind-protect context to avoid side effects from popping
- function contexts. Part of fix for problem reported by Nikolai
- Kondrashov <nikolai.kondrashov@redhat.com>
-
-execute_cmd.c
- - execute_simple_command: call unlink_fifo_list only if this is the
- last element of a pipeline (or not in a pipeline), rather than for
- every child. Fixes difference in behavior between /dev/fd and
- FIFOs reported by Zev Weiss <zev@bewilderbeest.net>
- - execute_null_command: do the same thing in the parent branch after
- make_child
-
- 11/14
- -----
-subst.c
- - parameter_brace_expand: a variable is null if it's special ($@, $*),
- the expansion occurs within double quotes, and the expansion turns
- into a quoted null. Fixes debian bug 692447 reported by
- Matrosov Dmitriy <sgf.dma@gmail.com>
-
-jobs.c
- - run_sigchld_trap: make sure `running_trap' sentinel is set
- appropriately
- - waitchld: only run the sigchld trap if we're not in a signal
- handler, not running a trap, and executing the wait builtin.
- Otherwise, queue for later handling. We still run one instance
- of the trap handler per exited child. Bulk of fix for bug
- reported by Elliott Forney <idfah@cs.colostate.edu>
-
-trap.c
- - queue_sigchld_trap: set catch_flag so run_pending_traps notices,
- and set trapped_signal_received for completeness. Rest of fix
- for bug reported by Elliott Forney <idfah@cs.colostate.edu>
-
-lib/malloc/malloc.c
- - block_signals: renamed to _malloc_block_signals, made public
- - unblock_signals: renamed to _malloc_unblock_signals, made public
-
-lib/malloc/imalloc.h
- - extern declarations for _malloc_{un,}block_signals
-
-lib/malloc/table.c
- - mregister_alloc, mregister_free: block signals around table
- manipulation
-
- 11/15
- -----
-trap.c
- - run_pending_traps: set SIG_INPROGRESS flag around calls to
- run_sigchld_handler so other parts of the shell know that the
- SIGCHLD trap handler is executing
- - run_pending_traps: if we get a situation where we are looking at
- running a SIGCHLD trap but the trap string is IMPOSSIBLE_TRAP_HANDLER
- and the SIG_INPROGRESS flag is set, just skip it. This is possible
- if run_pending_traps is called from a SIGCHLD trap handler run by
- run_sigchld_trap
-
-doc/bash.1,lib/readline/doc/{rluser.texi,readline.3}
- - corrected description of the effect of `set history-size 0'. Report
- from Vesa-Matti J Kari <vmkari@cc.helsinki.fi>
-
-include/stdc.h
- - CPP_STRING: new define, replaces __STRING
-
-lib/malloc/{malloc.c,imalloc.h}
- - replace __STRING with CPP_STRING
-
- 11/16
- -----
-lib/readline/bind.c
- - sv_histsize: if argument evaluates to a value < 0, unstifle the
- history
-
- 11/22
- -----
-redir.c
- - do_redirection_internal: if we have REDIR_VARASSIGN set in the
- redirection flags and we set up `redirector' using fcntl or dup2,
- don't add a redirect to make sure it stays open. Let the
- script programmer manage the file handle. Fixes bug reported by
- Sam Liddicott <sam@liddicott.com>
-
- 11/24
- -----
-jobs.c
- - wait_for_any_job: new function, waits for an unspecified background
- job to exit and returns its exit status. Returns -1 on no background
- jobs or no children or other errors. Calls wait_for with new
- sentinel value ANY_PID
- - wait_for: changes to handle argument of ANY_PID: don't look up or
- try to modify the child struct, only go through the wait loop once.
- Return -1 if waitpid returns no children
-
-jobs.h
- - ANY_PID: new define
-
-builtins/wait.def
- - new option: -n. Means to wait for the next job and return its exit
- status. Returns 127 if there are no background jobs (or no
- children). Feature most recently requested by Elliott Forney
- <idfah@cs.colostate.edu>
-
-doc/{bash.1,bashref.texi}
- - document new `wait -n' option
-
-execute_cmd.c
- - execute_command_internal: save make_command_string () result in a
- temp variable before calling savestring() on it; avoids evaluating
- make_command_string() result twice. Fix from John E. Malmberg
- <wb8tyw@qsl.net>
-
- 11/28
- -----
-
-builtins/declare.def
- - declare_internal: if an array variable is declared using `declare -a'
- or `declare -A', but not assigned a value, set the `invisible'
- attribute so the variable does not show up as set. Fix for bug
- about variable initialization reported by Tim Friske <me@timfriske.com>
-
-builtins/{mapfile,read}.def
- - after calling find_or_make_array_variable, make sure the invisible
- flag is turned off, in case the variable was declared previously
- using `declare -a' or `declare -A'. Side effect of above change to
- declare_internal
-
-subst.c
- - shell_expand_word_list: handle the W_ASSNGLOBAL flag and put -g into
- the list of options passed to make_internal_declare as appropriate.
- Fix for bug reported by Tim Friske <me@timfriske.com>
-
- 11/30
- -----
-test.c
- - unary_op: make sure -v and -n check that the variable is not marked
- as invisible before calling var_isset. Fix for bug reported by Tim
- Friske <me@timfriske.com>
-
- 12/2
- ----
-subst.c
- - process_substitute: turn off the `expanding_redir' flag, which
- controls whether or not variables.c:find_variable_internal uses the
- temporary environment to find variables. We want to use the
- temp environment, since we don't have to worry about order of
- evaluation in a subshell. Fixes bug reported by Andrey Borzenkov
- <arvidjaar@gmail.com>
-
- 12/4
- ----
-lib/glob/glob.c
- - glob_filename: changes to avoid null filenames and multiple entries
- returned for patterns like **/** (globstar enabled). Fixes bug
- reported by Ulf Magnusson <ulfalizer@gmail.com>
-
- 12/10
- -----
-lib/glob/glob.c
- - glob_filename: finish up a series of changes to make globstar-style
- globbing more efficient, avoid more duplicate filenames, and be more
- compatible with other shells that implement it
- o collapse a sequence of **/**/** to one **
- o note when the directory name is all ** or ends in ** so we
- can treat it specially when the filename is **
- All inspired by report from Andrey Borzenkov <arvidjaar@gmail.com>
-
-lib/sh/zread.c
- - zreadn: new function, like zread, but takes an additional argument
- saying how many bytes to read into the local buffer. Can be used to
- implement `read -N' without so many one-byte calls to zreadc. Code
- from Mike Frysinger <vapier@gentoo.org>
-
- 12/12
- -----
-lib/glob/sm_loop.c
- - PATSCAN (glob_patscan): if passed string already points to end of
- pattern, return NULL immediately. Fixes problem with
- extglob_skipname reported by Raphaël Droz <raphael.droz@gmail.com>
-
- 12/13
- -----
-execute_cmd.c
- - execute_coproc: handle the command's exit status being inverted
- (an oversight). Fixes bug reported by DJ Mills
- <danielmills1@gmail.com> and Andreas Schwab <schwab@linux-m68k.org>
-
- 12/14
- -----
-lib/readline/readline.c
- - bind_arrow_keys_internal: add MINGW key bindings for Home, End,
- Delete, and Insert keys. Fix from Pierre Muller
- <pierre.muller@ics-cnrs.unistra.fr>
-
-builtins/printf.def
- - printf_builtin: '%()T' conversion: if there is no argument supplied,
- behave as if -1 had been supplied (current time). ksh93-like feature
- suggested by Clark Wang <dearvoid@gmail.com>
-
-doc/{bash.1,bashref.texi}
- - document new printf %()T default argument behavior
-
- 12/15
- -----
-lib/readline/display.c
- - displaying_prompt_first_line: new variable, indicates whether or
- not the first line of output is displaying the prompt. Always true
- in normal mode, sometimes false in horizontal scrolling mode
- - rl_redisplay: set displaying_prompt_first_line to true unless we
- are in horizontal mode; set to false in horizontal mode if the left
- margin of the displayed line is greater than the end of the prompt
- string
- - rl_redisplay: when in horizontal scroll mode, don't adjust
- _rl_last_c_pos by the wrap offset unless the line is displaying
- a prompt containing invisible chars
- - update line: don't adjust _rl_last_c_pos by the wrap offset unless
- the line is displaying a prompt containing invisible chars
- - update_line: if shrinking the line by reducing the number of
- displayed characters, but we have already moved the cursor to the
- beginning of the line where the first difference starts, don't
- try to delete characters
-
-builtins/read.def
- - unbuffered_read: set to 2 if invoked as `read -N'
- - if unbuffered_read is set to 2, compute the number of chars we
- need to read and read that many with zreadn. Posix mode still
- uses zreadintr. Code from Mike Frysinger <vapier@gentoo.org>
-
-doc/{bash.1,bashref.texi}
- - read: make it clear that if read times out, it saves any input
- read to that point into the variable arguments. Report from
- Fiedler Roman <Roman.Fiedler@ait.ac.at>
-
-subst.c
- - command_substitute: change direct assignment of exit_immediately_on_error
- to use change_flag ('e', FLAG_OFF) instead
-
-flags.c
- - use errexit_flag as the variable modified by changes to the -e
- option, reflect those changes to exit_immediately_on_error
-
-execute_cmd.c
- - execute_builtin: new global variable, builtin_ignoring_errexit, set
- to 0 by default and set to 1 if eval/source/command executing in a
- context where -e should be ignored
- - execute_builtin: set exit_immediately_on_error to errextit_flag
- after executing eval/source/command in a context where -e should
- be ignored
-
-flags.c
- - if builtin_ignoring_errexit is set, changes to errexit_flag are
- not reflected in the setting of exit_immediately_on_error. Fixes
- bug reported by Robert Schiele <rschiele@gmail.com>
-
- 12/23
- -----
-include/posixjmp.h
- - setjmp_nosigs: new define, call setjmp in such a way that it will
- not manipulate the signal mask
-
-{expr,test,trap}.c
- - setjmp_nosigs: call instead of setjmp; don't need to manipulate
- signal mask
-
-builtins/read.def
- - read_builtin: setjmp_nosigs: call instead of setjmp; don't need
- to manipulate signal mask
-
-builtins/evalstring.c:
- - parse_and_execute: setjmp_nosigs: call instead of setjmp; don't need
- to manipulate signal mask
- - parse_string: setjmp_nosigs: call instead of setjmp; don't need
- to manipulate signal mask
- - parse_and_execute: save and restore the signal mask if we get a
- longjmp that doesn't cause us to return or exit (case DISCARD)
-
- 12/24
- -----
-general.c
- - bash_tilde_expand: only set interrupt_immediately if there are no
- signals trapped; we want to jump to top level if interrupted but
- not run any trap commands
-
- 12/25
- -----
-jobs.c
- - run_sigchld_trap: no longer set interrupt_immediately before calling
- parse_and_execute, even if this is no longer run in a signal handler
- context
-
-input.c
- - getc_with_restart: add call to QUIT instead of CHECK_TERMSIG
-
-parse.y
- - yy_stream_get: now that getc_with_restart calls QUIT, don't need to
- set interrupt_immediately (already had call to run_pending_traps)
-
-execute_cmd.c
- - execute_subshell_builtin_or_function,execute_function,execute_in_subshell:
- setjmp_nosigs: call instead of setjmp when saving return_catch; don't
- need to manipulate signal mask
- - execute_subshell_builtin_or_function,execute_in_subshell:
- setjmp_nosigs: call instead of setjmp where appropriate when saving
- top_level; don't need to manipulate signal mask if we're going to
- exit right away
-
-subst.c
- - command_substitute: setjmp_nosigs: call instead of setjmp when saving
- return_catch; don't need to manipulate signal mask
- - command_substitute: setjmp_nosigs: call instead of setjmp where
- appropriate when saving top_level; don't need to manipulate signal
- mask if we're going to exit right away
-
-trap.c
- - run_exit_trap: setjmp_nosigs: call instead of setjmp when saving
- return_catch; don't need to manipulate signal mask
- - run_exit_trap: setjmp_nosigs: call instead of setjmp where
- appropriate when saving top_level; don't need to manipulate signal
- mask if we're going to exit right away
- - _run_trap_internal: setjmp_nosigs: call instead of setjmp when saving
- return_catch; don't need to manipulate signal mask
-
-builtins/evalfile.c
- - _evalfile: setjmp_nosigs: call instead of setjmp when saving
- return_catch; don't need to manipulate signal mask
-
-builtins/evalstring.c
- - evalstring: setjmp_nosigs: call instead of setjmp when saving
- return_catch; don't need to manipulate signal mask
-
-shell.c
- - main: setjmp_nosigs: call instead of setjmp where appropriate when
- saving top_level; don't need to manipulate signal mask if we're
- going to exit right away
- - run_one_command: setjmp_nosigs: call instead of setjmp where
- appropriate when saving top_level; don't need to manipulate signal
- mask if we're going to exit right away
- - run_wordexp: setjmp_nosigs: call instead of setjmp where
- appropriate when saving top_level; don't need to manipulate signal
- mask if we're going to exit right away
-
-eval.c
- - reader_loop: save and restore the signal mask if we get a longjmp
- that doesn't cause us to return or exit (case DISCARD)
-
- 12/26
- -----
-parse.y
- - shell_input_line_{index,size,len}: now of type size_t; in some cases
- the unsigned property makes a difference
- - STRING_SAVER: saved_line_{size,index} now of type size_t
- - shell_getc: don't allow shell_input_line to grow larger than SIZE_MAX;
- lines longer than that are truncated until read sees a newline;
- addresses theoretical buffer overflow described by Paul Eggert
- <eggert@cs.ucla.edu>
- - set_line_mbstate: size_t changes like shell_getc
- - shell_getc: if shell_input_line is larger than 32K, free it and
- start over to avoid large memory allocations sticking around
-
-variables.c
- - bind_global_variable: new function, binds value to a variable in
- the global shell_variables table
-
-variables.h
- - bind_global_variable: new extern declaration
-
-builtins/declare.def
- - declare_internal: if -g given with name=value, but variable is not
- found in the global variable table, make sure to call
- bind_global_variable so the variable is created and modified at
- global scope. Fixes a bug where declare -g x=y could modify `x'
- at a previous function scope
-
-command.h
- - W_ASSIGNARRAY: new word flag, compound indexed array assignment
-
-subst.h
- - ASS_MKGLOBAL: new assignment flag, forcing global assignment even in
- a function context, used by declare -g
-
-execute_cmd.c
- - fix_assignment_words: set W_ASSIGNARRAY flag if -a option given to
- declaration builtin
-
-subst.c
- - do_assignment_internal: explicitly handle case where we are
- executing in a function and we want to create a global array or
- assoc variable
- - shell_expand_word_list: call make_internal_declare if -a option
- given to declaration builtin (W_ASSIGNARRAY); handle -g option with
- it (W_ASSNGLOBAL). Fixes inconsistency noticed by Vicente Couce
- Diaz <vituko@gmail.com>, where declare -ag foo=(bar) could modify
- array variable foo at previous function scope, not global scope
-
- 12/27
- -----
-bashline.c
- - Minix needs the third argument to tputs to be a void funtion taking
- an int argument, not an int-returning function. Fix from
- John E. Malmberg <wb8tyw@qsl.net> as part of VMS bash port
-
- 12/29
- -----
-configure.ac,version.c,patchlevel.h
- - bash-4.3-devel: new version, new shell compatibility level (43)
-
-subst.c
- - parameter_brace_patsub: put the bash-4.2 code back in from the
- change of 3/3 that runs the replacement string through quote
- removal, make it dependent on shell_compatibility_level <= 42
-
-builtins/shopt.def
- - compat42: new shopt option
- - set_compatibility_level: change logic to set and unset various
- compat variables and shell_compatibility_level
-
-COMPAT
- - new documentation for bash-4.3 compatibility changes
-
-doc/{bash.1,bashref.texi}
- - compat42: document new shopt option
-
-builtins/shopt.def
- - set_compatibility_opts: new function, sets the various shopt
- compat variables based on the value of shell_compatibility_level
-
-builtins/common.h
- - set_compatibility_opts: new extern declaration
-
-variables.c
- - BASH_COMPAT: new special variable; sets the shell compatibility
- level. Accepts values in decimal (4.2) or integer (42) form;
- Unsetting variable, setting it to empty string, or setting it to
- out-of-range value sets the shell's compatibility level to the
- default for the current version. Valid values are 3.1/31 through
- the current version
- - sv_shcompat: new function implementing logic for BASH_COMPAT
-
-variables.h
- - sv_shcompat: new extern declaration
-
-doc/{bash.1,bashref.texi}
- - BASH_COMPAT: description of new variable
-
-lib/readline/complete.c
- - _rl_colored_stats: default back to 0 for 4.3 release branch
-
- 1/5/2013
- --------
-quit.h
- - remove spurious call to itrace in CHECK_WAIT_INTR
-
-bashline.c
- - bash_event_hook: if we're going to jump to top_level, make sure we
- clean up after readline() by calling rl_cleanup_after_signal().
- Fixes bug reported against devel branch by Raphaël Droz
- <raphael.droz@gmail.com>
- - bash_event_hook: reset the event hook before checking for signals
- or traps in case we longjmp
-
-doc/{bash.1,bashref.texi}
- - small additions to the set -e section to make it more clear that
- contexts where -e is ignored extend to compound commands as well
- as shell functions
-
-lib/readline/readline.h
- - rl_signal_event_hook: new extern declaration
-
-lib/readline/input.c
- - rl_signal_event_hook: new variable, hook function to call when a
- function (currently just read(2)) is interrupted by a signal and
- not restarted
- - rl_getc: call rl_signal_event_hook instead of rl_event_hook
-
-lib/readline/doc/rltech.texi
- - rl_signal_event_hook: document new function
-
-bashline.c
- - changes to set rl_signal_event_hook instead of rl_event_hook
-
-lib/readline/readline.h
- - change readline version numbers to 6.3
-
- 1/6
- ---
-doc/{bash.1,bashref.texi}
- - a couple of changes to the descriptions of the ERR trap and its
- effects based on a message from Rob Nagler <nagler@bivio.biz>
-
- 1/9
- ---
-expr.c
- - expassign: invalidate curlval before freeing and NULLing tokstr to
- avoid aliasing issues. Fixes bug reported by Eduardo A. Bustamante
- López<dualbus@gmail.com> and Dan Douglas <ormaaj@gmail.com>
-
-braces.c
- - array_concat: don't be so aggressive in trying to short-circuit. We
- can only short-circuit if we have a single-element array where the
- element is an empty string (array[0] == "" array[1] = 0x0). Existing
- practice requires us to replicate arrays and prefix or append empty
- strings. Fixes bug reported by Eduardo A. Bustamante López
- <dualbus@gmail.com>
-
- 1/11
- ----
-execute_cmd.c
- - execute_builtin: since mapfile uses evalstring() to run its callbacks
- internally, just like eval, so it needs to handle the case where the
- temp environment given to mapfile persists throughout the entire
- set of callback commands. This might be a problem with trap also, but
- trap isn't run in the same way. Fixes bug reported by Dan Douglas
- <ormaaj@gmail.com>
-
- 1/13
- ----
-redir.c
- - redirection_error: before expanding the redirection word (if
- expandable_redirection_filename returns true), disable command
- substitution during expansion. Fixes bug reported by Dan Douglas
- <ormaaj@gmail.com>
-
-subst.c
- - expand_word_internal: case '\\': if the next character is an IFS
- character, and the expansion occurs within double quotes, and the
- character is not one for which backslash retains its meaning, add
- the (escaped) '\' and the (escaped) character. Fixes bug reported
- by Dan Douglas <ormaaj@gmail.com>
-
- 1/15
- ----
-builtins/cd.def
- - cd_builtin: make sure call to internal_getopt handles -e option.
- Fixes bug reported by <mashimiao.fnst@cn.fujitsu.com>
-
- 1/17
- ----
-subst.c
- - expand_word_list_internal: make sure tempenv_assign_error is
- initialized to 0
-
-execute_cmd.c
- - execute_simple_command: make sure tempenv_assign_error is reset to 0
- after it's tested to see if an error should force the shell to exit.
- Fixes problem where a the failure of a tempenv assignment preceding
- a non-special builtin `sticks' and causes the next special builtin
- to exit the shell. From a discussion on bug-bash started by
- douxin <wq-doux@cn.fujitsu.com>
-
- 1/20
- ----
-subst.c
- - parameter_brace_expand_rhs: call stupidly_hack_special_variables
- after assigning with ${param[:]=word} even if IFS is changing.
- Suggested by Dan Douglas <ormaaj@gmail.com> [TENTATIVE, needs work
- on IFS side effects]
-
-command.h
- - W_GLOBEXP (which was unused) is now W_SPLITSPACE (which isn't used
- yet)
-
-{execute_cmd,subst,variables}.c
- - removed all code that mentioned W_GLOBEXP
- - removed mention of gnu_argv_flags and code that set it
-
- 1/22
- ----
-subst.c
- - param_expand: set W_SPLITSPACE if we expand (unquoted) $* and
- IFS is unset or null so we can be sure to split this on spaces
- no matter what happens with IFS later
- - expand_word_internal: note that param_expand returns W_SPLITSPACE
- in the returned word flags and keep track of that state with
- `split_on_spaces'
-
- 1/23
- ----
-subst.c
- - expand_word_internal: if split_on_spaces is non-zero, make sure
- we split `istring' on spaces and return the resultant word. The
- previous expansions should have quoted spaces in the positional
- parameters where necessary. Suggested by Dan Douglas
- <ormaaj@gmail.com>
-
-execute_cmd.c
- - execute_command_internal: make sure any subshell forked to run a
- group command or user subshell at the end of a pipeline runs any
- EXIT trap it sets. Fixes debian bash bug 698411
- http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698411
-
-subst.c
- - shell_expand_word_list: fix code that creates args for and calls
- make_internal_declare to avoid calling it twice (missing `else'
- in 12/26 change)
- - do_assignment_internal: fix code from 12/26 change to fix problem
- where an existing assoc variable could be converted to an array
- without checking `mkassoc'
-
- 1/24
- ----
-builtins/evalfile.c
- - _evalfile: add missing `close (fd)' calls before returning to
- avoid fd leaks. Bug and fix from Roman Rakus <rrakus@redhat.com>
-
- 1/25
- ----
-builtins/read.def
- - read_builtin: don't try to play tricks with the top of the unwind-
- protect stack after read gets a SIGALRM; save input_string to new
- memory, run the stack, then restore input_string and assign the
- variables. Part of fix for bug reported by konsolebox
- <konsolebox@gmail.com>; the rest of the fix is with the changes in
- trap and signal handling and doing away with interrupt_immediately
-
- 1/26
- ----
-redir.c
- - redirection_expand, write_here_string, write_here_document: before
- calling any of the word expansion functions, after setting
- expanding_redir to 1 (which bypasses the temp environment in the
- variable lookup functions), call sv_ifs to reset the cached IFS-
- related variables set by subst.c:setifs(). This ensures that
- redirections will not get any IFS values that are set in the
- temporary environment, as Posix specifies. Then, after the word
- expansions, after resetting expanding_redir to 0, call sv_ifs
- again to make sure the cached IFS values are set from any
- assignments in the temporary environment. We force executing_builtin
- to 1 to `fool' the variable lookup functions into using any temp
- environment, then reset it to its old value after sv_ifs returns.
- This is what allows read() to use the (cached) IFS variables set
- in the temp environment. Fixes inconsistency reported by Dan Douglas
- <ormaaj@gmail.com>
-
- 1/29
- ----
-lib/readline/display.c
- - update_line: fix off-by-one error when updating vis_lbreaks array
- in a multibyte locale that occurs when moving multibyte chars from
- one line down to another. Bug report and fix from Egmont
- Koblinger <egmont@gmail.com>
-
- 1/30
- ----
-configure.ac
- - changed version to 4.3-alpha
-
-redir.c
- - redir_open: handle open returning -1/EINTR, which seems to happen
- a lot with FIFOs and SIGCHLD, and call QUIT to handle other
- signals that can interrupt open(2). Bug report and initial fix
- from Mike Frysinger <vapier@gentoo.org>
-
- 1/31
- ----
-subst.c
- - parameter_brace_expand: make sure to propagate the PF_ASSIGNRHS flag
- to parameter_brace_expand_word
- - parameter_brace_expand_word: make sure that if the PF_ASSIGNRHS flag
- is set and we are expanding ${a[@]} or ${a[*]} we set quoted to
- include Q_DOUBLE_QUOTES before calling array_value_internal, mirroring
- what we do for $@ and $*. Fixes inconsistency reported by Dan
- Douglas <ormaaj@gmail.com>
-
-configure.ac
- - use AC_CHECK_TOOL instead of AC_CHECK_PROG to check for ar, since it
- will find $host-prefixed versions of utilities. Report and fix from
- Mike Frysinger <vapier@gentoo.org>
-
-builtins/setattr.def
- - set_var_attribute: check whether bind_variable (called when the
- variable whose attributes are being modified is found in the temp
- environment) just modified a read-only global variable, and don't
- bother marking the temporary variable for propagation if so. The
- propagation is superfluous and will result in a strange error
- message
-
- 2/2
- ---
-variables.c
- - initialize_shell_variables: don't try to import function definitions
- with invalid names from the environment if already in posix mode,
- but create them as (invisible) exported variables so they pass
- through the environment. Print an error message so user knows
- what's wrong. Fixes bug reported by Tomas Trnka <ttrnka@mail.muni.cz>
-
- 2/9
- ---
-
-builtins/read.def
- - sigalrm_seen, alrmbuf: now global so the rest of the shell (trap.c)
- can use them
- - sigalrm: just sets flag, no longer longjmps to alrmbuf; problem was
- longjmp without manipulating signal mask, leaving SIGALRM blocked
-
-quit.h
- - move CHECK_ALRM macro here from builtins/read.def so trap.c:
- check_signals() can call it
-
-trap.c
- - check_signals: add call to CHECK_ALRM before QUIT
- - check_signals_and_traps: call check_signals() instead of including
- CHECK_ALRM and QUIT inline. Integrating check for read builtin's
- SIGALRM (where zread call to check_signals_and_traps can see it)
- fixes problem reported by Mike Frysinger <vapier@gentoo.org>
-
- 2/12
- ----
-lib/glob/xmbsrtowcs.c
- - xdupmbstowcs2: fixed but where end of string was not handled
- correctly, causing loop to go past end of string in a bunch of cases.
- Fixes bug reported by "Dashing" <dashing@hushmail.com>
-
-
- 2/13
- ----
-builtins/pushd.def
- - popd_builtin: treat any argument that isn't -n or of the form
- [-+][[:digit:]]* as an error. Fixes problem reported by Bruce
- Korb <bruce.korb@gmail.com>
-
- 2/14
- ----
-configure.ac
- - add check for sig_atomic_t; already a placeholder for it in
- config.h.in
-
- 2/15
- ----
-subst.c
- - do_compound_assignment: don't call assign_compound_array_list with
- a NULL variable in case make_local_xxx_variable returns NULL
- (it will if you try to shadow a readonly or noassign variable).
- Fixes bug reported by Richard Tollerton <rich.tollerton@ni.com>
-
- 2/16
- ----
-variables.c
- - make_local_variable: print error messager if an attempt is made to
- create a local variable shadowing a `noassign' variable. Previously
- we just silently refused to do it
-
-trap.[ch]
- - get_original_signal: now global so rest of the shell can use it
-
-sig.c
- - initialize_shell_signals: install a signal handler for SIGTERM
- that does nothing except set a sigterm_received flag instead of
- ignoring it with SIG_IGN, as long as SIGTERM is not ignored when
- the shell is started. Use get_original_signal early to get the
- original handler, since we will do that later anyway
- - set_signal_handler: if installing sigterm_sighandler as the SIGTERM
- handler, make sure to add SA_RESTART flag to make it as close to
- SIG_IGN as possible
-
-sig.h
- - sigterm_sighandler: new extern declaration
-
-quit.h
- - RESET_SIGTERM: set sigterm_receved to 0
- - CHECK_SIGTERM: check sigterm_received; if it's non-zero, treat it
- as a fatal signal and call termsig_handler to exit the shell
-
-jobs.c
- - make_child: call RESET_SIGTERM just before fork() so we can detect
- if the child process received a SIGTERM before it's able to change
- the signal handler back to what it was when the shell started
- (presumably SIG_DFL). Only has effect if the shell installed
- sigterm_sighandler for SIGTERM, interactive shells that were not
- started with SIG_IGN as the SIGTERM handler
- - make_child: call RESET_SIGTERM in the parent after fork() so the
- rest of the shell won't react to it
-
-execute_cmd.c
- - execute_simple_command: call CHECK_SIGTERM after make_child in child
- to catch SIGTERM received after fork() and before restoring old
- signal handlers
- - execute_disk_command: call CHECK_SIGTERM after make_child in child
- process after restoring old signal handlers and again just before
- calling shell_execve. Fixes race condition observed by
- Padraig Brady <p@draigbrady.com> when testing with his `timeout'
- program
-
-lib/readline/display.c
- - open_some_spaces: new function, subset of insert_some_chars that just
- opens up a specified number of spaces to be overwritten
- - insert_some_spaces: now just calls to open_some_spaces followed by
- _rl_output_some_chars
- - update_line: use col_temp instead of recalculating it using
- _rl_col_width in the case where we use more columns with fewer bytes
- - update_line: use open_some_spaces and then output the right number
- of chars instead of trying to print new characters then overwrite
- existing characters in two separate calls. This includes removing
- some dodgy code and making things simpler. Fix from Egmont
- Koblinger <egmont@gmail.com>
- - use new variable `bytes_to_insert' instead of overloading temp in
- some code blocks (nls - nfd, bytes that comprise the characters
- different in the new line from the old)
-
- 2/18
- ----
-redir.c
- - do_redirection_internal: add undoable redirection for the implicit
- close performed by the <&n- and >&n- redirections. Fixes bug
- reported by Stephane Chazelas <stephane.chazelas@gmail.com>
-
- 2/19
- ----
-sig.c
- - termsig_handler: an interactive shell killed by SIGHUP and keeping
- command history will try to save the shell history before exiting.
- This is an attempt to preserve the save-history-when-the-terminal-
- window-is-closed behavior
-
- 2/21
- ----
-braces.c
- - brace_expand: if a sequence expansion fails (e.g. because the
- integers overflow), treat that expansion as a simple string, including
- the braces, and try to process any remainder of the string. The
- remainder may include brace expansions. Derived from SuSE bug
- 804551 example (https://bugzilla.novell.com/show_bug.cgi?id=804551)
-
- 2/23
- ----
-{quit,sig}.h,sig.c
- - sigterm_received declaration now in sig.h; type is sig_atomic_t
- - sigwinch_received type now sig_atomic_t
- - sig.h includes bashtypes.h and <signal.h> if SIG_DFL not defined
- (same logic as trap.h) to pick up sig_atomic_t
-
-unwind_prot.c
- - include sig.h before quit.h (reverse order)
-
- 2/27
- ----
-builtins/shopt.def
- - reset_shopt_options: make sure check_window_size is reset to the
- default from config.h, not unconditionally to 0
-
-jobs.[ch]
- - last_made_pid, last_asynchronous_pid: now volatile. Change from SuSE
-
-jobs.c
- - wait_for: if we're using sigaction to install a handler for SIGCHLD,
- make sure we specify SA_RESTART
-
-lib/{tilde,readline}/shell.c
- - get_home_dir: instead of looking in the password file every time,
- look once and cache the result
-
-sig.[ch]
- - sigwinch_received, sigterm_received: now `volatile' qualified
-
-sig.c,quit.h
- - interrupt_state,terminating_signal: now sig_atomic_t
-
- 3/1
- ---
-MANIFEST,examples/*
- - removed around 120 files without FSF copyrights; requested by
- Karl Berry in early January
-
- 3/2
- ---
-lib/malloc/malloc.c
- - morecore: only check whether SIGCHLD is trapped if SIGCHLD is defined
-
-doc/bashref.texi
- - Fixed most of the examples in the GNU Parallel section to use better
- shell idioms following complaints on bug-bash; added a couple of
- examples and smoothed out the text
-
-quit.h
- - include "sig.h" for sig_atomic_t
-
-lib/readline/display.c
- - update_line: when inserting one or more characters at the end of
- the display line in a non-multibyte environment, just write from the
- first difference to the end of the line and return. We don't have
- to adjust _rl_last_c_pos. This is needed to adjust from the old
- two-part copy to a single call to _rl_output_some_chars (change of
- 2/16)
-
- 3/4
- ---
-Makefile.in,doc/Makefile.in
- - PACKAGE_TARNAME, docdir: new variables substituted by autoconf
- - OTHER_DOCS,OTHER_INSTALLED_DOCS: new variables with auxiliary
- documentation files to be installed into $(docdir)
- - install: add new rule to install $(OTHER_DOCS)
- - uninstall: add new rule to uninstall $(docdir)/$(OTHER_INSTALLED_DOCS)
-
-doc/bash.1
- - add URL to `POSIX' file in `SEE ALSO' section; put pointer to that
- section in --posix and set -o posix descriptions
-
-examples/
- - removed around 110 examples at the request of the FSF due to copyright
- issues
-
- 3/5
- ---
-builtins/setattr.def
- - readonly: modified help text slightly to make it clearer that
- functions aren't changed or displayed unless the -f option is given.
- Report from <gotmynick@gmail.com>
-
- 3/9
- ---
-include/typemax.h
- - SIZE_MAX: define to 65535 (Posix minimum maximum) if not defined
-
-parse.y
- - include "typemax.h" for possible SIZE_MAX definition, make sure we
- include it after shell.h
-
-{braces,expr}.c
- - include "typemax.h" for possible INTMAX_MIN and INTMAX_MAX definitions
-
- 3/10
- ----
-bashline.c
- - bash_default_completion: make sure completion type of `!' (same as
- TAB but with show-all-if-ambiguous set) and glob-word-completion
- sets rl_filename_completion_desired to 0 so extra backslashes don't
- get inserted by `quoting' the completion. We can't kill all the
- matches because show-all-if-ambiguous needs them. Bug report from
- Marcel (Felix) Giannelia <info@skeena.net>
-
-[bash-4.3-alpha frozen]
-
- 3/14
- ----
-general.c
- - trim_pathname: use memmove instead of memcpy since the source and
- destination pathnames may overlap. Report and fix from Matthew
- Riley <mattdr@google.com>
-
- 3/18
- ----
-configure.ac
- - socklen_t is defined as `unsigned int' if configure can't find it
-
- 3/20
- ----
-lib/readline/complete.c
- - S_ISVTX: since it's not defined on all platforms (Minix), make sure
- its use is protected with #ifdef
-
- 3/21
- ----
-doc/{bash.1,bashref.texi}
- - Added mention of ${!name[@]} and ${!name[*]} expansions to get all
- indices of an array. Suggested by Jonathan Leffler
- <jonathan.leffler@gmail.com>
-
- 3/24
- ----
-subst.h
- - SD_IGNOREQUOTE: new define for skip_to_delim; if set, means that
- single quotes (for now) will be treated as ordinary characters
-
-subst.c
- - skip_to_delim: handle SD_IGNOREQUOTE. no callers use it for now
-
- 3/25
- ----
-support/config.{guess,sub}
- - updated to versions from autoconf-2.69
-
- 3/31
- ----
-lib/sh/shquote.c
- - sh_single_quote: short-circuit quoting a single "'" instead of
- creating a long string with empty single-quoted strings
-
-parser.h
- - DOLBRACE_QUOTE2: new define, like DOLBRACE_QUOTE, but need to single-
- quote results of $'...' expansion because quote removal will be
- done later. Right now this is only done for ${word/pat/rep}
-
-parse.y
- - parse_matched_pair: set state to DOLBRACE_QUOTE2 for pattern
- substitution word expansion so we don't treat single quote specially
- in the pattern or replacement string
- - parse_matched_pair: if we're parsing a dollar-brace word expansion
- (${...}) and we're not treating single quote specially within
- double quotes, single-quote the translation of $'...' ansi-c
- escaped strings. Original report and fix from Eduardo A.
- Bustamante López <dualbus@gmail.com>
-
-subst.c
- - extract_dollar_brace_string: ${word/pat/rep} scanning now sets the
- DOLBRACE_QUOTE2 flag instead of DOLBRACE_QUOTE so we don't treat
- single quotes specially within a double-quoted string
-
-execute_cmd.c
- - fix_assignment_words: skip over assignment statements preceding a
- command word before trying to figure out whether or not assignment
- statements following a possible declaration command should be
- treated specially. Fixes bug reported by Dan Douglas
- <ormaaj@gmail.com>
-
- 4/4
- ---
-lib/readline/readline.c
- - _rl_dispatch_subseq: only call _rl_vi_set_last (and check whether
- the key is a text modification command) if the key sequence length
- is 1. That keeps the arrow keys from setting the last command
- when called in vi command mode. Fixes bug reported by Ian A.
- Watson <watson_ian_a@lilly.com>
-
- 4/6
- ---
-lib/readline/bind.c
- - rl_parse_and_bind: when parsing a double-quoted string as the value
- of a variable, make sure we skip past the leading double quote.
- Fix from Andreas Schwab <schwab@linux-m68k.org>
-
-variables.c
- - hash_lookup: set new local variable last_table_searched to the table
- a successful lookup appears in; tested in make_local_variable to
- solve the problem below
- - make_local_variable: if we find a variable with the tempenv flag
- set at the same `level' as variable_context', but not found in the
- temporary_env (temp environment preceding the builtin), return it.
- The temp environment preceding the function call has already been
- merged (in execute_function) into the list of variable contexts the
- function sees as shell_variables by the time this is called. Fixes
- inconsistency pointed out by Dan Douglas <ormaaj@gmail.com>
-
-subst.c
- - expand_arith_string: expanded out contents of expand_string,
- expand_string_internal, expand_string_if_necessary to create a
- WORD_DESC and call call_expand_word_internal() on it directly.
- We don't want process substitution to be performed ( 1<(2) ) should
- mean something different in an arithmetic expression context.
- It doesn't work to just turn on the DQUOTE flag, since that means
- that things like ${x["expression"]} are not expanded correctly.
- Fixes problem pointed out by Dan Douglas <ormaaj@gmail.com>
-
- 4/13
- ----
-subst.c
- - process_substitute: run the EXIT trap before exiting, as other
- shells seem to. Fixes problem pointed out by Dan Douglas
- <ormaaj@gmail.com>
-
-lib/readline/readline.c
- - readline_internal_setup: call rl_vi_insertion_mode to enter vi
- mode instead of rl_vi_insert_mode to avoid resetting the saved last
- command information. Posix says that `.' can repeat a command
- that was entered on a previous line so we need to save the info.
- Fixes bug reported by Ian A. Watson <watson_ian_a@lilly.com>
-
- 4/14
- ----
-lib/readline/complete.c
- - rl_completion_matches: make sure xrealloc returns something non-null
- (can happen when interrupted by a signal) before trying to add
- matches to match_list
-
-subst.c
- - array_remove_pattern: return NULL right away if array_variable_part
- returns an invisible variable
- - array_length_reference: handle array_variable_part returning an
- invisible variable
- - get_var_and_type: handle array_variable_part returning an invisible
- variable
-
- 4/15
- ----
-execute_cmd.c
- - execute_command_internal: make sure to run the EXIT trap for group
- commands anywhere in pipelines, not just at the end. From a point
- raised by Andreas Schwab <schwab@linux-m68k.org>
-
-variables.c
- - bind_int_variable: make sure invisible flag is unset. Fixes problems
- like "declare -ai a; : $(( a[4]=4 ));"
-
-arrayfunc.c
- - array_variable_part: return variable even if invisible flag set,
- callers must handle invisible vars
-
- 4/18
- ----
-builtins/set.def
- - unset_builtin: if -n flag given, call unset_nameref instead of
- unset_variable
-
-variables.c
- - find_variable_nameref: print warning message if nameref circular
- reference detected, return NULL and let caller deal with it
-
-builtins/declare.def
- - declare_builtin: only disallow global references at this point if
- we are at the global scope
-
- 5/16
- ----
-configure.ac
- - update release status to beta
-
- 5/23
- ----
-trap.c
- - run_pending_traps: save and restore pipeline around calls to
- evalstring() in case we get a trap while running a trap. Have to
- figure out the recursive running traps issue elsewhere. Fixes
- bug reported by Roman Rakus <rrakus@redhat.com>
- - run_pending_traps: make sure to set running_trap to the appropriate
- signal value when running a trap command
- - run_pending_traps: short-circuit immediately if running_trap set
- when invoked. Could change this later to only skip if it would
- run the same trap as currently being run (running_trap == sig + 1)
-
-configure.ac
- - add warning if bison not found
-
-lib/readline/doc/rltech.texi
- - new section with an example program illustrating the callback
- interface. Suggested by Peng Yu <pengyu.ut@gmail.com>
+++ /dev/null
-Starting bash with the `--posix' command-line option or executing
-`set -o posix' while bash is running will cause bash to conform more
-closely to the Posix.2 standard by changing the behavior to match that
-specified by Posix.2 in areas where the bash default differs.
-
-The following list is what's changed when `posix mode' is in effect:
-
-1. When a command in the hash table no longer exists, bash will re-search
- $PATH to find the new location. This is also available with
- `shopt -s checkhash'.
-
-2. The >& redirection does not redirect stdout and stderr.
-
-3. The message printed by the job control code and builtins when a job
- exits with a non-zero status is `Done(status)'.
-
-4. Reserved words may not be aliased.
-
-5. The Posix.2 PS1 and PS2 expansions of `!' -> history number and
- `!!' -> `!' are enabled, and parameter expansion is performed on
- the value regardless of the setting of the `promptvars' option.
-
-6. Interactive comments are enabled by default. (Note that bash has
- them on by default anyway.)
-
-7. The Posix.2 startup files are executed ($ENV) rather than the normal
- bash files.
-
-8. Tilde expansion is only performed on assignments preceding a command
- name, rather than on all assignment statements on the line.
-
-9. The default history file is ~/.sh_history (default value of $HISTFILE).
-
-10. The output of `kill -l' prints all the signal names on a single line,
- separated by spaces.
-
-11. Non-interactive shells exit if `file' in `. file' is not found.
-
-12. Redirection operators do not perform pathname expansion on the word
- in the redirection unless the shell is interactive
-
-13. Function names must be valid shell identifiers. That is, they may not
- contain characters other than letters, digits, and underscores, and
- may not start with a digit. Declaring a function with an illegal name
- causes a fatal syntax error in non-interactive shells.
-
-14. Posix.2 `special' builtins are found before shell functions during command
- lookup.
-
-15. If a Posix.2 special builtin returns an error status, a non-interactive
- shell exits. The fatal errors are those listed in the POSIX.2 standard,
- and include things like passing incorrect options, redirection errors,
- variable assignment errors for assignments preceding the command name,
- and so on.
-
-16. The environment passed to executed commands is not sorted. Neither is
- the output of `set'. This is not strictly Posix.2 behavior, but sh
- does it this way. Ksh does not. It's not necessary to sort the
- environment; no program should rely on it being sorted.
-
-17. If the `cd' builtin finds a directory to change to using $CDPATH, the
- value it assigns to $PWD does not contain any symbolic links, as if
- `cd -P' had been executed.
-
-18. A non-interactive shell exits with an error status if a variable
- assignment error occurs when no command name follows the assignment
- statements. A variable assignment error occurs, for example, when
- trying to assign a value to a read-only variable.
-
-19. A non-interactive shell exits with an error status if the iteration
- variable in a for statement or the selection variable in a select
- statement is a read-only variable.
-
-20. Process substitution is not available.
-
-21. Assignment statements preceding POSIX.2 `special' builtins persist in
- the shell environment after the builtin completes.
-
-There is other Posix.2 behavior that bash does not implement. Specifically:
-
-1. Assignment statements affect the execution environment of all builtins,
- not just special ones.
+++ /dev/null
-This file is set.def, from which is created set.c.
-It implements the "set" and "unset" builtins in Bash.
-
-Copyright (C) 1987, 1989, 1991 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 1, 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; see the file COPYING. If not, write to the Free Software
-Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-$PRODUCES set.c
-
-#include <stdio.h>
-#include "../shell.h"
-#include "../flags.h"
-
-#include "bashgetopt.h"
-
-extern int interactive;
-extern int noclobber, posixly_correct;
-#if defined (READLINE)
-extern int rl_editing_mode, no_line_editing;
-#endif /* READLINE */
-
-$BUILTIN set
-$FUNCTION set_builtin
-$SHORT_DOC set [--abefhkmnptuvxldBCHP] [-o option] [arg ...]
- -a Mark variables which are modified or created for export.
- -b Notify of job termination immediately.
- -e Exit immediately if a command exits with a non-zero status.
- -f Disable file name generation (globbing).
- -h Locate and remember function commands as functions are
- defined. Function commands are normally looked up when
- the function is executed.
- -i Force the shell to be an "interactive" one. Interactive shells
- always read `~/.bashrc' on startup.
- -k All keyword arguments are placed in the environment for a
- command, not just those that precede the command name.
- -m Job control is enabled.
- -n Read commands but do not execute them.
- -o option-name
- Set the variable corresponding to option-name:
- allexport same as -a
- braceexpand same as -B
-#if defined (READLINE)
- emacs use an emacs-style line editing interface
-#endif /* READLINE */
- errexit same as -e
- histexpand same as -H
- ignoreeof the shell will not exit upon reading EOF
- interactive-comments
- allow comments to appear in interactive commands
- monitor same as -m
- noclobber disallow redirection to existing files
- noexec same as -n
- noglob same as -f
- nohash same as -d
- notify save as -b
- nounset same as -u
- physical same as -P
- posix change the behavior of bash where the default
- operation differs from the 1003.2 standard to
- match the standard
- privileged same as -p
- verbose same as -v
-#if defined (READLINE)
- vi use a vi-style line editing interface
-#endif /* READLINE */
- xtrace same as -x
- -p Turned on whenever the real and effective user ids do not match.
- Disables processing of the $ENV file and importing of shell
- functions. Turning this option off causes the effective uid and
- gid to be set to the real uid and gid.
- -t Exit after reading and executing one command.
- -u Treat unset variables as an error when substituting.
- -v Print shell input lines as they are read.
- -x Print commands and their arguments as they are executed.
- -l Save and restore the binding of the NAME in a FOR command.
- -d Disable the hashing of commands that are looked up for execution.
- Normally, commands are remembered in a hash table, and once
- found, do not have to be looked up again.
-#if defined (BRACE_EXPANSION)
- -B the shell will perform brace expansion
-#endif /* BRACE_EXPANSION */
-#if defined (BANG_HISTORY)
- -H Enable ! style history substitution. This flag is on
- by default.
-#endif /* BANG_HISTORY */
- -C If set, disallow existing regular files to be overwritten
- by redirection of output.
- -P If set, do not follow symbolic links when executing commands
- such as cd which change the current directory.
-
-Using + rather than - causes these flags to be turned off. The
-flags can also be used upon invocation of the shell. The current
-set of flags may be found in $-. The remaining n ARGs are positional
-parameters and are assigned, in order, to $1, $2, .. $n. If no
-ARGs are given, all shell variables are printed.
-$END
-
-/* An a-list used to match long options for set -o to the corresponding
- option letter. */
-struct {
- char *name;
- int letter;
-} o_options[] = {
- { "allexport", 'a' },
-#if defined (BRACE_EXPANSION)
- { "braceexpand",'B' },
-#endif
- { "errexit", 'e' },
- { "histexpand", 'H' },
- { "monitor", 'm' },
- { "noexec", 'n' },
- { "noglob", 'f' },
- { "nohash", 'd' },
-#if defined (JOB_CONTROL)
- { "notify", 'b' },
-#endif /* JOB_CONTROL */
- {"nounset", 'u' },
- {"physical", 'P' },
- {"privileged", 'p' },
- {"verbose", 'v' },
- {"xtrace", 'x' },
- {(char *)NULL, 0},
-};
-
-#define MINUS_O_FORMAT "%-15s\t%s\n"
-
-void
-list_minus_o_opts ()
-{
- register int i;
- char *on = "on", *off = "off";
-
- printf (MINUS_O_FORMAT, "noclobber", (noclobber == 1) ? on : off);
-
- if (find_variable ("ignoreeof") || find_variable ("IGNOREEOF"))
- printf (MINUS_O_FORMAT, "ignoreeof", on);
- else
- printf (MINUS_O_FORMAT, "ignoreeof", off);
-
- printf (MINUS_O_FORMAT, "interactive-comments",
- interactive_comments ? on : off);
-
- printf (MINUS_O_FORMAT, "posix", posixly_correct ? on : off);
-
-#if defined (READLINE)
- if (no_line_editing)
- {
- printf (MINUS_O_FORMAT, "emacs", off);
- printf (MINUS_O_FORMAT, "vi", off);
- }
- else
- {
- /* Magic. This code `knows' how readline handles rl_editing_mode. */
- printf (MINUS_O_FORMAT, "emacs", (rl_editing_mode == 1) ? on : off);
- printf (MINUS_O_FORMAT, "vi", (rl_editing_mode == 0) ? on : off);
- }
-#endif /* READLINE */
-
- for (i = 0; o_options[i].name; i++)
- {
- int *on_or_off, zero = 0;
-
- on_or_off = find_flag (o_options[i].letter);
- if (on_or_off == FLAG_UNKNOWN)
- on_or_off = &zero;
- printf (MINUS_O_FORMAT, o_options[i].name, (*on_or_off == 1) ? on : off);
- }
-}
-
-set_minus_o_option (on_or_off, option_name)
- int on_or_off;
- char *option_name;
-{
- int option_char = -1;
-
- if (STREQ (option_name, "noclobber"))
- {
- if (on_or_off == FLAG_ON)
- bind_variable ("noclobber", "");
- else
- unbind_variable ("noclobber");
- stupidly_hack_special_variables ("noclobber");
- }
- else if (STREQ (option_name, "ignoreeof"))
- {
- unbind_variable ("ignoreeof");
- unbind_variable ("IGNOREEOF");
- if (on_or_off == FLAG_ON)
- bind_variable ("IGNOREEOF", "10");
- stupidly_hack_special_variables ("IGNOREEOF");
- }
-
-#if defined (READLINE)
- else if ((STREQ (option_name, "emacs")) || (STREQ (option_name, "vi")))
- {
- if (on_or_off == FLAG_ON)
- {
- rl_variable_bind ("editing-mode", option_name);
-
- if (interactive)
- with_input_from_stdin ();
- no_line_editing = 0;
- }
- else
- {
- int isemacs = (rl_editing_mode == 1);
- if ((isemacs && STREQ (option_name, "emacs")) ||
- (!isemacs && STREQ (option_name, "vi")))
- {
- if (interactive)
- with_input_from_stream (stdin, "stdin");
- no_line_editing = 1;
- }
- else
- builtin_error ("not in %s editing mode", option_name);
- }
- }
-#endif /* READLINE */
- else if (STREQ (option_name, "interactive-comments"))
- interactive_comments = (on_or_off == FLAG_ON);
- else if (STREQ (option_name, "posix"))
- {
- posixly_correct = (on_or_off == FLAG_ON);
- unbind_variable ("POSIXLY_CORRECT");
- unbind_variable ("POSIX_PEDANTIC");
- if (on_or_off == FLAG_ON)
- {
- bind_variable ("POSIXLY_CORRECT", "");
- stupidly_hack_special_variables ("POSIXLY_CORRECT");
- }
- }
- else
- {
- register int i;
- for (i = 0; o_options[i].name; i++)
- {
- if (STREQ (option_name, o_options[i].name))
- {
- option_char = o_options[i].letter;
- break;
- }
- }
- if (option_char == -1)
- {
- builtin_error ("%s: unknown option name", option_name);
- return (EXECUTION_FAILURE);
- }
- if (change_flag (option_char, on_or_off) == FLAG_ERROR)
- {
- bad_option (option_name);
- return (EXECUTION_FAILURE);
- }
- }
- return (EXECUTION_SUCCESS);
-}
-
-/* Set some flags from the word values in the input list. If LIST is empty,
- then print out the values of the variables instead. If LIST contains
- non-flags, then set $1 - $9 to the successive words of LIST. */
-set_builtin (list)
- WORD_LIST *list;
-{
- int on_or_off, flag_name, force_assignment = 0;
-
- if (!list)
- {
- SHELL_VAR **vars;
-
- vars = all_shell_variables ();
- if (vars)
- {
- print_var_list (vars);
- free (vars);
- }
-
- vars = all_shell_functions ();
- if (vars)
- {
- print_var_list (vars);
- free (vars);
- }
-
- return (EXECUTION_SUCCESS);
- }
-
- /* Check validity of flag arguments. */
- if (*list->word->word == '-' || *list->word->word == '+')
- {
- register char *arg;
- WORD_LIST *save_list = list;
-
- while (list && (arg = list->word->word))
- {
- char c;
-
- if (arg[0] != '-' && arg[0] != '+')
- break;
-
- /* `-' or `--' signifies end of flag arguments. */
- if (arg[0] == '-' &&
- (!arg[1] || (arg[1] == '-' && !arg[2])))
- break;
-
- while (c = *++arg)
- {
- if (find_flag (c) == FLAG_UNKNOWN && c != 'o')
- {
- char s[2];
- s[0] = c; s[1] = '\0';
- bad_option (s);
- if (c == '?')
- builtin_usage ();
- return (c == '?' ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
- }
- }
- list = list->next;
- }
- list = save_list;
- }
-
- /* Do the set command. While the list consists of words starting with
- '-' or '+' treat them as flags, otherwise, start assigning them to
- $1 ... $n. */
- while (list)
- {
- char *string = list->word->word;
-
- /* If the argument is `--' or `-' then signal the end of the list
- and remember the remaining arguments. */
- if (string[0] == '-' && (!string[1] || (string[1] == '-' && !string[2])))
- {
- list = list->next;
-
- /* `set --' unsets the positional parameters. */
- if (string[1] == '-')
- force_assignment = 1;
-
- /* Until told differently, the old shell behaviour of
- `set - [arg ...]' being equivalent to `set +xv [arg ...]'
- stands. Posix.2 says the behaviour is marked as obsolescent. */
- else
- {
- change_flag ('x', '+');
- change_flag ('v', '+');
- }
-
- break;
- }
-
- if ((on_or_off = *string) &&
- (on_or_off == '-' || on_or_off == '+'))
- {
- int i = 1;
- while (flag_name = string[i++])
- {
- if (flag_name == '?')
- {
- builtin_usage ();
- return (EXECUTION_SUCCESS);
- }
- else if (flag_name == 'o') /* -+o option-name */
- {
- char *option_name;
- WORD_LIST *opt;
-
- opt = list->next;
-
- if (!opt)
- {
- list_minus_o_opts ();
- continue;
- }
-
- option_name = opt->word->word;
-
- if (!option_name || !*option_name || (*option_name == '-'))
- {
- list_minus_o_opts ();
- continue;
- }
- list = list->next; /* Skip over option name. */
-
- if (set_minus_o_option (on_or_off, option_name) != EXECUTION_SUCCESS)
- return (EXECUTION_FAILURE);
- }
- else
- {
- if (change_flag (flag_name, on_or_off) == FLAG_ERROR)
- {
- char opt[3];
- opt[0] = on_or_off;
- opt[1] = flag_name;
- opt[2] = '\0';
- bad_option (opt);
- builtin_usage ();
- return (EXECUTION_FAILURE);
- }
- }
- }
- }
- else
- {
- break;
- }
- list = list->next;
- }
-
- /* Assigning $1 ... $n */
- if (list || force_assignment)
- remember_args (list, 1);
- return (EXECUTION_SUCCESS);
-}
-
-$BUILTIN unset
-$FUNCTION unset_builtin
-$SHORT_DOC unset [-f] [-v] [name ...]
-For each NAME, remove the corresponding variable or function. Given
-the `-v', unset will only act on variables. Given the `-f' flag,
-unset will only act on functions. With neither flag, unset first
-tries to unset a variable, and if that fails, then tries to unset a
-function. Some variables (such as PATH and IFS) cannot be unset; also
-see readonly.
-$END
-
-#define NEXT_VARIABLE() any_failed++; list = list->next; continue;
-
-unset_builtin (list)
- WORD_LIST *list;
-{
- int unset_function, unset_variable, unset_array, opt, any_failed;
- char *name;
-
- unset_function = unset_variable = unset_array = any_failed = 0;
-
- reset_internal_getopt ();
- while ((opt = internal_getopt (list, "fv")) != -1)
- {
- switch (opt)
- {
- case 'f':
- unset_function = 1;
- break;
- case 'v':
- unset_variable = 1;
- break;
- default:
- builtin_usage ();
- return (EXECUTION_FAILURE);
- }
- }
-
- list = loptend;
-
- if (unset_function && unset_variable)
- {
- builtin_error ("cannot simultaneously unset a function and a variable");
- return (EXECUTION_FAILURE);
- }
-
- while (list)
- {
- SHELL_VAR *var;
- int tem;
-#if defined (ARRAY_VARS)
- char *t;
-#endif
-
- name = list->word->word;
-
-#if defined (ARRAY_VARS)
- if (!unset_function && valid_array_reference (name))
- {
- t = strchr (name, '[');
- *t++ = '\0';
- unset_array++;
- }
-#endif
-
- var = unset_function ? find_function (name) : find_variable (name);
-
- if (var && !unset_function && non_unsettable_p (var))
- {
- builtin_error ("%s: cannot unset", name);
- NEXT_VARIABLE ();
- }
-
- /* Posix.2 says that unsetting readonly variables is an error. */
- if (var && readonly_p (var))
- {
- builtin_error ("%s: cannot unset: readonly %s",
- name, unset_function ? "function" : "variable");
- NEXT_VARIABLE ();
- }
-
- /* Unless the -f option is supplied, the name refers to a variable. */
-#if defined (ARRAY_VARS)
- if (var && unset_array)
- {
- if (array_p (var) == 0)
- {
- builtin_error ("%s: not an array variable", name);
- NEXT_VARIABLE ();
- }
- else
- tem = unbind_array_element (var, t);
- }
- else
-#endif /* ARRAY_VARS */
- tem = makunbound (name, unset_function ? shell_functions : shell_variables);
-
- /* This is what Posix.2 draft 11+ says. ``If neither -f nor -v
- is specified, the name refers to a variable; if a variable by
- that name does not exist, a function by that name, if any,
- shall be unset.'' */
- if ((tem == -1) && !unset_function && !unset_variable)
- tem = makunbound (name, shell_functions);
-
- if (tem == -1)
- any_failed++;
- else if (!unset_function)
- stupidly_hack_special_variables (name);
-
- list = list->next;
- }
-
- if (any_failed)
- return (EXECUTION_FAILURE);
- else
- return (EXECUTION_SUCCESS);
-}
+++ /dev/null
-/* unwind_prot.h - Macros and functions for hacking unwind protection. */
-
-/* Copyright (C) 1993 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 2, 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; see the file COPYING. If not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#if !defined (_UNWIND_PROT_H)
-#define _UNWIND_PROT_H
-
-/* Run a function without interrupts. */
-extern void begin_unwind_frame ();
-extern void discard_unwind_frame ();
-extern void run_unwind_frame ();
-extern void add_unwind_protect ();
-extern void remove_unwind_protect ();
-extern void run_unwind_protects ();
-extern void unwind_protect_var ();
-
-/* Define for people who like their code to look a certain way. */
-#define end_unwind_frame()
-
-/* How to protect an integer. */
-#define unwind_protect_int(X) unwind_protect_var (&(X), (char *)(X), sizeof (int))
-
-/* How to protect a pointer to a string. */
-#define unwind_protect_string(X) \
- unwind_protect_var ((int *)&(X), (X), sizeof (char *))
-
-/* How to protect any old pointer. */
-#define unwind_protect_pointer(X) unwind_protect_string (X)
-
-/* How to protect the contents of a jmp_buf. */
-#define unwind_protect_jmp_buf(X) \
- unwind_protect_var ((int *)(X), (char *)(X), sizeof (procenv_t))
-
-#endif /* _UNWIND_PROT_H */
+++ /dev/null
-This is a terse description of the new features added to bash-4.3 since
-the release of bash-4.2. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. The `helptopic' completion action now maps to all the help topics, not just
- the shell builtins.
-
-b. The `help' builtin no longer does prefix substring matching, so `help read'
- does not match `readonly'.
-
-c. The shell can be compiled to not display a message about processes that
- terminate due to SIGTERM.
-
-d. Non-interactive shells now react to the setting of checkwinsize and set
- LINES and COLUMNS after a foreground job exits.
-
-e. There is a new shell option, `globasciiranges', which, when set to on,
- forces globbing range comparisons to use character ordering as if they
- were run in the C locale.
-
-f. There is a new shell option, `direxpand', which makes filename completion
- expand variables in directory names in the way bash-4.1 did.
-
-g. In Posix mode, the `command' builtin does not change whether or not a
- builtin it shadows is treated as an assignment builtin.
-
-h. The `return' and `exit' builtins accept negative exit status arguments.
-
-i. The word completion code checks whether or not a filename containing a
- shell variable expands to a directory name and appends `/' to the word
- as appropriate. The same code expands shell variables in command names
- when performing command completion.
-
-j. In Posix mode, it is now an error to attempt to define a shell function
- with the same name as a Posix special builtin.
-
-k. When compiled for strict Posix conformance, history expansion is disabled
- by default.
-
-l. The history expansion character (!) does not cause history expansion when
- followed by the closing quote in a double-quoted string.
-
-m. `complete' and its siblings compgen/compopt now takes a new `-o noquote'
- option to inhibit quoting of the completions.
-
-n. Setting HISTSIZE to a value less than zero causes the history list to be
- unlimited (setting it 0 zero disables the history list).
-
-o. Setting HISTFILESIZE to a value less than zero causes the history file size
- to be unlimited (setting it to 0 causes the history file to be truncated
- to zero size).
-
-p. The `read' builtin now skips NUL bytes in the input.
-
-q. There is a new `bind -X' option to print all key sequences bound to Unix
- commands.
-
-r. When in Posix mode, `read' is interruptible by a trapped signal. After
- running the trap handler, read returns 128+signal and throws away any
- partially-read input.
-
-s. The command completion code skips whitespace and assignment statements
- before looking for the command name word to be completed.
-
-t. The build process has a new mechanism for constructing separate help files
- that better reflects the current set of compilation options.
-
-u. The -nt and -ot options to test now work with files with nanosecond
- timestamp resolution.
-
-v. The shell saves the command history in any shell for which history is
- enabled and HISTFILE is set, not just interactive shells.
-
-w. The shell has `nameref' variables and new -n(/+n) options to declare and
- unset to use them, and a `test -R' option to test for them.
-
-x. The shell now allows assigning, referencing, and unsetting elements of
- indexed arrays using negative subscripts (a[-1]=2, echo ${a[-1]}) which
- count back from the last element of the array.
-
-y. The {x}<word redirection feature now allows words like {array[ind]} and
- can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
-
-z. There is a new CHILD_MAX special shell variable; its value controls the
- number of exited child statues the shell remembers.
-
-aa. There is a new configuration option (--enable-direxpand-default) that
- causes the `direxpand' shell option to be enabled by default.
-
-bb. Bash does not do anything special to ensure that the file descriptor
- assigned to X in {x}<foo remains open after the block containing it
- completes.
-
-cc. The `wait' builtin has a new `-n' option to wait for the next child to
- change status.
-
-dd. The `printf' %(...)T format specifier now uses the current time if no
- argument is supplied.
-
-ee. There is a new variable, BASH_COMPAT, that controls the current shell
- compatibility level.
-
-ff. The `popd' builtin now treats additional arguments as errors.
-
-gg. The brace expansion code now treats a failed sequence expansion as a
- simple string and will continue to expand brace terms in the remainder
- of the word.
-
-hh. Shells started to run process substitutions now run any trap set on EXIT.
-
-2. New Features in Readline
-
-a. Readline is now more responsive to SIGHUP and other fatal signals when
- reading input from the terminal or performing word completion but no
- longer attempts to run any not-allowable functions from a signal handler
- context.
-
-b. There are new bindable commands to search the history for the string of
- characters between the beginning of the line and the point
- (history-substring-search-forward, history-substring-search-backward)
-
-c. Readline allows quoted strings as the values of variables when setting
- them with `set'. As a side effect, trailing spaces and tabs are ignored
- when setting a string variable's value.
-
-d. The history library creates a backup of the history file when writing it
- and restores the backup on a write error.
-
-e. New application-settable variable: rl_filename_stat_hook: a function called
- with a filename before using it in a call to stat(2). Bash uses it to
- expand shell variables so things like $HOME/Downloads have a slash
- appended.
-
-f. New bindable function `print-last-kbd-macro', prints the most-recently-
- defined keyboard macro in a reusable format.
-
-g. New user-settable variable `colored-stats', enables use of colored text
- to denote file types when displaying possible completions (colored analog
- of visible-stats).
-
-h. New user-settable variable `keyseq-timout', acts as an inter-character
- timeout when reading input or incremental search strings.
-
-i. New application-callable function: rl_clear_history. Clears the history list
- and frees all readline-associated private data.
-
-j. New user-settable variable, show-mode-in-prompt, adds a characters to the
- beginning of the prompt indicating the current editing mode.
-
-k. New application-settable variable: rl_input_available_hook; function to be
- called when readline detects there is data available on its input file
- descriptor.
-
-l. Readline calls an application-set event hook (rl_event_hook) after it gets
- a signal while reading input (read returns -1/EINTR but readline does not
- handle the signal immediately) to allow the application to handle or
- otherwise note it.
-
-m. If the user-settable variable `history-size' is set to a value less than
- 0, the history list size is unlimited.
-
-n. New application-settable variable: rl_signal_event_hook; function that is
- called when readline is reading terminal input and read(2) is interrupted
- by a signal. Currently not called for SIGHUP or SIGTERM.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-4.2 since
-the release of bash-4.1. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. `exec -a foo' now sets $0 to `foo' in an executable shell script without a
- leading #!.
-
-b. Subshells begun to execute command substitutions or run shell functions or
- builtins in subshells do not reset trap strings until a new trap is
- specified. This allows $(trap) to display the caller's traps and the
- trap strings to persist until a new trap is set.
-
-c. `trap -p' will now show signals ignored at shell startup, though their
- disposition still cannot be modified.
-
-d. $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
-
-e. declare/typeset has a new `-g' option, which creates variables in the
- global scope even when run in a shell function.
-
-f. test/[/[[ have a new -v variable unary operator, which returns success if
- `variable' has been set.
-
-g. Posix parsing changes to allow `! time command' and multiple consecutive
- instances of `!' (which toggle) and `time' (which have no cumulative
- effect).
-
-h. Posix change to allow `time' as a command by itself to print the elapsed
- user, system, and real times for the shell and its children.
-
-j. $((...)) is always parsed as an arithmetic expansion first, instead of as
- a potential nested command substitution, as Posix requires.
-
-k. A new FUNCNEST variable to allow the user to control the maximum shell
- function nesting (recursive execution) level.
-
-l. The mapfile builtin now supplies a third argument to the callback command:
- the line about to be assigned to the supplied array index.
-
-m. The printf builtin has a new %(fmt)T specifier, which allows time values
- to use strftime-like formatting.
-
-n. There is a new `compat41' shell option.
-
-o. The cd builtin has a new Posix-mandated `-e' option.
-
-p. Negative subscripts to indexed arrays, previously errors, now are treated
- as offsets from the maximum assigned index + 1.
-
-q. Negative length specifications in the ${var:offset:length} expansion,
- previously errors, are now treated as offsets from the end of the variable.
-
-r. Parsing change to allow `time -p --'.
-
-s. Posix-mode parsing change to not recognize `time' as a keyword if the
- following token begins with a `-'. This means no more Posix-mode
- `time -p'. Posix interpretation 267.
-
-t. There is a new `lastpipe' shell option that runs the last command of a
- pipeline in the current shell context. The lastpipe option has no
- effect if job control is enabled.
-
-u. History expansion no longer expands the `$!' variable expansion.
-
-v. Posix mode shells no longer exit if a variable assignment error occurs
- with an assignment preceding a command that is not a special builtin.
-
-w. Non-interactive mode shells exit if -u is enabled and an attempt is made
- to use an unset variable with the % or # expansions, the `//', `^', or
- `,' expansions, or the parameter length expansion.
-
-x. Posix-mode shells use the argument passed to `.' as-is if a $PATH search
- fails, effectively searching the current directory. Posix-2008 change.
-
-2. New Features in Readline
-
-a. The history library does not try to write the history filename in the
- current directory if $HOME is unset. This closes a potential security
- problem if the application does not specify a history filename.
-
-b. New bindable variable `completion-display-width' to set the number of
- columns used when displaying completions.
-
-c. New bindable variable `completion-case-map' to cause case-insensitive
- completion to treat `-' and `_' as identical.
-
-d. There are new bindable vi-mode command names to avoid readline's case-
- insensitive matching not allowing them to be bound separately.
-
-e. New bindable variable `menu-complete-display-prefix' causes the menu
- completion code to display the common prefix of the possible completions
- before cycling through the list, instead of after.
-
--------------------------------------------------------------------------------
-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 if the compatibility level
- is greater than 40.
-
-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.
-
-v. The mapfile/readarray builtin no longer stores the commands it invokes via
- callbacks in the history list.
-
-w. There is a new `compat40' shopt option.
-
-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.
-
-1. New Features in Bash
-
-a. When using substring expansion on the positional parameters, a starting
- index of 0 now causes $0 to be prefixed to the list.
-
-b. The `help' builtin now prints its columns with entries sorted vertically
- rather than horizontally.
-
-c. There is a new variable, $BASHPID, which always returns the process id of
- the current shell.
-
-d. There is a new `autocd' option that, when enabled, causes bash to attempt
- to `cd' to a directory name that is supplied as the first word of a
- simple command.
-
-e. There is a new `checkjobs' option that causes the shell to check for and
- report any running or stopped jobs at exit.
-
-f. The programmable completion code exports a new COMP_TYPE variable, set to
- a character describing the type of completion being attempted.
-
-g. The programmable completion code exports a new COMP_KEY variable, set to
- the character that caused the completion to be invoked (e.g., TAB).
-
-h. If creation of a child process fails due to insufficient resources, bash
- will try again several times before reporting failure.
-
-i. The programmable completion code now uses the same set of characters as
- readline when breaking the command line into a list of words.
-
-j. The block multiplier for the ulimit -c and -f options is now 512 when in
- Posix mode, as Posix specifies.
-
-k. Changed the behavior of the read builtin to save any partial input received
- in the specified variable when the read builtin times out. This also
- results in variables specified as arguments to read to be set to the empty
- string when there is no input available. When the read builtin times out,
- it returns an exit status greater than 128.
-
-l. The shell now has the notion of a `compatibility level', controlled by
- new variables settable by `shopt'. Setting this variable currently
- restores the bash-3.1 behavior when processing quoted strings on the rhs
- of the `=~' operator to the `[[' command.
-
-m. The `ulimit' builtin now has new -b (socket buffer size) and -T (number
- of threads) options.
-
-n. The -p option to `declare' now displays all variable values and attributes
- (or function values and attributes if used with -f).
-
-o. There is a new `compopt' builtin that allows completion functions to modify
- completion options for existing completions or the completion currently
- being executed.
-
-p. The `read' builtin has a new -i option which inserts text into the reply
- buffer when using readline.
-
-q. A new `-E' option to the complete builtin allows control of the default
- behavior for completion on an empty line.
-
-r. There is now limited support for completing command name words containing
- globbing characters.
-
-s. Changed format of internal help documentation for all builtins to roughly
- follow man page format.
-
-t. The `help' builtin now has a new -d option, to display a short description,
- and a -m option, to print help information in a man page-like format.
-
-u. There is a new `mapfile' builtin to populate an array with lines from a
- given file. The name `readarray' is a synonym.
-
-v. If a command is not found, the shell attempts to execute a shell function
- named `command_not_found_handle', supplying the command words as the
- function arguments.
-
-w. There is a new shell option: `globstar'. When enabled, the globbing code
- treats `**' specially -- it matches all directories (and files within
- them, when appropriate) recursively.
-
-x. There is a new shell option: `dirspell'. When enabled, the filename
- completion code performs spelling correction on directory names during
- completion.
-
-y. The `-t' option to the `read' builtin now supports fractional timeout
- values.
-
-z. Brace expansion now allows zero-padding of expanded numeric values and
- will add the proper number of zeroes to make sure all values contain the
- same number of digits.
-
-aa. There is a new bash-specific bindable readline function: `dabbrev-expand'.
- It uses menu completion on a set of words taken from the history list.
-
-bb. The command assigned to a key sequence with `bind -x' now sets two new
- variables in the environment of the executed command: READLINE_LINE_BUFFER
- and READLINE_POINT. The command can change the current readline line
- and cursor position by modifying READLINE_LINE_BUFFER and READLINE_POINT,
- respectively.
-
-cc. There is a new &>> redirection operator, which appends the standard output
- and standard error to the named file.
-
-dd. The parser now understands `|&' as a synonym for `2>&1 |', which redirects
- the standard error for a command through a pipe.
-
-ee. The new `;&' case statement action list terminator causes execution to
- continue with the action associated with the next pattern in the
- statement rather than terminating the command.
-
-ff. The new `;;&' case statement action list terminator causes the shell to
- test the next set of patterns after completing execution of the current
- action, rather than terminating the command.
-
-gg. The shell understands a new variable: PROMPT_DIRTRIM. When set to an
- integer value greater than zero, prompt expansion of \w and \W will
- retain only that number of trailing pathname components and replace
- the intervening characters with `...'.
-
-hh. There are new case-modifying word expansions: uppercase (^[^]) and
- lowercase (,[,]). They can work on either the first character or
- array element, or globally. They accept an optional shell pattern
- that determines which characters to modify. There is an optionally-
- configured feature to include capitalization operators.
-
-ii. The shell provides associative array variables, with the appropriate
- support to create, delete, assign values to, and expand them.
-
-jj. The `declare' builtin now has new -l (convert value to lowercase upon
- assignment) and -u (convert value to uppercase upon assignment) options.
- There is an optionally-configurable -c option to capitalize a value at
- assignment.
-
-kk. There is a new `coproc' reserved word that specifies a coprocess: an
- asynchronous command run with two pipes connected to the creating shell.
- Coprocs can be named. The input and output file descriptors and the
- PID of the coprocess are available to the calling shell in variables
- with coproc-specific names.
-
-ll. A value of 0 for the -t option to `read' now returns success if there is
- input available to be read from the specified file descriptor.
-
-mm. CDPATH and GLOBIGNORE are ignored when the shell is running in privileged
- mode.
-
-nn. New bindable readline functions shell-forward-word and shell-backward-word,
- which move forward and backward words delimited by shell metacharacters
- and honor shell quoting.
-
-oo. New bindable readline functions shell-backward-kill-word and shell-kill-word
- which kill words backward and forward, but use the same word boundaries
- as shell-forward-word and shell-backward-word.
-
-2. New Features in Readline
-
-a. A new variable, rl_sort_completion_matches; allows applications to inhibit
- match list sorting (but beware: some things don't work right if
- applications do this).
-
-b. A new variable, rl_completion_invoking_key; allows applications to discover
- the key that invoked rl_complete or rl_menu_complete.
-
-c. The functions rl_block_sigint and rl_release_sigint are now public and
- available to calling applications who want to protect critical sections
- (like redisplay).
-
-d. The functions rl_save_state and rl_restore_state are now public and
- available to calling applications; documented rest of readline's state
- flag values.
-
-e. A new user-settable variable, `history-size', allows setting the maximum
- number of entries in the history list.
-
-f. There is a new implementation of menu completion, with several improvements
- over the old; the most notable improvement is a better `completions
- browsing' mode.
-
-g. The menu completion code now uses the rl_menu_completion_entry_function
- variable, allowing applications to provide their own menu completion
- generators.
-
-h. There is support for replacing a prefix of a pathname with a `...' when
- displaying possible completions. This is controllable by setting the
- `completion-prefix-display-length' variable. Matches with a common prefix
- longer than this value have the common prefix replaced with `...'.
-
-i. There is a new `revert-all-at-newline' variable. If enabled, readline will
- undo all outstanding changes to all history lines when `accept-line' is
- executed.
-
-j. If the kernel supports it, readline displays special characters
- corresponding to a keyboard-generated signal when the signal is received.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-3.2 since
-the release of bash-3.1. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. Changed the parameter pattern replacement functions to not anchor the
- pattern at the beginning of the string if doing global replacement - that
- combination doesn't make any sense.
-
-b. When running in `word expansion only' mode (--wordexp option), inhibit
- process substitution.
-
-c. Loadable builtins now work on MacOS X 10.[34].
-
-d. Shells running in posix mode no longer set $HOME, as POSIX requires.
-
-e. The code that checks for binary files being executed as shell scripts now
- checks only for NUL rather than any non-printing character.
-
-f. Quoting the string argument to the [[ command's =~ operator now forces
- string matching, as with the other pattern-matching operators.
-
-2. New Features in Readline
-
-a. Calling applications can now set the keyboard timeout to 0, allowing
- poll-like behavior.
-
-b. The value of SYS_INPUTRC (configurable at compilation time) is now used as
- the default last-ditch startup file.
-
-c. The history file reading functions now allow windows-like \r\n line
- terminators.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-3.1 since
-the release of bash-3.0. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. Bash now understands LC_TIME as a special variable so that time display
- tracks the current locale.
-
-b. BASH_ARGC, BASH_ARGV, BASH_SOURCE, and BASH_LINENO are no longer created
- as `invisible' variables and may not be unset.
-
-c. In POSIX mode, if `xpg_echo' option is enabled, the `echo' builtin doesn't
- try to interpret any options at all, as POSIX requires.
-
-d. The `bg' builtin now accepts multiple arguments, as POSIX seems to specify.
-
-e. Fixed vi-mode word completion and glob expansion to perform tilde
- expansion.
-
-f. The `**' mathematic exponentiation operator is now right-associative.
-
-g. The `ulimit' builtin has new options: -i (max number of pending signals),
- -q (max size of POSIX message queues), and -x (max number of file locks).
-
-h. A bare `%' once again expands to the current job when used as a job
- specifier.
-
-i. The `+=' assignment operator (append to the value of a string or array) is
- now supported for assignment statements and arguments to builtin commands
- that accept assignment statements.
-
-j. BASH_COMMAND now preserves its value when a DEBUG trap is executed.
-
-k. The `gnu_errfmt' option is enabled automatically if the shell is running
- in an emacs terminal window.
-
-l. New configuration option: --single-help-strings. Causes long help text
- to be written as a single string; intended to ease translation.
-
-m. The COMP_WORDBREAKS variable now causes the list of word break characters
- to be emptied when the variable is unset.
-
-n. An unquoted expansion of $* when $IFS is empty now causes the positional
- parameters to be concatenated if the expansion doesn't undergo word
- splitting.
-
-o. Bash now inherits $_ from the environment if it appears there at startup.
-
-p. New shell option: nocasematch. If non-zero, shell pattern matching ignores
- case when used by `case' and `[[' commands.
-
-q. The `printf' builtin takes a new option: -v var. That causes the output
- to be placed into var instead of on stdout.
-
-r. By default, the shell no longer reports processes dying from SIGPIPE.
-
-s. Bash now sets the extern variable `environ' to the export environment it
- creates, so C library functions that call getenv() (and can't use the
- shell-provided replacement) get current values of environment variables.
-
-t. A new configuration option, `--enable-strict-posix-default', which will
- build bash to be POSIX conforming by default.
-
-u. If compiled for strict POSIX conformance, LINES and COLUMNS may now
- override the true terminal size.
-
-2. New Features in Readline
-
-a. The key sequence sent by the keypad `delete' key is now automatically
- bound to delete-char.
-
-b. A negative argument to menu-complete now cycles backward through the
- completion list.
-
-c. A new bindable readline variable: bind-tty-special-chars. If non-zero,
- readline will bind the terminal special characters to their readline
- equivalents when it's called (on by default).
-
-d. New bindable command: vi-rubout. Saves deleted text for possible
- reinsertion, as with any vi-mode `text modification' command; `X' is bound
- to this in vi command mode.
-
-e. A new external application-controllable variable that allows the LINES
- and COLUMNS environment variables to set the window size regardless of
- what the kernel returns: rl_prefer_env_winsize
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-3.0 since
-the release of bash-2.05b. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. ANSI string expansion now implements the \x{hexdigits} escape.
-
-b. There is a new loadable `strftime' builtin.
-
-c. New variable, COMP_WORDBREAKS, which controls the readline completer's
- idea of word break characters.
-
-d. The `type' builtin no longer reports on aliases unless alias expansion
- will actually be performed.
-
-e. HISTCONTROL is now a colon-separated list of values, which permits
- more extensibility and backwards compatibility.
-
-f. HISTCONTROL may now include the `erasedups' option, which causes all lines
- matching a line being added to be removed from the history list.
-
-g. `configure' has a new `--enable-multibyte' argument that permits multibyte
- character support to be disabled even on systems that support it.
-
-h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV,
- BASH_SOURCE, BASH_LINENO, BASH_SUBSHELL, BASH_EXECUTION_STRING,
- BASH_COMMAND
-
-i. FUNCNAME has been changed to support the debugger: it's now an array
- variable.
-
-j. for, case, select, arithmetic commands now keep line number information
- for the debugger.
-
-k. There is a new `RETURN' trap executed when a function or sourced script
- returns (not inherited child processes; inherited by command substitution
- if function tracing is enabled and the debugger is active).
-
-l. New invocation option: --debugger. Enables debugging and turns on new
- `extdebug' shell option.
-
-m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR
- traps, respectively, to be inherited by shell functions. Equivalent to
- `set -T' and `set -E' respectively. The `functrace' option also controls
- whether or not the DEBUG trap is inherited by sourced scripts.
-
-n. The DEBUG trap is run before binding the variable and running the action
- list in a `for' command, binding the selection variable and running the
- query in a `select' command, and before attempting a match in a `case'
- command.
-
-o. New `--enable-debugger' option to `configure' to compile in the debugger
- support code.
-
-p. `declare -F' now prints out extra line number and source file information
- if the `extdebug' option is set.
-
-q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes
- the next command to be skipped, and a return value of 2 while in a
- function or sourced script forces a `return'.
-
-r. New `caller' builtin to provide a call stack for the bash debugger.
-
-s. The DEBUG trap is run just before the first command in a function body is
- executed, for the debugger.
-
-t. `for', `select', and `case' command heads are printed when `set -x' is
- enabled.
-
-u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1,
- x+2,...,y}. x and y can be integers or single characters; the sequence
- may ascend or descend; the increment is always 1.
-
-v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices)
- of array.
-
-w. New `force_fignore' shopt option; if enabled, suffixes specified by
- FIGNORE cause words to be ignored when performing word completion even
- if they're the only possibilities.
-
-x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu
- style' (filename:lineno:message) format.
-
-y. New `-o bashdefault' option to complete and compgen; if set, causes the
- whole set of bash completions to be performed if the compspec doesn't
- result in a match.
-
-z. New `-o plusdirs' option to complete and compgen; if set, causes directory
- name completion to be performed and the results added to the rest of the
- possible completions.
-
-aa. `kill' is available as a builtin even when the shell is built without
- job control.
-
-bb. New HISTTIMEFORMAT variable; value is a format string to pass to
- strftime(3). If set and not null, the `history' builtin prints out
- timestamp information according to the specified format when displaying
- history entries. If set, bash tells the history library to write out
- timestamp information when the history file is written.
-
-cc. The [[ ... ]] command has a new binary `=~' operator that performs
- extended regular expression (egrep-like) matching.
-
-dd. `configure' has a new `--enable-cond-regexp' option (enabled by default)
- to enable the =~ operator and regexp matching in [[ ... ]].
-
-ee. Subexpressions matched by the =~ operator are placed in the new
- BASH_REMATCH array variable.
-
-ff. New `failglob' option that causes an expansion error when pathname
- expansion fails to produce a match.
-
-gg. New `set -o pipefail' option that causes a pipeline to return a failure
- status if any of the processes in the pipeline fail, not just the last
- one.
-
-hh. printf builtin understands two new escape sequences: \" and \?.
-
-ii. `echo -e' understands two new escape sequences: \" and \?.
-
-jj. The GNU `gettext' package and libintl have been integrated; the shell's
- messages can be translated into different languages.
-
-kk. The `\W' prompt expansion now abbreviates $HOME as `~', like `\w'.
-
-ll. The error message printed when bash cannot open a shell script supplied
- as argument 1 now includes the name of the shell, to better identify
- the error as coming from bash.
-
-mm. The parameter pattern removal and substitution expansions are now much
- faster and more efficient when using multibyte characters.
-
-nn. The `jobs', `kill', and `wait' builtins now accept job control notation
- even if job control is not enabled.
-
-oo. The historical behavior of `trap' that allows a missing `action' argument
- to cause each specified signal's handling to be reset to its default is
- now only supported when `trap' is given a single non-option argument.
-
-2. New Features in Readline
-
-a. History expansion has a new `a' modifier equivalent to the `g' modifier
- for compatibility with the BSD csh.
-
-b. History expansion has a new `G' modifier equivalent to the BSD csh `g'
- modifier, which performs a substitution once per word.
-
-c. All non-incremental search operations may now undo the operation of
- replacing the current line with the history line.
-
-d. The text inserted by an `a' command in vi mode can be reinserted with
- `.'.
-
-e. New bindable variable, `show-all-if-unmodified'. If set, the readline
- completer will list possible completions immediately if there is more
- than one completion and partial completion cannot be performed.
-
-f. There is a new application-callable `free_history_entry()' function.
-
-g. History list entries now contain timestamp information; the history file
- functions know how to read and write timestamp information associated
- with each entry.
-
-h. Four new key binding functions have been added:
-
- rl_bind_key_if_unbound()
- rl_bind_key_if_unbound_in_map()
- rl_bind_keyseq_if_unbound()
- rl_bind_keyseq_if_unbound_in_map()
-
-i. New application variable, rl_completion_quote_character, set to any
- quote character readline finds before it calls the application completion
- function.
-
-j. New application variable, rl_completion_suppress_quote, settable by an
- application completion function. If set to non-zero, readline does not
- attempt to append a closing quote to a completed word.
-
-k. New application variable, rl_completion_found_quote, set to a non-zero
- value if readline determines that the word to be completed is quoted.
- Set before readline calls any application completion function.
-
-l. New function hook, rl_completion_word_break_hook, called when readline
- needs to break a line into words when completion is attempted. Allows
- the word break characters to vary based on position in the line.
-
-m. New bindable command: unix-filename-rubout. Does the same thing as
- unix-word-rubout, but adds `/' to the set of word delimiters.
-
-n. When listing completions, directories have a `/' appended if the
- `mark-directories' option has been enabled.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.05b since
-the release of bash-2.05a. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. If set, TMOUT is the default timeout for the `read' builtin.
-
-b. `type' has two new options: `-f' suppresses shell function lookup, and
- `-P' forces a $PATH search.
-
-c. New code to handle multibyte characters.
-
-d. `select' was changed to be more ksh-compatible, in that the menu is
- reprinted each time through the loop only if REPLY is set to NULL.
- The previous behavior is available as a compile-time option.
-
-e. `complete -d' and `complete -o dirnames' now force a slash to be
- appended to names which are symlinks to directories.
-
-f. There is now a bindable edit-and-execute-command readline command,
- like the vi-mode `v' command, bound to C-xC-e in emacs mode.
-
-g. Added support for ksh93-like [:word:] character class in pattern matching.
-
-h. The $'...' quoting construct now expands \cX to Control-X.
-
-i. A new \D{...} prompt expansion; passes the `...' to strftime and inserts
- the result into the expanded prompt.
-
-j. The shell now performs arithmetic in the largest integer size the
- machine supports (intmax_t), instead of long.
-
-k. If a numeric argument is supplied to one of the bash globbing completion
- functions, a `*' is appended to the word before expansion is attempted.
-
-l. The bash globbing completion functions now allow completions to be listed
- with double tabs or if `show-all-if-ambiguous' is set.
-
-m. New `-o nospace' option for `complete' and `compgen' builtins; suppresses
- readline's appending a space to the completed word.
-
-n. New `here-string' redirection operator: <<< word.
-
-o. When displaying variables, function attributes and definitions are shown
- separately, allowing them to be re-used as input (attempting to re-use
- the old output would result in syntax errors).
-
-p. There is a new configuration option `--enable-mem-scramble', controls
- bash malloc behavior of writing garbage characters into memory at
- allocation and free time.
-
-q. The `complete' and `compgen' builtins now have a new `-s/-A service'
- option to complete on names from /etc/services.
-
-r. `read' has a new `-u fd' option to read from a specified file descriptor.
-
-s. Fix the completion code so that expansion errors in a directory name
- don't cause a longjmp back to the command loop.
-
-t. Fixed word completion inside command substitution to work a little more
- intuitively.
-
-u. The `printf' %q format specifier now uses $'...' quoting to print the
- argument if it contains non-printing characters.
-
-v. The `declare' and `typeset' builtins have a new `-t' option. When applied
- to functions, it causes the DEBUG trap to be inherited by the named
- function. Currently has no effect on variables.
-
-w. The DEBUG trap is now run *before* simple commands, ((...)) commands,
- [[...]] conditional commands, and for ((...)) loops.
-
-x. The expansion of $LINENO inside a shell function is only relative to the
- function start if the shell is interactive -- if the shell is running a
- script, $LINENO expands to the line number in the script. This is as
- POSIX-2001 requires.
-
-y. The bash debugger in examples/bashdb has been modified to work with the
- new DEBUG trap semantics, the command set has been made more gdb-like,
- and the changes to $LINENO make debugging functions work better. Code
- from Gary Vaughan.
-
-z. New [n]<&word- and [n]>&word- redirections from ksh93 -- move fds (dup
- and close).
-
-aa. There is a new `-l' invocation option, equivalent to `--login'.
-
-bb. The `hash' builtin has a new `-l' option to list contents in a reusable
- format, and a `-d' option to remove a name from the hash table.
-
-cc. There is now support for placing the long help text into separate files
- installed into ${datadir}/bash. Not enabled by default; can be turned
- on with `--enable-separate-helpfiles' option to configure.
-
-dd. All builtins that take operands accept a `--' pseudo-option, except
- `echo'.
-
-ee. The `echo' builtin now accepts \0xxx (zero to three octal digits following
- the `0') in addition to \xxx (one to three octal digits) for SUSv3/XPG6/
- POSIX.1-2001 compliance.
-
-
-2. New Features in Readline
-
-a. Support for key `subsequences': allows, e.g., ESC and ESC-a to both
- be bound to readline functions. Now the arrow keys may be used in vi
- insert mode.
-
-b. When listing completions, and the number of lines displayed is more than
- the screen length, readline uses an internal pager to display the results.
- This is controlled by the `page-completions' variable (default on).
-
-c. New code to handle editing and displaying multibyte characters.
-
-d. The behavior introduced in bash-2.05a of deciding whether or not to
- append a slash to a completed name that is a symlink to a directory has
- been made optional, controlled by the `mark-symlinked-directories'
- variable (default is the 2.05a behavior).
-
-e. The `insert-comment' command now acts as a toggle if given a numeric
- argument: if the first characters on the line don't specify a
- comment, insert one; if they do, delete the comment text
-
-f. New application-settable completion variable:
- rl_completion_mark_symlink_dirs, allows an application's completion
- function to temporarily override the user's preference for appending
- slashes to names which are symlinks to directories.
-
-g. New function available to application completion functions:
- rl_completion_mode, to tell how the completion function was invoked
- and decide which argument to supply to rl_complete_internal (to list
- completions, etc.).
-
-h. Readline now has an overwrite mode, toggled by the `overwrite-mode'
- bindable command, which could be bound to `Insert'.
-
-i. New application-settable completion variable:
- rl_completion_suppress_append, inhibits appending of
- rl_completion_append_character to completed words.
-
-j. New key bindings when reading an incremental search string: ^W yanks
- the currently-matched word out of the current line into the search
- string; ^Y yanks the rest of the current line into the search string,
- DEL or ^H deletes characters from the search string.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.05a since
-the release of bash-2.05. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. Added support for DESTDIR installation root prefix, so you can do a
- `make install DESTDIR=bash-root' and do easier binary packaging.
-
-b. Added support for builtin printf "'" flag character as per latest POSIX
- drafts.
-
-c. Support for POSIX.2 printf(1) length specifiers `j', `t', and `z' (from
- ISO C99).
-
-d. New autoconf macro, RL_LIB_READLINE_VERSION, for use by other applications
- (bash doesn't use very much of what it returns).
-
-e. `set [-+]o nolog' is recognized as required by the latest POSIX drafts,
- but ignored.
-
-f. New read-only `shopt' option: login_shell. Set to non-zero value if the
- shell is a login shell.
-
-g. New `\A' prompt string escape sequence; expands to time in 24 HH:MM format.
-
-h. New `-A group/-g' option to complete and compgen; does group name
- completion.
-
-i. New `-t' option to `hash' to list hash values for each filename argument.
-
-j. New [-+]O invocation option to set and unset `shopt' options at startup.
-
-k. configure's `--with-installed-readline' option now takes an optional
- `=PATH' suffix to set the root of the tree where readline is installed
- to PATH.
-
-l. The ksh-like `ERR' trap has been added. The `ERR' trap will be run
- whenever the shell would have exited if the -e option were enabled.
- It is not inherited by shell functions.
-
-m. `readonly', `export', and `declare' now print variables which have been
- given attributes but not set by assigning a value as just a command and
- a variable name (like `export foo') when listing, as the latest POSIX
- drafts require.
-
-n. `bashbug' now requires that the subject be changed from the default.
-
-o. configure has a new `--enable-largefile' option, like other GNU utilities.
-
-p. `for' loops now allow empty word lists after `in', like the latest POSIX
- drafts require.
-
-q. The builtin `ulimit' now takes two new non-numeric arguments: `hard',
- meaning the current hard limit, and `soft', meaning the current soft
- limit, in addition to `unlimited'
-
-r. `ulimit' now prints the option letter associated with a particular
- resource when printing more than one limit.
-
-s. `ulimit' prints `hard' or `soft' when a value is not `unlimited' but is
- one of RLIM_SAVED_MAX or RLIM_SAVED_CUR, respectively.
-
-t. The `printf' builtin now handles the %a and %A conversions if they're
- implemented by printf(3).
-
-u. The `printf' builtin now handles the %F conversion (just about like %f).
-
-v. The `printf' builtin now handles the %n conversion like printf(3). The
- corresponding argument is the name of a shell variable to which the
- value is assigned.
-
-2. New Features in Readline
-
-a. Added extern declaration for rl_get_termcap to readline.h, making it a
- public function (it was always there, just not in readline.h).
-
-b. New #defines in readline.h: RL_READLINE_VERSION, currently 0x0402,
- RL_VERSION_MAJOR, currently 4, and RL_VERSION_MINOR, currently 2.
-
-c. New readline variable: rl_readline_version, mirrors RL_READLINE_VERSION.
-
-d. New bindable boolean readline variable: match-hidden-files. Controls
- completion of files beginning with a `.' (on Unix). Enabled by default.
-
-e. The history expansion code now allows any character to terminate a
- `:first-' modifier, like csh.
-
-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.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.05 since
-the release of bash-2.04. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. Added a new `--init-file' invocation argument as a synonym for `--rcfile',
- per the new GNU coding standards.
-
-b. The /dev/tcp and /dev/udp redirections now accept service names as well as
- port numbers.
-
-c. `complete' and `compgen' now take a `-o value' option, which controls some
- of the aspects of that compspec. Valid values are:
-
- default - perform bash default completion if programmable
- completion produces no matches
- dirnames - perform directory name completion if programmable
- completion produces no matches
- filenames - tell readline that the compspec produces filenames,
- so it can do things like append slashes to
- directory names and suppress trailing spaces
-
-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
- 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.
-
-f. Bash-2.05 once again honors the current locale setting when processing
- ranges within pattern matching bracket expressions (e.g., [A-Z]).
-
-2. New Features in Readline
-
-a. The blink timeout for paren matching is now settable by applications,
- via the rl_set_paren_blink_timeout() function.
-
-b. _rl_executing_macro has been renamed to rl_executing_macro, which means
- it's now part of the public interface.
-
-c. Readline has a new variable, rl_readline_state, which is a bitmap that
- encapsulates the current state of the library; intended for use by
- callbacks and hook functions.
-
-d. New application-callable function rl_set_prompt(const char *prompt):
- expands its prompt string argument and sets rl_prompt to the result.
-
-e. New application-callable function rl_set_screen_size(int rows, int cols):
- public method for applications to set readline's idea of the screen
- dimensions.
-
-f. New function, rl_get_screen_size (int *rows, int *columns), returns
- readline's idea of the screen dimensions.
-
-g. The timeout in rl_gather_tyi (readline keyboard input polling function)
- is now settable via a function (rl_set_keyboard_input_timeout()).
-
-h. Renamed the max_input_history variable to history_max_entries; the old
- variable is maintained for backwards compatibility.
-
-i. The list of characters that separate words for the history tokenizer is
- now settable with a variable: history_word_delimiters. The default
- value is as before.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.04 since
-the release of bash-2.03. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. The history builtin has a `-d offset' option to delete the history entry
- at position `offset'.
-
-b. The prompt expansion code has two new escape sequences: \j, the number of
- active jobs; and \l, the basename of the shell's tty device name.
-
-c. The `bind' builtin has a new `-x' option to bind key sequences to shell
- commands.
-
-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
- synopsis.
-
-f. There are several new arithmetic operators: id++, id-- (variable
- post-increment/decrement), ++id, --id (variable pre-increment/decrement),
- expr1 , expr2 (comma operator).
-
-g. There is a new ksh-93 style arithmetic for command:
- for ((expr1 ; expr2; expr3 )); do list; done
-
-h. The `read' builtin has a number of new options:
- -t timeout only wait timeout seconds for input
- -n nchars only read nchars from input instead of a full line
- -d delim read until delim rather than newline
- -s don't echo input chars as they are read
-
-i. The redirection code now handles several filenames specially:
- /dev/fd/N, /dev/stdin, /dev/stdout, and /dev/stderr, whether or
- not they are present in the file system.
-
-j. The redirection code now recognizes pathnames of the form
- /dev/tcp/host/port and /dev/udp/host/port, and tries to open a socket
- of the appropriate type to the specified port on the specified host.
-
-k. The ksh-93 ${!prefix*} expansion, which expands to the names of all
- shell variables with prefix PREFIX, has been implemented.
-
-l. There is a new dynamic variable, FUNCNAME, which expands to the name of
- a currently-executing function. Assignments to FUNCNAME have no effect.
-
-m. The GROUPS variable is no longer readonly; assignments to it are silently
- discarded. This means it can be unset.
-
-n. A new programmable completion facility, with two new builtin commands:
- complete and compgen.
-
-o. configure has a new option, `--enable-progcomp', to compile in the
- programmable completion features (enabled by default).
-
-p. `shopt' has a new option, `progcomp', to enable and disable programmable
- completion at runtime.
-
-q. Unsetting HOSTFILE now clears the list of hostnames used for completion.
-
-r. configure has a new option, `--enable-bash-malloc', replacing the old
- `--with-gnu-malloc' (which is still present for backwards compatibility).
-
-s. There is a new manual page describing rbash, the restricted shell.
-
-t. `bashbug' has new `--help' and `--version' options.
-
-u. `shopt' has a new `xpg_echo' option, which controls the behavior of
- `echo' with respect to backslash-escaped characters at runtime.
-
-v. If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the
- startup files, even if they are not interactive.
-
-w. The LC_NUMERIC variable is now treated specially, and used to set the
- LC_NUMERIC locale category for number formatting, e.g., when `printf'
- displays floating-point numbers.
-
-2. New features in Readline
-
-a. Parentheses matching is now always compiled into readline, and enabled
- or disabled when the value of the `blink-matching-paren' variable is
- changed.
-
-b. MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.
-
-c. MS-DOS systems now use ~/_history as the default history file.
-
-d. history-search-{forward,backward} now leave the point at the end of the
- line when the string to search for is empty, like
- {reverse,forward}-search-history.
-
-e. history-search-{forward,backward} now leave the last history line found
- in the readline buffer if the second or subsequent search fails.
-
-f. New function for use by applications: rl_on_new_line_with_prompt, used
- when an application displays the prompt itself before calling readline().
-
-g. New variable for use by applications: rl_already_prompted. An application
- that displays the prompt itself before calling readline() must set this to
- a non-zero value.
-
-h. A new variable, rl_gnu_readline_p, always 1. The intent is that an
- application can verify whether or not it is linked with the `real'
- readline library or some substitute.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.03 since
-the release of bash-2.02. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. New `shopt' option, `restricted_shell', indicating whether or not the
- shell was started in restricted mode, for use in startup files.
-
-b. Filename generation is now performed on the words between ( and ) in
- array assignments (which it probably should have done all along).
-
-c. OLDPWD is now auto-exported, as POSIX.2 seems to require.
-
-d. ENV and BASH_ENV are read-only variables in a restricted shell.
-
-e. A change was made to the startup file code so that any shell begun with
- the `--login' option, even non-interactive shells, will source the login
- shell startup files.
-
-2. New Features in Readline
-
-a. Many changes to the signal handling:
- o Readline now catches SIGQUIT and cleans up the tty before returning;
- o A new variable, rl_catch_signals, is available to application writers
- to indicate to readline whether or not it should install its own
- signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP,
- SIGTTIN, and SIGTTOU;
- o A new variable, rl_catch_sigwinch, is available to application
- writers to indicate to readline whether or not it should install its
- own signal handler for SIGWINCH, which will chain to the calling
- applications's SIGWINCH handler, if one is installed;
- o There is a new function, rl_free_line_state, for application signal
- handlers to call to free up the state associated with the current
- line after receiving a signal;
- o There is a new function, rl_cleanup_after_signal, to clean up the
- display and terminal state after receiving a signal;
- o There is a new function, rl_reset_after_signal, to reinitialize the
- terminal and display state after an application signal handler
- returns and readline continues
-
-b. There is a new function, rl_resize_terminal, to reset readline's idea of
- the screen size after a SIGWINCH.
-
-c. New public functions: rl_save_prompt and rl_restore_prompt. These were
- previously private functions with a `_' prefix.
-
-d. New function hook: rl_pre_input_hook, called just before readline starts
- reading input, after initialization.
-
-e. New function hook: rl_display_matches_hook, called when readline would
- display the list of completion matches. The new function
- rl_display_match_list is what readline uses internally, and is available
- for use by application functions called via this hook.
-
-f. New bindable function, delete-char-or-list, like tcsh.
-
-g. A new variable, rl_erase_empty_line, which, if set by an application using
- readline, will cause readline to erase, prompt and all, lines on which the
- only thing typed was a newline.
-
-h. New bindable variable: `isearch-terminators'.
-
-i. New bindable function: `forward-backward-delete-char' (unbound by default).
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.02 since
-the release of bash-2.01.1. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. A new version of malloc, based on the older GNU malloc, that has many
- changes, is more page-based, is more conservative with memory usage,
- and does not `orphan' large blocks when they are freed.
-
-b. A new version of gmalloc, based on the old GLIBC malloc, with many
- changes and range checking included by default.
-
-c. A new implementation of fnmatch(3) that includes full POSIX.2 Basic
- Regular Expression matching, including character classes, collating
- symbols, equivalence classes, and support for case-insensitive pattern
- matching.
-
-d. ksh-88 egrep-style extended pattern matching ([@+*?!](patlist)) has been
- implemented, controlled by a new `shopt' option, `extglob'.
-
-e. There is a new ksh-like `[[' compound command, which implements
- extended `test' functionality.
-
-f. There is a new `printf' builtin, implemented according to the POSIX.2
- specification.
-
-g. There is a new feature for command substitution: $(< filename) now expands
- to the contents of `filename', with any trailing newlines removed
- (equivalent to $(cat filename)).
-
-h. There are new tilde prefixes which expand to directories from the
- directory stack.
-
-i. There is a new `**' arithmetic operator to do exponentiation.
-
-j. There are new configuration options to control how bash is linked:
- `--enable-profiling', to allow bash to be profiled with gprof, and
- `--enable-static-link', to allow bash to be linked statically.
-
-k. There is a new configuration option, `--enable-cond-command', which
- controls whether or not the `[[' command is included. It is on by
- default.
-
-l. There is a new configuration option, `--enable-extended-glob', which
- controls whether or not the ksh extended globbing feature is included.
- It is enabled by default.
-
-m. There is a new configuration #define in config.h.top that, when enabled,
- will cause all login shells to source /etc/profile and one of the user-
- specific login shell startup files, whether or not the shell is
- interactive.
-
-n. There is a new invocation option, `--dump-po-strings', to dump
- a shell script's translatable strings ($"...") in GNU `po' format.
-
-o. There is a new `shopt' option, `nocaseglob', to enable case-insensitive
- pattern matching when globbing filenames and using the `case' construct.
-
-p. There is a new `shopt' option, `huponexit', which, when enabled, causes
- the shell to send SIGHUP to all jobs when an interactive login shell
- exits.
-
-q. `bind' has a new `-u' option, which takes a readline function name as an
- argument and unbinds all key sequences bound to that function in a
- specified keymap.
-
-r. `disown' now has `-a' and `-r' options, to limit operation to all jobs
- and running jobs, respectively.
-
-s. The `shopt' `-p' option now causes output to be displayed in a reusable
- format.
-
-t. `test' has a new `-N' option, which returns true if the filename argument
- has been modified since it was last accessed.
-
-u. `umask' now has a `-p' option to print output in a reusable format.
-
-v. A new escape sequence, `\xNNN', has been added to the `echo -e' and $'...'
- translation code. It expands to the character whose ascii code is NNN
- in hexadecimal.
-
-w. The prompt string expansion code has a new `\r' escape sequence.
-
-x. The shell may now be cross-compiled for the CYGWIN32 environment on
- a Unix machine.
-
-2. New Features in Readline
-
-a. There is now an option for `iterative' yank-last-arg handline, so a user
- can keep entering `M-.', yanking the last argument of successive history
- lines.
-
-b. New variable, `print-completions-horizontally', which causes completion
- matches to be displayed across the screen (like `ls -x') rather than up
- and down the screen (like `ls').
-
-c. New variable, `completion-ignore-case', which causes filename completion
- and matching to be performed case-insensitively.
-
-d. There is a new bindable command, `magic-space', which causes history
- expansion to be performed on the current readline buffer and a space to
- be inserted into the result.
-
-e. There is a new bindable command, `menu-complete', which enables tcsh-like
- menu completion (successive executions of menu-complete insert a single
- completion match, cycling through the list of possible completions).
-
-f. There is a new bindable command, `paste-from-clipboard', for use on Win32
- systems, to insert the text from the Win32 clipboard into the editing
- buffer.
-
-g. The key sequence translation code now understands printf-style backslash
- escape sequences, including \NNN octal escapes. These escape sequences
- may be used in key sequence definitions or macro values.
-
-h. An `$include' inputrc file parser directive has been added.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.01 since
-the release of bash-2.0. As always, the manual page (doc/bash.1) is the
-place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. There is a new builtin array variable: GROUPS, the set of groups to which
- the user belongs. This is used by the test suite.
-
-2. New Features in Readline
-
-a. If a key sequence bound to `universal-argument' is read while reading a
- numeric argument started with `universal-argument', it terminates the
- argument but is otherwise ignored. This provides a way to insert multiple
- instances of a digit string, and is how GNU emacs does it.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.0 since
-the release of bash-1.14.7. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. There is a new invocation option, -D, that dumps translatable strings
- in a script.
-
-b. The `long' invocation options must now be prefixed with `--'.
-
-c. New long invocation options: --dump-strings, --help, --verbose
-
-d. The `nolineediting' invocation option was renamed to `noediting'.
-
-e. The `nobraceexpansion' and `quiet' long invocation options were removed.
-
-f. The `--help' and `--version' long options now work as the GNU coding
- standards specify.
-
-g. If invoked as `sh', bash now enters posix mode after reading the
- startup files, and reads and executes commands from the file named
- by $ENV if interactive (as POSIX.2 specifies). A login shell invoked
- as `sh' reads $ENV after /etc/profile and ~/.profile.
-
-h. There is a new reserved word, `time', for timing pipelines, builtin
- commands, and shell functions. It uses the value of the TIMEFORMAT
- variable as a format string describing how to print the timing
- statistics.
-
-i. The $'...' quoting syntax expands ANSI-C escapes in ... and leaves the
- result single-quoted.
-
-j. The $"..." quoting syntax performs locale-specific translation of ...
- and leaves the result double-quoted.
-
-k. LINENO now works correctly in functions.
-
-l. New variables: DIRSTACK, PIPESTATUS, BASH_VERSINFO, HOSTNAME, SHELLOPTS,
- MACHTYPE. The first three are array variables.
-
-m. The BASH_VERSION and BASH_VERSINFO variables now include the shell's
- `release status' (alpha[N], beta[N], release).
-
-n. Some variables have been removed: MAIL_WARNING, notify, history_control,
- command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
- nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
- cdable_vars. Most of them are now implemented with the new `shopt'
- builtin; others were already implemented by `set'.
-
-o. Bash now uses some new variables: LC_ALL, LC_MESSAGES, LC_CTYPE,
- LC_COLLATE, LANG, GLOBIGNORE, HISTIGNORE.
-
-p. The shell now supports integer-indexed arrays of unlimited length,
- with a new compound assignment syntax and changes to the appropriate
- builtin commands (declare/typeset, read, readonly, etc.). The array
- index may be an arithmetic expression.
-
-q. ${!var}: indirect variable expansion, equivalent to eval \${$var}.
-
-r. ${paramter:offset[:length]}: variable substring extraction.
-
-s. ${parameter/pattern[/[/]string]}: variable pattern substitution.
-
-t. The $[...] arithmetic expansion syntax is no longer supported, in
- favor of $((...)).
-
-u. Aliases can now be expanded in shell scripts with a shell option
- (shopt expand_aliases).
-
-v. History and history expansion can now be used in scripts with
- set -o history and set -H.
-
-w. All builtins now return an exit status of 2 for incorrect usage.
-
-x. Interactive shells resend SIGHUP to all running or stopped children
- if (and only if) they exit due to a SIGHUP.
-
-y. New prompting expansions: \a, \e, \H, \T, \@, \v, \V.
-
-z. Variable expansion in prompt strings is now controllable via a shell
- option (shopt promptvars).
-
-aa. Bash now defaults to using command-oriented history.
-
-bb. The history file ($HISTFILE) is now truncated to $HISTFILESIZE after
- being written.
-
-cc. The POSIX.2 conditional arithmetic evaluation syntax (expr ? expr : expr)
- has been implemented.
-
-dd. Each builtin now accepts `--' to signify the end of the options, except
- as documented (echo, etc.).
-
-ee. All builtins use -p to display values in a re-readable format where
- appropriate, except as documented (echo, type, etc.).
-
-ff. The `alias' builtin has a new -p option.
-
-gg. Changes to the `bind' builtin:
- o has new options: -psPSVr.
- o the `-d' option was renamed to `-p'
- o the `-v' option now dumps variables; the old `-v' is now `-P'
-
-hh. The `bye' synonym for `exit' was removed.
-
-ii. The -L and -P options to `cd' and `pwd' have been documented.
-
-jj. The `cd' builtin now does spelling correction on the directory name
- by default. This is settable with a shell option (shopt cdspell).
-
-kk. The `declare' builtin has new options: -a, -F, -p.
-
-ll. The `dirs' builtin has new options: -c, -p, -v.
-
-mm. The new `disown' builtin removes jobs from the shell's jobs table
- or inhibits the resending of SIGHUP when the shell receives a
- SIGHUP.
-
-nn. The `echo' builtin has a new escape character: \e.
-
-oo. The `enable' builtin can now load new builtins dynamically from shared
- objects on systems with the dlopen/dlsym interface. There are a number
- of examples in the examples/loadables directory. There are also
- new options: -d, -f, -s, -p.
-
-pp. The `-all' option to `enable' was removed in favor of `-a'.
-
-qq. The `exec' builtin has new options: -l, -c, -a.
-
-rr. The `hash' builtin has a new option: -p.
-
-ss. The `history' builtin has new options: -c, -p, -s.
-
-tt. The `jobs' builtin has new options: -r, -s.
-
-uu. The `kill' builtin has new options: -n signum, -l signame.
-
-vv. The `pushd' and `popd' builtins have a new option: -n.
-
-ww. The `read' builtin has new options: -p prompt, -e, -a.
-
-xx. The `readonly' builtin has a new -a option, and the -n option was removed.
-
-yy. Changes to the `set' builtin:
- o new options: -B, -o keyword, -o onecmd, -o history
- o options removed: -l, -d, -o nohash
- o options changed: +o, -h, -o hashall
- o now displays variables in a format that can be re-read as input
-
-zz. The new `shopt' builtin controls shell optional behavior previously
- done by setting and unsetting certain shell variables.
-
-aaa. The `test' builtin has new operators: -o option, s1 == s2, s1 < s2,
- and s1 > s2, where s1 and s2 are strings.
-
-bbb. There is a new trap, DEBUG, executed after every simple command.
-
-ccc. The `trap' builtin has a new -p option.
-
-ddd. The `ulimit' builtin has a new -l option on 4.4BSD-based systems.
-
-eee. The PS1, PS2, PATH, and IFS variables may now be unset.
-
-fff. The restricted shell mode has been expanded and is now documented.
-
-ggg. Security improvements:
- o functions are not imported from the environment if running setuid
- or with -p
- o no startup files are sourced if running setuid or with -p
-
-hhh. The documentation has been overhauled: the texinfo manual was
- expanded, and HTML versions of the man page and texinfo manual
- are included.
-
-iii. Changes to Posix mode:
- o Command lookup now finds special builtins before shell functions.
- o Failure of a special builtin causes a non-interactive shell to
- exit. Failures are defined in the POSIX.2 specification.
- o If the `cd' builtin finds a directory to change to using $CDPATH,
- the value assigned to PWD when `cd' completes does not contain
- 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
- `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
- stdout by default, not just when in posix mode.
- o Assignment statements preceding special builtins now persist in
- the shell's environment when the builtin completes.
-
- Posix mode is now completely POSIX.2-compliant (modulo bugs). When
- invoked as sh, bash should be completely POSIX.2-compliant.
-
-jjj. The default value of PS1 is now "\s-\v\$ ".
-
-kkk. The ksh-like ((...)) arithmetic command syntax has been implemented.
- This is exactly equivalent to `let "..."'.
-
-lll. Integer constants have been extended to base 64.
-
-mmm. The `ulimit' builtin now sets both hard and soft limits and reports the
- soft limit by default.
-
-2. New Features in Readline
-
-a. New variables: enable-keypad, input-meta (new name for meta-flag),
- mark-directories, visible-stats (now documented), disable-completion,
- comment-begin.
-
-b. New bindable commands: kill-region, copy-region-as-kill,
- copy-backward-word, copy-forward-word, set-mark, exchange-point-and-mark,
- character-search, character-search-backward, insert-comment,
- glob-expand-word, glob-list-expansions, dump-variables, dump-macros.
-
-c. New emacs keybindings: delete-horizontal-space (M-\),
- insert-completions (M-*), possible-completions (M-=).
-
-d. The history-search-backward and history-search-forward commands were
- modified to be the same as previous-line and next-line if point is at
- the start of the line.
-
-e. More file types are available for the visible-stats mode.
-
-3. Changes of interest in the Bash implementation
-
-a. There is a new autoconf-based configuration mechanism.
-
-b. More things have been moved from Posix mode to standard shell behavior.
-
-c. The trace output (set -x) now inserts quotes where necessary so it can
- be reused as input.
-
-d. There is a compile-time option for a system-wide interactive shell
- startup file (disabled by default).
-
-e. The YACC grammar is smaller and tighter, and all 66 shift-reduce
- conflicts are gone. Several parsing bugs have been fixed.
-
-f. Builtin option parsing has been regularized (using internal_getopt()),
- with the exception of `echo', `type', and `set'.
-
-g. Builtins now return standard usage messages constructed from the
- `short doc' used by the help builtin.
-
-h. Completion now quotes using backslashes by default, but honors
- user-supplied quotes.
-
-i. The GNU libc malloc is available as a configure-time option.
-
-j. There are more internationalization features; bash uses gettext if
- it is available. The $"..." translation syntax uses the current
- locale and gettext.
-
-k. There is better reporting of job termination when the shell is not
- interactive.
-
-l. The shell is somewhat more efficient: it uses a little less memory and
- makes fewer system calls.
-
-4. Changes of interest in the Readline implementation
-
-a. There is now support for readline `callback' functions.
-
-b. There is now support for user-supplied input, redisplay, and terminal
- preparation functions.
-
-c. Most of the shell-specific code in readline has been generalized or
- removed.
-
-d. Most of the annoying redisplay bugs have been fixed, notably the problems
- with incremental search and excessive redrawing when special characters
- appear in the prompt string.
-
-e. There are new library functions and variables available to application
- writers, most having to do with completion and quoting.
-
-f. The NEWLINE character (^J) is now treated as a search terminator by the
- incremental search functions.
--------------------------------------------------------------------------------
-
-Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved. This file is offered as-is,
-without any warranty.
+++ /dev/null
-This is a terse description of the new features added to bash-4.3 since
-the release of bash-4.2. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. The `helptopic' completion action now maps to all the help topics, not just
- the shell builtins.
-
-b. The `help' builtin no longer does prefix substring matching, so `help read'
- does not match `readonly'.
-
-c. The shell can be compiled to not display a message about processes that
- terminate due to SIGTERM.
-
-d. Non-interactive shells now react to the setting of checkwinsize and set
- LINES and COLUMNS after a foreground job exits.
-
-e. There is a new shell option, `globasciiranges', which, when set to on,
- forces globbing range comparisons to use character ordering as if they
- were run in the C locale.
-
-f. There is a new shell option, `direxpand', which makes filename completion
- expand variables in directory names in the way bash-4.1 did.
-
-g. In Posix mode, the `command' builtin does not change whether or not a
- builtin it shadows is treated as an assignment builtin.
-
-h. The `return' and `exit' builtins accept negative exit status arguments.
-
-i. The word completion code checks whether or not a filename containing a
- shell variable expands to a directory name and appends `/' to the word
- as appropriate. The same code expands shell variables in command names
- when performing command completion.
-
-j. In Posix mode, it is now an error to attempt to define a shell function
- with the same name as a Posix special builtin.
-
-k. When compiled for strict Posix conformance, history expansion is disabled
- by default.
-
-l. The history expansion character (!) does not cause history expansion when
- followed by the closing quote in a double-quoted string.
-
-m. `complete' and its siblings compgen/compopt now takes a new `-o noquote'
- option to inhibit quoting of the completions.
-
-n. Setting HISTSIZE to a value less than zero causes the history list to be
- unlimited (setting it 0 zero disables the history list).
-
-o. Setting HISTFILESIZE to a value less than zero causes the history file size
- to be unlimited (setting it to 0 causes the history file to be truncated
- to zero size).
-
-p. The `read' builtin now skips NUL bytes in the input.
-
-q. There is a new `bind -X' option to print all key sequences bound to Unix
- commands.
-
-r. When in Posix mode, `read' is interruptible by a trapped signal. After
- running the trap handler, read returns 128+signal and throws away any
- partially-read input.
-
-s. The command completion code skips whitespace and assignment statements
- before looking for the command name word to be completed.
-
-t. The build process has a new mechanism for constructing separate help files
- that better reflects the current set of compilation options.
-
-u. The -nt and -ot options to test now work with files with nanosecond
- timestamp resolution.
-
-v. The shell saves the command history in any shell for which history is
- enabled and HISTFILE is set, not just interactive shells.
-
-w. The shell has `nameref' variables and new -n(/+n) options to declare and
- unset to use them, and a `test -R' option to test for them.
-
-x. The shell now allows assigning, referencing, and unsetting elements of
- indexed arrays using negative subscripts (a[-1]=2, echo ${a[-1]}) which
- count back from the last element of the array.
-
-y. The {x}<word redirection feature now allows words like {array[ind]} and
- can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
-
-z. There is a new CHILD_MAX special shell variable; its value controls the
- number of exited child statues the shell remembers.
-
-aa. There is a new configuration option (--enable-direxpand-default) that
- causes the `direxpand' shell option to be enabled by default.
-
-bb. Bash does not do anything special to ensure that the file descriptor
- assigned to X in {x}<foo remains open after the block containing it
- completes.
-
-cc. The `wait' builtin has a new `-n' option to wait for the next child to
- change status.
-
-dd. The `printf' %(...)T format specifier now uses the current time if no
- argument is supplied.
-
-ee. There is a new variable, BASH_COMPAT, that controls the current shell
- compatibility level.
-
-ff. The `popd' builtin now treats additional arguments as errors.
-
-gg. The brace expansion code now treats a failed sequence expansion as a
- simple string and will continue to expand brace terms in the remainder
- of the word.
-
-2. New Features in Readline
-
-a. Readline is now more responsive to SIGHUP and other fatal signals when
- reading input from the terminal or performing word completion but no
- longer attempts to run any not-allowable functions from a signal handler
- context.
-
-b. There are new bindable commands to search the history for the string of
- characters between the beginning of the line and the point
- (history-substring-search-forward, history-substring-search-backward)
-
-c. Readline allows quoted strings as the values of variables when setting
- them with `set'. As a side effect, trailing spaces and tabs are ignored
- when setting a string variable's value.
-
-d. The history library creates a backup of the history file when writing it
- and restores the backup on a write error.
-
-e. New application-settable variable: rl_filename_stat_hook: a function called
- with a filename before using it in a call to stat(2). Bash uses it to
- expand shell variables so things like $HOME/Downloads have a slash
- appended.
-
-f. New bindable function `print-last-kbd-macro', prints the most-recently-
- defined keyboard macro in a reusable format.
-
-g. New user-settable variable `colored-stats', enables use of colored text
- to denote file types when displaying possible completions (colored analog
- of visible-stats).
-
-h. New user-settable variable `keyseq-timout', acts as an inter-character
- timeout when reading input or incremental search strings.
-
-i. New application-callable function: rl_clear_history. Clears the history list
- and frees all readline-associated private data.
-
-j. New user-settable variable, show-mode-in-prompt, adds a characters to the
- beginning of the prompt indicating the current editing mode.
-
-k. New application-settable variable: rl_input_available_hook; function to be
- called when readline detects there is data available on its input file
- descriptor.
-
-l. Readline calls an application-set event hook (rl_event_hook) after it gets
- a signal while reading input (read returns -1/EINTR but readline does not
- handle the signal immediately) to allow the application to handle or
- otherwise note it.
-
-m. If the user-settable variable `history-size' is set to a value less than
- 0, the history list size is unlimited.
-
-n. New application-settable variable: rl_signal_event_hook; function that is
- called when readline is reading terminal input and read(2) is interrupted
- by a signal. Currently not called for SIGHUP or SIGTERM.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-4.2 since
-the release of bash-4.1. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. `exec -a foo' now sets $0 to `foo' in an executable shell script without a
- leading #!.
-
-b. Subshells begun to execute command substitutions or run shell functions or
- builtins in subshells do not reset trap strings until a new trap is
- specified. This allows $(trap) to display the caller's traps and the
- trap strings to persist until a new trap is set.
-
-c. `trap -p' will now show signals ignored at shell startup, though their
- disposition still cannot be modified.
-
-d. $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
-
-e. declare/typeset has a new `-g' option, which creates variables in the
- global scope even when run in a shell function.
-
-f. test/[/[[ have a new -v variable unary operator, which returns success if
- `variable' has been set.
-
-g. Posix parsing changes to allow `! time command' and multiple consecutive
- instances of `!' (which toggle) and `time' (which have no cumulative
- effect).
-
-h. Posix change to allow `time' as a command by itself to print the elapsed
- user, system, and real times for the shell and its children.
-
-j. $((...)) is always parsed as an arithmetic expansion first, instead of as
- a potential nested command substitution, as Posix requires.
-
-k. A new FUNCNEST variable to allow the user to control the maximum shell
- function nesting (recursive execution) level.
-
-l. The mapfile builtin now supplies a third argument to the callback command:
- the line about to be assigned to the supplied array index.
-
-m. The printf builtin has a new %(fmt)T specifier, which allows time values
- to use strftime-like formatting.
-
-n. There is a new `compat41' shell option.
-
-o. The cd builtin has a new Posix-mandated `-e' option.
-
-p. Negative subscripts to indexed arrays, previously errors, now are treated
- as offsets from the maximum assigned index + 1.
-
-q. Negative length specifications in the ${var:offset:length} expansion,
- previously errors, are now treated as offsets from the end of the variable.
-
-r. Parsing change to allow `time -p --'.
-
-s. Posix-mode parsing change to not recognize `time' as a keyword if the
- following token begins with a `-'. This means no more Posix-mode
- `time -p'. Posix interpretation 267.
-
-t. There is a new `lastpipe' shell option that runs the last command of a
- pipeline in the current shell context. The lastpipe option has no
- effect if job control is enabled.
-
-u. History expansion no longer expands the `$!' variable expansion.
-
-v. Posix mode shells no longer exit if a variable assignment error occurs
- with an assignment preceding a command that is not a special builtin.
-
-w. Non-interactive mode shells exit if -u is enabled and an attempt is made
- to use an unset variable with the % or # expansions, the `//', `^', or
- `,' expansions, or the parameter length expansion.
-
-x. Posix-mode shells use the argument passed to `.' as-is if a $PATH search
- fails, effectively searching the current directory. Posix-2008 change.
-
-2. New Features in Readline
-
-a. The history library does not try to write the history filename in the
- current directory if $HOME is unset. This closes a potential security
- problem if the application does not specify a history filename.
-
-b. New bindable variable `completion-display-width' to set the number of
- columns used when displaying completions.
-
-c. New bindable variable `completion-case-map' to cause case-insensitive
- completion to treat `-' and `_' as identical.
-
-d. There are new bindable vi-mode command names to avoid readline's case-
- insensitive matching not allowing them to be bound separately.
-
-e. New bindable variable `menu-complete-display-prefix' causes the menu
- completion code to display the common prefix of the possible completions
- before cycling through the list, instead of after.
-
--------------------------------------------------------------------------------
-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 if the compatibility level
- is greater than 40.
-
-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.
-
-v. The mapfile/readarray builtin no longer stores the commands it invokes via
- callbacks in the history list.
-
-w. There is a new `compat40' shopt option.
-
-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.
-
-1. New Features in Bash
-
-a. When using substring expansion on the positional parameters, a starting
- index of 0 now causes $0 to be prefixed to the list.
-
-b. The `help' builtin now prints its columns with entries sorted vertically
- rather than horizontally.
-
-c. There is a new variable, $BASHPID, which always returns the process id of
- the current shell.
-
-d. There is a new `autocd' option that, when enabled, causes bash to attempt
- to `cd' to a directory name that is supplied as the first word of a
- simple command.
-
-e. There is a new `checkjobs' option that causes the shell to check for and
- report any running or stopped jobs at exit.
-
-f. The programmable completion code exports a new COMP_TYPE variable, set to
- a character describing the type of completion being attempted.
-
-g. The programmable completion code exports a new COMP_KEY variable, set to
- the character that caused the completion to be invoked (e.g., TAB).
-
-h. If creation of a child process fails due to insufficient resources, bash
- will try again several times before reporting failure.
-
-i. The programmable completion code now uses the same set of characters as
- readline when breaking the command line into a list of words.
-
-j. The block multiplier for the ulimit -c and -f options is now 512 when in
- Posix mode, as Posix specifies.
-
-k. Changed the behavior of the read builtin to save any partial input received
- in the specified variable when the read builtin times out. This also
- results in variables specified as arguments to read to be set to the empty
- string when there is no input available. When the read builtin times out,
- it returns an exit status greater than 128.
-
-l. The shell now has the notion of a `compatibility level', controlled by
- new variables settable by `shopt'. Setting this variable currently
- restores the bash-3.1 behavior when processing quoted strings on the rhs
- of the `=~' operator to the `[[' command.
-
-m. The `ulimit' builtin now has new -b (socket buffer size) and -T (number
- of threads) options.
-
-n. The -p option to `declare' now displays all variable values and attributes
- (or function values and attributes if used with -f).
-
-o. There is a new `compopt' builtin that allows completion functions to modify
- completion options for existing completions or the completion currently
- being executed.
-
-p. The `read' builtin has a new -i option which inserts text into the reply
- buffer when using readline.
-
-q. A new `-E' option to the complete builtin allows control of the default
- behavior for completion on an empty line.
-
-r. There is now limited support for completing command name words containing
- globbing characters.
-
-s. Changed format of internal help documentation for all builtins to roughly
- follow man page format.
-
-t. The `help' builtin now has a new -d option, to display a short description,
- and a -m option, to print help information in a man page-like format.
-
-u. There is a new `mapfile' builtin to populate an array with lines from a
- given file. The name `readarray' is a synonym.
-
-v. If a command is not found, the shell attempts to execute a shell function
- named `command_not_found_handle', supplying the command words as the
- function arguments.
-
-w. There is a new shell option: `globstar'. When enabled, the globbing code
- treats `**' specially -- it matches all directories (and files within
- them, when appropriate) recursively.
-
-x. There is a new shell option: `dirspell'. When enabled, the filename
- completion code performs spelling correction on directory names during
- completion.
-
-y. The `-t' option to the `read' builtin now supports fractional timeout
- values.
-
-z. Brace expansion now allows zero-padding of expanded numeric values and
- will add the proper number of zeroes to make sure all values contain the
- same number of digits.
-
-aa. There is a new bash-specific bindable readline function: `dabbrev-expand'.
- It uses menu completion on a set of words taken from the history list.
-
-bb. The command assigned to a key sequence with `bind -x' now sets two new
- variables in the environment of the executed command: READLINE_LINE_BUFFER
- and READLINE_POINT. The command can change the current readline line
- and cursor position by modifying READLINE_LINE_BUFFER and READLINE_POINT,
- respectively.
-
-cc. There is a new &>> redirection operator, which appends the standard output
- and standard error to the named file.
-
-dd. The parser now understands `|&' as a synonym for `2>&1 |', which redirects
- the standard error for a command through a pipe.
-
-ee. The new `;&' case statement action list terminator causes execution to
- continue with the action associated with the next pattern in the
- statement rather than terminating the command.
-
-ff. The new `;;&' case statement action list terminator causes the shell to
- test the next set of patterns after completing execution of the current
- action, rather than terminating the command.
-
-gg. The shell understands a new variable: PROMPT_DIRTRIM. When set to an
- integer value greater than zero, prompt expansion of \w and \W will
- retain only that number of trailing pathname components and replace
- the intervening characters with `...'.
-
-hh. There are new case-modifying word expansions: uppercase (^[^]) and
- lowercase (,[,]). They can work on either the first character or
- array element, or globally. They accept an optional shell pattern
- that determines which characters to modify. There is an optionally-
- configured feature to include capitalization operators.
-
-ii. The shell provides associative array variables, with the appropriate
- support to create, delete, assign values to, and expand them.
-
-jj. The `declare' builtin now has new -l (convert value to lowercase upon
- assignment) and -u (convert value to uppercase upon assignment) options.
- There is an optionally-configurable -c option to capitalize a value at
- assignment.
-
-kk. There is a new `coproc' reserved word that specifies a coprocess: an
- asynchronous command run with two pipes connected to the creating shell.
- Coprocs can be named. The input and output file descriptors and the
- PID of the coprocess are available to the calling shell in variables
- with coproc-specific names.
-
-ll. A value of 0 for the -t option to `read' now returns success if there is
- input available to be read from the specified file descriptor.
-
-mm. CDPATH and GLOBIGNORE are ignored when the shell is running in privileged
- mode.
-
-nn. New bindable readline functions shell-forward-word and shell-backward-word,
- which move forward and backward words delimited by shell metacharacters
- and honor shell quoting.
-
-oo. New bindable readline functions shell-backward-kill-word and shell-kill-word
- which kill words backward and forward, but use the same word boundaries
- as shell-forward-word and shell-backward-word.
-
-2. New Features in Readline
-
-a. A new variable, rl_sort_completion_matches; allows applications to inhibit
- match list sorting (but beware: some things don't work right if
- applications do this).
-
-b. A new variable, rl_completion_invoking_key; allows applications to discover
- the key that invoked rl_complete or rl_menu_complete.
-
-c. The functions rl_block_sigint and rl_release_sigint are now public and
- available to calling applications who want to protect critical sections
- (like redisplay).
-
-d. The functions rl_save_state and rl_restore_state are now public and
- available to calling applications; documented rest of readline's state
- flag values.
-
-e. A new user-settable variable, `history-size', allows setting the maximum
- number of entries in the history list.
-
-f. There is a new implementation of menu completion, with several improvements
- over the old; the most notable improvement is a better `completions
- browsing' mode.
-
-g. The menu completion code now uses the rl_menu_completion_entry_function
- variable, allowing applications to provide their own menu completion
- generators.
-
-h. There is support for replacing a prefix of a pathname with a `...' when
- displaying possible completions. This is controllable by setting the
- `completion-prefix-display-length' variable. Matches with a common prefix
- longer than this value have the common prefix replaced with `...'.
-
-i. There is a new `revert-all-at-newline' variable. If enabled, readline will
- undo all outstanding changes to all history lines when `accept-line' is
- executed.
-
-j. If the kernel supports it, readline displays special characters
- corresponding to a keyboard-generated signal when the signal is received.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-3.2 since
-the release of bash-3.1. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. Changed the parameter pattern replacement functions to not anchor the
- pattern at the beginning of the string if doing global replacement - that
- combination doesn't make any sense.
-
-b. When running in `word expansion only' mode (--wordexp option), inhibit
- process substitution.
-
-c. Loadable builtins now work on MacOS X 10.[34].
-
-d. Shells running in posix mode no longer set $HOME, as POSIX requires.
-
-e. The code that checks for binary files being executed as shell scripts now
- checks only for NUL rather than any non-printing character.
-
-f. Quoting the string argument to the [[ command's =~ operator now forces
- string matching, as with the other pattern-matching operators.
-
-2. New Features in Readline
-
-a. Calling applications can now set the keyboard timeout to 0, allowing
- poll-like behavior.
-
-b. The value of SYS_INPUTRC (configurable at compilation time) is now used as
- the default last-ditch startup file.
-
-c. The history file reading functions now allow windows-like \r\n line
- terminators.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-3.1 since
-the release of bash-3.0. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. Bash now understands LC_TIME as a special variable so that time display
- tracks the current locale.
-
-b. BASH_ARGC, BASH_ARGV, BASH_SOURCE, and BASH_LINENO are no longer created
- as `invisible' variables and may not be unset.
-
-c. In POSIX mode, if `xpg_echo' option is enabled, the `echo' builtin doesn't
- try to interpret any options at all, as POSIX requires.
-
-d. The `bg' builtin now accepts multiple arguments, as POSIX seems to specify.
-
-e. Fixed vi-mode word completion and glob expansion to perform tilde
- expansion.
-
-f. The `**' mathematic exponentiation operator is now right-associative.
-
-g. The `ulimit' builtin has new options: -i (max number of pending signals),
- -q (max size of POSIX message queues), and -x (max number of file locks).
-
-h. A bare `%' once again expands to the current job when used as a job
- specifier.
-
-i. The `+=' assignment operator (append to the value of a string or array) is
- now supported for assignment statements and arguments to builtin commands
- that accept assignment statements.
-
-j. BASH_COMMAND now preserves its value when a DEBUG trap is executed.
-
-k. The `gnu_errfmt' option is enabled automatically if the shell is running
- in an emacs terminal window.
-
-l. New configuration option: --single-help-strings. Causes long help text
- to be written as a single string; intended to ease translation.
-
-m. The COMP_WORDBREAKS variable now causes the list of word break characters
- to be emptied when the variable is unset.
-
-n. An unquoted expansion of $* when $IFS is empty now causes the positional
- parameters to be concatenated if the expansion doesn't undergo word
- splitting.
-
-o. Bash now inherits $_ from the environment if it appears there at startup.
-
-p. New shell option: nocasematch. If non-zero, shell pattern matching ignores
- case when used by `case' and `[[' commands.
-
-q. The `printf' builtin takes a new option: -v var. That causes the output
- to be placed into var instead of on stdout.
-
-r. By default, the shell no longer reports processes dying from SIGPIPE.
-
-s. Bash now sets the extern variable `environ' to the export environment it
- creates, so C library functions that call getenv() (and can't use the
- shell-provided replacement) get current values of environment variables.
-
-t. A new configuration option, `--enable-strict-posix-default', which will
- build bash to be POSIX conforming by default.
-
-u. If compiled for strict POSIX conformance, LINES and COLUMNS may now
- override the true terminal size.
-
-2. New Features in Readline
-
-a. The key sequence sent by the keypad `delete' key is now automatically
- bound to delete-char.
-
-b. A negative argument to menu-complete now cycles backward through the
- completion list.
-
-c. A new bindable readline variable: bind-tty-special-chars. If non-zero,
- readline will bind the terminal special characters to their readline
- equivalents when it's called (on by default).
-
-d. New bindable command: vi-rubout. Saves deleted text for possible
- reinsertion, as with any vi-mode `text modification' command; `X' is bound
- to this in vi command mode.
-
-e. A new external application-controllable variable that allows the LINES
- and COLUMNS environment variables to set the window size regardless of
- what the kernel returns: rl_prefer_env_winsize
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-3.0 since
-the release of bash-2.05b. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. ANSI string expansion now implements the \x{hexdigits} escape.
-
-b. There is a new loadable `strftime' builtin.
-
-c. New variable, COMP_WORDBREAKS, which controls the readline completer's
- idea of word break characters.
-
-d. The `type' builtin no longer reports on aliases unless alias expansion
- will actually be performed.
-
-e. HISTCONTROL is now a colon-separated list of values, which permits
- more extensibility and backwards compatibility.
-
-f. HISTCONTROL may now include the `erasedups' option, which causes all lines
- matching a line being added to be removed from the history list.
-
-g. `configure' has a new `--enable-multibyte' argument that permits multibyte
- character support to be disabled even on systems that support it.
-
-h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV,
- BASH_SOURCE, BASH_LINENO, BASH_SUBSHELL, BASH_EXECUTION_STRING,
- BASH_COMMAND
-
-i. FUNCNAME has been changed to support the debugger: it's now an array
- variable.
-
-j. for, case, select, arithmetic commands now keep line number information
- for the debugger.
-
-k. There is a new `RETURN' trap executed when a function or sourced script
- returns (not inherited child processes; inherited by command substitution
- if function tracing is enabled and the debugger is active).
-
-l. New invocation option: --debugger. Enables debugging and turns on new
- `extdebug' shell option.
-
-m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR
- traps, respectively, to be inherited by shell functions. Equivalent to
- `set -T' and `set -E' respectively. The `functrace' option also controls
- whether or not the DEBUG trap is inherited by sourced scripts.
-
-n. The DEBUG trap is run before binding the variable and running the action
- list in a `for' command, binding the selection variable and running the
- query in a `select' command, and before attempting a match in a `case'
- command.
-
-o. New `--enable-debugger' option to `configure' to compile in the debugger
- support code.
-
-p. `declare -F' now prints out extra line number and source file information
- if the `extdebug' option is set.
-
-q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes
- the next command to be skipped, and a return value of 2 while in a
- function or sourced script forces a `return'.
-
-r. New `caller' builtin to provide a call stack for the bash debugger.
-
-s. The DEBUG trap is run just before the first command in a function body is
- executed, for the debugger.
-
-t. `for', `select', and `case' command heads are printed when `set -x' is
- enabled.
-
-u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1,
- x+2,...,y}. x and y can be integers or single characters; the sequence
- may ascend or descend; the increment is always 1.
-
-v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices)
- of array.
-
-w. New `force_fignore' shopt option; if enabled, suffixes specified by
- FIGNORE cause words to be ignored when performing word completion even
- if they're the only possibilities.
-
-x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu
- style' (filename:lineno:message) format.
-
-y. New `-o bashdefault' option to complete and compgen; if set, causes the
- whole set of bash completions to be performed if the compspec doesn't
- result in a match.
-
-z. New `-o plusdirs' option to complete and compgen; if set, causes directory
- name completion to be performed and the results added to the rest of the
- possible completions.
-
-aa. `kill' is available as a builtin even when the shell is built without
- job control.
-
-bb. New HISTTIMEFORMAT variable; value is a format string to pass to
- strftime(3). If set and not null, the `history' builtin prints out
- timestamp information according to the specified format when displaying
- history entries. If set, bash tells the history library to write out
- timestamp information when the history file is written.
-
-cc. The [[ ... ]] command has a new binary `=~' operator that performs
- extended regular expression (egrep-like) matching.
-
-dd. `configure' has a new `--enable-cond-regexp' option (enabled by default)
- to enable the =~ operator and regexp matching in [[ ... ]].
-
-ee. Subexpressions matched by the =~ operator are placed in the new
- BASH_REMATCH array variable.
-
-ff. New `failglob' option that causes an expansion error when pathname
- expansion fails to produce a match.
-
-gg. New `set -o pipefail' option that causes a pipeline to return a failure
- status if any of the processes in the pipeline fail, not just the last
- one.
-
-hh. printf builtin understands two new escape sequences: \" and \?.
-
-ii. `echo -e' understands two new escape sequences: \" and \?.
-
-jj. The GNU `gettext' package and libintl have been integrated; the shell's
- messages can be translated into different languages.
-
-kk. The `\W' prompt expansion now abbreviates $HOME as `~', like `\w'.
-
-ll. The error message printed when bash cannot open a shell script supplied
- as argument 1 now includes the name of the shell, to better identify
- the error as coming from bash.
-
-mm. The parameter pattern removal and substitution expansions are now much
- faster and more efficient when using multibyte characters.
-
-nn. The `jobs', `kill', and `wait' builtins now accept job control notation
- even if job control is not enabled.
-
-oo. The historical behavior of `trap' that allows a missing `action' argument
- to cause each specified signal's handling to be reset to its default is
- now only supported when `trap' is given a single non-option argument.
-
-2. New Features in Readline
-
-a. History expansion has a new `a' modifier equivalent to the `g' modifier
- for compatibility with the BSD csh.
-
-b. History expansion has a new `G' modifier equivalent to the BSD csh `g'
- modifier, which performs a substitution once per word.
-
-c. All non-incremental search operations may now undo the operation of
- replacing the current line with the history line.
-
-d. The text inserted by an `a' command in vi mode can be reinserted with
- `.'.
-
-e. New bindable variable, `show-all-if-unmodified'. If set, the readline
- completer will list possible completions immediately if there is more
- than one completion and partial completion cannot be performed.
-
-f. There is a new application-callable `free_history_entry()' function.
-
-g. History list entries now contain timestamp information; the history file
- functions know how to read and write timestamp information associated
- with each entry.
-
-h. Four new key binding functions have been added:
-
- rl_bind_key_if_unbound()
- rl_bind_key_if_unbound_in_map()
- rl_bind_keyseq_if_unbound()
- rl_bind_keyseq_if_unbound_in_map()
-
-i. New application variable, rl_completion_quote_character, set to any
- quote character readline finds before it calls the application completion
- function.
-
-j. New application variable, rl_completion_suppress_quote, settable by an
- application completion function. If set to non-zero, readline does not
- attempt to append a closing quote to a completed word.
-
-k. New application variable, rl_completion_found_quote, set to a non-zero
- value if readline determines that the word to be completed is quoted.
- Set before readline calls any application completion function.
-
-l. New function hook, rl_completion_word_break_hook, called when readline
- needs to break a line into words when completion is attempted. Allows
- the word break characters to vary based on position in the line.
-
-m. New bindable command: unix-filename-rubout. Does the same thing as
- unix-word-rubout, but adds `/' to the set of word delimiters.
-
-n. When listing completions, directories have a `/' appended if the
- `mark-directories' option has been enabled.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.05b since
-the release of bash-2.05a. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. If set, TMOUT is the default timeout for the `read' builtin.
-
-b. `type' has two new options: `-f' suppresses shell function lookup, and
- `-P' forces a $PATH search.
-
-c. New code to handle multibyte characters.
-
-d. `select' was changed to be more ksh-compatible, in that the menu is
- reprinted each time through the loop only if REPLY is set to NULL.
- The previous behavior is available as a compile-time option.
-
-e. `complete -d' and `complete -o dirnames' now force a slash to be
- appended to names which are symlinks to directories.
-
-f. There is now a bindable edit-and-execute-command readline command,
- like the vi-mode `v' command, bound to C-xC-e in emacs mode.
-
-g. Added support for ksh93-like [:word:] character class in pattern matching.
-
-h. The $'...' quoting construct now expands \cX to Control-X.
-
-i. A new \D{...} prompt expansion; passes the `...' to strftime and inserts
- the result into the expanded prompt.
-
-j. The shell now performs arithmetic in the largest integer size the
- machine supports (intmax_t), instead of long.
-
-k. If a numeric argument is supplied to one of the bash globbing completion
- functions, a `*' is appended to the word before expansion is attempted.
-
-l. The bash globbing completion functions now allow completions to be listed
- with double tabs or if `show-all-if-ambiguous' is set.
-
-m. New `-o nospace' option for `complete' and `compgen' builtins; suppresses
- readline's appending a space to the completed word.
-
-n. New `here-string' redirection operator: <<< word.
-
-o. When displaying variables, function attributes and definitions are shown
- separately, allowing them to be re-used as input (attempting to re-use
- the old output would result in syntax errors).
-
-p. There is a new configuration option `--enable-mem-scramble', controls
- bash malloc behavior of writing garbage characters into memory at
- allocation and free time.
-
-q. The `complete' and `compgen' builtins now have a new `-s/-A service'
- option to complete on names from /etc/services.
-
-r. `read' has a new `-u fd' option to read from a specified file descriptor.
-
-s. Fix the completion code so that expansion errors in a directory name
- don't cause a longjmp back to the command loop.
-
-t. Fixed word completion inside command substitution to work a little more
- intuitively.
-
-u. The `printf' %q format specifier now uses $'...' quoting to print the
- argument if it contains non-printing characters.
-
-v. The `declare' and `typeset' builtins have a new `-t' option. When applied
- to functions, it causes the DEBUG trap to be inherited by the named
- function. Currently has no effect on variables.
-
-w. The DEBUG trap is now run *before* simple commands, ((...)) commands,
- [[...]] conditional commands, and for ((...)) loops.
-
-x. The expansion of $LINENO inside a shell function is only relative to the
- function start if the shell is interactive -- if the shell is running a
- script, $LINENO expands to the line number in the script. This is as
- POSIX-2001 requires.
-
-y. The bash debugger in examples/bashdb has been modified to work with the
- new DEBUG trap semantics, the command set has been made more gdb-like,
- and the changes to $LINENO make debugging functions work better. Code
- from Gary Vaughan.
-
-z. New [n]<&word- and [n]>&word- redirections from ksh93 -- move fds (dup
- and close).
-
-aa. There is a new `-l' invocation option, equivalent to `--login'.
-
-bb. The `hash' builtin has a new `-l' option to list contents in a reusable
- format, and a `-d' option to remove a name from the hash table.
-
-cc. There is now support for placing the long help text into separate files
- installed into ${datadir}/bash. Not enabled by default; can be turned
- on with `--enable-separate-helpfiles' option to configure.
-
-dd. All builtins that take operands accept a `--' pseudo-option, except
- `echo'.
-
-ee. The `echo' builtin now accepts \0xxx (zero to three octal digits following
- the `0') in addition to \xxx (one to three octal digits) for SUSv3/XPG6/
- POSIX.1-2001 compliance.
-
-
-2. New Features in Readline
-
-a. Support for key `subsequences': allows, e.g., ESC and ESC-a to both
- be bound to readline functions. Now the arrow keys may be used in vi
- insert mode.
-
-b. When listing completions, and the number of lines displayed is more than
- the screen length, readline uses an internal pager to display the results.
- This is controlled by the `page-completions' variable (default on).
-
-c. New code to handle editing and displaying multibyte characters.
-
-d. The behavior introduced in bash-2.05a of deciding whether or not to
- append a slash to a completed name that is a symlink to a directory has
- been made optional, controlled by the `mark-symlinked-directories'
- variable (default is the 2.05a behavior).
-
-e. The `insert-comment' command now acts as a toggle if given a numeric
- argument: if the first characters on the line don't specify a
- comment, insert one; if they do, delete the comment text
-
-f. New application-settable completion variable:
- rl_completion_mark_symlink_dirs, allows an application's completion
- function to temporarily override the user's preference for appending
- slashes to names which are symlinks to directories.
-
-g. New function available to application completion functions:
- rl_completion_mode, to tell how the completion function was invoked
- and decide which argument to supply to rl_complete_internal (to list
- completions, etc.).
-
-h. Readline now has an overwrite mode, toggled by the `overwrite-mode'
- bindable command, which could be bound to `Insert'.
-
-i. New application-settable completion variable:
- rl_completion_suppress_append, inhibits appending of
- rl_completion_append_character to completed words.
-
-j. New key bindings when reading an incremental search string: ^W yanks
- the currently-matched word out of the current line into the search
- string; ^Y yanks the rest of the current line into the search string,
- DEL or ^H deletes characters from the search string.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.05a since
-the release of bash-2.05. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. Added support for DESTDIR installation root prefix, so you can do a
- `make install DESTDIR=bash-root' and do easier binary packaging.
-
-b. Added support for builtin printf "'" flag character as per latest POSIX
- drafts.
-
-c. Support for POSIX.2 printf(1) length specifiers `j', `t', and `z' (from
- ISO C99).
-
-d. New autoconf macro, RL_LIB_READLINE_VERSION, for use by other applications
- (bash doesn't use very much of what it returns).
-
-e. `set [-+]o nolog' is recognized as required by the latest POSIX drafts,
- but ignored.
-
-f. New read-only `shopt' option: login_shell. Set to non-zero value if the
- shell is a login shell.
-
-g. New `\A' prompt string escape sequence; expands to time in 24 HH:MM format.
-
-h. New `-A group/-g' option to complete and compgen; does group name
- completion.
-
-i. New `-t' option to `hash' to list hash values for each filename argument.
-
-j. New [-+]O invocation option to set and unset `shopt' options at startup.
-
-k. configure's `--with-installed-readline' option now takes an optional
- `=PATH' suffix to set the root of the tree where readline is installed
- to PATH.
-
-l. The ksh-like `ERR' trap has been added. The `ERR' trap will be run
- whenever the shell would have exited if the -e option were enabled.
- It is not inherited by shell functions.
-
-m. `readonly', `export', and `declare' now print variables which have been
- given attributes but not set by assigning a value as just a command and
- a variable name (like `export foo') when listing, as the latest POSIX
- drafts require.
-
-n. `bashbug' now requires that the subject be changed from the default.
-
-o. configure has a new `--enable-largefile' option, like other GNU utilities.
-
-p. `for' loops now allow empty word lists after `in', like the latest POSIX
- drafts require.
-
-q. The builtin `ulimit' now takes two new non-numeric arguments: `hard',
- meaning the current hard limit, and `soft', meaning the current soft
- limit, in addition to `unlimited'
-
-r. `ulimit' now prints the option letter associated with a particular
- resource when printing more than one limit.
-
-s. `ulimit' prints `hard' or `soft' when a value is not `unlimited' but is
- one of RLIM_SAVED_MAX or RLIM_SAVED_CUR, respectively.
-
-t. The `printf' builtin now handles the %a and %A conversions if they're
- implemented by printf(3).
-
-u. The `printf' builtin now handles the %F conversion (just about like %f).
-
-v. The `printf' builtin now handles the %n conversion like printf(3). The
- corresponding argument is the name of a shell variable to which the
- value is assigned.
-
-2. New Features in Readline
-
-a. Added extern declaration for rl_get_termcap to readline.h, making it a
- public function (it was always there, just not in readline.h).
-
-b. New #defines in readline.h: RL_READLINE_VERSION, currently 0x0402,
- RL_VERSION_MAJOR, currently 4, and RL_VERSION_MINOR, currently 2.
-
-c. New readline variable: rl_readline_version, mirrors RL_READLINE_VERSION.
-
-d. New bindable boolean readline variable: match-hidden-files. Controls
- completion of files beginning with a `.' (on Unix). Enabled by default.
-
-e. The history expansion code now allows any character to terminate a
- `:first-' modifier, like csh.
-
-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.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.05 since
-the release of bash-2.04. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. Added a new `--init-file' invocation argument as a synonym for `--rcfile',
- per the new GNU coding standards.
-
-b. The /dev/tcp and /dev/udp redirections now accept service names as well as
- port numbers.
-
-c. `complete' and `compgen' now take a `-o value' option, which controls some
- of the aspects of that compspec. Valid values are:
-
- default - perform bash default completion if programmable
- completion produces no matches
- dirnames - perform directory name completion if programmable
- completion produces no matches
- filenames - tell readline that the compspec produces filenames,
- so it can do things like append slashes to
- directory names and suppress trailing spaces
-
-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
- 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.
-
-f. Bash-2.05 once again honors the current locale setting when processing
- ranges within pattern matching bracket expressions (e.g., [A-Z]).
-
-2. New Features in Readline
-
-a. The blink timeout for paren matching is now settable by applications,
- via the rl_set_paren_blink_timeout() function.
-
-b. _rl_executing_macro has been renamed to rl_executing_macro, which means
- it's now part of the public interface.
-
-c. Readline has a new variable, rl_readline_state, which is a bitmap that
- encapsulates the current state of the library; intended for use by
- callbacks and hook functions.
-
-d. New application-callable function rl_set_prompt(const char *prompt):
- expands its prompt string argument and sets rl_prompt to the result.
-
-e. New application-callable function rl_set_screen_size(int rows, int cols):
- public method for applications to set readline's idea of the screen
- dimensions.
-
-f. New function, rl_get_screen_size (int *rows, int *columns), returns
- readline's idea of the screen dimensions.
-
-g. The timeout in rl_gather_tyi (readline keyboard input polling function)
- is now settable via a function (rl_set_keyboard_input_timeout()).
-
-h. Renamed the max_input_history variable to history_max_entries; the old
- variable is maintained for backwards compatibility.
-
-i. The list of characters that separate words for the history tokenizer is
- now settable with a variable: history_word_delimiters. The default
- value is as before.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.04 since
-the release of bash-2.03. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. The history builtin has a `-d offset' option to delete the history entry
- at position `offset'.
-
-b. The prompt expansion code has two new escape sequences: \j, the number of
- active jobs; and \l, the basename of the shell's tty device name.
-
-c. The `bind' builtin has a new `-x' option to bind key sequences to shell
- commands.
-
-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
- synopsis.
-
-f. There are several new arithmetic operators: id++, id-- (variable
- post-increment/decrement), ++id, --id (variable pre-increment/decrement),
- expr1 , expr2 (comma operator).
-
-g. There is a new ksh-93 style arithmetic for command:
- for ((expr1 ; expr2; expr3 )); do list; done
-
-h. The `read' builtin has a number of new options:
- -t timeout only wait timeout seconds for input
- -n nchars only read nchars from input instead of a full line
- -d delim read until delim rather than newline
- -s don't echo input chars as they are read
-
-i. The redirection code now handles several filenames specially:
- /dev/fd/N, /dev/stdin, /dev/stdout, and /dev/stderr, whether or
- not they are present in the file system.
-
-j. The redirection code now recognizes pathnames of the form
- /dev/tcp/host/port and /dev/udp/host/port, and tries to open a socket
- of the appropriate type to the specified port on the specified host.
-
-k. The ksh-93 ${!prefix*} expansion, which expands to the names of all
- shell variables with prefix PREFIX, has been implemented.
-
-l. There is a new dynamic variable, FUNCNAME, which expands to the name of
- a currently-executing function. Assignments to FUNCNAME have no effect.
-
-m. The GROUPS variable is no longer readonly; assignments to it are silently
- discarded. This means it can be unset.
-
-n. A new programmable completion facility, with two new builtin commands:
- complete and compgen.
-
-o. configure has a new option, `--enable-progcomp', to compile in the
- programmable completion features (enabled by default).
-
-p. `shopt' has a new option, `progcomp', to enable and disable programmable
- completion at runtime.
-
-q. Unsetting HOSTFILE now clears the list of hostnames used for completion.
-
-r. configure has a new option, `--enable-bash-malloc', replacing the old
- `--with-gnu-malloc' (which is still present for backwards compatibility).
-
-s. There is a new manual page describing rbash, the restricted shell.
-
-t. `bashbug' has new `--help' and `--version' options.
-
-u. `shopt' has a new `xpg_echo' option, which controls the behavior of
- `echo' with respect to backslash-escaped characters at runtime.
-
-v. If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the
- startup files, even if they are not interactive.
-
-w. The LC_NUMERIC variable is now treated specially, and used to set the
- LC_NUMERIC locale category for number formatting, e.g., when `printf'
- displays floating-point numbers.
-
-2. New features in Readline
-
-a. Parentheses matching is now always compiled into readline, and enabled
- or disabled when the value of the `blink-matching-paren' variable is
- changed.
-
-b. MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.
-
-c. MS-DOS systems now use ~/_history as the default history file.
-
-d. history-search-{forward,backward} now leave the point at the end of the
- line when the string to search for is empty, like
- {reverse,forward}-search-history.
-
-e. history-search-{forward,backward} now leave the last history line found
- in the readline buffer if the second or subsequent search fails.
-
-f. New function for use by applications: rl_on_new_line_with_prompt, used
- when an application displays the prompt itself before calling readline().
-
-g. New variable for use by applications: rl_already_prompted. An application
- that displays the prompt itself before calling readline() must set this to
- a non-zero value.
-
-h. A new variable, rl_gnu_readline_p, always 1. The intent is that an
- application can verify whether or not it is linked with the `real'
- readline library or some substitute.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.03 since
-the release of bash-2.02. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. New `shopt' option, `restricted_shell', indicating whether or not the
- shell was started in restricted mode, for use in startup files.
-
-b. Filename generation is now performed on the words between ( and ) in
- array assignments (which it probably should have done all along).
-
-c. OLDPWD is now auto-exported, as POSIX.2 seems to require.
-
-d. ENV and BASH_ENV are read-only variables in a restricted shell.
-
-e. A change was made to the startup file code so that any shell begun with
- the `--login' option, even non-interactive shells, will source the login
- shell startup files.
-
-2. New Features in Readline
-
-a. Many changes to the signal handling:
- o Readline now catches SIGQUIT and cleans up the tty before returning;
- o A new variable, rl_catch_signals, is available to application writers
- to indicate to readline whether or not it should install its own
- signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP,
- SIGTTIN, and SIGTTOU;
- o A new variable, rl_catch_sigwinch, is available to application
- writers to indicate to readline whether or not it should install its
- own signal handler for SIGWINCH, which will chain to the calling
- applications's SIGWINCH handler, if one is installed;
- o There is a new function, rl_free_line_state, for application signal
- handlers to call to free up the state associated with the current
- line after receiving a signal;
- o There is a new function, rl_cleanup_after_signal, to clean up the
- display and terminal state after receiving a signal;
- o There is a new function, rl_reset_after_signal, to reinitialize the
- terminal and display state after an application signal handler
- returns and readline continues
-
-b. There is a new function, rl_resize_terminal, to reset readline's idea of
- the screen size after a SIGWINCH.
-
-c. New public functions: rl_save_prompt and rl_restore_prompt. These were
- previously private functions with a `_' prefix.
-
-d. New function hook: rl_pre_input_hook, called just before readline starts
- reading input, after initialization.
-
-e. New function hook: rl_display_matches_hook, called when readline would
- display the list of completion matches. The new function
- rl_display_match_list is what readline uses internally, and is available
- for use by application functions called via this hook.
-
-f. New bindable function, delete-char-or-list, like tcsh.
-
-g. A new variable, rl_erase_empty_line, which, if set by an application using
- readline, will cause readline to erase, prompt and all, lines on which the
- only thing typed was a newline.
-
-h. New bindable variable: `isearch-terminators'.
-
-i. New bindable function: `forward-backward-delete-char' (unbound by default).
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.02 since
-the release of bash-2.01.1. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. A new version of malloc, based on the older GNU malloc, that has many
- changes, is more page-based, is more conservative with memory usage,
- and does not `orphan' large blocks when they are freed.
-
-b. A new version of gmalloc, based on the old GLIBC malloc, with many
- changes and range checking included by default.
-
-c. A new implementation of fnmatch(3) that includes full POSIX.2 Basic
- Regular Expression matching, including character classes, collating
- symbols, equivalence classes, and support for case-insensitive pattern
- matching.
-
-d. ksh-88 egrep-style extended pattern matching ([@+*?!](patlist)) has been
- implemented, controlled by a new `shopt' option, `extglob'.
-
-e. There is a new ksh-like `[[' compound command, which implements
- extended `test' functionality.
-
-f. There is a new `printf' builtin, implemented according to the POSIX.2
- specification.
-
-g. There is a new feature for command substitution: $(< filename) now expands
- to the contents of `filename', with any trailing newlines removed
- (equivalent to $(cat filename)).
-
-h. There are new tilde prefixes which expand to directories from the
- directory stack.
-
-i. There is a new `**' arithmetic operator to do exponentiation.
-
-j. There are new configuration options to control how bash is linked:
- `--enable-profiling', to allow bash to be profiled with gprof, and
- `--enable-static-link', to allow bash to be linked statically.
-
-k. There is a new configuration option, `--enable-cond-command', which
- controls whether or not the `[[' command is included. It is on by
- default.
-
-l. There is a new configuration option, `--enable-extended-glob', which
- controls whether or not the ksh extended globbing feature is included.
- It is enabled by default.
-
-m. There is a new configuration #define in config.h.top that, when enabled,
- will cause all login shells to source /etc/profile and one of the user-
- specific login shell startup files, whether or not the shell is
- interactive.
-
-n. There is a new invocation option, `--dump-po-strings', to dump
- a shell script's translatable strings ($"...") in GNU `po' format.
-
-o. There is a new `shopt' option, `nocaseglob', to enable case-insensitive
- pattern matching when globbing filenames and using the `case' construct.
-
-p. There is a new `shopt' option, `huponexit', which, when enabled, causes
- the shell to send SIGHUP to all jobs when an interactive login shell
- exits.
-
-q. `bind' has a new `-u' option, which takes a readline function name as an
- argument and unbinds all key sequences bound to that function in a
- specified keymap.
-
-r. `disown' now has `-a' and `-r' options, to limit operation to all jobs
- and running jobs, respectively.
-
-s. The `shopt' `-p' option now causes output to be displayed in a reusable
- format.
-
-t. `test' has a new `-N' option, which returns true if the filename argument
- has been modified since it was last accessed.
-
-u. `umask' now has a `-p' option to print output in a reusable format.
-
-v. A new escape sequence, `\xNNN', has been added to the `echo -e' and $'...'
- translation code. It expands to the character whose ascii code is NNN
- in hexadecimal.
-
-w. The prompt string expansion code has a new `\r' escape sequence.
-
-x. The shell may now be cross-compiled for the CYGWIN32 environment on
- a Unix machine.
-
-2. New Features in Readline
-
-a. There is now an option for `iterative' yank-last-arg handline, so a user
- can keep entering `M-.', yanking the last argument of successive history
- lines.
-
-b. New variable, `print-completions-horizontally', which causes completion
- matches to be displayed across the screen (like `ls -x') rather than up
- and down the screen (like `ls').
-
-c. New variable, `completion-ignore-case', which causes filename completion
- and matching to be performed case-insensitively.
-
-d. There is a new bindable command, `magic-space', which causes history
- expansion to be performed on the current readline buffer and a space to
- be inserted into the result.
-
-e. There is a new bindable command, `menu-complete', which enables tcsh-like
- menu completion (successive executions of menu-complete insert a single
- completion match, cycling through the list of possible completions).
-
-f. There is a new bindable command, `paste-from-clipboard', for use on Win32
- systems, to insert the text from the Win32 clipboard into the editing
- buffer.
-
-g. The key sequence translation code now understands printf-style backslash
- escape sequences, including \NNN octal escapes. These escape sequences
- may be used in key sequence definitions or macro values.
-
-h. An `$include' inputrc file parser directive has been added.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.01 since
-the release of bash-2.0. As always, the manual page (doc/bash.1) is the
-place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. There is a new builtin array variable: GROUPS, the set of groups to which
- the user belongs. This is used by the test suite.
-
-2. New Features in Readline
-
-a. If a key sequence bound to `universal-argument' is read while reading a
- numeric argument started with `universal-argument', it terminates the
- argument but is otherwise ignored. This provides a way to insert multiple
- instances of a digit string, and is how GNU emacs does it.
-
--------------------------------------------------------------------------------
-This is a terse description of the new features added to bash-2.0 since
-the release of bash-1.14.7. As always, the manual page (doc/bash.1) is
-the place to look for complete descriptions.
-
-1. New Features in Bash
-
-a. There is a new invocation option, -D, that dumps translatable strings
- in a script.
-
-b. The `long' invocation options must now be prefixed with `--'.
-
-c. New long invocation options: --dump-strings, --help, --verbose
-
-d. The `nolineediting' invocation option was renamed to `noediting'.
-
-e. The `nobraceexpansion' and `quiet' long invocation options were removed.
-
-f. The `--help' and `--version' long options now work as the GNU coding
- standards specify.
-
-g. If invoked as `sh', bash now enters posix mode after reading the
- startup files, and reads and executes commands from the file named
- by $ENV if interactive (as POSIX.2 specifies). A login shell invoked
- as `sh' reads $ENV after /etc/profile and ~/.profile.
-
-h. There is a new reserved word, `time', for timing pipelines, builtin
- commands, and shell functions. It uses the value of the TIMEFORMAT
- variable as a format string describing how to print the timing
- statistics.
-
-i. The $'...' quoting syntax expands ANSI-C escapes in ... and leaves the
- result single-quoted.
-
-j. The $"..." quoting syntax performs locale-specific translation of ...
- and leaves the result double-quoted.
-
-k. LINENO now works correctly in functions.
-
-l. New variables: DIRSTACK, PIPESTATUS, BASH_VERSINFO, HOSTNAME, SHELLOPTS,
- MACHTYPE. The first three are array variables.
-
-m. The BASH_VERSION and BASH_VERSINFO variables now include the shell's
- `release status' (alpha[N], beta[N], release).
-
-n. Some variables have been removed: MAIL_WARNING, notify, history_control,
- command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
- nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
- cdable_vars. Most of them are now implemented with the new `shopt'
- builtin; others were already implemented by `set'.
-
-o. Bash now uses some new variables: LC_ALL, LC_MESSAGES, LC_CTYPE,
- LC_COLLATE, LANG, GLOBIGNORE, HISTIGNORE.
-
-p. The shell now supports integer-indexed arrays of unlimited length,
- with a new compound assignment syntax and changes to the appropriate
- builtin commands (declare/typeset, read, readonly, etc.). The array
- index may be an arithmetic expression.
-
-q. ${!var}: indirect variable expansion, equivalent to eval \${$var}.
-
-r. ${paramter:offset[:length]}: variable substring extraction.
-
-s. ${parameter/pattern[/[/]string]}: variable pattern substitution.
-
-t. The $[...] arithmetic expansion syntax is no longer supported, in
- favor of $((...)).
-
-u. Aliases can now be expanded in shell scripts with a shell option
- (shopt expand_aliases).
-
-v. History and history expansion can now be used in scripts with
- set -o history and set -H.
-
-w. All builtins now return an exit status of 2 for incorrect usage.
-
-x. Interactive shells resend SIGHUP to all running or stopped children
- if (and only if) they exit due to a SIGHUP.
-
-y. New prompting expansions: \a, \e, \H, \T, \@, \v, \V.
-
-z. Variable expansion in prompt strings is now controllable via a shell
- option (shopt promptvars).
-
-aa. Bash now defaults to using command-oriented history.
-
-bb. The history file ($HISTFILE) is now truncated to $HISTFILESIZE after
- being written.
-
-cc. The POSIX.2 conditional arithmetic evaluation syntax (expr ? expr : expr)
- has been implemented.
-
-dd. Each builtin now accepts `--' to signify the end of the options, except
- as documented (echo, etc.).
-
-ee. All builtins use -p to display values in a re-readable format where
- appropriate, except as documented (echo, type, etc.).
-
-ff. The `alias' builtin has a new -p option.
-
-gg. Changes to the `bind' builtin:
- o has new options: -psPSVr.
- o the `-d' option was renamed to `-p'
- o the `-v' option now dumps variables; the old `-v' is now `-P'
-
-hh. The `bye' synonym for `exit' was removed.
-
-ii. The -L and -P options to `cd' and `pwd' have been documented.
-
-jj. The `cd' builtin now does spelling correction on the directory name
- by default. This is settable with a shell option (shopt cdspell).
-
-kk. The `declare' builtin has new options: -a, -F, -p.
-
-ll. The `dirs' builtin has new options: -c, -p, -v.
-
-mm. The new `disown' builtin removes jobs from the shell's jobs table
- or inhibits the resending of SIGHUP when the shell receives a
- SIGHUP.
-
-nn. The `echo' builtin has a new escape character: \e.
-
-oo. The `enable' builtin can now load new builtins dynamically from shared
- objects on systems with the dlopen/dlsym interface. There are a number
- of examples in the examples/loadables directory. There are also
- new options: -d, -f, -s, -p.
-
-pp. The `-all' option to `enable' was removed in favor of `-a'.
-
-qq. The `exec' builtin has new options: -l, -c, -a.
-
-rr. The `hash' builtin has a new option: -p.
-
-ss. The `history' builtin has new options: -c, -p, -s.
-
-tt. The `jobs' builtin has new options: -r, -s.
-
-uu. The `kill' builtin has new options: -n signum, -l signame.
-
-vv. The `pushd' and `popd' builtins have a new option: -n.
-
-ww. The `read' builtin has new options: -p prompt, -e, -a.
-
-xx. The `readonly' builtin has a new -a option, and the -n option was removed.
-
-yy. Changes to the `set' builtin:
- o new options: -B, -o keyword, -o onecmd, -o history
- o options removed: -l, -d, -o nohash
- o options changed: +o, -h, -o hashall
- o now displays variables in a format that can be re-read as input
-
-zz. The new `shopt' builtin controls shell optional behavior previously
- done by setting and unsetting certain shell variables.
-
-aaa. The `test' builtin has new operators: -o option, s1 == s2, s1 < s2,
- and s1 > s2, where s1 and s2 are strings.
-
-bbb. There is a new trap, DEBUG, executed after every simple command.
-
-ccc. The `trap' builtin has a new -p option.
-
-ddd. The `ulimit' builtin has a new -l option on 4.4BSD-based systems.
-
-eee. The PS1, PS2, PATH, and IFS variables may now be unset.
-
-fff. The restricted shell mode has been expanded and is now documented.
-
-ggg. Security improvements:
- o functions are not imported from the environment if running setuid
- or with -p
- o no startup files are sourced if running setuid or with -p
-
-hhh. The documentation has been overhauled: the texinfo manual was
- expanded, and HTML versions of the man page and texinfo manual
- are included.
-
-iii. Changes to Posix mode:
- o Command lookup now finds special builtins before shell functions.
- o Failure of a special builtin causes a non-interactive shell to
- exit. Failures are defined in the POSIX.2 specification.
- o If the `cd' builtin finds a directory to change to using $CDPATH,
- the value assigned to PWD when `cd' completes does not contain
- 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
- `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
- stdout by default, not just when in posix mode.
- o Assignment statements preceding special builtins now persist in
- the shell's environment when the builtin completes.
-
- Posix mode is now completely POSIX.2-compliant (modulo bugs). When
- invoked as sh, bash should be completely POSIX.2-compliant.
-
-jjj. The default value of PS1 is now "\s-\v\$ ".
-
-kkk. The ksh-like ((...)) arithmetic command syntax has been implemented.
- This is exactly equivalent to `let "..."'.
-
-lll. Integer constants have been extended to base 64.
-
-mmm. The `ulimit' builtin now sets both hard and soft limits and reports the
- soft limit by default.
-
-2. New Features in Readline
-
-a. New variables: enable-keypad, input-meta (new name for meta-flag),
- mark-directories, visible-stats (now documented), disable-completion,
- comment-begin.
-
-b. New bindable commands: kill-region, copy-region-as-kill,
- copy-backward-word, copy-forward-word, set-mark, exchange-point-and-mark,
- character-search, character-search-backward, insert-comment,
- glob-expand-word, glob-list-expansions, dump-variables, dump-macros.
-
-c. New emacs keybindings: delete-horizontal-space (M-\),
- insert-completions (M-*), possible-completions (M-=).
-
-d. The history-search-backward and history-search-forward commands were
- modified to be the same as previous-line and next-line if point is at
- the start of the line.
-
-e. More file types are available for the visible-stats mode.
-
-3. Changes of interest in the Bash implementation
-
-a. There is a new autoconf-based configuration mechanism.
-
-b. More things have been moved from Posix mode to standard shell behavior.
-
-c. The trace output (set -x) now inserts quotes where necessary so it can
- be reused as input.
-
-d. There is a compile-time option for a system-wide interactive shell
- startup file (disabled by default).
-
-e. The YACC grammar is smaller and tighter, and all 66 shift-reduce
- conflicts are gone. Several parsing bugs have been fixed.
-
-f. Builtin option parsing has been regularized (using internal_getopt()),
- with the exception of `echo', `type', and `set'.
-
-g. Builtins now return standard usage messages constructed from the
- `short doc' used by the help builtin.
-
-h. Completion now quotes using backslashes by default, but honors
- user-supplied quotes.
-
-i. The GNU libc malloc is available as a configure-time option.
-
-j. There are more internationalization features; bash uses gettext if
- it is available. The $"..." translation syntax uses the current
- locale and gettext.
-
-k. There is better reporting of job termination when the shell is not
- interactive.
-
-l. The shell is somewhat more efficient: it uses a little less memory and
- makes fewer system calls.
-
-4. Changes of interest in the Readline implementation
-
-a. There is now support for readline `callback' functions.
-
-b. There is now support for user-supplied input, redisplay, and terminal
- preparation functions.
-
-c. Most of the shell-specific code in readline has been generalized or
- removed.
-
-d. Most of the annoying redisplay bugs have been fixed, notably the problems
- with incremental search and excessive redrawing when special characters
- appear in the prompt string.
-
-e. There are new library functions and variables available to application
- writers, most having to do with completion and quoting.
-
-f. The NEWLINE character (^J) is now treated as a search terminator by the
- incremental search functions.
--------------------------------------------------------------------------------
-
-Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved. This file is offered as-is,
-without any warranty.
+++ /dev/null
-dnl
-dnl Configure script for bash-4.3
-dnl
-dnl report bugs to chet@po.cwru.edu
-dnl
-dnl Process this file with autoconf to produce a configure script.
-
-# Copyright (C) 1987-2013 Free Software Foundation, Inc.
-
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-AC_REVISION([for Bash 4.3, version 4.057])dnl
-
-define(bashvers, 4.3)
-define(relstatus, beta)
-
-AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
-
-dnl make sure we are using a recent autoconf version
-AC_PREREQ(2.61)
-
-AC_CONFIG_SRCDIR(shell.h)
-dnl where to find install.sh, config.sub, and config.guess
-AC_CONFIG_AUX_DIR(./support)
-AC_CONFIG_HEADERS(config.h)
-
-dnl checks for version info
-BASHVERS=bashvers
-RELSTATUS=relstatus
-
-dnl defaults for debug settings
-case "$RELSTATUS" in
-alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
-*) DEBUG= MALLOC_DEBUG= ;;
-esac
-
-dnl canonicalize the host and os so we can do some tricky things before
-dnl parsing options
-AC_CANONICAL_HOST
-AC_CANONICAL_BUILD
-
-dnl configure defaults
-opt_bash_malloc=yes
-opt_purify=no
-opt_purecov=no
-opt_afs=no
-opt_curses=no
-opt_with_installed_readline=no
-
-#htmldir=
-
-dnl some systems should be configured without the bash malloc by default
-dnl and some need a special compiler or loader
-dnl look in the NOTES file for more
-case "${host_cpu}-${host_os}" in
-alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
-*[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays
-*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
-sparc-svr4*) opt_bash_malloc=no ;; # sparc SVR4, SVR4.2
-sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
-mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
-m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
-sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
-#*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here
-#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
-*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
-*-mirbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
-*-aix*) opt_bash_malloc=no ;; # AIX machines
-*-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
-*-openstep*) opt_bash_malloc=no ;; # i386/Sparc/HP machines running Openstep
-*-macos*) opt_bash_malloc=no ;; # Apple MacOS X
-*-rhapsody*) opt_bash_malloc=no ;; # Apple Rhapsody (MacOS X)
-*-darwin*) opt_bash_malloc=no ;; # Apple Darwin (MacOS X)
-*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
-*-qnx*) opt_bash_malloc=no ;; # QNX 4.2, QNX 6.x
-*-machten4) opt_bash_malloc=no ;; # MachTen 4.x
-*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
-*-beos*) opt_bash_malloc=no ;; # they say it's suitable
-*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
-*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
-*-nsk*) opt_bash_malloc=no ;; # HP NonStop
-esac
-
-# memory scrambling on free()
-case "${host_os}" in
-sco3.2v5*|sco3.2v4*) opt_memscramble=no ;;
-*) opt_memscramble=yes ;;
-esac
-
-dnl
-dnl macros for the bash debugger
-dnl
-dnl AM_PATH_LISPDIR
-AC_ARG_VAR(DEBUGGER_START_FILE, [location of bash debugger initialization file])
-
-dnl arguments to configure
-dnl packages
-AC_ARG_WITH(afs, AC_HELP_STRING([--with-afs], [if you are running AFS]), opt_afs=$withval)
-AC_ARG_WITH(bash-malloc, AC_HELP_STRING([--with-bash-malloc], [use the Bash version of malloc]), opt_bash_malloc=$withval)
-AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
-AC_ARG_WITH(gnu-malloc, AC_HELP_STRING([--with-gnu-malloc], [synonym for --with-bash-malloc]), opt_bash_malloc=$withval)
-AC_ARG_WITH(installed-readline, AC_HELP_STRING([--with-installed-readline], [use a version of the readline library that is already installed]), opt_with_installed_readline=$withval)
-AC_ARG_WITH(purecov, AC_HELP_STRING([--with-purecov], [configure to postprocess with pure coverage]), opt_purecov=$withval)
-AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval)
-
-if test "$opt_bash_malloc" = yes; then
- MALLOC_TARGET=malloc
- MALLOC_SRC=malloc.c
-
- MALLOC_LIB='-lmalloc'
- MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
- MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
- MALLOC_DEP='$(MALLOC_LIBRARY)'
-
- AC_DEFINE(USING_BASH_MALLOC)
-else
- MALLOC_LIB=
- MALLOC_LIBRARY=
- MALLOC_LDFLAGS=
- MALLOC_DEP=
-fi
-
-if test "$opt_purify" = yes; then
- PURIFY="purify "
- AC_DEFINE(DISABLE_MALLOC_WRAPPERS)
-else
- PURIFY=
-fi
-
-if test "$opt_purecov" = yes; then
- PURIFY="${PURIFY}purecov"
-fi
-
-if test "$opt_afs" = yes; then
- AC_DEFINE(AFS)
-fi
-
-if test "$opt_curses" = yes; then
- prefer_curses=yes
-fi
-
-if test -z "${DEBUGGER_START_FILE}"; then
- DEBUGGER_START_FILE='${datadir}/bashdb/bashdb-main.inc'
-fi
-
-dnl optional shell features in config.h.in
-opt_minimal_config=no
-
-opt_job_control=yes
-opt_alias=yes
-opt_readline=yes
-opt_history=yes
-opt_bang_history=yes
-opt_dirstack=yes
-opt_restricted=yes
-opt_process_subst=yes
-opt_prompt_decoding=yes
-opt_select=yes
-opt_help=yes
-opt_array_variables=yes
-opt_dparen_arith=yes
-opt_extended_glob=yes
-opt_brace_expansion=yes
-opt_disabled_builtins=no
-opt_command_timing=yes
-opt_xpg_echo=no
-opt_strict_posix=no
-opt_cond_command=yes
-opt_cond_regexp=yes
-opt_coproc=yes
-opt_arith_for_command=yes
-opt_net_redirs=yes
-opt_progcomp=yes
-opt_separate_help=no
-opt_multibyte=yes
-opt_debugger=yes
-opt_single_longdoc_strings=yes
-opt_casemod_attrs=yes
-opt_casemod_expansions=yes
-opt_extglob_default=no
-opt_dircomplete_expand_default=no
-
-dnl options that affect how bash is compiled and linked
-opt_static_link=no
-opt_profiling=no
-
-dnl argument parsing for optional features
-AC_ARG_ENABLE(minimal-config, AC_HELP_STRING([--enable-minimal-config], [a minimal sh-like configuration]), opt_minimal_config=$enableval)
-
-dnl a minimal configuration turns everything off, but features can be
-dnl added individually
-if test $opt_minimal_config = yes; then
- opt_job_control=no opt_alias=no opt_readline=no
- opt_history=no opt_bang_history=no opt_dirstack=no
- opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
- opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
- opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
- opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
- opt_net_redirs=no opt_progcomp=no opt_separate_help=no
- opt_multibyte=yes opt_cond_regexp=no opt_coproc=no
- opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
-fi
-
-AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
-AC_ARG_ENABLE(arith-for-command, AC_HELP_STRING([--enable-arith-for-command], [enable arithmetic for command]), opt_arith_for_command=$enableval)
-AC_ARG_ENABLE(array-variables, AC_HELP_STRING([--enable-array-variables], [include shell array variables]), opt_array_variables=$enableval)
-AC_ARG_ENABLE(bang-history, AC_HELP_STRING([--enable-bang-history], [turn on csh-style history substitution]), opt_bang_history=$enableval)
-AC_ARG_ENABLE(brace-expansion, AC_HELP_STRING([--enable-brace-expansion], [include brace expansion]), opt_brace_expansion=$enableval)
-AC_ARG_ENABLE(casemod-attributes, AC_HELP_STRING([--enable-casemod-attributes], [include case-modifying variable attributes]), opt_casemod_attrs=$enableval)
-AC_ARG_ENABLE(casemod-expansions, AC_HELP_STRING([--enable-casemod-expansions], [include case-modifying word expansions]), opt_casemod_expansions=$enableval)
-AC_ARG_ENABLE(command-timing, AC_HELP_STRING([--enable-command-timing], [enable the time reserved word and command timing]), opt_command_timing=$enableval)
-AC_ARG_ENABLE(cond-command, AC_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval)
-AC_ARG_ENABLE(cond-regexp, AC_HELP_STRING([--enable-cond-regexp], [enable extended regular expression matching in conditional commands]), opt_cond_regexp=$enableval)
-AC_ARG_ENABLE(coprocesses, AC_HELP_STRING([--enable-coprocesses], [enable coprocess support and the coproc reserved word]), opt_coproc=$enableval)
-AC_ARG_ENABLE(debugger, AC_HELP_STRING([--enable-debugger], [enable support for bash debugger]), opt_debugger=$enableval)
-AC_ARG_ENABLE(direxpand-default, AC_HELP_STRING([--enable-direxpand-default], [enable the direxpand shell option by default]), opt_dircomplete_expand_default=$enableval)
-AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval)
-AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [allow disabled builtins to still be invoked]), opt_disabled_builtins=$enableval)
-AC_ARG_ENABLE(dparen-arithmetic, AC_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval)
-AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval)
-AC_ARG_ENABLE(extended-glob-default, AC_HELP_STRING([--enable-extended-glob-default], [force extended pattern matching to be enabled by default]), opt_extglob_default=$enableval)
-AC_ARG_ENABLE(help-builtin, AC_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval)
-AC_ARG_ENABLE(history, AC_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval)
-AC_ARG_ENABLE(job-control, AC_HELP_STRING([--enable-job-control], [enable job control features]), opt_job_control=$enableval)
-AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
-AC_ARG_ENABLE(net-redirections, AC_HELP_STRING([--enable-net-redirections], [enable /dev/tcp/host/port redirection]), opt_net_redirs=$enableval)
-AC_ARG_ENABLE(process-substitution, AC_HELP_STRING([--enable-process-substitution], [enable process substitution]), opt_process_subst=$enableval)
-AC_ARG_ENABLE(progcomp, AC_HELP_STRING([--enable-progcomp], [enable programmable completion and the complete builtin]), opt_progcomp=$enableval)
-AC_ARG_ENABLE(prompt-string-decoding, AC_HELP_STRING([--enable-prompt-string-decoding], [turn on escape character decoding in prompts]), opt_prompt_decoding=$enableval)
-AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [turn on command line editing]), opt_readline=$enableval)
-AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
-AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
-AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
-AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
-AC_ARG_ENABLE(strict-posix-default, AC_HELP_STRING([--enable-strict-posix-default], [configure bash to be posix-conformant by default]), opt_strict_posix=$enableval)
-AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval)
-AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval)
-
-dnl options that alter how bash is compiled and linked
-AC_ARG_ENABLE(mem-scramble, AC_HELP_STRING([--enable-mem-scramble], [scramble memory on calls to malloc and free]), opt_memscramble=$enableval)
-AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling], [allow profiling with gprof]), opt_profiling=$enableval)
-AC_ARG_ENABLE(static-link, AC_HELP_STRING([--enable-static-link], [link bash statically, for use as a root shell]), opt_static_link=$enableval)
-
-dnl So-called `precious' variables
-AC_ARG_VAR([CC_FOR_BUILD], [C compiler used when compiling binaries used only at build time])
-AC_ARG_VAR([CFLAGS_FOR_BUILD], [Compliation options (CFLAGS) used when compiling binaries used only at build time])
-AC_ARG_VAR([LDFLAGS_FOR_BUILD], [Linker options (LDFLAGS) used when compiling binaries used only at build time])
-AC_ARG_VAR([CPPFLAGS_FOR_BUILD], [C preprocessor options (CPPFLAGS) used when compiling binaries used only at build time])
-
-dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
-
-dnl opt_readline and opt_history are handled later, because AC_PROG_CC needs
-dnl to be run before we can check the version of an already-installed readline
-dnl library
-
-if test $opt_alias = yes; then
-AC_DEFINE(ALIAS)
-fi
-if test $opt_dirstack = yes; then
-AC_DEFINE(PUSHD_AND_POPD)
-fi
-if test $opt_restricted = yes; then
-AC_DEFINE(RESTRICTED_SHELL)
-fi
-if test $opt_process_subst = yes; then
-AC_DEFINE(PROCESS_SUBSTITUTION)
-fi
-if test $opt_prompt_decoding = yes; then
-AC_DEFINE(PROMPT_STRING_DECODE)
-fi
-if test $opt_select = yes; then
-AC_DEFINE(SELECT_COMMAND)
-fi
-if test $opt_help = yes; then
-AC_DEFINE(HELP_BUILTIN)
-fi
-if test $opt_array_variables = yes; then
-AC_DEFINE(ARRAY_VARS)
-fi
-if test $opt_dparen_arith = yes; then
-AC_DEFINE(DPAREN_ARITHMETIC)
-fi
-if test $opt_brace_expansion = yes; then
-AC_DEFINE(BRACE_EXPANSION)
-fi
-if test $opt_disabled_builtins = yes; then
-AC_DEFINE(DISABLED_BUILTINS)
-fi
-if test $opt_command_timing = yes; then
-AC_DEFINE(COMMAND_TIMING)
-fi
-if test $opt_xpg_echo = yes ; then
-AC_DEFINE(DEFAULT_ECHO_TO_XPG)
-fi
-if test $opt_strict_posix = yes; then
-AC_DEFINE(STRICT_POSIX)
-fi
-if test $opt_extended_glob = yes ; then
-AC_DEFINE(EXTENDED_GLOB)
-fi
-if test $opt_extglob_default = yes; then
-AC_DEFINE(EXTGLOB_DEFAULT, 1)
-else
-AC_DEFINE(EXTGLOB_DEFAULT, 0)
-fi
-if test $opt_cond_command = yes ; then
-AC_DEFINE(COND_COMMAND)
-fi
-if test $opt_cond_regexp = yes ; then
-AC_DEFINE(COND_REGEXP)
-fi
-if test $opt_coproc = yes; then
-AC_DEFINE(COPROCESS_SUPPORT)
-fi
-if test $opt_arith_for_command = yes; then
-AC_DEFINE(ARITH_FOR_COMMAND)
-fi
-if test $opt_net_redirs = yes; then
-AC_DEFINE(NETWORK_REDIRECTIONS)
-fi
-if test $opt_progcomp = yes; then
-AC_DEFINE(PROGRAMMABLE_COMPLETION)
-fi
-if test $opt_multibyte = no; then
-AC_DEFINE(NO_MULTIBYTE_SUPPORT)
-fi
-if test $opt_debugger = yes; then
-AC_DEFINE(DEBUGGER)
-fi
-if test $opt_casemod_attrs = yes; then
-AC_DEFINE(CASEMOD_ATTRS)
-fi
-if test $opt_casemod_expansions = yes; then
-AC_DEFINE(CASEMOD_EXPANSIONS)
-fi
-if test $opt_dircomplete_expand_default = yes; then
-AC_DEFINE(DIRCOMPLETE_EXPAND_DEFAULT)
-fi
-
-if test $opt_memscramble = yes; then
-AC_DEFINE(MEMSCRAMBLE)
-fi
-
-if test "$opt_minimal_config" = yes; then
- TESTSCRIPT=run-minimal
-else
- TESTSCRIPT=run-all
-fi
-
-HELPDIR= HELPDIRDEFINE= HELPINSTALL= HELPFILES_TARGET=
-if test "$opt_separate_help" != no; then
- if test "$opt_separate_help" = "yes" ; then
- HELPDIR='${datadir}/bash'
- else
- HELPDIR=$opt_separate_help
- fi
- HELPDIRDEFINE='-H ${HELPDIR}'
- HELPINSTALL='install-help'
- HELPFILES_TARGET='helpdoc'
-fi
-HELPSTRINGS=
-if test "$opt_single_longdoc_strings" != "yes"; then
- HELPSTRINGS='-S'
-fi
-
-dnl now substitute in the values generated by arguments
-AC_SUBST(TESTSCRIPT)
-AC_SUBST(PURIFY)
-AC_SUBST(MALLOC_TARGET)
-AC_SUBST(MALLOC_SRC)
-
-AC_SUBST(MALLOC_LIB)
-AC_SUBST(MALLOC_LIBRARY)
-AC_SUBST(MALLOC_LDFLAGS)
-AC_SUBST(MALLOC_DEP)
-
-AC_SUBST(htmldir)
-
-AC_SUBST(HELPDIR)
-AC_SUBST(HELPDIRDEFINE)
-AC_SUBST(HELPINSTALL)
-AC_SUBST(HELPFILES_TARGET)
-AC_SUBST(HELPSTRINGS)
-
-echo ""
-echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
-echo ""
-
-dnl compilation checks
-dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
-dnl different environment
-AC_PROG_CC
-
-dnl test for Unix variants
-AC_ISC_POSIX
-AC_MINIX
-
-AC_SYS_LARGEFILE
-
-dnl BEGIN changes for cross-building (currently cygwin, minGW, and
-dnl (obsolete) BeOS)
-
-SIGNAMES_O=
-SIGNAMES_H=lsignames.h
-
-dnl load up the cross-building cache file -- add more cases and cache
-dnl files as necessary
-
-dnl Note that host and target machine are the same, and different than the
-dnl build machine.
-dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
-
-CROSS_COMPILE=
-if test "x$cross_compiling" = "xyes"; then
- case "${host}" in
- *-cygwin*)
- cross_cache=${srcdir}/cross-build/cygwin32.cache
- ;;
- *-mingw*)
- cross_cache=${srcdir}/cross-build/cygwin32.cache
- ;;
- i[[3456]]86-*-beos*)
- cross_cache=${srcdir}/cross-build/x86-beos.cache
- ;;
- *) echo "configure: cross-compiling for $host is not supported" >&2
- ;;
- esac
- if test -n "${cross_cache}" && test -r "${cross_cache}"; then
- echo "loading cross-build cache file ${cross_cache}"
- . ${cross_cache}
- fi
- unset cross_cache
- SIGNAMES_O='signames.o'
- CROSS_COMPILE='-DCROSS_COMPILING'
- AC_SUBST(CROSS_COMPILE)
-fi
-AC_SUBST(SIGNAMES_H)
-AC_SUBST(SIGNAMES_O)
-
-dnl END changes for cross-building
-
-dnl We want these before the checks, so the checks can modify their values.
-if test -z "$CFLAGS"; then
- AUTO_CFLAGS="-g ${GCC+-O2}"
- AUTO_LDFLAGS="-g ${GCC+-O2}"
-else
- AUTO_CFLAGS= AUTO_LDFLAGS=
-fi
-
-dnl default values
-CFLAGS=${CFLAGS-"$AUTO_CFLAGS"}
-# LDFLAGS=${LDFLAGS="$AUTO_LDFLAGS"} # XXX
-
-dnl handle options that alter how bash is compiled and linked
-dnl these must come after the test for cc/gcc
-if test "$opt_profiling" = "yes"; then
- PROFILE_FLAGS=-pg
- case "$host_os" in
- solaris2*) ;;
- *) opt_static_link=yes ;;
- esac
- DEBUG= MALLOC_DEBUG=
-fi
-
-prefer_shared=yes
-prefer_static=no
-
-if test "$opt_static_link" = yes; then
- prefer_static=yes
- prefer_shared=no
- # if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
- if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
- STATIC_LD="-static"
- case "$host_os" in
- solaris2*) ;;
- *) LDFLAGS="$LDFLAGS -static" ;; # XXX experimental
- esac
- fi
-fi
-
-# set the appropriate make variables for building the "build tools"
-# modify defaults based on whether or not we are cross compiling, since the
-# options for the target host may not be appropriate for the build host
-if test "X$cross_compiling" = "Xno"; then
- CC_FOR_BUILD=${CC_FOR_BUILD-'$(CC)'}
- CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"$CPPFLAGS"} # XXX - should it be '$(CPPFLAGS)'
- LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(LDFLAGS)'}
- # CFLAGS set above to default value if not passed in environment
- CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
- LIBS_FOR_BUILD=${LIBS_FOR_BUILD-'$(LIBS)'}
-else
- CC_FOR_BUILD=${CC_FOR_BUILD-"gcc"}
- CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
- LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
- CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD="-g"}
- LIBS_FOR_BUILD=${LIBS_FOR_BUILD-""}
-fi
-
-AC_SUBST(CFLAGS)
-AC_SUBST(CPPFLAGS)
-AC_SUBST(LDFLAGS)
-AC_SUBST(STATIC_LD)
-
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-AC_SUBST(CPPFLAGS_FOR_BUILD)
-AC_SUBST(LDFLAGS_FOR_BUILD)
-AC_SUBST(LIBS_FOR_BUILD)
-
-AC_PROG_GCC_TRADITIONAL
-
-dnl BEGIN READLINE and HISTORY LIBRARY SECTION
-dnl prepare to allow bash to be linked against an already-installed readline
-
-dnl first test that the readline version is new enough to link bash against
-if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no"
-then
- # If the user specified --with-installed-readline=PREFIX and PREFIX
- # is not `yes', set ac_cv_rl_prefix to PREFIX
- test $opt_with_installed_readline != "yes" && ac_cv_rl_prefix=$opt_with_installed_readline
-
- RL_LIB_READLINE_VERSION
-
- case "$ac_cv_rl_version" in
- 5*|6*|7*|8*|9*) ;;
- *) opt_with_installed_readline=no
- AC_MSG_WARN([installed readline library is too old to be linked with bash])
- AC_MSG_WARN([using private bash version])
- ;;
- esac
-fi
-
-TILDE_LIB=-ltilde
-if test $opt_readline = yes; then
- AC_DEFINE(READLINE)
- if test "$opt_with_installed_readline" != "no" ; then
- case "$opt_with_installed_readline" in
- yes) RL_INCLUDE= ;;
- *) case "$RL_INCLUDEDIR" in
- /usr/include) ;;
- *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
- esac
- ;;
- esac
- READLINE_DEP=
- READLINE_LIB=-lreadline
- # section for OS versions that don't allow unresolved symbols
- # to be compiled into dynamic libraries.
- case "$host_os" in
- cygwin*) TILDE_LIB= ;;
- esac
- else
- RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
- READLINE_DEP='$(READLINE_LIBRARY)'
- # section for OS versions that ship an older/broken version of
- # readline as a standard dynamic library and don't allow a
- # static version specified as -llibname to override the
- # dynamic version
- case "${host_os}" in
- darwin[[89]]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;;
- *) READLINE_LIB=-lreadline ;;
- esac
- fi
-else
- RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
- READLINE_LIB= READLINE_DEP=
-fi
-if test $opt_history = yes || test $opt_bang_history = yes; then
- if test $opt_history = yes; then
- AC_DEFINE(HISTORY)
- fi
- if test $opt_bang_history = yes; then
- AC_DEFINE(BANG_HISTORY)
- fi
- if test "$opt_with_installed_readline" != "no"; then
- HIST_LIBDIR=$RL_LIBDIR
- HISTORY_DEP=
- HISTORY_LIB=-lhistory
- case "$opt_with_installed_readline" in
- yes) RL_INCLUDE= ;;
- *) case "$RL_INCLUDEDIR" in
- /usr/include) ;;
- *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
- esac
- ;;
- esac
- else
- HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
- HISTORY_DEP='$(HISTORY_LIBRARY)'
- # section for OS versions that ship an older version of
- # readline as a standard dynamic library and don't allow a
- # static version specified as -llibname to override the
- # dynamic version
- case "${host_os}" in
- darwin[[89]]*|darwin10*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
- *) HISTORY_LIB=-lhistory ;;
- esac
- fi
-else
- HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
- HISTORY_LIB= HISTORY_DEP=
-fi
-AC_SUBST(READLINE_LIB)
-AC_SUBST(READLINE_DEP)
-AC_SUBST(RL_LIBDIR)
-AC_SUBST(RL_INCLUDEDIR)
-AC_SUBST(RL_INCLUDE)
-AC_SUBST(HISTORY_LIB)
-AC_SUBST(HISTORY_DEP)
-AC_SUBST(HIST_LIBDIR)
-AC_SUBST(TILDE_LIB)
-
-dnl END READLINE and HISTORY LIBRARY SECTION
-
-dnl programs needed by the build and install process
-AC_PROG_INSTALL
-AC_CHECK_TOOL(AR, ar)
-dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
-dnl This allows people to set it when running configure or make
-test -n "$ARFLAGS" || ARFLAGS="cr"
-AC_PROG_RANLIB
-AC_PROG_YACC
-AC_PROG_MAKE_SET
-
-case "$host_os" in
-opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
-*) MAKE_SHELL=/bin/sh ;;
-esac
-AC_SUBST(MAKE_SHELL)
-
-dnl this is similar to the expanded AC_PROG_RANLIB
-if test x$SIZE = x; then
- if test x$ac_tool_prefix = x; then
- SIZE=size
- else
- SIZE=${ac_tool_prefix}size
- save_IFS=$IFS ; IFS=:
- size_found=0
- for dir in $PATH; do
- if test -x $dir/$SIZE ; then
- size_found=1
- break
- fi
- done
- if test $size_found -eq 0; then
- SIZE=:
- fi
- IFS=$save_IFS
- fi
-fi
-AC_SUBST(SIZE)
-
-m4_include([m4/stat-time.m4])
-m4_include([m4/timespec.m4])
-
-dnl Turn on any extensions available in the GNU C library.
-AC_DEFINE(_GNU_SOURCE, 1)
-
-dnl C compiler characteristics
-AC_C_CONST
-AC_C_INLINE
-AC_C_BIGENDIAN
-AC_C_STRINGIZE
-AC_C_LONG_DOUBLE
-AC_C_PROTOTYPES
-AC_C_CHAR_UNSIGNED
-AC_C_VOLATILE
-AC_C_RESTRICT
-
-dnl initialize GNU gettext
-AM_GNU_GETTEXT([no-libtool], [need-ngettext], [lib/intl])
-
-dnl header files
-AC_HEADER_DIRENT
-AC_HEADER_TIME
-
-BASH_HEADER_INTTYPES
-
-AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
- memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
- stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \
- regex.h syslog.h ulimit.h)
-AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h \
- sys/resource.h sys/param.h sys/socket.h sys/stat.h \
- sys/time.h sys/times.h sys/types.h sys/wait.h)
-AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
-
-dnl sys/ptem.h requires definitions from sys/stream.h on systems where it
-dnl exists
-AC_CHECK_HEADER(sys/ptem.h, , ,[[
-#if HAVE_SYS_STREAM_H
-# include <sys/stream.h>
-#endif
-]])
-
-dnl special checks for libc functions
-AC_FUNC_ALLOCA
-AC_FUNC_GETPGRP
-AC_FUNC_SETVBUF_REVERSED
-AC_FUNC_VPRINTF
-AC_FUNC_STRCOLL
-
-dnl if we're not using the bash malloc but require the C alloca, set things
-dnl up to build a libmalloc.a containing only alloca.o
-
-if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; then
- MALLOC_TARGET=alloca
- MALLOC_SRC=alloca.c
-
- MALLOC_LIB='-lmalloc'
- MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
- MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
- MALLOC_DEP='$(MALLOC_LIBRARY)'
-fi
-
-dnl if vprintf is not in libc, see if it's defined in stdio.h
-if test "$ac_cv_func_vprintf" = no; then
- AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
- AC_EGREP_HEADER([[int[ ]*vprintf[^a-zA-Z0-9]]],stdio.h,ac_cv_func_vprintf=yes)
- AC_MSG_RESULT($ac_cv_func_vprintf)
- if test $ac_cv_func_vprintf = yes; then
- AC_DEFINE(HAVE_VPRINTF)
- fi
-fi
-
-if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then
- AC_LIBOBJ(vprint)
-fi
-
-dnl signal stuff
-AC_TYPE_SIGNAL
-
-dnl checks for certain version-specific system calls and libc functions
-AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
-AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
-
-dnl checks for missing libc functions
-AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
-
-dnl checks for system calls
-AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \
- getpagesize getpeername getrlimit getrusage gettimeofday \
- kill killpg lstat readlink sbrk select setdtablesize \
- setitimer tcgetpgrp uname ulimit waitpid)
-AC_REPLACE_FUNCS(rename)
-
-dnl checks for c library functions
-AC_CHECK_FUNCS(bcopy bzero confstr faccessat fnmatch \
- getaddrinfo gethostbyname getservbyname getservent inet_aton \
- imaxdiv memmove pathconf putenv raise regcomp regexec \
- setenv setlinebuf setlocale setvbuf siginterrupt strchr \
- sysconf syslog tcgetattr times ttyname tzset unsetenv)
-
-AC_CHECK_FUNCS(vasprintf asprintf)
-AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
-AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
-AC_REPLACE_FUNCS(getcwd memset)
-AC_REPLACE_FUNCS(strcasecmp strcasestr strerror strftime strnlen strpbrk strstr)
-AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
-AC_REPLACE_FUNCS(dprintf)
-AC_REPLACE_FUNCS(strchrnul)
-
-AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
-
-AC_CHECK_DECLS([confstr])
-AC_CHECK_DECLS([printf])
-AC_CHECK_DECLS([sbrk])
-AC_CHECK_DECLS([setregid])
-AC_CHECK_DECLS([strcpy])
-AC_CHECK_DECLS([strsignal])
-
-dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3)
-AC_CHECK_DECLS([strtold], [
- AC_MSG_CHECKING([for broken strtold])
- AC_CACHE_VAL(bash_cv_strtold_broken,
- [AC_TRY_COMPILE(
- [#include <stdlib.h>],
- [int main() { long double r; char *foo, bar; r = strtold(foo, &bar);}],
- bash_cv_strtold_broken=no, bash_cv_strtold_broken=yes,
- [AC_MSG_WARN(cannot check for broken strtold if cross-compiling, defaulting to no)])
- ]
- )
- AC_MSG_RESULT($bash_cv_strtold_broken)
- if test "$bash_cv_strtold_broken" = "yes" ; then
- AC_DEFINE(STRTOLD_BROKEN)
- fi
-])
-
-BASH_CHECK_DECL(strtoimax)
-BASH_CHECK_DECL(strtol)
-BASH_CHECK_DECL(strtoll)
-BASH_CHECK_DECL(strtoul)
-BASH_CHECK_DECL(strtoull)
-BASH_CHECK_DECL(strtoumax)
-
-AC_FUNC_MKTIME
-
-dnl
-dnl Checks for lib/intl and related code (uses some of the output from
-dnl AM_GNU_GETTEXT)
-dnl
-
-AC_CHECK_HEADERS([argz.h errno.h fcntl.h malloc.h stdio_ext.h])
-
-dnl AC_FUNC_MALLOC
-AC_FUNC_MMAP
-AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify dcgettext mempcpy \
- munmap stpcpy strcspn strdup])
-
-INTL_DEP= INTL_INC= LIBINTL_H=
-if test "x$USE_INCLUDED_LIBINTL" = "xyes"; then
- INTL_DEP='${INTL_LIBDIR}/libintl.a'
- INTL_INC='-I${INTL_LIBSRC} -I${INTL_BUILDDIR}'
- LIBINTL_H='${INTL_BUILDDIR}/libintl.h'
-fi
-AC_SUBST(INTL_DEP)
-AC_SUBST(INTL_INC)
-AC_SUBST(LIBINTL_H)
-
-dnl
-dnl End of checks needed by files in lib/intl
-dnl
-
-BASH_CHECK_MULTIBYTE
-
-dnl checks for the dynamic loading library functions in libc and libdl
-if test "$opt_static_link" != yes; then
-AC_CHECK_LIB(dl, dlopen)
-AC_CHECK_FUNCS(dlopen dlclose dlsym)
-fi
-
-dnl this defines HAVE_DECL_SYS_SIGLIST
-AC_DECL_SYS_SIGLIST
-
-dnl network functions -- check for inet_aton again
-if test "$ac_cv_func_inet_aton" != 'yes'; then
-BASH_FUNC_INET_ATON
-fi
-
-dnl libraries
-dnl this is reportedly no longer necessary for irix[56].?
-case "$host_os" in
-irix4*) AC_CHECK_LIB(sun, getpwent) ;;
-esac
-
-dnl check for getpeername in the socket library only if it's not in libc
-if test "$ac_cv_func_getpeername" = no; then
- BASH_CHECK_LIB_SOCKET
-fi
-dnl check for gethostbyname in socket libraries if it's not in libc
-if test "$ac_cv_func_gethostbyname" = no; then
- BASH_FUNC_GETHOSTBYNAME
-fi
-
-dnl system types
-AC_TYPE_GETGROUPS
-AC_TYPE_OFF_T
-AC_TYPE_MODE_T
-AC_TYPE_UID_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_CHECK_TYPE(ssize_t, int)
-AC_CHECK_TYPE(time_t, long)
-
-BASH_TYPE_LONG_LONG
-BASH_TYPE_UNSIGNED_LONG_LONG
-
-AC_TYPE_SIGNAL
-BASH_TYPE_SIG_ATOMIC_T
-
-AC_CHECK_SIZEOF(char, 1)
-AC_CHECK_SIZEOF(short, 2)
-AC_CHECK_SIZEOF(int, 4)
-AC_CHECK_SIZEOF(long, 4)
-AC_CHECK_SIZEOF(char *, 4)
-AC_CHECK_SIZEOF(double, 8)
-AC_CHECK_SIZEOF([long long], 8)
-
-AC_CHECK_TYPE(u_int, [unsigned int])
-AC_CHECK_TYPE(u_long, [unsigned long])
-
-BASH_TYPE_BITS16_T
-BASH_TYPE_U_BITS16_T
-BASH_TYPE_BITS32_T
-BASH_TYPE_U_BITS32_T
-BASH_TYPE_BITS64_T
-
-BASH_TYPE_PTRDIFF_T
-
-dnl structures
-AC_HEADER_STAT
-
-dnl system services
-AC_SYS_INTERPRETER
-if test $ac_cv_sys_interpreter = yes; then
-AC_DEFINE(HAVE_HASH_BANG_EXEC)
-fi
-
-dnl Miscellaneous Bash tests
-if test "$ac_cv_func_lstat" = "no"; then
-BASH_FUNC_LSTAT
-fi
-
-dnl behavior of system calls and library functions
-BASH_FUNC_CTYPE_NONASCII
-BASH_FUNC_DUP2_CLOEXEC_CHECK
-BASH_SYS_PGRP_SYNC
-BASH_SYS_SIGNAL_VINTAGE
-
-dnl checking for the presence of certain library symbols
-BASH_SYS_ERRLIST
-BASH_SYS_SIGLIST
-BASH_UNDER_SYS_SIGLIST
-
-dnl various system types
-BASH_TYPE_SIGHANDLER
-BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
-BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
-BASH_CHECK_TYPE(sig_atomic_t, [#include <signal.h>], int)
-BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
-BASH_CHECK_TYPE(intmax_t, , $bash_cv_type_long_long)
-BASH_CHECK_TYPE(uintmax_t, , $bash_cv_type_unsigned_long_long)
-if test "$ac_cv_header_sys_socket_h" = "yes"; then
-BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], [unsigned int], HAVE_SOCKLEN_T)
-fi
-BASH_TYPE_RLIMIT
-
-AC_CHECK_SIZEOF(intmax_t, 8)
-
-dnl presence and contents of structures used by system calls
-BASH_STRUCT_TERMIOS_LDISC
-BASH_STRUCT_TERMIO_LDISC
-BASH_STRUCT_DIRENT_D_INO
-BASH_STRUCT_DIRENT_D_FILENO
-BASH_STRUCT_DIRENT_D_NAMLEN
-BASH_STRUCT_WINSIZE
-BASH_STRUCT_TIMEVAL
-AC_CHECK_MEMBERS([struct stat.st_blocks])
-AC_STRUCT_TM
-AC_STRUCT_TIMEZONE
-BASH_STRUCT_TIMEZONE
-
-BASH_STRUCT_WEXITSTATUS_OFFSET
-
-BASH_CHECK_TYPE_STRUCT_TIMESPEC
-BASH_STAT_TIME
-
-dnl presence and behavior of C library functions
-BASH_FUNC_STRSIGNAL
-BASH_FUNC_OPENDIR_CHECK
-BASH_FUNC_ULIMIT_MAXFDS
-BASH_FUNC_FPURGE
-BASH_FUNC_GETENV
-if test "$ac_cv_func_getcwd" = "yes"; then
-BASH_FUNC_GETCWD
-fi
-BASH_FUNC_POSIX_SETJMP
-BASH_FUNC_STRCOLL
-BASH_FUNC_SNPRINTF
-BASH_FUNC_VSNPRINTF
-
-dnl If putenv or unsetenv is not present, set the right define so the
-dnl prototype and declaration in lib/sh/getenv.c will be standard-conformant
-
-if test "$ac_cv_func_putenv" = "yes"; then
-BASH_FUNC_STD_PUTENV
-else
-AC_DEFINE(HAVE_STD_PUTENV)
-fi
-if test "$ac_cv_func_unsetenv" = "yes"; then
-BASH_FUNC_STD_UNSETENV
-else
-AC_DEFINE(HAVE_STD_UNSETENV)
-fi
-
-BASH_FUNC_PRINTF_A_FORMAT
-
-dnl presence and behavior of OS functions
-BASH_SYS_REINSTALL_SIGHANDLERS
-BASH_SYS_JOB_CONTROL_MISSING
-BASH_SYS_NAMED_PIPES
-
-dnl presence of certain CPP defines
-AC_HEADER_TIOCGWINSZ
-BASH_HAVE_TIOCSTAT
-BASH_HAVE_FIONREAD
-
-BASH_CHECK_WCONTINUED
-
-dnl miscellaneous
-BASH_CHECK_SPEED_T
-BASH_CHECK_GETPW_FUNCS
-BASH_CHECK_RTSIGS
-BASH_CHECK_SYS_SIGLIST
-
-dnl special checks
-case "$host_os" in
-hpux*) BASH_CHECK_KERNEL_RLIMIT ;;
-esac
-
-if test "$opt_readline" = yes; then
-dnl yuck
-case "$host_os" in
-aix*) prefer_curses=yes ;;
-esac
-BASH_CHECK_LIB_TERMCAP
-fi
-AC_SUBST(TERMCAP_LIB)
-AC_SUBST(TERMCAP_DEP)
-
-BASH_CHECK_DEV_FD
-BASH_CHECK_DEV_STDIN
-BASH_SYS_DEFAULT_MAIL_DIR
-
-if test "$bash_cv_job_control_missing" = missing; then
- opt_job_control=no
-fi
-
-if test "$opt_job_control" = yes; then
-AC_DEFINE(JOB_CONTROL)
-JOBS_O=jobs.o
-else
-JOBS_O=nojobs.o
-fi
-
-AC_SUBST(JOBS_O)
-
-dnl Defines that we want to propagate to the Makefiles in subdirectories,
-dnl like glob and readline
-
-LOCAL_DEFS=-DSHELL
-
-dnl use this section to possibly define more cpp variables, specify local
-dnl libraries, and specify any additional local cc or ld flags
-dnl
-dnl this should really go away someday
-
-case "${host_os}" in
-sysv4.2*) AC_DEFINE(SVR4_2)
- AC_DEFINE(SVR4) ;;
-sysv4*) AC_DEFINE(SVR4) ;;
-sysv5*) AC_DEFINE(SVR5) ;;
-hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
-hpux*) LOCAL_CFLAGS=-DHPUX ;;
-dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
-isc*) LOCAL_CFLAGS=-Disc386 ;;
-rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
-darwin*) LOCAL_CFLAGS=-DMACOSX ;;
-sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
-sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
-sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
-sunos4*) LOCAL_CFLAGS=-DSunOS4 ;;
-solaris2.5*) LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;;
-solaris2.8*) LOCAL_CFLAGS=-DSOLARIS ;;
-solaris2.9*) LOCAL_CFLAGS=-DSOLARIS ;;
-solaris2.10*) LOCAL_CFLAGS=-DSOLARIS ;;
-solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
-lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
-linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
- case "`uname -r`" in
- 2.[[456789]]*|3*) AC_DEFINE(PGRP_PIPE) ;;
- esac ;;
-*qnx6*) LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
-*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
-powerux*) LOCAL_LIBS="-lgen" ;;
-cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
-opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE -DRECYCLES_PIDS" ;;
-*openstep*) LOCAL_CFLAGS="-D__APPLE_CC__" ;;
-esac
-
-dnl Stanza for OS/compiler pair-specific flags
-case "${host_os}-${CC}" in
-aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
-aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
-bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
-esac
-
-dnl FreeBSD-3.x can have either a.out or ELF
-case "${host_os}" in
-freebsd[[3-9]]*)
- if test -x /usr/bin/objformat && test "`/usr/bin/objformat`" = "elf" ; then
- LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
- fi ;;
-freebsdelf*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
-dragonfly*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
-esac
-
-case "$host_cpu" in
-*cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
-esac
-
-case "$host_cpu-$host_os" in
-ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
-esac
-
-case "$host_cpu-$host_vendor-$host_os" in
-m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
-mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
-esac
-
-#
-# Shared object configuration section. These values are generated by
-# ${srcdir}/support/shobj-conf
-#
-if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
-then
- AC_MSG_CHECKING(shared object configuration for loadable builtins)
- eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"`
- AC_SUBST(SHOBJ_CC)
- AC_SUBST(SHOBJ_CFLAGS)
- AC_SUBST(SHOBJ_LD)
- AC_SUBST(SHOBJ_LDFLAGS)
- AC_SUBST(SHOBJ_XLDFLAGS)
- AC_SUBST(SHOBJ_LIBS)
- AC_SUBST(SHOBJ_STATUS)
- AC_MSG_RESULT($SHOBJ_STATUS)
-fi
-
-# try to create a directory tree if the source is elsewhere
-# this should be packaged into a script accessible via ${srcdir}/support
-case "$srcdir" in
-.) ;;
-*) for d in doc tests support lib examples; do # dirs
- test -d $d || mkdir $d
- done
- for ld in readline glob tilde malloc sh termcap; do # libdirs
- test -d lib/$ld || mkdir lib/$ld
- done
- test -d examples/loadables || mkdir examples/loadables # loadable builtins
- test -d examples/loadables/perl || mkdir examples/loadables/perl
- ;;
-esac
-
-BUILD_DIR=`pwd`
-case "$BUILD_DIR" in
-*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
-*) ;;
-esac
-
-if test -z "$localedir"; then
- localedir='${datarootdir}/locale'
-fi
-if test -z "$datarootdir"; then
- datarootdir='${prefix}/share'
-fi
-
-AC_SUBST(PROFILE_FLAGS)
-
-AC_SUBST(incdir)
-AC_SUBST(BUILD_DIR)
-
-# Some versions of autoconf don't substitute these automatically
-AC_SUBST(datarootdir)
-AC_SUBST(localedir)
-
-AC_SUBST(YACC)
-AC_SUBST(AR)
-AC_SUBST(ARFLAGS)
-
-AC_SUBST(BASHVERS)
-AC_SUBST(RELSTATUS)
-AC_SUBST(DEBUG)
-AC_SUBST(MALLOC_DEBUG)
-
-AC_SUBST(host_cpu)
-AC_SUBST(host_vendor)
-AC_SUBST(host_os)
-
-AC_SUBST(LOCAL_LIBS)
-AC_SUBST(LOCAL_CFLAGS)
-AC_SUBST(LOCAL_LDFLAGS)
-AC_SUBST(LOCAL_DEFS)
-
-#AC_SUBST(ALLOCA_SOURCE)
-#AC_SUBST(ALLOCA_OBJECT)
-
-AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
- lib/intl/Makefile \
- lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
- lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in \
- examples/loadables/Makefile examples/loadables/perl/Makefile],
-[
-# Makefile uses this timestamp file to record whether config.h is up to date.
-echo timestamp > stamp-h
-])
+++ /dev/null
-# This file is a shell script that caches the results of configure
-# tests for CYGWIN32 so they don't need to be done when cross-compiling.
-
-# AC_FUNC_GETPGRP should also define GETPGRP_VOID
-ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void='yes'}
-# AC_FUNC_SETVBUF_REVERSED should not define anything else
-ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed='no'}
-# on CYGWIN32, system calls do not restart
-ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}
-bash_cv_sys_restartable_syscalls=${bash_cv_sys_restartable_syscalls='no'}
-
-# these may be necessary, but they are currently commented out
-#ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
-ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p='4'}
-ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
-ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
-ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
-
-bash_cv_dup2_broken=${bash_cv_dup2_broken='no'}
-bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe='no'}
-bash_cv_type_rlimit=${bash_cv_type_rlimit='long'}
-bash_cv_decl_under_sys_siglist=${bash_cv_decl_under_sys_siglist='no'}
-bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist='no'}
-bash_cv_sys_siglist=${bash_cv_sys_siglist='no'}
-bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust='no'}
-bash_cv_getenv_redef=${bash_cv_getenv_redef='yes'}
-bash_cv_printf_declared=${bash_cv_printf_declared='yes'}
-bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds='no'}
-bash_cv_getcwd_calls_popen=${bash_cv_getcwd_calls_popen='no'}
-bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers='no'}
-bash_cv_job_control_missing=${bash_cv_job_control_missing='present'}
-bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes='missing'}
-bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp='missing'}
-bash_cv_mail_dir=${bash_cv_mail_dir='unknown'}
-bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken='no'}
-
-bash_cv_type_int32_t=${bash_cv_type_int32_t='int'}
-bash_cv_type_u_int32_t=${bash_cv_type_u_int32_t='int'}
-
-ac_cv_type_bits64_t=${ac_cv_type_bits64_t='no'}
-
-# end of cross-build/cygwin32.cache
+++ /dev/null
-This is the Bash FAQ, version 3.24, for Bash version 2.05b.
-
-This document contains a set of frequently-asked questions concerning
-Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
-interpreter with advanced features for both interactive use and shell
-programming.
-
-Another good source of basic information about shells is the collection
-of FAQ articles periodically posted to comp.unix.shell.
-
-Questions and comments concerning this document should be sent to
-chet@po.cwru.edu.
-
-This document is available for anonymous FTP with the URL
-
-ftp://ftp.cwru.edu/pub/bash/FAQ
-
-The Bash home page is http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html
-
-----------
-Contents:
-
-Section A: The Basics
-
-A1) What is it?
-A2) What's the latest version?
-A3) Where can I get it?
-A4) On what machines will bash run?
-A5) Will bash run on operating systems other than Unix?
-A6) How can I build bash with gcc?
-A7) How can I make bash my login shell?
-A8) I just changed my login shell to bash, and now I can't FTP into my
- machine. Why not?
-A9) What's the `POSIX 1003.2 standard'?
-A10) What is the bash `posix mode'?
-
-Section B: The latest version
-
-B1) What's new in version 2.05b?
-B2) Are there any user-visible incompatibilities between bash-2.05b and
- bash-1.14.7?
-
-Section C: Differences from other Unix shells
-
-C1) How does bash differ from sh, the Bourne shell?
-C2) How does bash differ from the Korn shell, version ksh88?
-C3) Which new features in ksh-93 are not in bash, and which are?
-
-Section D: Why does bash do some things differently than other Unix shells?
-
-D1) Why does bash run a different version of `command' than
- `which command' says it will?
-D2) Why doesn't bash treat brace expansions exactly like csh?
-D3) Why doesn't bash have csh variable modifiers?
-D4) How can I make my csh aliases work when I convert to bash?
-D5) How can I pipe standard output and standard error from one command to
- another, like csh does with `|&'?
-D6) Now that I've converted from ksh to bash, are there equivalents to
- ksh features like autoloaded functions and the `whence' command?
-
-Section E: Why does bash do certain things the way it does?
-
-E1) Why is the bash builtin `test' slightly different from /bin/test?
-E2) Why does bash sometimes say `Broken pipe'?
-E3) When I have terminal escape sequences in my prompt, why does bash
- wrap lines at the wrong column?
-E4) If I pipe the output of a command into `read variable', why doesn't
- the output show up in $variable when the read command finishes?
-E5) I have a bunch of shell scripts that use backslash-escaped characters
- in arguments to `echo'. Bash doesn't interpret these characters. Why
- not, and how can I make it understand them?
-E6) Why doesn't a while or for loop get suspended when I type ^Z?
-E7) What about empty for loops in Makefiles?
-E8) Why does the arithmetic evaluation code complain about `08'?
-E9) Why does the pattern matching expression [A-Z]* match files beginning
- with every letter except `z'?
-E10) Why does `cd //' leave $PWD as `//'?
-E11) If I resize my xterm while another program is running, why doesn't bash
- notice the change?
-
-Section F: Things to watch out for on certain Unix versions
-
-F1) Why can't I use command line editing in my `cmdtool'?
-F2) I built bash on Solaris 2. Why do globbing expansions and filename
- completion chop off the first few characters of each filename?
-F3) Why does bash dump core after I interrupt username completion or
- `~user' tilde expansion on a machine running NIS?
-F4) I'm running SVR4.2. Why is the line erased every time I type `@'?
-F5) Why does bash report syntax errors when my C News scripts use a
- redirection before a subshell command?
-F6) Why can't I use vi-mode editing on Red Hat Linux 6.1?
-F7) Why do bash-2.05a and bash-2.05b fail to compile `printf.def' on
- HP/UX 11.x?
-
-Section G: How can I get bash to do certain common things?
-
-G1) How can I get bash to read and display eight-bit characters?
-G2) How do I write a function `x' to replace builtin command `x', but
- still invoke the command from within the function?
-G3) How can I find the value of a shell variable whose name is the value
- of another shell variable?
-G4) How can I make the bash `time' reserved word print timing output that
- looks like the output from my system's /usr/bin/time?
-G5) How do I get the current directory into my prompt?
-G6) How can I rename "*.foo" to "*.bar"?
-G7) How can I translate a filename from uppercase to lowercase?
-G8) How can I write a filename expansion (globbing) pattern that will match
- all files in the current directory except "." and ".."?
-
-Section H: Where do I go from here?
-
-H1) How do I report bugs in bash, and where should I look for fixes and
- advice?
-H2) What kind of bash documentation is there?
-H3) What's coming in future versions?
-H4) What's on the bash `wish list'?
-H5) When will the next release appear?
-
-----------
-Section A: The Basics
-
-A1) What is it?
-
-Bash is a Unix command interpreter (shell). It is an implementation of
-the Posix 1003.2 shell standard, and resembles the Korn and System V
-shells.
-
-Bash contains a number of enhancements over those shells, both
-for interactive use and shell programming. Features geared
-toward interactive use include command line editing, command
-history, job control, aliases, and prompt expansion. Programming
-features include additional variable expansions, shell
-arithmetic, and a number of variables and options to control
-shell behavior.
-
-Bash was originally written by Brian Fox of the Free Software
-Foundation. The current developer and maintainer is Chet Ramey
-of Case Western Reserve University.
-
-A2) What's the latest version?
-
-The latest version is 2.05b, first made available on Wednesday, 17
-July, 2002.
-
-A3) Where can I get it?
-
-Bash is the GNU project's shell, and so is available from the
-master GNU archive site, ftp.gnu.org, and its mirrors. The
-latest version is also available for FTP from ftp.cwru.edu.
-The following URLs tell how to get version 2.05b:
-
-ftp://ftp.gnu.org/pub/gnu/bash/bash-2.05b.tar.gz
-ftp://ftp.cwru.edu/pub/bash/bash-2.05b.tar.gz
-
-Formatted versions of the documentation are available with the URLs:
-
-ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-2.05b.tar.gz
-ftp://ftp.cwru.edu/pub/bash/bash-doc-2.05b.tar.gz
-
-A4) On what machines will bash run?
-
-Bash has been ported to nearly every version of UNIX. All you
-should have to do to build it on a machine for which a port
-exists is to type `configure' and then `make'. The build process
-will attempt to discover the version of UNIX you have and tailor
-itself accordingly, using a script created by GNU autoconf.
-
-More information appears in the file `INSTALL' in the distribution.
-
-The Bash web page (http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html)
-explains how to obtain binary versions of bash for most of the major
-commercial Unix systems.
-
-A5) Will bash run on operating systems other than Unix?
-
-Configuration specifics for Unix-like systems such as QNX and
-LynxOS are included in the distribution. Bash-2.05 and later
-versions should compile and run on Minix 2.0 (patches were
-contributed), but I don't believe anyone has built bash-2.x on
-earlier Minix versions yet.
-
-Bash has been ported to versions of Windows implementing the Win32
-programming interface. This includes Windows 95 and Windows NT.
-The port was done by Cygnus Solutions as part of their CYGWIN
-project. For more information about the project, look at the URLs
-
-http://www.cygwin.com/
-http://sourceware.cygnus.com/cygwin
-
-Cygnus originally ported bash-1.14.7, and that port was part of their
-early GNU-Win32 (the original name) releases. Cygnus has also done a
-port of bash-2.05 to the CYGWIN environment, and it is available as
-part of their current release.
-
-Bash-2.05b should require no local Cygnus changes to build and run under
-CYGWIN.
-
-The Cygnus port works only on Intel machines. There is a port of bash
-(I don't know which version) to the alpha/NT environment available from
-
-ftp://ftp.gnustep.org//pub/win32/bash-alpha-nt-1.01.tar.gz
-
-DJ Delorie has a port of bash-2.x which runs under MS-DOS, as part
-of the DJGPP project. For more information on the project, see
-
-http://www.delorie.com/djgpp/
-
-I have been told that the original DJGPP port was done by Daisuke Aoyama.
-
-Mark Elbrecht <snowball3@bigfoot.com> has sent me notice that bash-2.04
-is available for DJGPP V2. The files are available as:
-
-ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204b.zip binary
-ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204d.zip documentation
-ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204s.zip source
-
-Mark has begun to work with bash-2.05, but I don't know the status.
-
-Ports of bash-1.12 and bash-2.0 are available for OS/2 from
-
-ftp://hobbes.nmsu.edu/pub/os2/util/shell/bash_112.zip
-ftp://hobbes.nmsu.edu/pub/os2/util/shell/bash-2.0(253).zip
-
-I haven't looked at either, but the second appears to be a binary-only
-distribution. Beware.
-
-I have received word that Bash (I'm not sure which version, but I
-believe that it's at least bash-2.02.1) is the standard shell on
-BeOS.
-
-A6) How can I build bash with gcc?
-
-Bash configures to use gcc by default if it is available. Read the
-file INSTALL in the distribution for more information.
-
-A7) How can I make bash my login shell?
-
-Some machines let you use `chsh' to change your login shell. Other
-systems use `passwd -s' or `passwd -e'. If one of these works for
-you, that's all you need. Note that many systems require the full
-pathname to a shell to appear in /etc/shells before you can make it
-your login shell. For this, you may need the assistance of your
-friendly local system administrator.
-
-If you cannot do this, you can still use bash as your login shell, but
-you need to perform some tricks. The basic idea is to add a command
-to your login shell's startup file to replace your login shell with
-bash.
-
-For example, if your login shell is csh or tcsh, and you have installed
-bash in /usr/gnu/bin/bash, add the following line to ~/.login:
-
- if ( -f /usr/gnu/bin/bash ) exec /usr/gnu/bin/bash --login
-
-(the `--login' tells bash that it is a login shell).
-
-It's not a good idea to put this command into ~/.cshrc, because every
-csh you run without the `-f' option, even ones started to run csh scripts,
-reads that file. If you must put the command in ~/.cshrc, use something
-like
-
- if ( $?prompt ) exec /usr/gnu/bin/bash --login
-
-to ensure that bash is exec'd only when the csh is interactive.
-
-If your login shell is sh or ksh, you have to do two things.
-
-First, create an empty file in your home directory named `.bash_profile'.
-The existence of this file will prevent the exec'd bash from trying to
-read ~/.profile, and re-execing itself over and over again. ~/.bash_profile
-is the first file bash tries to read initialization commands from when
-it is invoked as a login shell.
-
-Next, add a line similar to the above to ~/.profile:
-
- [ -f /usr/gnu/bin/bash ] && [ -x /usr/gnu/bin/bash ] && \
- exec /usr/gnu/bin/bash --login
-
-This will cause login shells to replace themselves with bash running as
-a login shell. Once you have this working, you can copy your initialization
-code from ~/.profile to ~/.bash_profile.
-
-I have received word that the recipe supplied above is insufficient for
-machines running CDE. CDE has a maze of twisty little startup files, all
-slightly different.
-
-If you cannot change your login shell in the password file to bash, you
-will have to (apparently) live with CDE using the shell in the password
-file to run its startup scripts. If you have changed your shell to bash,
-there is code in the CDE startup files (on Solaris, at least) that attempts
-to do the right thing. It is, however, often broken, and may require that
-you use the $BASH_ENV trick described below.
-
-`dtterm' claims to use $SHELL as the default program to start, so if you
-can change $SHELL in the CDE startup files, you should be able to use bash
-in your terminal windows.
-
-Setting DTSOURCEPROFILE in ~/.dtprofile will cause the `Xsession' program
-to read your login shell's startup files. You may be able to use bash for
-the rest of the CDE programs by setting SHELL to bash in ~/.dtprofile as
-well, but I have not tried this.
-
-You can use the above `exec' recipe to start bash when not logging in with
-CDE by testing the value of the DT variable:
-
- if [ -n "$DT" ]; then
- [ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login
- fi
-
-If CDE starts its shells non-interactively during login, the login shell
-startup files (~/.profile, ~/.bash_profile) will not be sourced at login.
-To get around this problem, append a line similar to the following to your
-~/.dtprofile:
-
- BASH_ENV=${HOME}/.bash_profile ; export BASH_ENV
-
-and add the following line to the beginning of ~/.bash_profile:
-
- unset BASH_ENV
-
-A8) I just changed my login shell to bash, and now I can't FTP into my
- machine. Why not?
-
-You must add the full pathname to bash to the file /etc/shells. As
-noted in the answer to the previous question, many systems require
-this before you can make bash your login shell.
-
-Most versions of ftpd use this file to prohibit `special' users
-such as `uucp' and `news' from using FTP.
-
-A9) What's the `POSIX 1003.2 standard'?
-
-POSIX is a name originally coined by Richard Stallman for a
-family of open system standards based on UNIX. There are a
-number of aspects of UNIX under consideration for
-standardization, from the basic system services at the system
-call and C library level to applications and tools to system
-administration and management. Each area of standardization is
-assigned to a working group in the 1003 series.
-
-The POSIX Shell and Utilities standard has been developed by IEEE
-Working Group 1003.2 (POSIX.2). It concentrates on the command
-interpreter interface and utility programs commonly executed from
-the command line or by other programs. An initial version of the
-standard has been approved and published by the IEEE, and work is
-currently underway to update it.
-
-Bash is concerned with the aspects of the shell's behavior
-defined by POSIX.2. The shell command language has of course
-been standardized, including the basic flow control and program
-execution constructs, I/O redirection and pipelining, argument
-handling, variable expansion, and quoting.
-
-The `special' builtins, which must be implemented as part of the
-shell to provide the desired functionality, are specified as
-being part of the shell; examples of these are `eval' and
-`export'. Other utilities appear in the sections of POSIX.2 not
-devoted to the shell which are commonly (and in some cases must
-be) implemented as builtin commands, such as `read' and `test'.
-POSIX.2 also specifies aspects of the shell's interactive
-behavior as part of the UPE, including job control and command
-line editing. Only vi-style line editing commands have been
-standardized; emacs editing commands were left out due to
-objections.
-
-The Open Group has made an older version of its Single Unix
-Specification (version 2), which is very similar to POSIX.2,
-available on the web at
-
-http://www.opengroup.org/onlinepubs/007908799/
-
-The Single Unix Specification, version 3, is available on the web at
-
-http://www.opengroup.org/onlinepubs/007904975/
-
-A10) What is the bash `posix mode'?
-
-Although bash is an implementation of the POSIX.2 shell
-specification, there are areas where the bash default behavior
-differs from that spec. The bash `posix mode' changes the bash
-behavior in these areas so that it obeys the spec more closely.
-
-Posix mode is entered by starting bash with the --posix or
-'-o posix' option or executing `set -o posix' after bash is running.
-
-The specific aspects of bash which change when posix mode is
-active are listed in the file POSIX in the bash distribution.
-They are also listed in a section in the Bash Reference Manual
-(from which that file is generated).
-
-Section B: The latest version
-
-B1) What's new in version 2.05b?
-
-The raison d'etre for bash-2.05b is to make a second intermediate
-release containing the first of the new features to be available
-in bash-3.0 and get feedback on those features before proceeding.
-The major new feature is multibyte character support in both Bash
-and Readline.
-
-Bash-2.05b contains the following new features (see the manual page for
-complete descriptions and the CHANGES and NEWS files in the bash-2.05b
-distribution):
-
-o support for multibyte characters has been added to both bash and readline
-
-o the DEBUG trap is now run *before* simple commands, ((...)) commands,
- [[...]] conditional commands, and for ((...)) loops
-
-o the shell now performs arithmetic in the largest integer size the machine
- supports (intmax_t)
-
-o there is a new \D{...} prompt expansion; passes the `...' to strftime(3)
- and inserts the result into the expanded prompt
-
-o there is a new `here-string' redirection operator: <<< word
-
-o when displaying variables, function attributes and definitions are shown
- separately, allowing them to be re-used as input (attempting to re-use
- the old output would result in syntax errors).
-
-o `read' has a new `-u fd' option to read from a specified file descriptor
-
-o the bash debugger in examples/bashdb has been modified to work with the
- new DEBUG trap semantics, the command set has been made more gdb-like,
- and the changes to $LINENO make debugging functions work better
-
-o the expansion of $LINENO inside a shell function is only relative to the
- function start if the shell is interactive -- if the shell is running a
- script, $LINENO expands to the line number in the script. This is as
- POSIX-2001 requires
-
-
-A short feature history dating from Bash-2.0:
-
-Bash-2.05a introduced the following new features:
-
-o The `printf' builtin has undergone major work
-
-o There is a new read-only `shopt' option: login_shell, which is set by
- login shells and unset otherwise
-
-o New `\A' prompt string escape sequence; expanding to time in 24-hour
- HH:MM format
-
-o New `-A group/-g' option to complete and compgen; goes group name
- completion
-
-o New [+-]O invocation option to set and unset `shopt' options at startup
-
-o ksh-like `ERR' trap
-
-o `for' loops now allow empty word lists after the `in' reserved word
-
-o new `hard' and `soft' arguments for the `ulimit' builtin
-
-o Readline can be configured to place the user at the same point on the line
- when retrieving commands from the history list
-
-o Readline can be configured to skip `hidden' files (filenames with a leading
- `.' on Unix) when performing completion
-
-Bash-2.05 introduced the following new features:
-
-o This version has once again reverted to using locales and strcoll(3) when
- processing pattern matching bracket expressions, as POSIX requires.
-o Added a new `--init-file' invocation argument as a synonym for `--rcfile',
- per the new GNU coding standards.
-o The /dev/tcp and /dev/udp redirections now accept service names as well as
- port numbers.
-o `complete' and `compgen' now take a `-o value' option, which controls some
- of the aspects of that compspec. Valid values are:
-
- default - perform bash default completion if programmable
- completion produces no matches
- dirnames - perform directory name completion if programmable
- completion produces no matches
- filenames - tell readline that the compspec produces filenames,
- so it can do things like append slashes to
- directory names and suppress trailing spaces
-o A new loadable builtin, realpath, which canonicalizes and expands symlinks
- in pathname arguments.
-o When `set' is called without options, it prints function defintions 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.
-
-Bash-2.04 introduced the following new features:
-
-o Programmable word completion with the new `complete' and `compgen' builtins;
- examples are provided in examples/complete/complete-examples
-o `history' has a new `-d' option to delete a history entry
-o `bind' has a new `-x' option to bind key sequences to shell commands
-o The prompt expansion code has new `\j' and `\l' escape sequences
-o The `no_empty_cmd_completion' shell option, if enabled, inhibits
- command completion when TAB is typed on an empty line
-o `help' has a new `-s' option to print a usage synopsis
-o New arithmetic operators: var++, var--, ++var, --var, expr1,expr2 (comma)
-o New ksh93-style arithmetic for command:
- for ((expr1 ; expr2; expr3 )); do list; done
-o `read' has new options: `-t', `-n', `-d', `-s'
-o The redirection code handles several filenames specially: /dev/fd/N,
- /dev/stdin, /dev/stdout, /dev/stderr
-o The redirection code now recognizes /dev/tcp/HOST/PORT and
- /dev/udp/HOST/PORT and tries to open a TCP or UDP socket, respectively,
- to the specified port on the specified host
-o The ${!prefix*} expansion has been implemented
-o A new FUNCNAME variable, which expands to the name of a currently-executing
- function
-o The GROUPS variable is no longer readonly
-o A new shopt `xpg_echo' variable, to control the behavior of echo with
- respect to backslash-escape sequences at runtime
-o The NON_INTERACTIVE_LOGIN_SHELLS #define has returned
-
-The version of Readline released with Bash-2.04, Readline-4.1, had several
-new features as well:
-
-o Parentheses matching is always compiled into readline, and controllable
- with the new `blink-matching-paren' variable
-o The history-search-forward and history-search-backward functions now leave
- point at the end of the line when the search string is empty, like
- reverse-search-history, and forward-search-history
-o A new function for applications: rl_on_new_line_with_prompt()
-o New variables for applications: rl_already_prompted, and rl_gnu_readline_p
-
-
-Bash-2.03 had very few new features, in keeping with the convention
-that odd-numbered releases provide mainly bug fixes. A number of new
-features were added to Readline, mostly at the request of the Cygnus
-folks.
-
-A new shopt option, `restricted_shell', so that startup files can test
- whether or not the shell was started in restricted mode
-Filename generation is now performed on the words between ( and ) in
- compound array assignments (this is really a bug fix)
-OLDPWD is now auto-exported, as POSIX.2 requires
-ENV and BASH_ENV are read-only variables in a restricted shell
-Bash may now be linked against an already-installed Readline library,
- as long as the Readline library is version 4 or newer
-All shells begun with the `--login' option will source the login shell
- startup files, even if the shell is not interactive
-
-There were lots of changes to the version of the Readline library released
-along with Bash-2.03. For a complete list of the changes, read the file
-CHANGES in the Bash-2.03 distribution.
-
-Bash-2.02 contained the following new features:
-
-a new version of malloc (based on the old GNU malloc code in previous
- bash versions) that is more page-oriented, more conservative
- with memory usage, does not `orphan' large blocks when they
- are freed, is usable on 64-bit machines, and has allocation
- checking turned on unconditionally
-POSIX.2-style globbing character classes ([:alpha:], [:alnum:], etc.)
-POSIX.2-style globbing equivalence classes
-POSIX.2-style globbing collating symbols
-the ksh [[...]] extended conditional command
-the ksh egrep-style extended pattern matching operators
-a new `printf' builtin
-the ksh-like $(<filename) command substitution, which is equivalent to
- $(cat filename)
-new tilde prefixes that expand to directories from the directory stack
-new `**' arithmetic operator to do exponentiation
-case-insensitive globbing (filename expansion)
-menu completion a la tcsh
-`magic-space' history expansion function like tcsh
-the readline inputrc `language' has a new file inclusion directive ($include)
-
-Bash-2.01 contained only a few new features:
-
-new `GROUPS' builtin array variable containing the user's group list
-new bindable readline commands: history-and-alias-expand-line and
- alias-expand-line
-
-Bash-2.0 contained extensive changes and new features from bash-1.14.7.
-Here's a short list:
-
-new `time' reserved word to time pipelines, shell builtins, and
- shell functions
-one-dimensional arrays with a new compound assignment statement,
- appropriate expansion constructs and modifications to some
- of the builtins (read, declare, etc.) to use them
-new quoting syntaxes for ANSI-C string expansion and locale-specific
- string translation
-new expansions to do substring extraction, pattern replacement, and
- indirect variable expansion
-new builtins: `disown' and `shopt'
-new variables: HISTIGNORE, SHELLOPTS, PIPESTATUS, DIRSTACK, GLOBIGNORE,
- MACHTYPE, BASH_VERSINFO
-special handling of many unused or redundant variables removed
- (e.g., $notify, $glob_dot_filenames, $no_exit_on_failed_exec)
-dynamic loading of new builtin commands; many loadable examples provided
-new prompt expansions: \a, \e, \n, \H, \T, \@, \v, \V
-history and aliases available in shell scripts
-new readline variables: enable-keypad, mark-directories, input-meta,
- visible-stats, disable-completion, comment-begin
-new readline commands to manipulate the mark and operate on the region
-new readline emacs mode commands and bindings for ksh-88 compatibility
-updated and extended builtins
-new DEBUG trap
-expanded (and now documented) restricted shell mode
-
-implementation stuff:
-autoconf-based configuration
-nearly all of the bugs reported since version 1.14 have been fixed
-most builtins converted to use builtin `getopt' for consistency
-most builtins use -p option to display output in a reusable form
- (for consistency)
-grammar tighter and smaller (66 reduce-reduce conflicts gone)
-lots of code now smaller and faster
-test suite greatly expanded
-
-B2) Are there any user-visible incompatibilities between bash-2.05b and
- bash-1.14.7?
-
-There are a few incompatibilities between version 1.14.7 and version 2.05b.
-They are detailed in the file COMPAT in the bash distribution. That file
-is not meant to be all-encompassing; send mail to bash-maintainers@gnu.org
-if if you find something that's not mentioned there.
-
-Section C: Differences from other Unix shells
-
-C1) How does bash differ from sh, the Bourne shell?
-
-This is a non-comprehensive list of features that differentiate bash
-from the SVR4.2 shell. The bash manual page explains these more
-completely.
-
-Things bash has that sh does not:
- long invocation options
- [+-]O invocation option
- -l invocation option
- `!' reserved word to invert pipeline return value
- `time' reserved word to time pipelines and shell builtins
- the `function' reserved word
- the `select' compound command and reserved word
- arithmetic for command: for ((expr1 ; expr2; expr3 )); do list; done
- new $'...' and $"..." quoting
- the $(...) form of command substitution
- the $(<filename) form of command substitution, equivalent to
- $(cat filename)
- the ${#param} parameter value length operator
- the ${!param} indirect parameter expansion operator
- the ${!param*} prefix expansion operator
- the ${param:offset[:length]} parameter substring operator
- the ${param/pat[/string]} parameter pattern substitution operator
- expansions to perform substring removal (${p%[%]w}, ${p#[#]w})
- expansion of positional parameters beyond $9 with ${num}
- variables: BASH, BASH_VERSION, BASH_VERSINFO, UID, EUID, REPLY,
- TIMEFORMAT, PPID, PWD, OLDPWD, SHLVL, RANDOM, SECONDS,
- LINENO, HISTCMD, HOSTTYPE, OSTYPE, MACHTYPE, HOSTNAME,
- ENV, PS3, PS4, DIRSTACK, PIPESTATUS, HISTSIZE, HISTFILE,
- HISTFILESIZE, HISTCONTROL, HISTIGNORE, GLOBIGNORE, GROUPS,
- PROMPT_COMMAND, FCEDIT, FIGNORE, IGNOREEOF, INPUTRC,
- SHELLOPTS, OPTERR, HOSTFILE, TMOUT, FUNCNAME, histchars,
- auto_resume
- DEBUG trap
- ERR trap
- variable arrays with new compound assignment syntax
- redirections: <>, &>, >|, <<<, [n]<&word-, [n]>&word-
- prompt string special char translation and variable expansion
- auto-export of variables in initial environment
- command search finds functions before builtins
- bash return builtin will exit a file sourced with `.'
- builtins: cd -/-L/-P, exec -l/-c/-a, echo -e/-E, hash -d/-l/-p/-t.
- export -n/-f/-p/name=value, pwd -L/-P,
- read -e/-p/-a/-t/-n/-d/-s/-u,
- readonly -a/-f/name=value, trap -l, set +o,
- set -b/-m/-o option/-h/-p/-B/-C/-H/-P,
- unset -f/-v, ulimit -m/-p/-u,
- type -a/-p/-t/-f/-P, suspend -f, kill -n,
- test -o optname/s1 == s2/s1 < s2/s1 > s2/-nt/-ot/-ef/-O/-G/-S
- bash reads ~/.bashrc for interactive shells, $ENV for non-interactive
- bash restricted shell mode is more extensive
- bash allows functions and variables with the same name
- brace expansion
- tilde expansion
- arithmetic expansion with $((...)) and `let' builtin
- the `[[...]]' extended conditional command
- process substitution
- aliases and alias/unalias builtins
- local variables in functions and `local' builtin
- readline and command-line editing with programmable completion
- command history and history/fc builtins
- csh-like history expansion
- other new bash builtins: bind, command, compgen, complete, builtin,
- declare/typeset, dirs, enable, fc, help,
- history, logout, popd, pushd, disown, shopt,
- printf
- exported functions
- filename generation when using output redirection (command >a*)
- POSIX.2-style globbing character classes
- POSIX.2-style globbing equivalence classes
- POSIX.2-style globbing collating symbols
- egrep-like extended pattern matching operators
- case-insensitive pattern matching and globbing
- variable assignments preceding commands affect only that command,
- even for builtins and functions
- posix mode
- redirection to /dev/fd/N, /dev/stdin, /dev/stdout, /dev/stderr,
- /dev/tcp/host/port, /dev/udp/host/port
-
-Things sh has that bash does not:
- uses variable SHACCT to do shell accounting
- includes `stop' builtin (bash can use alias stop='kill -s STOP')
- `newgrp' builtin
- turns on job control if called as `jsh'
- $TIMEOUT (like bash $TMOUT)
- `^' is a synonym for `|'
- new SVR4.2 sh builtins: mldmode, priv
-
-Implementation differences:
- redirection to/from compound commands causes sh to create a subshell
- bash does not allow unbalanced quotes; sh silently inserts them at EOF
- bash does not mess with signal 11
- sh sets (euid, egid) to (uid, gid) if -p not supplied and uid < 100
- bash splits only the results of expansions on IFS, using POSIX.2
- field splitting rules; sh splits all words on IFS
- sh does not allow MAILCHECK to be unset (?)
- sh does not allow traps on SIGALRM or SIGCHLD
- bash allows multiple option arguments when invoked (e.g. -x -v);
- sh allows only a single option argument (`sh -x -v' attempts
- to open a file named `-v', and, on SunOS 4.1.4, dumps core.
- On Solaris 2.4 and earlier versions, sh goes into an infinite
- loop.)
- sh exits a script if any builtin fails; bash exits only if one of
- the POSIX.2 `special' builtins fails
-
-C2) How does bash differ from the Korn shell, version ksh88?
-
-Things bash has or uses that ksh88 does not:
- long invocation options
- [-+]O invocation option
- -l invocation option
- `!' reserved word
- arithmetic for command: for ((expr1 ; expr2; expr3 )); do list; done
- arithmetic in largest machine-supported size (intmax_t)
- posix mode and posix conformance
- command hashing
- tilde expansion for assignment statements that look like $PATH
- process substitution with named pipes if /dev/fd is not available
- the ${!param} indirect parameter expansion operator
- the ${!param*} prefix expansion operator
- the ${param:offset[:length]} parameter substring operator
- the ${param/pat[/string]} parameter pattern substitution operator
- variables: BASH, BASH_VERSION, BASH_VERSINFO, UID, EUID, SHLVL,
- TIMEFORMAT, HISTCMD, HOSTTYPE, OSTYPE, MACHTYPE,
- HISTFILESIZE, HISTIGNORE, HISTCONTROL, PROMPT_COMMAND,
- IGNOREEOF, FIGNORE, INPUTRC, HOSTFILE, DIRSTACK,
- PIPESTATUS, HOSTNAME, OPTERR, SHELLOPTS, GLOBIGNORE,
- GROUPS, FUNCNAME, histchars, auto_resume
- prompt expansion with backslash escapes and command substitution
- redirection: &> (stdout and stderr), <<<, [n]<&word-, [n]>&word-
- more extensive and extensible editing and programmable completion
- builtins: bind, builtin, command, declare, dirs, echo -e/-E, enable,
- exec -l/-c/-a, fc -s, export -n/-f/-p, hash, help, history,
- jobs -x/-r/-s, kill -s/-n/-l, local, logout, popd, pushd,
- read -e/-p/-a/-t/-n/-d/-s, readonly -a/-n/-f/-p,
- set -o braceexpand/-o histexpand/-o interactive-comments/
- -o notify/-o physical/-o posix/-o hashall/-o onecmd/
- -h/-B/-C/-b/-H/-P, set +o, suspend, trap -l, type,
- typeset -a/-F/-p, ulimit -u, umask -S, alias -p, shopt,
- disown, printf, complete, compgen
- `!' csh-style history expansion
- POSIX.2-style globbing character classes
- POSIX.2-style globbing equivalence classes
- POSIX.2-style globbing collating symbols
- egrep-like extended pattern matching operators
- case-insensitive pattern matching and globbing
- `**' arithmetic operator to do exponentiation
- redirection to /dev/fd/N, /dev/stdin, /dev/stdout, /dev/stderr
- arrays of unlimited size
- TMOUT is default timeout for `read' and `select'
-
-Things ksh88 has or uses that bash does not:
- tracked aliases (alias -t)
- variables: ERRNO, FPATH, EDITOR, VISUAL
- co-processes (|&, >&p, <&p)
- weirdly-scoped functions
- typeset +f to list all function names without definitions
- text of command history kept in a file, not memory
- builtins: alias -x, cd old new, fc -e -, newgrp, print,
- read -p/-s/var?prompt, set -A/-o gmacs/
- -o bgnice/-o markdirs/-o nolog/-o trackall/-o viraw/-s,
- typeset -H/-L/-R/-Z/-A/-ft/-fu/-fx/-l/-u/-t, whence
- using environment to pass attributes of exported variables
- arithmetic evaluation done on arguments to some builtins
- reads .profile from $PWD when invoked as login shell
-
-Implementation differences:
- ksh runs last command of a pipeline in parent shell context
- bash has brace expansion by default (ksh88 compile-time option)
- bash has fixed startup file for all interactive shells; ksh reads $ENV
- bash has exported functions
- bash command search finds functions before builtins
- bash waits for all commands in pipeline to exit before returning status
- emacs-mode editing has some slightly different key bindings
-
-C3) Which new features in ksh-93 are not in bash, and which are?
-
-New things in ksh-93 not in bash-2.05b:
- associative arrays
- floating point arithmetic and variables
- math library functions
- ${!name[sub]} name of subscript for associative array
- `.' is allowed in variable names to create a hierarchical namespace
- more extensive compound assignment syntax
- discipline functions
- `sleep' and `getconf' builtins (bash has loadable versions)
- typeset -n and `nameref' variables
- KEYBD trap
- variables: .sh.edchar, .sh.edmode, .sh.edcol, .sh.edtext, .sh.version,
- .sh.name, .sh.subscript, .sh.value, .sh.match, HISTEDIT
- backreferences in pattern matching (\N)
- `&' operator in pattern lists for matching
- print -f (bash uses printf)
- `fc' has been renamed to `hist'
- `.' can execute shell functions
- exit statuses between 0 and 255
- set -o pipefail
- `+=' variable assignment operator
- FPATH and PATH mixing
- getopts -a
- -I invocation option
- DEBUG trap now executed before each simple command, instead of after
- printf %H, %P, %T, %Z modifiers, output base for %d
- lexical scoping for local variables in `ksh' functions
- no scoping for local variables in `POSIX' functions
-
-New things in ksh-93 present in bash-2.05b:
- [n]<&word- and [n]>&word- redirections (combination dup and close)
- for (( expr1; expr2; expr3 )) ; do list; done - arithmetic for command
- ?:, ++, --, `expr1 , expr2' arithmetic operators
- expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]},
- ${!param*}
- compound array assignment
- the `!' reserved word
- loadable builtins -- but ksh uses `builtin' while bash uses `enable'
- `command', `builtin', `disown' builtins
- new $'...' and $"..." quoting
- FIGNORE (but bash uses GLOBIGNORE), HISTCMD
- set -o notify/-C
- changes to kill builtin
- read -A (bash uses read -a)
- read -t/-d
- trap -p
- exec -c/-a
- `.' restores the positional parameters when it completes
- POSIX.2 `test'
- umask -S
- unalias -a
- command and arithmetic substitution performed on PS1, PS4, and ENV
- command name completion
- ENV processed only for interactive shells
-
-Section D: Why does bash do some things differently than other Unix shells?
-
-D1) Why does bash run a different version of `command' than
- `which command' says it will?
-
-On many systems, `which' is actually a csh script that assumes
-you're running csh. In tcsh, `which' and its cousin `where'
-are builtins. On other Unix systems, `which' is a perl script
-that uses the PATH environment variable.
-
-The csh script version reads the csh startup files from your
-home directory and uses those to determine which `command' will
-be invoked. Since bash doesn't use any of those startup files,
-there's a good chance that your bash environment differs from
-your csh environment. The bash `type' builtin does everything
-`which' does, and will report correct results for the running
-shell. If you're really wedded to the name `which', try adding
-the following function definition to your .bashrc:
-
- which()
- {
- builtin type "$@"
- }
-
-If you're moving from tcsh and would like to bring `where' along
-as well, use this function:
-
- where()
- {
- builtin type -a "$@"
- }
-
-D2) Why doesn't bash treat brace expansions exactly like csh?
-
-The only difference between bash and csh brace expansion is that
-bash requires a brace expression to contain at least one unquoted
-comma if it is to be expanded. Any brace-surrounded word not
-containing an unquoted comma is left unchanged by the brace
-expansion code. This affords the greatest degree of sh
-compatibility.
-
-Bash, ksh, zsh, and pd-ksh all implement brace expansion this way.
-
-D3) Why doesn't bash have csh variable modifiers?
-
-Posix has specified a more powerful, albeit somewhat more cryptic,
-mechanism cribbed from ksh, and bash implements it.
-
-${parameter%word}
- Remove smallest suffix pattern. The WORD is expanded to produce
- a pattern. It then expands to the value of PARAMETER, with the
- smallest portion of the suffix matched by the pattern deleted.
-
- x=file.c
- echo ${x%.c}.o
- -->file.o
-
-${parameter%%word}
-
- Remove largest suffix pattern. The WORD is expanded to produce
- a pattern. It then expands to the value of PARAMETER, with the
- largest portion of the suffix matched by the pattern deleted.
-
- x=posix/src/std
- echo ${x%%/*}
- -->posix
-
-${parameter#word}
- Remove smallest prefix pattern. The WORD is expanded to produce
- a pattern. It then expands to the value of PARAMETER, with the
- smallest portion of the prefix matched by the pattern deleted.
-
- x=$HOME/src/cmd
- echo ${x#$HOME}
- -->/src/cmd
-
-${parameter##word}
- Remove largest prefix pattern. The WORD is expanded to produce
- a pattern. It then expands to the value of PARAMETER, with the
- largest portion of the prefix matched by the pattern deleted.
-
- x=/one/two/three
- echo ${x##*/}
- -->three
-
-
-Given
- a=/a/b/c/d
- b=b.xxx
-
- csh bash result
- --- ---- ------
- $a:h ${a%/*} /a/b/c
- $a:t ${a##*/} d
- $b:r ${b%.*} b
- $b:e ${b##*.} xxx
-
-
-D4) How can I make my csh aliases work when I convert to bash?
-
-Bash uses a different syntax to support aliases than csh does.
-The details can be found in the documentation. We have provided
-a shell script which does most of the work of conversion for you;
-this script can be found in ./examples/misc/aliasconv.sh. Here is
-how you use it:
-
-Start csh in the normal way for you. (e.g., `csh')
-
-Pipe the output of `alias' through `aliasconv.sh', saving the
-results into `bash_aliases':
-
- alias | bash aliasconv.sh >bash_aliases
-
-Edit `bash_aliases', carefully reading through any created
-functions. You will need to change the names of some csh specific
-variables to the bash equivalents. The script converts $cwd to
-$PWD, $term to $TERM, $home to $HOME, $user to $USER, and $prompt
-to $PS1. You may also have to add quotes to avoid unwanted
-expansion.
-
-For example, the csh alias:
-
- alias cd 'cd \!*; echo $cwd'
-
-is converted to the bash function:
-
- cd () { command cd "$@"; echo $PWD ; }
-
-The only thing that needs to be done is to quote $PWD:
-
- cd () { command cd "$@"; echo "$PWD" ; }
-
-Merge the edited file into your ~/.bashrc.
-
-There is an additional, more ambitious, script in
-examples/misc/cshtobash that attempts to convert your entire csh
-environment to its bash equivalent. This script can be run as
-simply `cshtobash' to convert your normal interactive
-environment, or as `cshtobash ~/.login' to convert your login
-environment.
-
-D5) How can I pipe standard output and standard error from one command to
- another, like csh does with `|&'?
-
-Use
- command 2>&1 | command2
-
-The key is to remember that piping is performed before redirection, so
-file descriptor 1 points to the pipe when it is duplicated onto file
-descriptor 2.
-
-D6) Now that I've converted from ksh to bash, are there equivalents to
- ksh features like autoloaded functions and the `whence' command?
-
-There are features in ksh-88 and ksh-93 that do not have direct bash
-equivalents. Most, however, can be emulated with very little trouble.
-
-ksh-88 feature Bash equivalent
--------------- ---------------
-compiled-in aliases set up aliases in .bashrc; some ksh aliases are
- bash builtins (hash, history, type)
-coprocesses named pipe pairs (one for read, one for write)
-typeset +f declare -F
-cd, print, whence function substitutes in examples/functions/kshenv
-autoloaded functions examples/functions/autoload is the same as typeset -fu
-read var?prompt read -p prompt var
-
-ksh-93 feature Bash equivalent
--------------- ---------------
-sleep, getconf Bash has loadable versions in examples/loadables
-${.sh.version} $BASH_VERSION
-print -f printf
-hist alias hist=fc
-$HISTEDIT $FCEDIT
-
-Section E: How can I get bash to do certain things, and why does bash do
- things the way it does?
-
-E1) Why is the bash builtin `test' slightly different from /bin/test?
-
-The specific example used here is [ ! x -o x ], which is false.
-
-Bash's builtin `test' implements the Posix.2 spec, which can be
-summarized as follows (the wording is due to David Korn):
-
-Here is the set of rules for processing test arguments.
-
- 0 Args: False
- 1 Arg: True iff argument is not null.
- 2 Args: If first arg is !, True iff second argument is null.
- If first argument is unary, then true if unary test is true
- Otherwise error.
- 3 Args: If second argument is a binary operator, do binary test of $1 $3
- If first argument is !, negate two argument test of $2 $3
- If first argument is `(' and third argument is `)', do the
- one-argument test of the second argument.
- Otherwise error.
- 4 Args: If first argument is !, negate three argument test of $2 $3 $4.
- Otherwise unspecified
- 5 or more Args: unspecified. (Historical shells would use their
- current algorithm).
-
-The operators -a and -o are considered binary operators for the purpose
-of the 3 Arg case.
-
-As you can see, the test becomes (not (x or x)), which is false.
-
-E2) Why does bash sometimes say `Broken pipe'?
-
-If a sequence of commands appears in a pipeline, and one of the
-reading commands finishes before the writer has finished, the
-writer receives a SIGPIPE signal. Many other shells special-case
-SIGPIPE as an exit status in the pipeline and do not report it.
-For example, in:
-
- ps -aux | head
-
-`head' can finish before `ps' writes all of its output, and ps
-will try to write on a pipe without a reader. In that case, bash
-will print `Broken pipe' to stderr when ps is killed by a
-SIGPIPE.
-
-You can build a version of bash that will not report SIGPIPE errors
-by uncommenting the definition of DONT_REPORT_SIGPIPE in the file
-config-top.h.
-
-E3) When I have terminal escape sequences in my prompt, why does bash
- wrap lines at the wrong column?
-
-Readline, the line editing library that bash uses, does not know
-that the terminal escape sequences do not take up space on the
-screen. The redisplay code assumes, unless told otherwise, that
-each character in the prompt is a `printable' character that
-takes up one character position on the screen.
-
-You can use the bash prompt expansion facility (see the PROMPTING
-section in the manual page) to tell readline that sequences of
-characters in the prompt strings take up no screen space.
-
-Use the \[ escape to begin a sequence of non-printing characters,
-and the \] escape to signal the end of such a sequence.
-
-E4) If I pipe the output of a command into `read variable', why doesn't
- the output show up in $variable when the read command finishes?
-
-This has to do with the parent-child relationship between Unix
-processes. It affects all commands run in pipelines, not just
-simple calls to `read'. For example, piping a command's output
-into a `while' loop that repeatedly calls `read' will result in
-the same behavior.
-
-Each element of a pipeline runs in a separate process, a child of
-the shell running the pipeline. A subprocess cannot affect its
-parent's environment. When the `read' command sets the variable
-to the input, that variable is set only in the subshell, not the
-parent shell. When the subshell exits, the value of the variable
-is lost.
-
-Many pipelines that end with `read variable' can be converted
-into command substitutions, which will capture the output of
-a specified command. The output can then be assigned to a
-variable:
-
- grep ^gnu /usr/lib/news/active | wc -l | read ngroup
-
-can be converted into
-
- ngroup=$(grep ^gnu /usr/lib/news/active | wc -l)
-
-This does not, unfortunately, work to split the text among
-multiple variables, as read does when given multiple variable
-arguments. If you need to do this, you can either use the
-command substitution above to read the output into a variable
-and chop up the variable using the bash pattern removal
-expansion operators or use some variant of the following
-approach.
-
-Say /usr/local/bin/ipaddr is the following shell script:
-
-#! /bin/sh
-host `hostname` | awk '/address/ {print $NF}'
-
-Instead of using
-
- /usr/local/bin/ipaddr | read A B C D
-
-to break the local machine's IP address into separate octets, use
-
- OIFS="$IFS"
- IFS=.
- set -- $(/usr/local/bin/ipaddr)
- IFS="$OIFS"
- A="$1" B="$2" C="$3" D="$4"
-
-Beware, however, that this will change the shell's positional
-parameters. If you need them, you should save them before doing
-this.
-
-This is the general approach -- in most cases you will not need to
-set $IFS to a different value.
-
-Some other user-supplied alternatives include:
-
-read A B C D << HERE
- $(IFS=.; echo $(/usr/local/bin/ipaddr))
-HERE
-
-and, where process substitution is available,
-
-read A B C D < <(IFS=.; echo $(/usr/local/bin/ipaddr))
-
-E5) I have a bunch of shell scripts that use backslash-escaped characters
- in arguments to `echo'. Bash doesn't interpret these characters. Why
- not, and how can I make it understand them?
-
-This is the behavior of echo on most Unix System V machines.
-
-The bash builtin `echo' is modeled after the 9th Edition
-Research Unix version of `echo'. It does not interpret
-backslash-escaped characters in its argument strings by default;
-it requires the use of the -e option to enable the
-interpretation. The System V echo provides no way to disable the
-special characters; the bash echo has a -E option to disable
-them.
-
-There is a configuration option that will make bash behave like
-the System V echo and interpret things like `\t' by default. Run
-configure with the --enable-xpg-echo-default option to turn this
-on. Be aware that this will cause some of the tests run when you
-type `make tests' to fail.
-
-There is a shell option, `xpg_echo', settable with `shopt', that will
-change the behavior of echo at runtime. Enabling this option turns
-on expansion of backslash-escape sequences.
-
-E6) Why doesn't a while or for loop get suspended when I type ^Z?
-
-This is a consequence of how job control works on Unix. The only
-thing that can be suspended is the process group. This is a single
-command or pipeline of commands that the shell forks and executes.
-
-When you run a while or for loop, the only thing that the shell forks
-and executes are any commands in the while loop test and commands in
-the loop bodies. These, therefore, are the only things that can be
-suspended when you type ^Z.
-
-If you want to be able to stop the entire loop, you need to put it
-within parentheses, which will force the loop into a subshell that
-may be stopped (and subsequently restarted) as a single unit.
-
-E7) What about empty for loops in Makefiles?
-
-It's fairly common to see constructs like this in automatically-generated
-Makefiles:
-
-SUBDIRS = @SUBDIRS@
-
- ...
-
-subdirs-clean:
- for d in ${SUBDIRS}; do \
- ( cd $$d && ${MAKE} ${MFLAGS} clean ) \
- done
-
-When SUBDIRS is empty, this results in a command like this being passed to
-bash:
-
- for d in ; do
- ( cd $d && ${MAKE} ${MFLAGS} clean )
- done
-
-In versions of bash before bash-2.05a, this was a syntax error. If the
-reserved word `in' was present, a word must follow it before the semicolon
-or newline. The language in the manual page referring to the list of words
-being empty referred to the list after it is expanded. These versions of
-bash required that there be at least one word following the `in' when the
-construct was parsed.
-
-The idiomatic Makefile solution is something like:
-
-SUBDIRS = @SUBDIRS@
-
-subdirs-clean:
- subdirs=$SUBDIRS ; for d in $$subdirs; do \
- ( cd $$d && ${MAKE} ${MFLAGS} clean ) \
- done
-
-The latest drafts of the updated POSIX standard have changed this: the
-word list is no longer required. Bash versions 2.05a and later accept
-the new syntax.
-
-E8) Why does the arithmetic evaluation code complain about `08'?
-
-The bash arithmetic evaluation code (used for `let', $(()), (()), and in
-other places), interprets a leading `0' in numeric constants as denoting
-an octal number, and a leading `0x' as denoting hexadecimal. This is
-in accordance with the POSIX.2 spec, section 2.9.2.1, which states that
-arithmetic constants should be handled as signed long integers as defined
-by the ANSI/ISO C standard.
-
-The POSIX.2 interpretation committee has confirmed this:
-
-http://www.pasc.org/interps/unofficial/db/p1003.2/pasc-1003.2-173.html
-
-E9) Why does the pattern matching expression [A-Z]* match files beginning
- with every letter except `z'?
-
-Bash-2.03, Bash-2.05 and later versions honor the current locale setting
-when processing ranges within pattern matching bracket expressions ([A-Z]).
-This is what POSIX.2 and SUSv3/XPG6 specify.
-
-The behavior of the matcher in bash-2.05 and later versions depends on the
-current LC_COLLATE setting. Setting this variable to `C' or `POSIX' will
-result in the traditional behavior ([A-Z] matches all uppercase ASCII
-characters). Many other locales, including the en_US locale (the default
-on many US versions of Linux) collate the upper and lower case letters like
-this:
-
- AaBb...Zz
-
-which means that [A-Z] matches every letter except `z'. Others collate like
-
- aAbBcC...zZ
-
-which means that [A-Z] matches every letter except `a'.
-
-The portable way to specify upper case letters is [:upper:] instead of
-A-Z; lower case may be specified as [:lower:] instead of a-z.
-
-Look at the manual pages for setlocale(3), strcoll(3), and, if it is
-present, locale(1). If you have locale(1), you can use it to find
-your current locale information even if you do not have any of the
-LC_ variables set.
-
-My advice is to put
-
- export LC_COLLATE=C
-
-into /etc/profile and inspect any shell scripts run from cron for
-constructs like [A-Z]. This will prevent things like
-
- rm [A-Z]*
-
-from removing every file in the current directory except those beginning
-with `z' and still allow individual users to change the collation order.
-Users may put the above command into their own profiles as well, of course.
-
-E10) Why does `cd //' leave $PWD as `//'?
-
-POSIX.2, in its description of `cd', says that *three* or more leading
-slashes may be replaced with a single slash when canonicalizing the
-current working directory.
-
-This is, I presume, for historical compatibility. Certain versions of
-Unix, and early network file systems, used paths of the form
-//hostname/path to access `path' on server `hostname'.
-
-E11) If I resize my xterm while another program is running, why doesn't bash
- notice the change?
-
-This is another issue that deals with job control.
-
-The kernel maintains a notion of a current terminal process group. Members
-of this process group (processes whose process group ID is equal to the
-current terminal process group ID) receive terminal-generated signals like
-SIGWINCH. (For more details, see the JOB CONTROL section of the bash
-man page.)
-
-If a terminal is resized, the kernel sends SIGWINCH to each member of
-the terminal's current process group (the `foreground' process group).
-
-When bash is running with job control enabled, each pipeline (which may be
-a single command) is run in its own process group, different from bash's
-process group. This foreground process group receives the SIGWINCH; bash
-does not. Bash has no way of knowing that the terminal has been resized.
-
-There is a `checkwinsize' option, settable with the `shopt' builtin, that
-will cause bash to check the window size and adjust its idea of the
-terminal's dimensions each time a process stops or exits and returns control
-of the terminal to bash. Enable it with `shopt -s checkwinsize'.
-
-Section F: Things to watch out for on certain Unix versions
-
-F1) Why can't I use command line editing in my `cmdtool'?
-
-The problem is `cmdtool' and bash fighting over the input. When
-scrolling is enabled in a cmdtool window, cmdtool puts the tty in
-`raw mode' to permit command-line editing using the mouse for
-applications that cannot do it themselves. As a result, bash and
-cmdtool each try to read keyboard input immediately, with neither
-getting enough of it to be useful.
-
-This mode also causes cmdtool to not implement many of the
-terminal functions and control sequences appearing in the
-`sun-cmd' termcap entry. For a more complete explanation, see
-that file examples/suncmd.termcap in the bash distribution.
-
-`xterm' is a better choice, and gets along with bash much more
-smoothly.
-
-If you must use cmdtool, you can use the termcap description in
-examples/suncmd.termcap. Set the TERMCAP variable to the terminal
-description contained in that file, i.e.
-
-TERMCAP='Mu|sun-cmd:am:bs:km:pt:li#34:co#80:cl=^L:ce=\E[K:cd=\E[J:rs=\E[s:'
-
-Then export TERMCAP and start a new cmdtool window from that shell.
-The bash command-line editing should behave better in the new
-cmdtool. If this works, you can put the assignment to TERMCAP
-in your bashrc file.
-
-F2) I built bash on Solaris 2. Why do globbing expansions and filename
- completion chop off the first few characters of each filename?
-
-This is the consequence of building bash on SunOS 5 and linking
-with the libraries in /usr/ucblib, but using the definitions
-and structures from files in /usr/include.
-
-The actual conflict is between the dirent structure in
-/usr/include/dirent.h and the struct returned by the version of
-`readdir' in libucb.a (a 4.3-BSD style `struct direct').
-
-Make sure you've got /usr/ccs/bin ahead of /usr/ucb in your $PATH
-when configuring and building bash. This will ensure that you
-use /usr/ccs/bin/cc or acc instead of /usr/ucb/cc and that you
-link with libc before libucb.
-
-If you have installed the Sun C compiler, you may also need to
-put /usr/ccs/bin and /opt/SUNWspro/bin into your $PATH before
-/usr/ucb.
-
-F3) Why does bash dump core after I interrupt username completion or
- `~user' tilde expansion on a machine running NIS?
-
-This is a famous and long-standing bug in the SunOS YP (sorry, NIS)
-client library, which is part of libc.
-
-The YP library code keeps static state -- a pointer into the data
-returned from the server. When YP initializes itself (setpwent),
-it looks at this pointer and calls free on it if it's non-null.
-So far, so good.
-
-If one of the YP functions is interrupted during getpwent (the
-exact function is interpretwithsave()), and returns NULL, the
-pointer is freed without being reset to NULL, and the function
-returns. The next time getpwent is called, it sees that this
-pointer is non-null, calls free, and the bash free() blows up
-because it's being asked to free freed memory.
-
-The traditional Unix mallocs allow memory to be freed multiple
-times; that's probably why this has never been fixed. You can
-run configure with the `--without-gnu-malloc' option to use
-the C library malloc and avoid the problem.
-
-F4) I'm running SVR4.2. Why is the line erased every time I type `@'?
-
-The `@' character is the default `line kill' character in most
-versions of System V, including SVR4.2. You can change this
-character to whatever you want using `stty'. For example, to
-change the line kill character to control-u, type
-
- stty kill ^U
-
-where the `^' and `U' can be two separate characters.
-
-F5) Why does bash report syntax errors when my C News scripts use a
- redirection before a subshell command?
-
-The actual command in question is something like
-
- < file ( command )
-
-According to the grammar given in the POSIX.2 standard, this construct
-is, in fact, a syntax error. Redirections may only precede `simple
-commands'. A subshell construct such as the above is one of the shell's
-`compound commands'. A redirection may only follow a compound command.
-
-This affects the mechanical transformation of commands that use `cat'
-to pipe a file into a command (a favorite Useless-Use-Of-Cat topic on
-comp.unix.shell). While most commands of the form
-
- cat file | command
-
-can be converted to `< file command', shell control structures such as
-loops and subshells require `command < file'.
-
-The file CWRU/sh-redir-hack in the bash-2.05a distribution is an
-(unofficial) patch to parse.y that will modify the grammar to
-support this construct. It will not apply with `patch'; you must
-modify parse.y by hand. Note that if you apply this, you must
-recompile with -DREDIRECTION_HACK. This introduces a large
-number of reduce/reduce conflicts into the shell grammar.
-
-F6) Why can't I use vi-mode editing on Red Hat Linux 6.1?
-
-The short answer is that Red Hat screwed up.
-
-The long answer is that they shipped an /etc/inputrc that only works
-for emacs mode editing, and then screwed all the vi users by setting
-INPUTRC to /etc/inputrc in /etc/profile.
-
-The short fix is to do one of the following: remove or rename
-/etc/inputrc, set INPUTRC=~/.inputrc in ~/.bashrc (or .bash_profile,
-but make sure you export it if you do), remove the assignment to
-INPUTRC from /etc/profile, add
-
- set keymap emacs
-
-to the beginning of /etc/inputrc, or bracket the key bindings in
-/etc/inputrc with these lines
-
- $if mode=emacs
- [...]
- $endif
-
-F7) Why do bash-2.05a and bash-2.05b fail to compile `printf.def' on
- HP/UX 11.x?
-
-HP/UX's support for long double is imperfect at best.
-
-GCC will support it without problems, but the HP C library functions
-like strtold(3) and printf(3) don't actually work with long doubles.
-HP implemented a `long_double' type as a 4-element array of 32-bit
-ints, and that is what the library functions use. The ANSI C
-`long double' type is a 128-bit floating point scalar.
-
-The easiest fix, until HP fixes things up, is to edit the generated
-config.h and #undef the HAVE_LONG_DOUBLE line. After doing that,
-the compilation should complete successfully.
-
-Section G: How can I get bash to do certain common things?
-
-G1) How can I get bash to read and display eight-bit characters?
-
-This is a process requiring several steps.
-
-First, you must ensure that the `physical' data path is a full eight
-bits. For xterms, for example, the `vt100' resources `eightBitInput'
-and `eightBitOutput' should be set to `true'.
-
-Once you have set up an eight-bit path, you must tell the kernel and
-tty driver to leave the eighth bit of characters alone when processing
-keyboard input. Use `stty' to do this:
-
- stty cs8 -istrip -parenb
-
-For old BSD-style systems, you can use
-
- stty pass8
-
-You may also need
-
- stty even odd
-
-Finally, you need to tell readline that you will be inputting and
-displaying eight-bit characters. You use readline variables to do
-this. These variables can be set in your .inputrc or using the bash
-`bind' builtin. Here's an example using `bind':
-
- bash$ bind 'set convert-meta off'
- bash$ bind 'set meta-flag on'
- bash$ bind 'set output-meta on'
-
-The `set' commands between the single quotes may also be placed
-in ~/.inputrc.
-
-G2) How do I write a function `x' to replace builtin command `x', but
- still invoke the command from within the function?
-
-This is why the `command' and `builtin' builtins exist. The
-`command' builtin executes the command supplied as its first
-argument, skipping over any function defined with that name. The
-`builtin' builtin executes the builtin command given as its first
-argument directly.
-
-For example, to write a function to replace `cd' that writes the
-hostname and current directory to an xterm title bar, use
-something like the following:
-
- cd()
- {
- builtin cd "$@" && xtitle "$HOST: $PWD"
- }
-
-This could also be written using `command' instead of `builtin';
-the version above is marginally more efficient.
-
-G3) How can I find the value of a shell variable whose name is the value
- of another shell variable?
-
-Versions of Bash newer than Bash-2.0 support this directly. You can use
-
- ${!var}
-
-For example, the following sequence of commands will echo `z':
-
- var1=var2
- var2=z
- echo ${!var1}
-
-For sh compatibility, use the `eval' builtin. The important
-thing to remember is that `eval' expands the arguments you give
-it again, so you need to quote the parts of the arguments that
-you want `eval' to act on.
-
-For example, this expression prints the value of the last positional
-parameter:
-
- eval echo \"\$\{$#\}\"
-
-The expansion of the quoted portions of this expression will be
-deferred until `eval' runs, while the `$#' will be expanded
-before `eval' is executed. In versions of bash later than bash-2.0,
-
- echo ${!#}
-
-does the same thing.
-
-This is not the same thing as ksh93 `nameref' variables, though the syntax
-is similar. I may add namerefs in a future bash version.
-
-G4) How can I make the bash `time' reserved word print timing output that
- looks like the output from my system's /usr/bin/time?
-
-The bash command timing code looks for a variable `TIMEFORMAT' and
-uses its value as a format string to decide how to display the
-timing statistics.
-
-The value of TIMEFORMAT is a string with `%' escapes expanded in a
-fashion similar in spirit to printf(3). The manual page explains
-the meanings of the escape sequences in the format string.
-
-If TIMEFORMAT is not set, bash acts as if the following assignment had
-been performed:
-
- TIMEFORMAT=$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'
-
-The POSIX.2 default time format (used by `time -p command') is
-
- TIMEFORMAT=$'real %2R\nuser %2U\nsys %2S'
-
-The BSD /usr/bin/time format can be emulated with:
-
- TIMEFORMAT=$'\t%1R real\t%1U user\t%1S sys'
-
-The System V /usr/bin/time format can be emulated with:
-
- TIMEFORMAT=$'\nreal\t%1R\nuser\t%1U\nsys\t%1S'
-
-The ksh format can be emulated with:
-
- TIMEFORMAT=$'\nreal\t%2lR\nuser\t%2lU\nsys\t%2lS'
-
-G5) How do I get the current directory into my prompt?
-
-Bash provides a number of backslash-escape sequences which are expanded
-when the prompt string (PS1 or PS2) is displayed. The full list is in
-the manual page.
-
-The \w expansion gives the full pathname of the current directory, with
-a tilde (`~') substituted for the current value of $HOME. The \W
-expansion gives the basename of the current directory. To put the full
-pathname of the current directory into the path without any tilde
-subsitution, use $PWD. Here are some examples:
-
- PS1='\w$ ' # current directory with tilde
- PS1='\W$ ' # basename of current directory
- PS1='$PWD$ ' # full pathname of current directory
-
-The single quotes are important in the final example to prevent $PWD from
-being expanded when the assignment to PS1 is performed.
-
-G6) How can I rename "*.foo" to "*.bar"?
-
-Use the pattern removal functionality described in D3. The following `for'
-loop will do the trick:
-
- for f in *.foo; do
- mv $f ${f%foo}bar
- done
-
-G7) How can I translate a filename from uppercase to lowercase?
-
-The script examples/functions/lowercase, originally written by John DuBois,
-will do the trick. The converse is left as an exercise.
-
-G8) How can I write a filename expansion (globbing) pattern that will match
- all files in the current directory except "." and ".."?
-
-You must have set the `extglob' shell option using `shopt -s extglob' to use
-this:
-
- echo .!(.|) *
-
-A solution that works without extended globbing is given in the Unix Shell
-FAQ, posted periodically to comp.unix.shell.
-
-Section H: Where do I go from here?
-
-H1) How do I report bugs in bash, and where should I look for fixes and
- advice?
-
-Use the `bashbug' script to report bugs. It is built and
-installed at the same time as bash. It provides a standard
-template for reporting a problem and automatically includes
-information about your configuration and build environment.
-
-`bashbug' sends its reports to bug-bash@gnu.org, which
-is a large mailing list gatewayed to the usenet newsgroup gnu.bash.bug.
-
-Bug fixes, answers to questions, and announcements of new releases
-are all posted to gnu.bash.bug. Discussions concerning bash features
-and problems also take place there.
-
-To reach the bash maintainers directly, send mail to
-bash-maintainers@gnu.org.
-
-H2) What kind of bash documentation is there?
-
-First, look in the doc directory in the bash distribution. It should
-contain at least the following files:
-
-bash.1 an extensive, thorough Unix-style manual page
-builtins.1 a manual page covering just bash builtin commands
-bashref.texi a reference manual in GNU tex`info format
-bashref.info an info version of the reference manual
-FAQ this file
-article.ms text of an article written for The Linux Journal
-readline.3 a man page describing readline
-
-Postscript, HTML, and ASCII files created from the above source are
-available in the documentation distribution.
-
-There is additional documentation available for anonymous FTP from host
-ftp.cwru.edu in the `pub/bash' directory.
-
-Cameron Newham and Bill Rosenblatt have written a book on bash, published
-by O'Reilly and Associates. The book is based on Bill Rosenblatt's Korn
-Shell book. The title is ``Learning the Bash Shell'', and the ISBN number
-is 1-56592-147-X. Look for it in fine bookstores near you. This book
-covers bash-1.14, but has an appendix describing some of the new features
-in bash-2.0.
-
-A second edition of this book is available, published in January, 1998.
-The ISBN number is 1-56592-347-2. Look for it in the same fine bookstores
-or on the web.
-
-The GNU Bash Reference Manual has been published as a printed book by
-Network Theory Ltd (Paperback, ISBN: 0-9541617-7-7, Feb 2003). It covers
-bash-2.0 and is available from most online bookstores (see
-http://www.network-theory.co.uk/bash/manual/ for details). The publisher
-will donate $1 to the Free Software Foundation for each copy sold.
-
-H3) What's coming in future versions?
-
-These are features I hope to include in a future version of bash.
-
-a better bash debugger (a minimally-tested version is included with bash-2.05b)
-associative arrays
-co-processes, but with a new-style syntax that looks like function declaration
-
-H4) What's on the bash `wish list' for future versions?
-
-These are features that may or may not appear in a future version of bash.
-
-breaking some of the shell functionality into embeddable libraries
-a module system like zsh's, using dynamic loading like builtins
-better internationalization using GNU `gettext'
-date-stamped command history
-a bash programmer's guide with a chapter on creating loadable builtins
-a better loadable interface to perl with access to the shell builtins and
- variables (contributions gratefully accepted)
-ksh93-like `nameref' variables
-ksh93-like `+=' variable assignment operator
-ksh93-like `xx.yy' variables (including some of the .sh.* variables) and
- associated disipline functions
-Some of the new ksh93 pattern matching operators, like backreferencing
-
-H5) When will the next release appear?
-
-The next version will appear sometime in 2002. Never make predictions.
-
-
-This document is Copyright 1995-2003 by Chester Ramey.
-
-Permission is hereby granted, without written agreement and
-without license or royalty fees, to use, copy, and distribute
-this document for any purpose, provided that the above copyright
-notice appears in all copies of this document and that the
-contents of this document remain unaltered.
+++ /dev/null
-#
-# Simple makefile for the sample loadable builtins
-#
-# Copyright (C) 1996 Free Software Foundation, Inc.
-
-# This program 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 2, or (at your option)
-# any later version.
-
-# This program 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 this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
-
-# Include some boilerplate Gnu makefile definitions.
-prefix = @prefix@
-
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir = @libdir@
-infodir = @infodir@
-includedir = @includedir@
-
-topdir = @top_srcdir@
-BUILD_DIR = @BUILD_DIR@
-srcdir = @srcdir@
-VPATH = .:@srcdir@
-
-@SET_MAKE@
-CC = @CC@
-RM = rm -f
-
-SHELL = @MAKE_SHELL@
-
-host_os = @host_os@
-host_cpu = @host_cpu@
-host_vendor = @host_vendor@
-
-CFLAGS = @CFLAGS@
-LOCAL_CFLAGS = @LOCAL_CFLAGS@
-DEFS = @DEFS@
-LOCAL_DEFS = @LOCAL_DEFS@
-
-CPPFLAGS = @CPPFLAGS@
-
-BASHINCDIR = ${topdir}/include
-
-LIBBUILD = ${BUILD_DIR}/lib
-
-INTL_LIBSRC = ${topdir}/lib/intl
-INTL_BUILDDIR = ${LIBBUILD}/intl
-INTL_INC = @INTL_INC@
-LIBINTL_H = @LIBINTL_H@
-
-CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) $(CFLAGS)
-
-#
-# These values are generated for configure by ${topdir}/support/shobj-conf.
-# If your system is not supported by that script, but includes facilities for
-# dynamic loading of shared objects, please update the script and send the
-# changes to bash-maintainers@gnu.org.
-#
-SHOBJ_CC = @SHOBJ_CC@
-SHOBJ_CFLAGS = @SHOBJ_CFLAGS@
-SHOBJ_LD = @SHOBJ_LD@
-SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
-SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
-SHOBJ_LIBS = @SHOBJ_LIBS@
-SHOBJ_STATUS = @SHOBJ_STATUS@
-
-INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
- -I$(BASHINCDIR) -I$(BUILD_DIR) -I$(LIBBUILD) \
- -I$(BUILD_DIR)/builtins $(INTL_INC)
-
-.c.o:
- $(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $<
-
-
-ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
- tty pathchk tee head mkdir rmdir printenv id whoami \
- uname sync push ln unlink cut realpath getconf strftime
-OTHERPROG = necho hello cat
-
-all: $(SHOBJ_STATUS)
-
-supported: $(ALLPROG)
-others: $(OTHERPROG)
-
-unsupported:
- @echo "Your system (${host_os}) is not supported by the"
- @echo "${topdir}/support/shobj-conf script."
- @echo "If your operating system provides facilities for dynamic"
- @echo "loading of shared objects using the dlopen(3) interface,"
- @echo "please update the script and re-run configure.
- @echo "Please send the changes you made to bash-maintainers@gnu.org"
- @echo "for inclusion in future bash releases."
-
-everything: supported others
-
-print: print.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ print.o $(SHOBJ_LIBS)
-
-necho: necho.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ necho.o $(SHOBJ_LIBS)
-
-getconf: getconf.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ getconf.o $(SHOBJ_LIBS)
-
-hello: hello.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ hello.o $(SHOBJ_LIBS)
-
-truefalse: truefalse.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ truefalse.o $(SHOBJ_LIBS)
-
-sleep: sleep.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sleep.o $(SHOBJ_LIBS)
-
-finfo: finfo.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ finfo.o $(SHOBJ_LIBS)
-
-cat: cat.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cat.o $(SHOBJ_LIBS)
-
-logname: logname.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ logname.o $(SHOBJ_LIBS)
-
-basename: basename.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ basename.o $(SHOBJ_LIBS)
-
-dirname: dirname.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ dirname.o $(SHOBJ_LIBS)
-
-tty: tty.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ tty.o $(SHOBJ_LIBS)
-
-pathchk: pathchk.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pathchk.o $(SHOBJ_LIBS)
-
-tee: tee.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ tee.o $(SHOBJ_LIBS)
-
-mkdir: mkdir.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ mkdir.o $(SHOBJ_LIBS)
-
-rmdir: rmdir.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ rmdir.o $(SHOBJ_LIBS)
-
-head: head.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ head.o $(SHOBJ_LIBS)
-
-printenv: printenv.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ printenv.o $(SHOBJ_LIBS)
-
-id: id.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ id.o $(SHOBJ_LIBS)
-
-whoami: whoami.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ whoami.o $(SHOBJ_LIBS)
-
-uname: uname.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ uname.o $(SHOBJ_LIBS)
-
-sync: sync.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sync.o $(SHOBJ_LIBS)
-
-push: push.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ push.o $(SHOBJ_LIBS)
-
-ln: ln.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ ln.o $(SHOBJ_LIBS)
-
-unlink: unlink.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ unlink.o $(SHOBJ_LIBS)
-
-cut: cut.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cut.o $(SHOBJ_LIBS)
-
-realpath: realpath.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS)
-
-strftime: strftime.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ strftime.o $(SHOBJ_LIBS)
-
-# pushd is a special case. We use the same source that the builtin version
-# uses, with special compilation options.
-#
-pushd.c: ${topdir}/builtins/pushd.def
- $(RM) $@
- ${BUILD_DIR}/builtins/mkbuiltins -D ${topdir}/builtins ${topdir}/builtins/pushd.def
-
-pushd.o: pushd.c
- $(RM) $@
- $(SHOBJ_CC) -DHAVE_CONFIG_H -DPUSHD_AND_POPD -DLOADABLE_BUILTIN $(SHOBJ_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INC) -c -o $@ $<
-
-pushd: pushd.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pushd.o $(SHOBJ_LIBS)
-
-clean:
- $(RM) $(ALLPROG) $(OTHERPROG) *.o
- -( cd perl && ${MAKE} ${MFLAGS} $@ )
-
-mostlyclean: clean
- -( cd perl && ${MAKE} ${MFLAGS} $@ )
-
-distclean maintainer-clean: clean
- $(RM) Makefile pushd.c
- -( cd perl && ${MAKE} ${MFLAGS} $@ )
-
-print.o: print.c
-truefalse.o: truefalse.c
-sleep.o: sleep.c
-finfo.o: finfo.c
-logname.o: logname.c
-basename.o: basename.c
-dirname.o: dirname.c
-tty.o: tty.c
-pathchk.o: pathchk.c
-tee.o: tee.c
-head.o: head.c
-rmdir.o: rmdir.c
-necho.o: necho.c
-getconf.o: getconf.c
-hello.o: hello.c
-cat.o: cat.c
-printenv.o: printenv.c
-id.o: id.c
-whoami.o: whoami.c
-uname.o: uname.c
-sync.o: sync.c
-push.o: push.c
-mkdir.o: mkdir.c
-realpath.o: realpath.c
-strftime.o: strftime.c
+++ /dev/null
-#
-# Simple makefile for the sample loadable builtins
-#
-# Copyright (C) 1996-2009 Free Software Foundation, Inc.
-
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-# Include some boilerplate Gnu makefile definitions.
-prefix = @prefix@
-
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir = @libdir@
-infodir = @infodir@
-includedir = @includedir@
-
-datarootdir = @datarootdir@
-
-topdir = @top_srcdir@
-BUILD_DIR = @BUILD_DIR@
-srcdir = @srcdir@
-VPATH = .:@srcdir@
-
-@SET_MAKE@
-CC = @CC@
-RM = rm -f
-
-SHELL = @MAKE_SHELL@
-
-host_os = @host_os@
-host_cpu = @host_cpu@
-host_vendor = @host_vendor@
-
-CFLAGS = @CFLAGS@
-LOCAL_CFLAGS = @LOCAL_CFLAGS@
-DEFS = @DEFS@
-LOCAL_DEFS = @LOCAL_DEFS@
-
-CPPFLAGS = @CPPFLAGS@
-
-BASHINCDIR = ${topdir}/include
-
-LIBBUILD = ${BUILD_DIR}/lib
-
-INTL_LIBSRC = ${topdir}/lib/intl
-INTL_BUILDDIR = ${LIBBUILD}/intl
-INTL_INC = @INTL_INC@
-LIBINTL_H = @LIBINTL_H@
-
-CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) $(CFLAGS)
-
-#
-# These values are generated for configure by ${topdir}/support/shobj-conf.
-# If your system is not supported by that script, but includes facilities for
-# dynamic loading of shared objects, please update the script and send the
-# changes to bash-maintainers@gnu.org.
-#
-SHOBJ_CC = @SHOBJ_CC@
-SHOBJ_CFLAGS = @SHOBJ_CFLAGS@
-SHOBJ_LD = @SHOBJ_LD@
-SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@ @LDFLAGS@
-SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
-SHOBJ_LIBS = @SHOBJ_LIBS@
-SHOBJ_STATUS = @SHOBJ_STATUS@
-
-INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
- -I$(BASHINCDIR) -I$(BUILD_DIR) -I$(LIBBUILD) \
- -I$(BUILD_DIR)/builtins $(INTL_INC)
-
-.c.o:
- $(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $<
-
-
-ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
- tty pathchk tee head mkdir rmdir printenv id whoami \
- uname sync push ln unlink cut realpath getconf strftime mypid
-OTHERPROG = necho hello cat
-
-all: $(SHOBJ_STATUS)
-
-supported: $(ALLPROG)
-others: $(OTHERPROG)
-
-unsupported:
- @echo "Your system (${host_os}) is not supported by the"
- @echo "${topdir}/support/shobj-conf script."
- @echo "If your operating system provides facilities for dynamic"
- @echo "loading of shared objects using the dlopen(3) interface,"
- @echo "please update the script and re-run configure.
- @echo "Please send the changes you made to bash-maintainers@gnu.org"
- @echo "for inclusion in future bash releases."
-
-everything: supported others
-
-print: print.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ print.o $(SHOBJ_LIBS)
-
-necho: necho.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ necho.o $(SHOBJ_LIBS)
-
-getconf: getconf.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ getconf.o $(SHOBJ_LIBS)
-
-hello: hello.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ hello.o $(SHOBJ_LIBS)
-
-truefalse: truefalse.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ truefalse.o $(SHOBJ_LIBS)
-
-sleep: sleep.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sleep.o $(SHOBJ_LIBS)
-
-finfo: finfo.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ finfo.o $(SHOBJ_LIBS)
-
-cat: cat.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cat.o $(SHOBJ_LIBS)
-
-logname: logname.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ logname.o $(SHOBJ_LIBS)
-
-basename: basename.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ basename.o $(SHOBJ_LIBS)
-
-dirname: dirname.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ dirname.o $(SHOBJ_LIBS)
-
-tty: tty.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ tty.o $(SHOBJ_LIBS)
-
-pathchk: pathchk.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pathchk.o $(SHOBJ_LIBS)
-
-tee: tee.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ tee.o $(SHOBJ_LIBS)
-
-mkdir: mkdir.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ mkdir.o $(SHOBJ_LIBS)
-
-rmdir: rmdir.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ rmdir.o $(SHOBJ_LIBS)
-
-head: head.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ head.o $(SHOBJ_LIBS)
-
-printenv: printenv.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ printenv.o $(SHOBJ_LIBS)
-
-id: id.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ id.o $(SHOBJ_LIBS)
-
-whoami: whoami.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ whoami.o $(SHOBJ_LIBS)
-
-uname: uname.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ uname.o $(SHOBJ_LIBS)
-
-sync: sync.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sync.o $(SHOBJ_LIBS)
-
-push: push.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ push.o $(SHOBJ_LIBS)
-
-ln: ln.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ ln.o $(SHOBJ_LIBS)
-
-unlink: unlink.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ unlink.o $(SHOBJ_LIBS)
-
-cut: cut.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cut.o $(SHOBJ_LIBS)
-
-realpath: realpath.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS)
-
-strftime: strftime.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ strftime.o $(SHOBJ_LIBS)
-
-mypid: mypid.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ mypid.o $(SHOBJ_LIBS)
-
-# pushd is a special case. We use the same source that the builtin version
-# uses, with special compilation options.
-#
-pushd.c: ${topdir}/builtins/pushd.def
- $(RM) $@
- ${BUILD_DIR}/builtins/mkbuiltins -D ${topdir}/builtins ${topdir}/builtins/pushd.def
-
-pushd.o: pushd.c
- $(RM) $@
- $(SHOBJ_CC) -DHAVE_CONFIG_H -DPUSHD_AND_POPD -DLOADABLE_BUILTIN $(SHOBJ_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INC) -c -o $@ $<
-
-pushd: pushd.o
- $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pushd.o $(SHOBJ_LIBS)
-
-clean:
- $(RM) $(ALLPROG) $(OTHERPROG) *.o
- -( cd perl && ${MAKE} ${MFLAGS} $@ )
-
-mostlyclean: clean
- -( cd perl && ${MAKE} ${MFLAGS} $@ )
-
-distclean maintainer-clean: clean
- $(RM) Makefile pushd.c
- -( cd perl && ${MAKE} ${MFLAGS} $@ )
-
-print.o: print.c
-truefalse.o: truefalse.c
-sleep.o: sleep.c
-finfo.o: finfo.c
-logname.o: logname.c
-basename.o: basename.c
-dirname.o: dirname.c
-tty.o: tty.c
-pathchk.o: pathchk.c
-tee.o: tee.c
-head.o: head.c
-rmdir.o: rmdir.c
-necho.o: necho.c
-getconf.o: getconf.c
-hello.o: hello.c
-cat.o: cat.c
-printenv.o: printenv.c
-id.o: id.c
-whoami.o: whoami.c
-uname.o: uname.c
-sync.o: sync.c
-push.o: push.c
-mkdir.o: mkdir.c
-realpath.o: realpath.c
-strftime.o: strftime.c
-mypid.o: mypid.c
+++ /dev/null
-/* jobs.c - functions that make children, remember them, and handle their termination. */
-
-/* This file works with both POSIX and BSD systems. It implements job
- control. */
-
-/* Copyright (C) 1989-2013 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "config.h"
-
-#include "bashtypes.h"
-#include "trap.h"
-#include <stdio.h>
-#include <signal.h>
-#include <errno.h>
-
-#if defined (HAVE_UNISTD_H)
-# include <unistd.h>
-#endif
-
-#include "posixtime.h"
-
-#if defined (HAVE_SYS_RESOURCE_H) && defined (HAVE_WAIT3) && !defined (_POSIX_VERSION) && !defined (RLIMTYPE)
-# include <sys/resource.h>
-#endif /* !_POSIX_VERSION && HAVE_SYS_RESOURCE_H && HAVE_WAIT3 && !RLIMTYPE */
-
-#if defined (HAVE_SYS_FILE_H)
-# include <sys/file.h>
-#endif
-
-#include "filecntl.h"
-#include <sys/ioctl.h>
-#if defined (HAVE_SYS_PARAM_H)
-#include <sys/param.h>
-#endif
-
-#if defined (BUFFERED_INPUT)
-# include "input.h"
-#endif
-
-/* Need to include this up here for *_TTY_DRIVER definitions. */
-#include "shtty.h"
-
-/* Define this if your output is getting swallowed. It's a no-op on
- machines with the termio or termios tty drivers. */
-/* #define DRAIN_OUTPUT */
-
-/* For the TIOCGPGRP and TIOCSPGRP ioctl parameters on HP-UX */
-#if defined (hpux) && !defined (TERMIOS_TTY_DRIVER)
-# include <bsdtty.h>
-#endif /* hpux && !TERMIOS_TTY_DRIVER */
-
-#include "bashansi.h"
-#include "bashintl.h"
-#include "shell.h"
-#include "jobs.h"
-#include "execute_cmd.h"
-#include "flags.h"
-
-#include "builtins/builtext.h"
-#include "builtins/common.h"
-
-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
-
-#if !defined (HAVE_KILLPG)
-extern int killpg __P((pid_t, int));
-#endif
-
-#if !DEFAULT_CHILD_MAX
-# define DEFAULT_CHILD_MAX 32
-#endif
-
-#if !MAX_CHILD_MAX
-# define MAX_CHILD_MAX 8192
-#endif
-
-#if !defined (DEBUG)
-#define MAX_JOBS_IN_ARRAY 4096 /* production */
-#else
-#define MAX_JOBS_IN_ARRAY 128 /* testing */
-#endif
-
-/* Flag values for second argument to delete_job */
-#define DEL_WARNSTOPPED 1 /* warn about deleting stopped jobs */
-#define DEL_NOBGPID 2 /* don't add pgrp leader to bgpids */
-
-/* Take care of system dependencies that must be handled when waiting for
- children. The arguments to the WAITPID macro match those to the Posix.1
- waitpid() function. */
-
-#if defined (ultrix) && defined (mips) && defined (_POSIX_VERSION)
-# define WAITPID(pid, statusp, options) \
- wait3 ((union wait *)statusp, options, (struct rusage *)0)
-#else
-# if defined (_POSIX_VERSION) || defined (HAVE_WAITPID)
-# define WAITPID(pid, statusp, options) \
- waitpid ((pid_t)pid, statusp, options)
-# else
-# if defined (HAVE_WAIT3)
-# define WAITPID(pid, statusp, options) \
- wait3 (statusp, options, (struct rusage *)0)
-# else
-# define WAITPID(pid, statusp, options) \
- wait3 (statusp, options, (int *)0)
-# endif /* HAVE_WAIT3 */
-# endif /* !_POSIX_VERSION && !HAVE_WAITPID*/
-#endif /* !(Ultrix && mips && _POSIX_VERSION) */
-
-/* getpgrp () varies between systems. Even systems that claim to be
- Posix.1 compatible lie sometimes (Ultrix, SunOS4, apollo). */
-#if defined (GETPGRP_VOID)
-# define getpgid(p) getpgrp ()
-#else
-# define getpgid(p) getpgrp (p)
-#endif /* !GETPGRP_VOID */
-
-/* If the system needs it, REINSTALL_SIGCHLD_HANDLER will reinstall the
- handler for SIGCHLD. */
-#if defined (MUST_REINSTALL_SIGHANDLERS)
-# define REINSTALL_SIGCHLD_HANDLER signal (SIGCHLD, sigchld_handler)
-#else
-# define REINSTALL_SIGCHLD_HANDLER
-#endif /* !MUST_REINSTALL_SIGHANDLERS */
-
-/* Some systems let waitpid(2) tell callers about stopped children. */
-#if !defined (WCONTINUED) || defined (WCONTINUED_BROKEN)
-# undef WCONTINUED
-# define WCONTINUED 0
-#endif
-#if !defined (WIFCONTINUED)
-# define WIFCONTINUED(s) (0)
-#endif
-
-/* The number of additional slots to allocate when we run out. */
-#define JOB_SLOTS 8
-
-typedef int sh_job_map_func_t __P((JOB *, int, int, int));
-
-/* Variables used here but defined in other files. */
-extern int subshell_environment, line_number;
-extern int posixly_correct, shell_level;
-extern int last_command_exit_value, last_command_exit_signal;
-extern int loop_level, breaking;
-extern int executing_list;
-extern int sourcelevel;
-extern int running_trap;
-extern sh_builtin_func_t *this_shell_builtin;
-extern char *shell_name, *this_command_name;
-extern sigset_t top_level_mask;
-extern procenv_t wait_intr_buf;
-extern int wait_signal_received;
-extern WORD_LIST *subst_assign_varlist;
-
-static struct jobstats zerojs = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NO_JOB, NO_JOB, 0, 0 };
-struct jobstats js = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NO_JOB, NO_JOB, 0, 0 };
-
-struct bgpids bgpids = { 0, 0, 0 };
-
-/* The array of known jobs. */
-JOB **jobs = (JOB **)NULL;
-
-#if 0
-/* The number of slots currently allocated to JOBS. */
-int job_slots = 0;
-#endif
-
-/* The controlling tty for this shell. */
-int shell_tty = -1;
-
-/* The shell's process group. */
-pid_t shell_pgrp = NO_PID;
-
-/* The terminal's process group. */
-pid_t terminal_pgrp = NO_PID;
-
-/* The process group of the shell's parent. */
-pid_t original_pgrp = NO_PID;
-
-/* The process group of the pipeline currently being made. */
-pid_t pipeline_pgrp = (pid_t)0;
-
-#if defined (PGRP_PIPE)
-/* Pipes which each shell uses to communicate with the process group leader
- until all of the processes in a pipeline have been started. Then the
- process leader is allowed to continue. */
-int pgrp_pipe[2] = { -1, -1 };
-#endif
-
-#if 0
-/* The job which is current; i.e. the one that `%+' stands for. */
-int current_job = NO_JOB;
-
-/* The previous job; i.e. the one that `%-' stands for. */
-int previous_job = NO_JOB;
-#endif
-
-/* Last child made by the shell. */
-volatile pid_t last_made_pid = NO_PID;
-
-/* Pid of the last asynchronous child. */
-volatile pid_t last_asynchronous_pid = NO_PID;
-
-/* The pipeline currently being built. */
-PROCESS *the_pipeline = (PROCESS *)NULL;
-
-/* If this is non-zero, do job control. */
-int job_control = 1;
-
-/* Call this when you start making children. */
-int already_making_children = 0;
-
-/* If this is non-zero, $LINES and $COLUMNS are reset after every process
- exits from get_tty_state(). */
-int check_window_size = CHECKWINSIZE_DEFAULT;
-
-/* Functions local to this file. */
-
-static sighandler wait_sigint_handler __P((int));
-static sighandler sigchld_handler __P((int));
-static sighandler sigcont_sighandler __P((int));
-static sighandler sigstop_sighandler __P((int));
-
-static int waitchld __P((pid_t, int));
-
-static PROCESS *find_pipeline __P((pid_t, int, int *));
-static PROCESS *find_process __P((pid_t, int, int *));
-
-static char *current_working_directory __P((void));
-static char *job_working_directory __P((void));
-static char *j_strsignal __P((int));
-static char *printable_job_status __P((int, PROCESS *, int));
-
-static PROCESS *find_last_proc __P((int, int));
-static pid_t find_last_pid __P((int, int));
-
-static int set_new_line_discipline __P((int));
-static int map_over_jobs __P((sh_job_map_func_t *, int, int));
-static int job_last_stopped __P((int));
-static int job_last_running __P((int));
-static int most_recent_job_in_state __P((int, JOB_STATE));
-static int find_job __P((pid_t, int, PROCESS **));
-static int print_job __P((JOB *, int, int, int));
-static int process_exit_status __P((WAIT));
-static int process_exit_signal __P((WAIT));
-static int set_job_status_and_cleanup __P((int));
-
-static WAIT job_signal_status __P((int));
-static WAIT raw_job_exit_status __P((int));
-
-static void notify_of_job_status __P((void));
-static void reset_job_indices __P((void));
-static void cleanup_dead_jobs __P((void));
-static int processes_in_job __P((int));
-static void realloc_jobs_list __P((void));
-static int compact_jobs_list __P((int));
-static int discard_pipeline __P((PROCESS *));
-static void add_process __P((char *, pid_t));
-static void print_pipeline __P((PROCESS *, int, int, FILE *));
-static void pretty_print_job __P((int, int, FILE *));
-static void set_current_job __P((int));
-static void reset_current __P((void));
-static void set_job_running __P((int));
-static void setjstatus __P((int));
-static int maybe_give_terminal_to __P((pid_t, pid_t, int));
-static void mark_all_jobs_as_dead __P((void));
-static void mark_dead_jobs_as_notified __P((int));
-static void restore_sigint_handler __P((void));
-#if defined (PGRP_PIPE)
-static void pipe_read __P((int *));
-#endif
-
-static struct pidstat *bgp_alloc __P((pid_t, int));
-static struct pidstat *bgp_add __P((pid_t, int));
-static int bgp_delete __P((pid_t));
-static void bgp_clear __P((void));
-static int bgp_search __P((pid_t));
-static void bgp_prune __P((void));
-
-#if defined (ARRAY_VARS)
-static int *pstatuses; /* list of pipeline statuses */
-static int statsize;
-#endif
-
-/* Used to synchronize between wait_for and other functions and the SIGCHLD
- signal handler. */
-static int sigchld;
-static int queue_sigchld;
-
-#define QUEUE_SIGCHLD(os) (os) = sigchld, queue_sigchld++
-
-#define UNQUEUE_SIGCHLD(os) \
- do { \
- queue_sigchld--; \
- if (queue_sigchld == 0 && os != sigchld) \
- waitchld (-1, 0); \
- } while (0)
-
-static SigHandler *old_tstp, *old_ttou, *old_ttin;
-static SigHandler *old_cont = (SigHandler *)SIG_DFL;
-
-/* A place to temporarily save the current pipeline. */
-static PROCESS *saved_pipeline;
-static int saved_already_making_children;
-
-/* Set this to non-zero whenever you don't want the jobs list to change at
- all: no jobs deleted and no status change notifications. This is used,
- for example, when executing SIGCHLD traps, which may run arbitrary
- commands. */
-static int jobs_list_frozen;
-
-static char retcode_name_buffer[64];
-
-#if !defined (_POSIX_VERSION)
-
-/* These are definitions to map POSIX 1003.1 functions onto existing BSD
- library functions and system calls. */
-#define setpgid(pid, pgrp) setpgrp (pid, pgrp)
-#define tcsetpgrp(fd, pgrp) ioctl ((fd), TIOCSPGRP, &(pgrp))
-
-pid_t
-tcgetpgrp (fd)
- int fd;
-{
- pid_t pgrp;
-
- /* ioctl will handle setting errno correctly. */
- if (ioctl (fd, TIOCGPGRP, &pgrp) < 0)
- return (-1);
- return (pgrp);
-}
-
-#endif /* !_POSIX_VERSION */
-
-/* Initialize the global job stats structure and other bookkeeping variables */
-void
-init_job_stats ()
-{
- js = zerojs;
-}
-
-/* Return the working directory for the current process. Unlike
- job_working_directory, this does not call malloc (), nor do any
- of the functions it calls. This is so that it can safely be called
- from a signal handler. */
-static char *
-current_working_directory ()
-{
- char *dir;
- static char d[PATH_MAX];
-
- dir = get_string_value ("PWD");
-
- if (dir == 0 && the_current_working_directory && no_symbolic_links)
- dir = the_current_working_directory;
-
- if (dir == 0)
- {
- dir = getcwd (d, sizeof(d));
- if (dir)
- dir = d;
- }
-
- return (dir == 0) ? "<unknown>" : dir;
-}
-
-/* Return the working directory for the current process. */
-static char *
-job_working_directory ()
-{
- char *dir;
-
- dir = get_string_value ("PWD");
- if (dir)
- return (savestring (dir));
-
- dir = get_working_directory ("job-working-directory");
- if (dir)
- return (dir);
-
- return (savestring ("<unknown>"));
-}
-
-void
-making_children ()
-{
- if (already_making_children)
- return;
-
- already_making_children = 1;
- start_pipeline ();
-}
-
-void
-stop_making_children ()
-{
- already_making_children = 0;
-}
-
-void
-cleanup_the_pipeline ()
-{
- PROCESS *disposer;
- sigset_t set, oset;
-
- BLOCK_CHILD (set, oset);
- disposer = the_pipeline;
- the_pipeline = (PROCESS *)NULL;
- UNBLOCK_CHILD (oset);
-
- if (disposer)
- discard_pipeline (disposer);
-}
-
-void
-save_pipeline (clear)
- int clear;
-{
- saved_pipeline = the_pipeline;
- if (clear)
- the_pipeline = (PROCESS *)NULL;
- saved_already_making_children = already_making_children;
-}
-
-void
-restore_pipeline (discard)
- int discard;
-{
- PROCESS *old_pipeline;
-
- old_pipeline = the_pipeline;
- the_pipeline = saved_pipeline;
- already_making_children = saved_already_making_children;
- if (discard && old_pipeline)
- discard_pipeline (old_pipeline);
-}
-
-/* Start building a pipeline. */
-void
-start_pipeline ()
-{
- if (the_pipeline)
- {
- cleanup_the_pipeline ();
- pipeline_pgrp = 0;
-#if defined (PGRP_PIPE)
- sh_closepipe (pgrp_pipe);
-#endif
- }
-
-#if defined (PGRP_PIPE)
- if (job_control)
- {
- if (pipe (pgrp_pipe) == -1)
- sys_error (_("start_pipeline: pgrp pipe"));
- }
-#endif
-}
-
-/* Stop building a pipeline. Install the process list in the job array.
- This returns the index of the newly installed job.
- DEFERRED is a command structure to be executed upon satisfactory
- execution exit of this pipeline. */
-int
-stop_pipeline (async, deferred)
- int async;
- COMMAND *deferred;
-{
- register int i, j;
- JOB *newjob;
- sigset_t set, oset;
-
- BLOCK_CHILD (set, oset);
-
-#if defined (PGRP_PIPE)
- /* The parent closes the process group synchronization pipe. */
- sh_closepipe (pgrp_pipe);
-#endif
-
- cleanup_dead_jobs ();
-
- if (js.j_jobslots == 0)
- {
- js.j_jobslots = JOB_SLOTS;
- jobs = (JOB **)xmalloc (js.j_jobslots * sizeof (JOB *));
-
- /* Now blank out these new entries. */
- for (i = 0; i < js.j_jobslots; i++)
- jobs[i] = (JOB *)NULL;
-
- js.j_firstj = js.j_lastj = js.j_njobs = 0;
- }
-
- /* Scan from the last slot backward, looking for the next free one. */
- /* XXX - revisit this interactive assumption */
- /* XXX - this way for now */
- if (interactive)
- {
- for (i = js.j_jobslots; i; i--)
- if (jobs[i - 1])
- break;
- }
- else
- {
-#if 0
- /* This wraps around, but makes it inconvenient to extend the array */
- for (i = js.j_lastj+1; i != js.j_lastj; i++)
- {
- if (i >= js.j_jobslots)
- i = 0;
- if (jobs[i] == 0)
- break;
- }
- if (i == js.j_lastj)
- i = js.j_jobslots;
-#else
- /* This doesn't wrap around yet. */
- for (i = js.j_lastj ? js.j_lastj + 1 : js.j_lastj; i < js.j_jobslots; i++)
- if (jobs[i] == 0)
- break;
-#endif
- }
-
- /* Do we need more room? */
-
- /* First try compaction */
- if ((interactive_shell == 0 || subshell_environment) && i == js.j_jobslots && js.j_jobslots >= MAX_JOBS_IN_ARRAY)
- i = compact_jobs_list (0);
-
- /* If we can't compact, reallocate */
- if (i == js.j_jobslots)
- {
- js.j_jobslots += JOB_SLOTS;
- jobs = (JOB **)xrealloc (jobs, (js.j_jobslots * sizeof (JOB *)));
-
- for (j = i; j < js.j_jobslots; j++)
- jobs[j] = (JOB *)NULL;
- }
-
- /* Add the current pipeline to the job list. */
- if (the_pipeline)
- {
- register PROCESS *p;
- int any_running, any_stopped, n;
-
- newjob = (JOB *)xmalloc (sizeof (JOB));
-
- for (n = 1, p = the_pipeline; p->next != the_pipeline; n++, p = p->next)
- ;
- p->next = (PROCESS *)NULL;
- newjob->pipe = REVERSE_LIST (the_pipeline, PROCESS *);
- for (p = newjob->pipe; p->next; p = p->next)
- ;
- p->next = newjob->pipe;
-
- the_pipeline = (PROCESS *)NULL;
- newjob->pgrp = pipeline_pgrp;
- pipeline_pgrp = 0;
-
- newjob->flags = 0;
-
- /* Flag to see if in another pgrp. */
- if (job_control)
- newjob->flags |= J_JOBCONTROL;
-
- /* Set the state of this pipeline. */
- p = newjob->pipe;
- any_running = any_stopped = 0;
- do
- {
- any_running |= PRUNNING (p);
- any_stopped |= PSTOPPED (p);
- p = p->next;
- }
- while (p != newjob->pipe);
-
- newjob->state = any_running ? JRUNNING : (any_stopped ? JSTOPPED : JDEAD);
- newjob->wd = job_working_directory ();
- newjob->deferred = deferred;
-
- newjob->j_cleanup = (sh_vptrfunc_t *)NULL;
- newjob->cleanarg = (PTR_T) NULL;
-
- jobs[i] = newjob;
- if (newjob->state == JDEAD && (newjob->flags & J_FOREGROUND))
- setjstatus (i);
- if (newjob->state == JDEAD)
- {
- js.c_reaped += n; /* wouldn't have been done since this was not part of a job */
- js.j_ndead++;
- }
- js.c_injobs += n;
-
- js.j_lastj = i;
- js.j_njobs++;
- }
- else
- newjob = (JOB *)NULL;
-
- if (newjob)
- js.j_lastmade = newjob;
-
- if (async)
- {
- if (newjob)
- {
- newjob->flags &= ~J_FOREGROUND;
- newjob->flags |= J_ASYNC;
- js.j_lastasync = newjob;
- }
- reset_current ();
- }
- else
- {
- if (newjob)
- {
- newjob->flags |= J_FOREGROUND;
- /*
- * !!!!! NOTE !!!!! (chet@ins.cwru.edu)
- *
- * The currently-accepted job control wisdom says to set the
- * terminal's process group n+1 times in an n-step pipeline:
- * once in the parent and once in each child. This is where
- * the parent gives it away.
- *
- * Don't give the terminal away if this shell is an asynchronous
- * subshell.
- *
- */
- if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
- maybe_give_terminal_to (shell_pgrp, newjob->pgrp, 0);
- }
- }
-
- stop_making_children ();
- UNBLOCK_CHILD (oset);
- return (newjob ? i : js.j_current);
-}
-
-/* Functions to manage the list of exited background pids whose status has
- been saved. */
-
-static struct pidstat *
-bgp_alloc (pid, status)
- pid_t pid;
- int status;
-{
- struct pidstat *ps;
-
- ps = (struct pidstat *)xmalloc (sizeof (struct pidstat));
- ps->pid = pid;
- ps->status = status;
- ps->next = (struct pidstat *)0;
- return ps;
-}
-
-static struct pidstat *
-bgp_add (pid, status)
- pid_t pid;
- int status;
-{
- struct pidstat *ps;
-
- ps = bgp_alloc (pid, status);
-
- if (bgpids.list == 0)
- {
- bgpids.list = bgpids.end = ps;
- bgpids.npid = 0; /* just to make sure */
- }
- else
- {
- bgpids.end->next = ps;
- bgpids.end = ps;
- }
- bgpids.npid++;
-
- if (bgpids.npid > js.c_childmax)
- bgp_prune ();
-
- return ps;
-}
-
-static int
-bgp_delete (pid)
- pid_t pid;
-{
- struct pidstat *prev, *p;
-
- for (prev = p = bgpids.list; p; prev = p, p = p->next)
- if (p->pid == pid)
- {
- prev->next = p->next; /* remove from list */
- break;
- }
-
- if (p == 0)
- return 0; /* not found */
-
-#if defined (DEBUG)
- itrace("bgp_delete: deleting %d", pid);
-#endif
-
- /* Housekeeping in the border cases. */
- if (p == bgpids.list)
- bgpids.list = bgpids.list->next;
- else if (p == bgpids.end)
- bgpids.end = prev;
-
- bgpids.npid--;
- if (bgpids.npid == 0)
- bgpids.list = bgpids.end = 0;
- else if (bgpids.npid == 1)
- bgpids.end = bgpids.list; /* just to make sure */
-
- free (p);
- return 1;
-}
-
-/* Clear out the list of saved statuses */
-static void
-bgp_clear ()
-{
- struct pidstat *ps, *p;
-
- for (ps = bgpids.list; ps; )
- {
- p = ps;
- ps = ps->next;
- free (p);
- }
- bgpids.list = bgpids.end = 0;
- bgpids.npid = 0;
-}
-
-/* Search for PID in the list of saved background pids; return its status if
- found. If not found, return -1. */
-static int
-bgp_search (pid)
- pid_t pid;
-{
- struct pidstat *ps;
-
- for (ps = bgpids.list ; ps; ps = ps->next)
- if (ps->pid == pid)
- return ps->status;
- return -1;
-}
-
-static void
-bgp_prune ()
-{
- struct pidstat *ps;
-
- while (bgpids.npid > js.c_childmax)
- {
- ps = bgpids.list;
- bgpids.list = bgpids.list->next;
- free (ps);
- bgpids.npid--;
- }
-}
-
-/* Reset the values of js.j_lastj and js.j_firstj after one or both have
- been deleted. The caller should check whether js.j_njobs is 0 before
- calling this. This wraps around, but the rest of the code does not. At
- this point, it should not matter. */
-static void
-reset_job_indices ()
-{
- int old;
-
- if (jobs[js.j_firstj] == 0)
- {
- old = js.j_firstj++;
- if (old >= js.j_jobslots)
- old = js.j_jobslots - 1;
- while (js.j_firstj != old)
- {
- if (js.j_firstj >= js.j_jobslots)
- js.j_firstj = 0;
- if (jobs[js.j_firstj] || js.j_firstj == old) /* needed if old == 0 */
- break;
- js.j_firstj++;
- }
- if (js.j_firstj == old)
- js.j_firstj = js.j_lastj = js.j_njobs = 0;
- }
- if (jobs[js.j_lastj] == 0)
- {
- old = js.j_lastj--;
- if (old < 0)
- old = 0;
- while (js.j_lastj != old)
- {
- if (js.j_lastj < 0)
- js.j_lastj = js.j_jobslots - 1;
- if (jobs[js.j_lastj] || js.j_lastj == old) /* needed if old == js.j_jobslots */
- break;
- js.j_lastj--;
- }
- if (js.j_lastj == old)
- js.j_firstj = js.j_lastj = js.j_njobs = 0;
- }
-}
-
-/* Delete all DEAD jobs that the user had received notification about. */
-static void
-cleanup_dead_jobs ()
-{
- register int i;
- int os;
-
- if (js.j_jobslots == 0 || jobs_list_frozen)
- return;
-
- QUEUE_SIGCHLD(os);
-
- /* XXX could use js.j_firstj and js.j_lastj here */
- for (i = 0; i < js.j_jobslots; i++)
- {
-#if defined (DEBUG)
- if (i < js.j_firstj && jobs[i])
- itrace("cleanup_dead_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
- if (i > js.j_lastj && jobs[i])
- itrace("cleanup_dead_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
-#endif
-
- if (jobs[i] && DEADJOB (i) && IS_NOTIFIED (i))
- delete_job (i, 0);
- }
-
-#if defined (COPROCESS_SUPPORT)
- coproc_reap ();
-#endif
-
- UNQUEUE_SIGCHLD(os);
-}
-
-static int
-processes_in_job (job)
- int job;
-{
- int nproc;
- register PROCESS *p;
-
- nproc = 0;
- p = jobs[job]->pipe;
- do
- {
- p = p->next;
- nproc++;
- }
- while (p != jobs[job]->pipe);
-
- return nproc;
-}
-
-static void
-delete_old_job (pid)
- pid_t pid;
-{
- PROCESS *p;
- int job;
-
- job = find_job (pid, 0, &p);
- if (job != NO_JOB)
- {
-#ifdef DEBUG
- itrace ("delete_old_job: found pid %d in job %d with state %d", pid, job, jobs[job]->state);
-#endif
- if (JOBSTATE (job) == JDEAD)
- delete_job (job, DEL_NOBGPID);
- else
- {
- internal_warning (_("forked pid %d appears in running job %d"), pid, job);
- if (p)
- p->pid = 0;
- }
- }
-}
-
-/* Reallocate and compress the jobs list. This returns with a jobs array
- whose size is a multiple of JOB_SLOTS and can hold the current number of
- jobs. Heuristics are used to minimize the number of new reallocs. */
-static void
-realloc_jobs_list ()
-{
- sigset_t set, oset;
- int nsize, i, j, ncur, nprev;
- JOB **nlist;
-
- ncur = nprev = NO_JOB;
- nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
- nsize *= JOB_SLOTS;
- i = js.j_njobs % JOB_SLOTS;
- if (i == 0 || i > (JOB_SLOTS >> 1))
- nsize += JOB_SLOTS;
-
- BLOCK_CHILD (set, oset);
- nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
-
- js.c_reaped = js.j_ndead = 0;
- for (i = j = 0; i < js.j_jobslots; i++)
- if (jobs[i])
- {
- if (i == js.j_current)
- ncur = j;
- if (i == js.j_previous)
- nprev = j;
- nlist[j++] = jobs[i];
- if (jobs[i]->state == JDEAD)
- {
- js.j_ndead++;
- js.c_reaped += processes_in_job (i);
- }
- }
-
-#if 0
- itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
- itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
- itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, j);
- itrace ("realloc_jobs_list: js.j_ndead %d js.c_reaped %d", js.j_ndead, js.c_reaped);
-#endif
-
- js.j_firstj = 0;
- js.j_lastj = (j > 0) ? j - 1 : 0;
- js.j_njobs = j;
- js.j_jobslots = nsize;
-
- /* Zero out remaining slots in new jobs list */
- for ( ; j < nsize; j++)
- nlist[j] = (JOB *)NULL;
-
- if (jobs != nlist)
- {
- free (jobs);
- jobs = nlist;
- }
-
- if (ncur != NO_JOB)
- js.j_current = ncur;
- if (nprev != NO_JOB)
- js.j_previous = nprev;
-
- /* Need to reset these */
- if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
- reset_current ();
-
-#if 0
- itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
-#endif
-
- UNBLOCK_CHILD (oset);
-}
-
-/* Compact the jobs list by removing dead jobs. Assume that we have filled
- the jobs array to some predefined maximum. Called when the shell is not
- the foreground process (subshell_environment != 0). Returns the first
- available slot in the compacted list. If that value is js.j_jobslots, then
- the list needs to be reallocated. The jobs array may be in new memory if
- this returns > 0 and < js.j_jobslots. FLAGS is reserved for future use. */
-static int
-compact_jobs_list (flags)
- int flags;
-{
- if (js.j_jobslots == 0 || jobs_list_frozen)
- return js.j_jobslots;
-
- reap_dead_jobs ();
- realloc_jobs_list ();
-
-#if 0
- itrace("compact_jobs_list: returning %d", (js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0);
-#endif
-
- return ((js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0);
-}
-
-/* Delete the job at INDEX from the job list. Must be called
- with SIGCHLD blocked. */
-void
-delete_job (job_index, dflags)
- int job_index, dflags;
-{
- register JOB *temp;
- PROCESS *proc;
- int ndel;
-
- if (js.j_jobslots == 0 || jobs_list_frozen)
- return;
-
- if ((dflags & DEL_WARNSTOPPED) && subshell_environment == 0 && STOPPED (job_index))
- internal_warning (_("deleting stopped job %d with process group %ld"), job_index+1, (long)jobs[job_index]->pgrp);
- temp = jobs[job_index];
- if (temp == 0)
- return;
-
- if ((dflags & DEL_NOBGPID) == 0)
- {
- proc = find_last_proc (job_index, 0);
- /* Could do this just for J_ASYNC jobs, but we save all. */
- if (proc)
- bgp_add (proc->pid, process_exit_status (proc->status));
- }
-
- jobs[job_index] = (JOB *)NULL;
- if (temp == js.j_lastmade)
- js.j_lastmade = 0;
- else if (temp == js.j_lastasync)
- js.j_lastasync = 0;
-
- free (temp->wd);
- ndel = discard_pipeline (temp->pipe);
-
- js.c_injobs -= ndel;
- if (temp->state == JDEAD)
- {
- js.c_reaped -= ndel;
- js.j_ndead--;
- if (js.c_reaped < 0)
- {
-#ifdef DEBUG
- itrace("delete_job (%d pgrp %d): js.c_reaped (%d) < 0 ndel = %d js.j_ndead = %d", job_index, temp->pgrp, js.c_reaped, ndel, js.j_ndead);
-#endif
- js.c_reaped = 0;
- }
- }
-
- if (temp->deferred)
- dispose_command (temp->deferred);
-
- free (temp);
-
- js.j_njobs--;
- if (js.j_njobs == 0)
- js.j_firstj = js.j_lastj = 0;
- else if (jobs[js.j_firstj] == 0 || jobs[js.j_lastj] == 0)
- reset_job_indices ();
-
- if (job_index == js.j_current || job_index == js.j_previous)
- reset_current ();
-}
-
-/* Must be called with SIGCHLD blocked. */
-void
-nohup_job (job_index)
- int job_index;
-{
- register JOB *temp;
-
- if (js.j_jobslots == 0)
- return;
-
- if (temp = jobs[job_index])
- temp->flags |= J_NOHUP;
-}
-
-/* Get rid of the data structure associated with a process chain. */
-static int
-discard_pipeline (chain)
- register PROCESS *chain;
-{
- register PROCESS *this, *next;
- int n;
-
- this = chain;
- n = 0;
- do
- {
- next = this->next;
- FREE (this->command);
- free (this);
- n++;
- this = next;
- }
- while (this != chain);
-
- return n;
-}
-
-/* Add this process to the chain being built in the_pipeline.
- NAME is the command string that will be exec'ed later.
- PID is the process id of the child. */
-static void
-add_process (name, pid)
- char *name;
- pid_t pid;
-{
- PROCESS *t, *p;
-
-#if defined (RECYCLES_PIDS)
- int j;
- p = find_process (pid, 0, &j);
- if (p)
- {
-# ifdef DEBUG
- if (j == NO_JOB)
- internal_warning (_("add_process: process %5ld (%s) in the_pipeline"), (long)p->pid, p->command);
-# endif
- if (PALIVE (p))
- internal_warning (_("add_process: pid %5ld (%s) marked as still alive"), (long)p->pid, p->command);
- p->running = PS_RECYCLED; /* mark as recycled */
- }
-#endif
-
- t = (PROCESS *)xmalloc (sizeof (PROCESS));
- t->next = the_pipeline;
- t->pid = pid;
- WSTATUS (t->status) = 0;
- t->running = PS_RUNNING;
- t->command = name;
- the_pipeline = t;
-
- if (t->next == 0)
- t->next = t;
- else
- {
- p = t->next;
- while (p->next != t->next)
- p = p->next;
- p->next = t;
- }
-}
-
-/* Create a (dummy) PROCESS with NAME, PID, and STATUS, and make it the last
- process in jobs[JID]->pipe. Used by the lastpipe code. */
-void
-append_process (name, pid, status, jid)
- char *name;
- pid_t pid;
- int status;
- int jid;
-{
- PROCESS *t, *p;
-
- t = (PROCESS *)xmalloc (sizeof (PROCESS));
- t->next = (PROCESS *)NULL;
- t->pid = pid;
- /* set process exit status using offset discovered by configure */
- t->status = (status & 0xff) << WEXITSTATUS_OFFSET;
- t->running = PS_DONE;
- t->command = name;
-
- js.c_reaped++; /* XXX */
-
- for (p = jobs[jid]->pipe; p->next != jobs[jid]->pipe; p = p->next)
- ;
- p->next = t;
- t->next = jobs[jid]->pipe;
-}
-
-#if 0
-/* Take the last job and make it the first job. Must be called with
- SIGCHLD blocked. */
-int
-rotate_the_pipeline ()
-{
- PROCESS *p;
-
- if (the_pipeline->next == the_pipeline)
- return;
- for (p = the_pipeline; p->next != the_pipeline; p = p->next)
- ;
- the_pipeline = p;
-}
-
-/* Reverse the order of the processes in the_pipeline. Must be called with
- SIGCHLD blocked. */
-int
-reverse_the_pipeline ()
-{
- PROCESS *p, *n;
-
- if (the_pipeline->next == the_pipeline)
- return;
-
- for (p = the_pipeline; p->next != the_pipeline; p = p->next)
- ;
- p->next = (PROCESS *)NULL;
-
- n = REVERSE_LIST (the_pipeline, PROCESS *);
-
- the_pipeline = n;
- for (p = the_pipeline; p->next; p = p->next)
- ;
- p->next = the_pipeline;
-}
-#endif
-
-/* Map FUNC over the list of jobs. If FUNC returns non-zero,
- then it is time to stop mapping, and that is the return value
- for map_over_jobs. FUNC is called with a JOB, arg1, arg2,
- and INDEX. */
-static int
-map_over_jobs (func, arg1, arg2)
- sh_job_map_func_t *func;
- int arg1, arg2;
-{
- register int i;
- int result;
- sigset_t set, oset;
-
- if (js.j_jobslots == 0)
- return 0;
-
- BLOCK_CHILD (set, oset);
-
- /* XXX could use js.j_firstj here */
- for (i = result = 0; i < js.j_jobslots; i++)
- {
-#if defined (DEBUG)
- if (i < js.j_firstj && jobs[i])
- itrace("map_over_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
- if (i > js.j_lastj && jobs[i])
- itrace("map_over_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
-#endif
- if (jobs[i])
- {
- result = (*func)(jobs[i], arg1, arg2, i);
- if (result)
- break;
- }
- }
-
- UNBLOCK_CHILD (oset);
-
- return (result);
-}
-
-/* Cause all the jobs in the current pipeline to exit. */
-void
-terminate_current_pipeline ()
-{
- if (pipeline_pgrp && pipeline_pgrp != shell_pgrp)
- {
- killpg (pipeline_pgrp, SIGTERM);
- killpg (pipeline_pgrp, SIGCONT);
- }
-}
-
-/* Cause all stopped jobs to exit. */
-void
-terminate_stopped_jobs ()
-{
- register int i;
-
- /* XXX could use js.j_firstj here */
- for (i = 0; i < js.j_jobslots; i++)
- {
- if (jobs[i] && STOPPED (i))
- {
- killpg (jobs[i]->pgrp, SIGTERM);
- killpg (jobs[i]->pgrp, SIGCONT);
- }
- }
-}
-
-/* Cause all jobs, running or stopped, to receive a hangup signal. If
- a job is marked J_NOHUP, don't send the SIGHUP. */
-void
-hangup_all_jobs ()
-{
- register int i;
-
- /* XXX could use js.j_firstj here */
- for (i = 0; i < js.j_jobslots; i++)
- {
- if (jobs[i])
- {
- if (jobs[i]->flags & J_NOHUP)
- continue;
- killpg (jobs[i]->pgrp, SIGHUP);
- if (STOPPED (i))
- killpg (jobs[i]->pgrp, SIGCONT);
- }
- }
-}
-
-void
-kill_current_pipeline ()
-{
- stop_making_children ();
- start_pipeline ();
-}
-
-/* Return the pipeline that PID belongs to. Note that the pipeline
- doesn't have to belong to a job. Must be called with SIGCHLD blocked.
- If JOBP is non-null, return the index of the job containing PID. */
-static PROCESS *
-find_pipeline (pid, alive_only, jobp)
- pid_t pid;
- int alive_only;
- int *jobp; /* index into jobs list or NO_JOB */
-{
- int job;
- PROCESS *p;
-
- /* See if this process is in the pipeline that we are building. */
- if (jobp)
- *jobp = NO_JOB;
- if (the_pipeline)
- {
- p = the_pipeline;
- do
- {
- /* Return it if we found it. Don't ever return a recycled pid. */
- if (p->pid == pid && ((alive_only == 0 && PRECYCLED(p) == 0) || PALIVE(p)))
- return (p);
-
- p = p->next;
- }
- while (p != the_pipeline);
- }
-
- job = find_job (pid, alive_only, &p);
- if (jobp)
- *jobp = job;
- return (job == NO_JOB) ? (PROCESS *)NULL : jobs[job]->pipe;
-}
-
-/* Return the PROCESS * describing PID. If JOBP is non-null return the index
- into the jobs array of the job containing PID. Must be called with
- SIGCHLD blocked. */
-static PROCESS *
-find_process (pid, alive_only, jobp)
- pid_t pid;
- int alive_only;
- int *jobp; /* index into jobs list or NO_JOB */
-{
- PROCESS *p;
-
- p = find_pipeline (pid, alive_only, jobp);
- while (p && p->pid != pid)
- p = p->next;
- return p;
-}
-
-/* Return the job index that PID belongs to, or NO_JOB if it doesn't
- belong to any job. Must be called with SIGCHLD blocked. */
-static int
-find_job (pid, alive_only, procp)
- pid_t pid;
- int alive_only;
- PROCESS **procp;
-{
- register int i;
- PROCESS *p;
-
- /* XXX could use js.j_firstj here, and should check js.j_lastj */
- for (i = 0; i < js.j_jobslots; i++)
- {
-#if defined (DEBUG)
- if (i < js.j_firstj && jobs[i])
- itrace("find_job: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
- if (i > js.j_lastj && jobs[i])
- itrace("find_job: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
-#endif
- if (jobs[i])
- {
- p = jobs[i]->pipe;
-
- do
- {
- if (p->pid == pid && ((alive_only == 0 && PRECYCLED(p) == 0) || PALIVE(p)))
- {
- if (procp)
- *procp = p;
- return (i);
- }
-
- p = p->next;
- }
- while (p != jobs[i]->pipe);
- }
- }
-
- return (NO_JOB);
-}
-
-/* Find a job given a PID. If BLOCK is non-zero, block SIGCHLD as
- required by find_job. */
-int
-get_job_by_pid (pid, block)
- pid_t pid;
- int block;
-{
- int job;
- sigset_t set, oset;
-
- if (block)
- BLOCK_CHILD (set, oset);
-
- job = find_job (pid, 0, NULL);
-
- if (block)
- UNBLOCK_CHILD (oset);
-
- return job;
-}
-
-/* Print descriptive information about the job with leader pid PID. */
-void
-describe_pid (pid)
- pid_t pid;
-{
- int job;
- sigset_t set, oset;
-
- BLOCK_CHILD (set, oset);
-
- job = find_job (pid, 0, NULL);
-
- if (job != NO_JOB)
- fprintf (stderr, "[%d] %ld\n", job + 1, (long)pid);
- else
- programming_error (_("describe_pid: %ld: no such pid"), (long)pid);
-
- UNBLOCK_CHILD (oset);
-}
-
-static char *
-j_strsignal (s)
- int s;
-{
- char *x;
-
- x = strsignal (s);
- if (x == 0)
- {
- x = retcode_name_buffer;
- sprintf (x, _("Signal %d"), s);
- }
- return x;
-}
-
-static char *
-printable_job_status (j, p, format)
- int j;
- PROCESS *p;
- int format;
-{
- static char *temp;
- int es;
-
- temp = _("Done");
-
- if (STOPPED (j) && format == 0)
- {
- if (posixly_correct == 0 || p == 0 || (WIFSTOPPED (p->status) == 0))
- temp = _("Stopped");
- else
- {
- temp = retcode_name_buffer;
- sprintf (temp, _("Stopped(%s)"), signal_name (WSTOPSIG (p->status)));
- }
- }
- else if (RUNNING (j))
- temp = _("Running");
- else
- {
- if (WIFSTOPPED (p->status))
- temp = j_strsignal (WSTOPSIG (p->status));
- else if (WIFSIGNALED (p->status))
- temp = j_strsignal (WTERMSIG (p->status));
- else if (WIFEXITED (p->status))
- {
- temp = retcode_name_buffer;
- es = WEXITSTATUS (p->status);
- if (es == 0)
- strcpy (temp, _("Done"));
- else if (posixly_correct)
- sprintf (temp, _("Done(%d)"), es);
- else
- sprintf (temp, _("Exit %d"), es);
- }
- else
- temp = _("Unknown status");
- }
-
- return temp;
-}
-
-/* This is the way to print out information on a job if you
- know the index. FORMAT is:
-
- JLIST_NORMAL) [1]+ Running emacs
- JLIST_LONG ) [1]+ 2378 Running emacs
- -1 ) [1]+ 2378 emacs
-
- JLIST_NORMAL) [1]+ Stopped ls | more
- JLIST_LONG ) [1]+ 2369 Stopped ls
- 2367 | more
- JLIST_PID_ONLY)
- Just list the pid of the process group leader (really
- the process group).
- JLIST_CHANGED_ONLY)
- Use format JLIST_NORMAL, but list only jobs about which
- the user has not been notified. */
-
-/* Print status for pipeline P. If JOB_INDEX is >= 0, it is the index into
- the JOBS array corresponding to this pipeline. FORMAT is as described
- above. Must be called with SIGCHLD blocked.
-
- If you're printing a pipeline that's not in the jobs array, like the
- current pipeline as it's being created, pass -1 for JOB_INDEX */
-static void
-print_pipeline (p, job_index, format, stream)
- PROCESS *p;
- int job_index, format;
- FILE *stream;
-{
- PROCESS *first, *last, *show;
- int es, name_padding;
- char *temp;
-
- if (p == 0)
- return;
-
- first = last = p;
- while (last->next != first)
- last = last->next;
-
- for (;;)
- {
- if (p != first)
- fprintf (stream, format ? " " : " |");
-
- if (format != JLIST_STANDARD)
- fprintf (stream, "%5ld", (long)p->pid);
-
- fprintf (stream, " ");
-
- if (format > -1 && job_index >= 0)
- {
- show = format ? p : last;
- temp = printable_job_status (job_index, show, format);
-
- if (p != first)
- {
- if (format)
- {
- if (show->running == first->running &&
- WSTATUS (show->status) == WSTATUS (first->status))
- temp = "";
- }
- else
- temp = (char *)NULL;
- }
-
- if (temp)
- {
- fprintf (stream, "%s", temp);
-
- es = STRLEN (temp);
- if (es == 0)
- es = 2; /* strlen ("| ") */
- name_padding = LONGEST_SIGNAL_DESC - es;
-
- fprintf (stream, "%*s", name_padding, "");
-
- if ((WIFSTOPPED (show->status) == 0) &&
- (WIFCONTINUED (show->status) == 0) &&
- WIFCORED (show->status))
- fprintf (stream, _("(core dumped) "));
- }
- }
-
- if (p != first && format)
- fprintf (stream, "| ");
-
- if (p->command)
- fprintf (stream, "%s", p->command);
-
- if (p == last && job_index >= 0)
- {
- temp = current_working_directory ();
-
- if (RUNNING (job_index) && (IS_FOREGROUND (job_index) == 0))
- fprintf (stream, " &");
-
- if (strcmp (temp, jobs[job_index]->wd) != 0)
- fprintf (stream,
- _(" (wd: %s)"), polite_directory_format (jobs[job_index]->wd));
- }
-
- if (format || (p == last))
- {
- /* We need to add a CR only if this is an interactive shell, and
- we're reporting the status of a completed job asynchronously.
- We can't really check whether this particular job is being
- reported asynchronously, so just add the CR if the shell is
- currently interactive and asynchronous notification is enabled. */
- if (asynchronous_notification && interactive)
- fprintf (stream, "\r\n");
- else
- fprintf (stream, "\n");
- }
-
- if (p == last)
- break;
- p = p->next;
- }
- fflush (stream);
-}
-
-/* Print information to STREAM about jobs[JOB_INDEX] according to FORMAT.
- Must be called with SIGCHLD blocked or queued with queue_sigchld */
-static void
-pretty_print_job (job_index, format, stream)
- int job_index, format;
- FILE *stream;
-{
- register PROCESS *p;
-
- /* Format only pid information about the process group leader? */
- if (format == JLIST_PID_ONLY)
- {
- fprintf (stream, "%ld\n", (long)jobs[job_index]->pipe->pid);
- return;
- }
-
- if (format == JLIST_CHANGED_ONLY)
- {
- if (IS_NOTIFIED (job_index))
- return;
- format = JLIST_STANDARD;
- }
-
- if (format != JLIST_NONINTERACTIVE)
- fprintf (stream, "[%d]%c ", job_index + 1,
- (job_index == js.j_current) ? '+':
- (job_index == js.j_previous) ? '-' : ' ');
-
- if (format == JLIST_NONINTERACTIVE)
- format = JLIST_LONG;
-
- p = jobs[job_index]->pipe;
-
- print_pipeline (p, job_index, format, stream);
-
- /* We have printed information about this job. When the job's
- status changes, waitchld () sets the notification flag to 0. */
- jobs[job_index]->flags |= J_NOTIFIED;
-}
-
-static int
-print_job (job, format, state, job_index)
- JOB *job;
- int format, state, job_index;
-{
- if (state == -1 || (JOB_STATE)state == job->state)
- pretty_print_job (job_index, format, stdout);
- return (0);
-}
-
-void
-list_one_job (job, format, ignore, job_index)
- JOB *job;
- int format, ignore, job_index;
-{
- pretty_print_job (job_index, format, stdout);
-}
-
-void
-list_stopped_jobs (format)
- int format;
-{
- cleanup_dead_jobs ();
- map_over_jobs (print_job, format, (int)JSTOPPED);
-}
-
-void
-list_running_jobs (format)
- int format;
-{
- cleanup_dead_jobs ();
- map_over_jobs (print_job, format, (int)JRUNNING);
-}
-
-/* List jobs. If FORMAT is non-zero, then the long form of the information
- is printed, else just a short version. */
-void
-list_all_jobs (format)
- int format;
-{
- cleanup_dead_jobs ();
- map_over_jobs (print_job, format, -1);
-}
-
-/* Fork, handling errors. Returns the pid of the newly made child, or 0.
- COMMAND is just for remembering the name of the command; we don't do
- anything else with it. ASYNC_P says what to do with the tty. If
- non-zero, then don't give it away. */
-pid_t
-make_child (command, async_p)
- char *command;
- int async_p;
-{
- int forksleep;
- sigset_t set, oset;
- pid_t pid;
-
- /* XXX - block SIGTERM here and unblock in child after fork resets the
- set of pending signals? */
- sigemptyset (&set);
- sigaddset (&set, SIGCHLD);
- sigaddset (&set, SIGINT);
- sigemptyset (&oset);
- sigprocmask (SIG_BLOCK, &set, &oset);
-
- making_children ();
-
- forksleep = 1;
-
-#if defined (BUFFERED_INPUT)
- /* If default_buffered_input is active, we are reading a script. If
- the command is asynchronous, we have already duplicated /dev/null
- as fd 0, but have not changed the buffered stream corresponding to
- the old fd 0. We don't want to sync the stream in this case. */
- if (default_buffered_input != -1 &&
- (!async_p || default_buffered_input > 0))
- sync_buffered_stream (default_buffered_input);
-#endif /* BUFFERED_INPUT */
-
- RESET_SIGTERM;
-
- /* Create the child, handle severe errors. Retry on EAGAIN. */
- while ((pid = fork ()) < 0 && errno == EAGAIN && forksleep < FORKSLEEP_MAX)
- {
- /* bash-4.2 */
- /* If we can't create any children, try to reap some dead ones. */
- waitchld (-1, 0);
-
- sys_error ("fork: retry");
- RESET_SIGTERM;
-
- if (sleep (forksleep) != 0)
- break;
- forksleep <<= 1;
- }
-
- if (pid != 0)
- RESET_SIGTERM;
-
- if (pid < 0)
- {
- sys_error ("fork");
-
- /* Kill all of the processes in the current pipeline. */
- terminate_current_pipeline ();
-
- /* Discard the current pipeline, if any. */
- if (the_pipeline)
- kill_current_pipeline ();
-
- last_command_exit_value = EX_NOEXEC;
- throw_to_top_level (); /* Reset signals, etc. */
- }
-
- if (pid == 0)
- {
- /* In the child. Give this child the right process group, set the
- signals to the default state for a new process. */
- pid_t mypid;
-
- mypid = getpid ();
-#if defined (BUFFERED_INPUT)
- /* Close default_buffered_input if it's > 0. We don't close it if it's
- 0 because that's the file descriptor used when redirecting input,
- and it's wrong to close the file in that case. */
- unset_bash_input (0);
-#endif /* BUFFERED_INPUT */
-
- /* Restore top-level signal mask. */
- sigprocmask (SIG_SETMASK, &top_level_mask, (sigset_t *)NULL);
-
- if (job_control)
- {
- /* All processes in this pipeline belong in the same
- process group. */
-
- if (pipeline_pgrp == 0) /* This is the first child. */
- pipeline_pgrp = mypid;
-
- /* Check for running command in backquotes. */
- if (pipeline_pgrp == shell_pgrp)
- ignore_tty_job_signals ();
- else
- default_tty_job_signals ();
-
- /* Set the process group before trying to mess with the terminal's
- process group. This is mandated by POSIX. */
- /* This is in accordance with the Posix 1003.1 standard,
- section B.7.2.4, which says that trying to set the terminal
- process group with tcsetpgrp() to an unused pgrp value (like
- this would have for the first child) is an error. Section
- B.4.3.3, p. 237 also covers this, in the context of job control
- shells. */
- if (setpgid (mypid, pipeline_pgrp) < 0)
- sys_error (_("child setpgid (%ld to %ld)"), (long)mypid, (long)pipeline_pgrp);
-
- /* By convention (and assumption above), if
- pipeline_pgrp == shell_pgrp, we are making a child for
- command substitution.
- In this case, we don't want to give the terminal to the
- shell's process group (we could be in the middle of a
- pipeline, for example). */
- if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0))
- give_terminal_to (pipeline_pgrp, 0);
-
-#if defined (PGRP_PIPE)
- if (pipeline_pgrp == mypid)
- pipe_read (pgrp_pipe);
-#endif
- }
- else /* Without job control... */
- {
- if (pipeline_pgrp == 0)
- pipeline_pgrp = shell_pgrp;
-
- /* If these signals are set to SIG_DFL, we encounter the curious
- situation of an interactive ^Z to a running process *working*
- and stopping the process, but being unable to do anything with
- that process to change its state. On the other hand, if they
- are set to SIG_IGN, jobs started from scripts do not stop when
- the shell running the script gets a SIGTSTP and stops. */
-
- default_tty_job_signals ();
- }
-
-#if defined (PGRP_PIPE)
- /* Release the process group pipe, since our call to setpgid ()
- is done. The last call to sh_closepipe is done in stop_pipeline. */
- sh_closepipe (pgrp_pipe);
-#endif /* PGRP_PIPE */
-
-#if 0
- /* Don't set last_asynchronous_pid in the child */
- if (async_p)
- last_asynchronous_pid = mypid; /* XXX */
- else
-#endif
-#if defined (RECYCLES_PIDS)
- if (last_asynchronous_pid == mypid)
- /* Avoid pid aliasing. 1 seems like a safe, unusual pid value. */
- last_asynchronous_pid = 1;
-#endif
- }
- else
- {
- /* In the parent. Remember the pid of the child just created
- as the proper pgrp if this is the first child. */
-
- if (job_control)
- {
- if (pipeline_pgrp == 0)
- {
- pipeline_pgrp = pid;
- /* Don't twiddle terminal pgrps in the parent! This is the bug,
- not the good thing of twiddling them in the child! */
- /* give_terminal_to (pipeline_pgrp, 0); */
- }
- /* This is done on the recommendation of the Rationale section of
- the POSIX 1003.1 standard, where it discusses job control and
- shells. It is done to avoid possible race conditions. (Ref.
- 1003.1 Rationale, section B.4.3.3, page 236). */
- setpgid (pid, pipeline_pgrp);
- }
- else
- {
- if (pipeline_pgrp == 0)
- pipeline_pgrp = shell_pgrp;
- }
-
- /* Place all processes into the jobs array regardless of the
- state of job_control. */
- add_process (command, pid);
-
- if (async_p)
- last_asynchronous_pid = pid;
-#if defined (RECYCLES_PIDS)
- else if (last_asynchronous_pid == pid)
- /* Avoid pid aliasing. 1 seems like a safe, unusual pid value. */
- last_asynchronous_pid = 1;
-#endif
-
- /* Delete the saved status for any job containing this PID in case it's
- been reused. */
- delete_old_job (pid);
-
- /* Perform the check for pid reuse unconditionally. Some systems reuse
- PIDs before giving a process CHILD_MAX/_SC_CHILD_MAX unique ones. */
- bgp_delete (pid); /* new process, discard any saved status */
-
- last_made_pid = pid;
-
- /* keep stats */
- js.c_totforked++;
- js.c_living++;
-
- /* Unblock SIGINT and SIGCHLD unless creating a pipeline, in which case
- SIGCHLD remains blocked until all commands in the pipeline have been
- created. */
- sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
- }
-
- return (pid);
-}
-
-/* These two functions are called only in child processes. */
-void
-ignore_tty_job_signals ()
-{
- set_signal_handler (SIGTSTP, SIG_IGN);
- set_signal_handler (SIGTTIN, SIG_IGN);
- set_signal_handler (SIGTTOU, SIG_IGN);
-}
-
-void
-default_tty_job_signals ()
-{
- set_signal_handler (SIGTSTP, SIG_DFL);
- set_signal_handler (SIGTTIN, SIG_DFL);
- set_signal_handler (SIGTTOU, SIG_DFL);
-}
-
-/* When we end a job abnormally, or if we stop a job, we set the tty to the
- state kept in here. When a job ends normally, we set the state in here
- to the state of the tty. */
-
-static TTYSTRUCT shell_tty_info;
-
-#if defined (NEW_TTY_DRIVER)
-static struct tchars shell_tchars;
-static struct ltchars shell_ltchars;
-#endif /* NEW_TTY_DRIVER */
-
-#if defined (NEW_TTY_DRIVER) && defined (DRAIN_OUTPUT)
-/* Since the BSD tty driver does not allow us to change the tty modes
- while simultaneously waiting for output to drain and preserving
- typeahead, we have to drain the output ourselves before calling
- ioctl. We cheat by finding the length of the output queue, and
- using select to wait for an appropriate length of time. This is
- a hack, and should be labeled as such (it's a hastily-adapted
- mutation of a `usleep' implementation). It's only reason for
- existing is the flaw in the BSD tty driver. */
-
-static int ttspeeds[] =
-{
- 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200,
- 1800, 2400, 4800, 9600, 19200, 38400
-};
-
-static void
-draino (fd, ospeed)
- int fd, ospeed;
-{
- register int delay = ttspeeds[ospeed];
- int n;
-
- if (!delay)
- return;
-
- while ((ioctl (fd, TIOCOUTQ, &n) == 0) && n)
- {
- if (n > (delay / 100))
- {
- struct timeval tv;
-
- n *= 10; /* 2 bits more for conservativeness. */
- tv.tv_sec = n / delay;
- tv.tv_usec = ((n % delay) * 1000000) / delay;
- select (fd, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv);
- }
- else
- break;
- }
-}
-#endif /* NEW_TTY_DRIVER && DRAIN_OUTPUT */
-
-/* Return the fd from which we are actually getting input. */
-#define input_tty() (shell_tty != -1) ? shell_tty : fileno (stderr)
-
-/* Fill the contents of shell_tty_info with the current tty info. */
-int
-get_tty_state ()
-{
- int tty;
-
- tty = input_tty ();
- if (tty != -1)
- {
-#if defined (NEW_TTY_DRIVER)
- ioctl (tty, TIOCGETP, &shell_tty_info);
- ioctl (tty, TIOCGETC, &shell_tchars);
- ioctl (tty, TIOCGLTC, &shell_ltchars);
-#endif /* NEW_TTY_DRIVER */
-
-#if defined (TERMIO_TTY_DRIVER)
- ioctl (tty, TCGETA, &shell_tty_info);
-#endif /* TERMIO_TTY_DRIVER */
-
-#if defined (TERMIOS_TTY_DRIVER)
- if (tcgetattr (tty, &shell_tty_info) < 0)
- {
-#if 0
- /* Only print an error message if we're really interactive at
- this time. */
- if (interactive)
- sys_error ("[%ld: %d (%d)] tcgetattr", (long)getpid (), shell_level, tty);
-#endif
- return -1;
- }
-#endif /* TERMIOS_TTY_DRIVER */
- if (check_window_size)
- get_new_window_size (0, (int *)0, (int *)0);
- }
- return 0;
-}
-
-/* Make the current tty use the state in shell_tty_info. */
-int
-set_tty_state ()
-{
- int tty;
-
- tty = input_tty ();
- if (tty != -1)
- {
-#if defined (NEW_TTY_DRIVER)
-# if defined (DRAIN_OUTPUT)
- draino (tty, shell_tty_info.sg_ospeed);
-# endif /* DRAIN_OUTPUT */
- ioctl (tty, TIOCSETN, &shell_tty_info);
- ioctl (tty, TIOCSETC, &shell_tchars);
- ioctl (tty, TIOCSLTC, &shell_ltchars);
-#endif /* NEW_TTY_DRIVER */
-
-#if defined (TERMIO_TTY_DRIVER)
- ioctl (tty, TCSETAW, &shell_tty_info);
-#endif /* TERMIO_TTY_DRIVER */
-
-#if defined (TERMIOS_TTY_DRIVER)
- if (tcsetattr (tty, TCSADRAIN, &shell_tty_info) < 0)
- {
- /* Only print an error message if we're really interactive at
- this time. */
- if (interactive)
- sys_error ("[%ld: %d (%d)] tcsetattr", (long)getpid (), shell_level, tty);
- return -1;
- }
-#endif /* TERMIOS_TTY_DRIVER */
- }
- return 0;
-}
-
-/* Given an index into the jobs array JOB, return the PROCESS struct of the last
- process in that job's pipeline. This is the one whose exit status
- counts. Must be called with SIGCHLD blocked or queued. */
-static PROCESS *
-find_last_proc (job, block)
- int job;
- int block;
-{
- register PROCESS *p;
- sigset_t set, oset;
-
- if (block)
- BLOCK_CHILD (set, oset);
-
- p = jobs[job]->pipe;
- while (p && p->next != jobs[job]->pipe)
- p = p->next;
-
- if (block)
- UNBLOCK_CHILD (oset);
-
- return (p);
-}
-
-static pid_t
-find_last_pid (job, block)
- int job;
- int block;
-{
- PROCESS *p;
-
- p = find_last_proc (job, block);
- /* Possible race condition here. */
- return p->pid;
-}
-
-/* Wait for a particular child of the shell to finish executing.
- This low-level function prints an error message if PID is not
- a child of this shell. It returns -1 if it fails, or whatever
- wait_for returns otherwise. If the child is not found in the
- jobs table, it returns 127. */
-int
-wait_for_single_pid (pid)
- pid_t pid;
-{
- register PROCESS *child;
- sigset_t set, oset;
- int r, job;
-
- BLOCK_CHILD (set, oset);
- child = find_pipeline (pid, 0, (int *)NULL);
- UNBLOCK_CHILD (oset);
-
- if (child == 0)
- {
- r = bgp_search (pid);
- if (r >= 0)
- return r;
- }
-
- if (child == 0)
- {
- internal_error (_("wait: pid %ld is not a child of this shell"), (long)pid);
- return (127);
- }
-
- r = wait_for (pid);
-
- /* POSIX.2: if we just waited for a job, we can remove it from the jobs
- table. */
- BLOCK_CHILD (set, oset);
- job = find_job (pid, 0, NULL);
- if (job != NO_JOB && jobs[job] && DEADJOB (job))
- jobs[job]->flags |= J_NOTIFIED;
- UNBLOCK_CHILD (oset);
-
- /* If running in posix mode, remove the job from the jobs table immediately */
- if (posixly_correct)
- {
- cleanup_dead_jobs ();
- bgp_delete (pid);
- }
-
- return r;
-}
-
-/* Wait for all of the background processes started by this shell to finish. */
-void
-wait_for_background_pids ()
-{
- register int i, r, waited_for;
- sigset_t set, oset;
- pid_t pid;
-
- for (waited_for = 0;;)
- {
- BLOCK_CHILD (set, oset);
-
- /* find first running job; if none running in foreground, break */
- /* XXX could use js.j_firstj and js.j_lastj here */
- for (i = 0; i < js.j_jobslots; i++)
- {
-#if defined (DEBUG)
- if (i < js.j_firstj && jobs[i])
- itrace("wait_for_background_pids: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
- if (i > js.j_lastj && jobs[i])
- itrace("wait_for_background_pids: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
-#endif
- if (jobs[i] && RUNNING (i) && IS_FOREGROUND (i) == 0)
- break;
- }
- if (i == js.j_jobslots)
- {
- UNBLOCK_CHILD (oset);
- break;
- }
-
- /* now wait for the last pid in that job. */
- pid = find_last_pid (i, 0);
- UNBLOCK_CHILD (oset);
- QUIT;
- errno = 0; /* XXX */
- r = wait_for_single_pid (pid);
- if (r == -1)
- {
- /* If we're mistaken about job state, compensate. */
- if (errno == ECHILD)
- mark_all_jobs_as_dead ();
- }
- else
- waited_for++;
- }
-
- /* POSIX.2 says the shell can discard the statuses of all completed jobs if
- `wait' is called with no arguments. */
- mark_dead_jobs_as_notified (1);
- cleanup_dead_jobs ();
- bgp_clear ();
-}
-
-/* Make OLD_SIGINT_HANDLER the SIGINT signal handler. */
-#define INVALID_SIGNAL_HANDLER (SigHandler *)wait_for_background_pids
-static SigHandler *old_sigint_handler = INVALID_SIGNAL_HANDLER;
-
-static int wait_sigint_received;
-static int child_caught_sigint;
-static int waiting_for_child;
-
-static void
-restore_sigint_handler ()
-{
- if (old_sigint_handler != INVALID_SIGNAL_HANDLER)
- {
- set_signal_handler (SIGINT, old_sigint_handler);
- old_sigint_handler = INVALID_SIGNAL_HANDLER;
- waiting_for_child = 0;
- }
-}
-
-/* Handle SIGINT while we are waiting for children in a script to exit.
- The `wait' builtin should be interruptible, but all others should be
- effectively ignored (i.e. not cause the shell to exit). */
-static sighandler
-wait_sigint_handler (sig)
- int sig;
-{
- SigHandler *sigint_handler;
-
- if (interrupt_immediately ||
- (this_shell_builtin && this_shell_builtin == wait_builtin))
- {
- last_command_exit_value = 128+SIGINT;
- restore_sigint_handler ();
- /* If we got a SIGINT while in `wait', and SIGINT is trapped, do
- what POSIX.2 says (see builtins/wait.def for more info). */
- if (this_shell_builtin && this_shell_builtin == wait_builtin &&
- signal_is_trapped (SIGINT) &&
- ((sigint_handler = trap_to_sighandler (SIGINT)) == trap_handler))
- {
- trap_handler (SIGINT); /* set pending_traps[SIGINT] */
- wait_signal_received = SIGINT;
- if (interrupt_immediately)
- {
- interrupt_immediately = 0;
- longjmp (wait_intr_buf, 1);
- }
- else
- /* Let CHECK_WAIT_INTR handle it in wait_for/waitchld */
- SIGRETURN (0);
- }
- else if (interrupt_immediately)
- {
- ADDINTERRUPT;
- QUIT;
- }
- else /* wait_builtin but signal not trapped, treat as interrupt */
- kill (getpid (), SIGINT);
- }
-
- /* XXX - should this be interrupt_state? If it is, the shell will act
- as if it got the SIGINT interrupt. */
- if (waiting_for_child)
- wait_sigint_received = 1;
- else
- {
- last_command_exit_value = 128+SIGINT;
- restore_sigint_handler ();
- kill (getpid (), SIGINT);
- }
-
- /* Otherwise effectively ignore the SIGINT and allow the running job to
- be killed. */
- SIGRETURN (0);
-}
-
-static int
-process_exit_signal (status)
- WAIT status;
-{
- return (WIFSIGNALED (status) ? WTERMSIG (status) : 0);
-}
-
-static int
-process_exit_status (status)
- WAIT status;
-{
- if (WIFSIGNALED (status))
- return (128 + WTERMSIG (status));
- else if (WIFSTOPPED (status) == 0)
- return (WEXITSTATUS (status));
- else
- return (EXECUTION_SUCCESS);
-}
-
-static WAIT
-job_signal_status (job)
- int job;
-{
- register PROCESS *p;
- WAIT s;
-
- p = jobs[job]->pipe;
- do
- {
- s = p->status;
- if (WIFSIGNALED(s) || WIFSTOPPED(s))
- break;
- p = p->next;
- }
- while (p != jobs[job]->pipe);
-
- return s;
-}
-
-/* Return the exit status of the last process in the pipeline for job JOB.
- This is the exit status of the entire job. */
-static WAIT
-raw_job_exit_status (job)
- int job;
-{
- register PROCESS *p;
- int fail;
- WAIT ret;
-
- if (pipefail_opt)
- {
- fail = 0;
- p = jobs[job]->pipe;
- do
- {
- if (WSTATUS (p->status) != EXECUTION_SUCCESS)
- fail = WSTATUS(p->status);
- p = p->next;
- }
- while (p != jobs[job]->pipe);
- WSTATUS (ret) = fail;
- return ret;
- }
-
- for (p = jobs[job]->pipe; p->next != jobs[job]->pipe; p = p->next)
- ;
- return (p->status);
-}
-
-/* Return the exit status of job JOB. This is the exit status of the last
- (rightmost) process in the job's pipeline, modified if the job was killed
- by a signal or stopped. */
-int
-job_exit_status (job)
- int job;
-{
- return (process_exit_status (raw_job_exit_status (job)));
-}
-
-int
-job_exit_signal (job)
- int job;
-{
- return (process_exit_signal (raw_job_exit_status (job)));
-}
-
-#define FIND_CHILD(pid, child) \
- do \
- { \
- child = find_pipeline (pid, 0, (int *)NULL); \
- if (child == 0) \
- { \
- give_terminal_to (shell_pgrp, 0); \
- UNBLOCK_CHILD (oset); \
- internal_error (_("wait_for: No record of process %ld"), (long)pid); \
- restore_sigint_handler (); \
- return (termination_state = 127); \
- } \
- } \
- while (0)
-
-/* Wait for pid (one of our children) to terminate, then
- return the termination state. Returns 127 if PID is not found in
- the jobs table. Returns -1 if waitchld() returns -1, indicating
- that there are no unwaited-for child processes. */
-int
-wait_for (pid)
- pid_t pid;
-{
- int job, termination_state, r;
- WAIT s;
- register PROCESS *child;
- sigset_t set, oset;
-
- /* In the case that this code is interrupted, and we longjmp () out of it,
- we are relying on the code in throw_to_top_level () to restore the
- top-level signal mask. */
- child = 0;
- BLOCK_CHILD (set, oset);
-
- /* Ignore interrupts while waiting for a job run without job control
- to finish. We don't want the shell to exit if an interrupt is
- received, only if one of the jobs run is killed via SIGINT. If
- job control is not set, the job will be run in the same pgrp as
- the shell, and the shell will see any signals the job gets. In
- fact, we want this set every time the waiting shell and the waited-
- for process are in the same process group, including command
- substitution. */
-
- /* This is possibly a race condition -- should it go in stop_pipeline? */
- wait_sigint_received = child_caught_sigint = 0;
- if (job_control == 0 || (subshell_environment&SUBSHELL_COMSUB))
- {
- old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
- waiting_for_child = 0;
- if (old_sigint_handler == SIG_IGN)
- set_signal_handler (SIGINT, old_sigint_handler);
- }
-
- termination_state = last_command_exit_value;
-
- if (interactive && job_control == 0)
- QUIT;
- /* Check for terminating signals and exit the shell if we receive one */
- CHECK_TERMSIG;
-
- /* Check for a trapped signal interrupting the wait builtin and jump out */
- CHECK_WAIT_INTR;
-
- /* If we say wait_for (), then we have a record of this child somewhere.
- If it and none of its peers are running, don't call waitchld(). */
-
- job = NO_JOB;
- do
- {
- if (pid != ANY_PID)
- FIND_CHILD (pid, child);
-
- /* If this child is part of a job, then we are really waiting for the
- job to finish. Otherwise, we are waiting for the child to finish.
- We check for JDEAD in case the job state has been set by waitchld
- after receipt of a SIGCHLD. */
- if (job == NO_JOB)
- job = find_job (pid, 0, NULL);
-
- /* waitchld() takes care of setting the state of the job. If the job
- has already exited before this is called, sigchld_handler will have
- called waitchld and the state will be set to JDEAD. */
-
- if (pid == ANY_PID || PRUNNING(child) || (job != NO_JOB && RUNNING (job)))
- {
-#if defined (WAITPID_BROKEN) /* SCOv4 */
- sigset_t suspend_set;
- sigemptyset (&suspend_set);
- sigsuspend (&suspend_set);
-#else /* !WAITPID_BROKEN */
-# if defined (MUST_UNBLOCK_CHLD)
- struct sigaction act, oact;
- sigset_t nullset, chldset;
-
- sigemptyset (&nullset);
- sigemptyset (&chldset);
- sigprocmask (SIG_SETMASK, &nullset, &chldset);
- act.sa_handler = SIG_DFL;
- sigemptyset (&act.sa_mask);
- sigemptyset (&oact.sa_mask);
- act.sa_flags = 0;
-# if defined (SA_RESTART)
- act.sa_flags |= SA_RESTART;
-# endif
- sigaction (SIGCHLD, &act, &oact);
-# endif /* MUST_UNBLOCK_CHLD */
- queue_sigchld = 1;
- waiting_for_child++;
- r = waitchld (pid, 1); /* XXX */
- waiting_for_child--;
-#if 0
-itrace("wait_for: blocking wait for %d returns %d child = 0x%x", (int)pid, r, child);
-#endif
-# if defined (MUST_UNBLOCK_CHLD)
- sigaction (SIGCHLD, &oact, (struct sigaction *)NULL);
- sigprocmask (SIG_SETMASK, &chldset, (sigset_t *)NULL);
-# endif
- queue_sigchld = 0;
- if (r == -1 && errno == ECHILD && this_shell_builtin == wait_builtin)
- {
- termination_state = -1;
- /* XXX - restore sigint handler here? */
- goto wait_for_return;
- }
-
- /* If child is marked as running, but waitpid() returns -1/ECHILD,
- there is something wrong. Somewhere, wait should have returned
- that child's pid. Mark the child as not running and the job,
- if it exists, as JDEAD. */
- if (r == -1 && errno == ECHILD)
- {
- if (child)
- {
- child->running = PS_DONE;
- WSTATUS (child->status) = 0; /* XXX -- can't find true status */
- }
- js.c_living = 0; /* no living child processes */
- if (job != NO_JOB)
- {
- jobs[job]->state = JDEAD;
- js.c_reaped++;
- js.j_ndead++;
- }
- if (pid == ANY_PID)
- {
- termination_state = -1;
- break;
- }
- }
-#endif /* WAITPID_BROKEN */
- }
-
- /* If the shell is interactive, and job control is disabled, see
- if the foreground process has died due to SIGINT and jump out
- of the wait loop if it has. waitchld has already restored the
- old SIGINT signal handler. */
- if (interactive && job_control == 0)
- QUIT;
- /* Check for terminating signals and exit the shell if we receive one */
- CHECK_TERMSIG;
-
- /* Check for a trapped signal interrupting the wait builtin and jump out */
- CHECK_WAIT_INTR;
-
- if (pid == ANY_PID)
- /* XXX - could set child but we don't have a handle on what waitchld
- reaps. Leave termination_state alone. */
- goto wait_for_return;
- }
- while (PRUNNING (child) || (job != NO_JOB && RUNNING (job)));
-
- /* Restore the original SIGINT signal handler before we return. */
- restore_sigint_handler ();
-
- /* The exit state of the command is either the termination state of the
- child, or the termination state of the job. If a job, the status
- of the last child in the pipeline is the significant one. If the command
- or job was terminated by a signal, note that value also. */
- termination_state = (job != NO_JOB) ? job_exit_status (job)
- : process_exit_status (child->status);
- last_command_exit_signal = (job != NO_JOB) ? job_exit_signal (job)
- : process_exit_signal (child->status);
-
- /* XXX */
- if ((job != NO_JOB && JOBSTATE (job) == JSTOPPED) || WIFSTOPPED (child->status))
- termination_state = 128 + WSTOPSIG (child->status);
-
- if (job == NO_JOB || IS_JOBCONTROL (job))
- {
- /* XXX - under what circumstances is a job not present in the jobs
- table (job == NO_JOB)?
- 1. command substitution
-
- In the case of command substitution, at least, it's probably not
- the right thing to give the terminal to the shell's process group,
- even though there is code in subst.c:command_substitute to work
- around it.
-
- Things that don't:
- $PROMPT_COMMAND execution
- process substitution
- */
-#if 0
-if (job == NO_JOB)
- itrace("wait_for: job == NO_JOB, giving the terminal to shell_pgrp (%ld)", (long)shell_pgrp);
-#endif
- give_terminal_to (shell_pgrp, 0);
- }
-
- /* If the command did not exit cleanly, or the job is just
- being stopped, then reset the tty state back to what it
- was before this command. Reset the tty state and notify
- the user of the job termination only if the shell is
- interactive. Clean up any dead jobs in either case. */
- if (job != NO_JOB)
- {
- if (interactive_shell && subshell_environment == 0)
- {
- /* This used to use `child->status'. That's wrong, however, for
- pipelines. `child' is the first process in the pipeline. It's
- likely that the process we want to check for abnormal termination
- or stopping is the last process in the pipeline, especially if
- it's long-lived and the first process is short-lived. Since we
- know we have a job here, we can check all the processes in this
- job's pipeline and see if one of them stopped or terminated due
- to a signal. We might want to change this later to just check
- the last process in the pipeline. If no process exits due to a
- signal, S is left as the status of the last job in the pipeline. */
- s = job_signal_status (job);
-
- if (WIFSIGNALED (s) || WIFSTOPPED (s))
- {
- set_tty_state ();
-
- /* If the current job was stopped or killed by a signal, and
- the user has requested it, get a possibly new window size */
- if (check_window_size && (job == js.j_current || IS_FOREGROUND (job)))
- get_new_window_size (0, (int *)0, (int *)0);
- }
- else
- get_tty_state ();
-
- /* If job control is enabled, the job was started with job
- control, the job was the foreground job, and it was killed
- by SIGINT, then print a newline to compensate for the kernel
- printing the ^C without a trailing newline. */
- if (job_control && IS_JOBCONTROL (job) && IS_FOREGROUND (job) &&
- WIFSIGNALED (s) && WTERMSIG (s) == SIGINT)
- {
- /* If SIGINT is not trapped and the shell is in a for, while,
- or until loop, act as if the shell received SIGINT as
- well, so the loop can be broken. This doesn't call the
- SIGINT signal handler; maybe it should. */
- if (signal_is_trapped (SIGINT) == 0 && (loop_level || (shell_compatibility_level > 32 && executing_list)))
- ADDINTERRUPT;
- else
- {
- putchar ('\n');
- fflush (stdout);
- }
- }
- }
- else if ((subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PIPE)) && wait_sigint_received)
- {
- /* If waiting for a job in a subshell started to do command
- substitution or to run a pipeline element that consists of
- something like a while loop or a for loop, simulate getting
- and being killed by the SIGINT to pass the status back to our
- parent. */
- s = job_signal_status (job);
-
- if (child_caught_sigint == 0 && signal_is_trapped (SIGINT) == 0)
- {
- UNBLOCK_CHILD (oset);
- old_sigint_handler = set_signal_handler (SIGINT, SIG_DFL);
- if (old_sigint_handler == SIG_IGN)
- restore_sigint_handler ();
- else
- kill (getpid (), SIGINT);
- }
- }
- else if (interactive_shell == 0 && IS_FOREGROUND (job) && check_window_size)
- get_new_window_size (0, (int *)0, (int *)0);
-
- /* Moved here from set_job_status_and_cleanup, which is in the SIGCHLD
- signal handler path */
- if (DEADJOB (job) && IS_FOREGROUND (job) /*&& subshell_environment == 0*/)
- setjstatus (job);
-
- /* If this job is dead, notify the user of the status. If the shell
- is interactive, this will display a message on the terminal. If
- the shell is not interactive, make sure we turn on the notify bit
- so we don't get an unwanted message about the job's termination,
- and so delete_job really clears the slot in the jobs table. */
- notify_and_cleanup ();
- }
-
-wait_for_return:
-
- UNBLOCK_CHILD (oset);
-
- return (termination_state);
-}
-
-/* Wait for the last process in the pipeline for JOB. Returns whatever
- wait_for returns: the last process's termination state or -1 if there
- are no unwaited-for child processes or an error occurs. */
-int
-wait_for_job (job)
- int job;
-{
- pid_t pid;
- int r;
- sigset_t set, oset;
-
- BLOCK_CHILD(set, oset);
- if (JOBSTATE (job) == JSTOPPED)
- internal_warning (_("wait_for_job: job %d is stopped"), job+1);
-
- pid = find_last_pid (job, 0);
- UNBLOCK_CHILD(oset);
- r = wait_for (pid);
-
- /* POSIX.2: we can remove the job from the jobs table if we just waited
- for it. */
- BLOCK_CHILD (set, oset);
- if (job != NO_JOB && jobs[job] && DEADJOB (job))
- jobs[job]->flags |= J_NOTIFIED;
- UNBLOCK_CHILD (oset);
-
- return r;
-}
-
-/* Wait for any background job started by this shell to finish. Very
- similar to wait_for_background_pids(). Returns the exit status of
- the next exiting job, -1 if there are no background jobs. The caller
- is responsible for translating -1 into the right return value. */
-int
-wait_for_any_job ()
-{
- pid_t pid;
- int i, r, waited_for;
- sigset_t set, oset;
-
- if (jobs_list_frozen)
- return -1;
-
- /* First see if there are any unnotified dead jobs that we can report on */
- BLOCK_CHILD (set, oset);
- for (i = 0; i < js.j_jobslots; i++)
- {
- if (jobs[i] && DEADJOB (i) && IS_NOTIFIED (i) == 0)
- {
-return_job:
- r = job_exit_status (i);
- notify_of_job_status (); /* XXX */
- delete_job (i, 0);
-#if defined (COPROCESS_SUPPORT)
- coproc_reap ();
-#endif
- UNBLOCK_CHILD (oset);
- return r;
- }
- }
- UNBLOCK_CHILD (oset);
-
- /* At this point, we have no dead jobs in the jobs table. Wait until we
- get one, even if it takes multiple pids exiting. */
- for (waited_for = 0;;)
- {
- /* Make sure there is a background job to wait for */
- BLOCK_CHILD (set, oset);
- for (i = 0; i < js.j_jobslots; i++)
- if (jobs[i] && RUNNING (i) && IS_FOREGROUND (i) == 0)
- break;
- if (i == js.j_jobslots)
- {
- UNBLOCK_CHILD (oset);
- return -1;
- }
-
- UNBLOCK_CHILD (oset);
-
- QUIT;
- CHECK_TERMSIG;
- CHECK_WAIT_INTR;
-
- errno = 0;
- r = wait_for (ANY_PID); /* special sentinel value for wait_for */
- if (r == -1 && errno == ECHILD)
- mark_all_jobs_as_dead ();
-
- /* Now we see if we have any dead jobs and return the first one */
- BLOCK_CHILD (set, oset);
- for (i = 0; i < js.j_jobslots; i++)
- if (jobs[i] && DEADJOB (i))
- goto return_job;
- UNBLOCK_CHILD (oset);
- }
-
- return -1;
-}
-
-/* Print info about dead jobs, and then delete them from the list
- of known jobs. This does not actually delete jobs when the
- shell is not interactive, because the dead jobs are not marked
- as notified. */
-void
-notify_and_cleanup ()
-{
- if (jobs_list_frozen)
- return;
-
- if (interactive || interactive_shell == 0 || sourcelevel)
- notify_of_job_status ();
-
- cleanup_dead_jobs ();
-}
-
-/* Make dead jobs disappear from the jobs array without notification.
- This is used when the shell is not interactive. */
-void
-reap_dead_jobs ()
-{
- mark_dead_jobs_as_notified (0);
- cleanup_dead_jobs ();
-}
-
-/* Return the next closest (chronologically) job to JOB which is in
- STATE. STATE can be JSTOPPED, JRUNNING. NO_JOB is returned if
- there is no next recent job. */
-static int
-most_recent_job_in_state (job, state)
- int job;
- JOB_STATE state;
-{
- register int i, result;
- sigset_t set, oset;
-
- BLOCK_CHILD (set, oset);
-
- for (result = NO_JOB, i = job - 1; i >= 0; i--)
- {
- if (jobs[i] && (JOBSTATE (i) == state))
- {
- result = i;
- break;
- }
- }
-
- UNBLOCK_CHILD (oset);
-
- return (result);
-}
-
-/* Return the newest *stopped* job older than JOB, or NO_JOB if not
- found. */
-static int
-job_last_stopped (job)
- int job;
-{
- return (most_recent_job_in_state (job, JSTOPPED));
-}
-
-/* Return the newest *running* job older than JOB, or NO_JOB if not
- found. */
-static int
-job_last_running (job)
- int job;
-{
- return (most_recent_job_in_state (job, JRUNNING));
-}
-
-/* Make JOB be the current job, and make previous be useful. Must be
- called with SIGCHLD blocked. */
-static void
-set_current_job (job)
- int job;
-{
- int candidate;
-
- if (js.j_current != job)
- {
- js.j_previous = js.j_current;
- js.j_current = job;
- }
-
- /* First choice for previous job is the old current job. */
- if (js.j_previous != js.j_current &&
- js.j_previous != NO_JOB &&
- jobs[js.j_previous] &&
- STOPPED (js.j_previous))
- return;
-
- /* Second choice: Newest stopped job that is older than
- the current job. */
- candidate = NO_JOB;
- if (STOPPED (js.j_current))
- {
- candidate = job_last_stopped (js.j_current);
-
- if (candidate != NO_JOB)
- {
- js.j_previous = candidate;
- return;
- }
- }
-
- /* If we get here, there is either only one stopped job, in which case it is
- the current job and the previous job should be set to the newest running
- job, or there are only running jobs and the previous job should be set to
- the newest running job older than the current job. We decide on which
- alternative to use based on whether or not JOBSTATE(js.j_current) is
- JSTOPPED. */
-
- candidate = RUNNING (js.j_current) ? job_last_running (js.j_current)
- : job_last_running (js.j_jobslots);
-
- if (candidate != NO_JOB)
- {
- js.j_previous = candidate;
- return;
- }
-
- /* There is only a single job, and it is both `+' and `-'. */
- js.j_previous = js.j_current;
-}
-
-/* Make current_job be something useful, if it isn't already. */
-
-/* Here's the deal: The newest non-running job should be `+', and the
- next-newest non-running job should be `-'. If there is only a single
- stopped job, the js.j_previous is the newest non-running job. If there
- are only running jobs, the newest running job is `+' and the
- next-newest running job is `-'. Must be called with SIGCHLD blocked. */
-
-static void
-reset_current ()
-{
- int candidate;
-
- if (js.j_jobslots && js.j_current != NO_JOB && jobs[js.j_current] && STOPPED (js.j_current))
- candidate = js.j_current;
- else
- {
- candidate = NO_JOB;
-
- /* First choice: the previous job. */
- if (js.j_previous != NO_JOB && jobs[js.j_previous] && STOPPED (js.j_previous))
- candidate = js.j_previous;
-
- /* Second choice: the most recently stopped job. */
- if (candidate == NO_JOB)
- candidate = job_last_stopped (js.j_jobslots);
-
- /* Third choice: the newest running job. */
- if (candidate == NO_JOB)
- candidate = job_last_running (js.j_jobslots);
- }
-
- /* If we found a job to use, then use it. Otherwise, there
- are no jobs period. */
- if (candidate != NO_JOB)
- set_current_job (candidate);
- else
- js.j_current = js.j_previous = NO_JOB;
-}
-
-/* Set up the job structures so we know the job and its processes are
- all running. */
-static void
-set_job_running (job)
- int job;
-{
- register PROCESS *p;
-
- /* Each member of the pipeline is now running. */
- p = jobs[job]->pipe;
-
- do
- {
- if (WIFSTOPPED (p->status))
- p->running = PS_RUNNING; /* XXX - could be PS_STOPPED */
- p = p->next;
- }
- while (p != jobs[job]->pipe);
-
- /* This means that the job is running. */
- JOBSTATE (job) = JRUNNING;
-}
-
-/* Start a job. FOREGROUND if non-zero says to do that. Otherwise,
- start the job in the background. JOB is a zero-based index into
- JOBS. Returns -1 if it is unable to start a job, and the return
- status of the job otherwise. */
-int
-start_job (job, foreground)
- int job, foreground;
-{
- register PROCESS *p;
- int already_running;
- sigset_t set, oset;
- char *wd, *s;
- static TTYSTRUCT save_stty;
-
- BLOCK_CHILD (set, oset);
-
- if (DEADJOB (job))
- {
- internal_error (_("%s: job has terminated"), this_command_name);
- UNBLOCK_CHILD (oset);
- return (-1);
- }
-
- already_running = RUNNING (job);
-
- if (foreground == 0 && already_running)
- {
- internal_error (_("%s: job %d already in background"), this_command_name, job + 1);
- UNBLOCK_CHILD (oset);
- return (0); /* XPG6/SUSv3 says this is not an error */
- }
-
- wd = current_working_directory ();
-
- /* You don't know about the state of this job. Do you? */
- jobs[job]->flags &= ~J_NOTIFIED;
-
- if (foreground)
- {
- set_current_job (job);
- jobs[job]->flags |= J_FOREGROUND;
- }
-
- /* Tell the outside world what we're doing. */
- p = jobs[job]->pipe;
-
- if (foreground == 0)
- {
- /* POSIX.2 says `bg' doesn't give any indication about current or
- previous job. */
- if (posixly_correct == 0)
- s = (job == js.j_current) ? "+ ": ((job == js.j_previous) ? "- " : " ");
- else
- s = " ";
- printf ("[%d]%s", job + 1, s);
- }
-
- do
- {
- printf ("%s%s",
- p->command ? p->command : "",
- p->next != jobs[job]->pipe? " | " : "");
- p = p->next;
- }
- while (p != jobs[job]->pipe);
-
- if (foreground == 0)
- printf (" &");
-
- if (strcmp (wd, jobs[job]->wd) != 0)
- printf (" (wd: %s)", polite_directory_format (jobs[job]->wd));
-
- printf ("\n");
-
- /* Run the job. */
- if (already_running == 0)
- set_job_running (job);
-
- /* Save the tty settings before we start the job in the foreground. */
- if (foreground)
- {
- get_tty_state ();
- save_stty = shell_tty_info;
- /* Give the terminal to this job. */
- if (IS_JOBCONTROL (job))
- give_terminal_to (jobs[job]->pgrp, 0);
- }
- else
- jobs[job]->flags &= ~J_FOREGROUND;
-
- /* If the job is already running, then don't bother jump-starting it. */
- if (already_running == 0)
- {
- jobs[job]->flags |= J_NOTIFIED;
- killpg (jobs[job]->pgrp, SIGCONT);
- }
-
- if (foreground)
- {
- pid_t pid;
- int st;
-
- pid = find_last_pid (job, 0);
- UNBLOCK_CHILD (oset);
- st = wait_for (pid);
- shell_tty_info = save_stty;
- set_tty_state ();
- return (st);
- }
- else
- {
- reset_current ();
- UNBLOCK_CHILD (oset);
- return (0);
- }
-}
-
-/* Give PID SIGNAL. This determines what job the pid belongs to (if any).
- If PID does belong to a job, and the job is stopped, then CONTinue the
- job after giving it SIGNAL. Returns -1 on failure. If GROUP is non-null,
- then kill the process group associated with PID. */
-int
-kill_pid (pid, sig, group)
- pid_t pid;
- int sig, group;
-{
- register PROCESS *p;
- int job, result, negative;
- sigset_t set, oset;
-
- if (pid < -1)
- {
- pid = -pid;
- group = negative = 1;
- }
- else
- negative = 0;
-
- result = EXECUTION_SUCCESS;
- if (group)
- {
- BLOCK_CHILD (set, oset);
- p = find_pipeline (pid, 0, &job);
-
- if (job != NO_JOB)
- {
- jobs[job]->flags &= ~J_NOTIFIED;
-
- /* Kill process in backquotes or one started without job control? */
-
- /* If we're passed a pid < -1, just call killpg and see what happens */
- if (negative && jobs[job]->pgrp == shell_pgrp)
- result = killpg (pid, sig);
- /* If we're killing using job control notification, for example,
- without job control active, we have to do things ourselves. */
- else if (jobs[job]->pgrp == shell_pgrp)
- {
- p = jobs[job]->pipe;
- do
- {
- if (PALIVE (p) == 0)
- continue; /* avoid pid recycling problem */
- kill (p->pid, sig);
- if (PEXITED (p) && (sig == SIGTERM || sig == SIGHUP))
- kill (p->pid, SIGCONT);
- p = p->next;
- }
- while (p != jobs[job]->pipe);
- }
- else
- {
- result = killpg (jobs[job]->pgrp, sig);
- if (p && STOPPED (job) && (sig == SIGTERM || sig == SIGHUP))
- killpg (jobs[job]->pgrp, SIGCONT);
- /* If we're continuing a stopped job via kill rather than bg or
- fg, emulate the `bg' behavior. */
- if (p && STOPPED (job) && (sig == SIGCONT))
- {
- set_job_running (job);
- jobs[job]->flags &= ~J_FOREGROUND;
- jobs[job]->flags |= J_NOTIFIED;
- }
- }
- }
- else
- result = killpg (pid, sig);
-
- UNBLOCK_CHILD (oset);
- }
- else
- result = kill (pid, sig);
-
- return (result);
-}
-
-/* sigchld_handler () flushes at least one of the children that we are
- waiting for. It gets run when we have gotten a SIGCHLD signal. */
-static sighandler
-sigchld_handler (sig)
- int sig;
-{
- int n, oerrno;
-
- oerrno = errno;
- REINSTALL_SIGCHLD_HANDLER;
- sigchld++;
- n = 0;
- if (queue_sigchld == 0)
- n = waitchld (-1, 0);
- errno = oerrno;
- SIGRETURN (n);
-}
-
-/* waitchld() reaps dead or stopped children. It's called by wait_for and
- sigchld_handler, and runs until there aren't any children terminating any
- more.
- If BLOCK is 1, this is to be a blocking wait for a single child, although
- an arriving SIGCHLD could cause the wait to be non-blocking. It returns
- the number of children reaped, or -1 if there are no unwaited-for child
- processes. */
-static int
-waitchld (wpid, block)
- pid_t wpid;
- int block;
-{
- WAIT status;
- PROCESS *child;
- pid_t pid;
-
- int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
- static int wcontinued = WCONTINUED; /* run-time fix for glibc problem */
-
- call_set_current = children_exited = 0;
- last_stopped_job = NO_JOB;
-
- do
- {
- /* We don't want to be notified about jobs stopping if job control
- is not active. XXX - was interactive_shell instead of job_control */
- waitpid_flags = (job_control && subshell_environment == 0)
- ? (WUNTRACED|wcontinued)
- : 0;
- if (sigchld || block == 0)
- waitpid_flags |= WNOHANG;
-
- /* Check for terminating signals and exit the shell if we receive one */
- CHECK_TERMSIG;
- /* Check for a trapped signal interrupting the wait builtin and jump out */
- CHECK_WAIT_INTR;
-
- if (block == 1 && queue_sigchld == 0 && (waitpid_flags & WNOHANG) == 0)
- {
- internal_warning (_("waitchld: turning on WNOHANG to avoid indefinite block"));
- waitpid_flags |= WNOHANG;
- }
-
- pid = WAITPID (-1, &status, waitpid_flags);
-
-#if 0
-if (wpid != -1 && block)
- itrace("waitchld: blocking waitpid returns %d", pid);
-#endif
- /* WCONTINUED may be rejected by waitpid as invalid even when defined */
- if (wcontinued && pid < 0 && errno == EINVAL)
- {
- wcontinued = 0;
- continue; /* jump back to the test and retry without WCONTINUED */
- }
-
- /* The check for WNOHANG is to make sure we decrement sigchld only
- if it was non-zero before we called waitpid. */
- if (sigchld > 0 && (waitpid_flags & WNOHANG))
- sigchld--;
-
- /* If waitpid returns -1 with errno == ECHILD, there are no more
- unwaited-for child processes of this shell. */
- if (pid < 0 && errno == ECHILD)
- {
- if (children_exited == 0)
- return -1;
- else
- break;
- }
-
-#if 0
-itrace("waitchld: waitpid returns %d block = %d", pid, block);
-#endif
- /* If waitpid returns 0, there are running children. If it returns -1,
- the only other error POSIX says it can return is EINTR. */
- CHECK_TERMSIG;
- CHECK_WAIT_INTR;
-
- /* If waitpid returns -1/EINTR and the shell saw a SIGINT, then we
- assume the child has blocked or handled SIGINT. In that case, we
- require the child to actually die due to SIGINT to act on the
- SIGINT we received; otherwise we assume the child handled it and
- let it go. */
- if (pid < 0 && errno == EINTR && wait_sigint_received)
- child_caught_sigint = 1;
-
- if (pid <= 0)
- continue; /* jumps right to the test */
-
- /* If the child process did die due to SIGINT, forget our assumption
- that it caught or otherwise handled it. */
- if (WIFSIGNALED (status) && WTERMSIG (status) == SIGINT)
- child_caught_sigint = 0;
-
- /* children_exited is used to run traps on SIGCHLD. We don't want to
- run the trap if a process is just being continued. */
- if (WIFCONTINUED(status) == 0)
- {
- children_exited++;
- js.c_living--;
- }
-
- /* Locate our PROCESS for this pid. */
- child = find_process (pid, 1, &job); /* want living procs only */
-
-#if defined (COPROCESS_SUPPORT)
- coproc_pidchk (pid, WSTATUS(status));
-#endif
-
- /* It is not an error to have a child terminate that we did
- not have a record of. This child could have been part of
- a pipeline in backquote substitution. Even so, I'm not
- sure child is ever non-zero. */
- if (child == 0)
- {
- if (WIFEXITED (status) || WIFSIGNALED (status))
- js.c_reaped++;
- continue;
- }
-
- /* Remember status, and whether or not the process is running. */
- child->status = status;
- child->running = WIFCONTINUED(status) ? PS_RUNNING : PS_DONE;
-
- if (PEXITED (child))
- {
- js.c_totreaped++;
- if (job != NO_JOB)
- js.c_reaped++;
- }
-
- if (job == NO_JOB)
- continue;
-
- call_set_current += set_job_status_and_cleanup (job);
-
- if (STOPPED (job))
- last_stopped_job = job;
- else if (DEADJOB (job) && last_stopped_job == job)
- last_stopped_job = NO_JOB;
- }
- while ((sigchld || block == 0) && pid > (pid_t)0);
-
- /* If a job was running and became stopped, then set the current
- job. Otherwise, don't change a thing. */
- if (call_set_current)
- {
- if (last_stopped_job != NO_JOB)
- set_current_job (last_stopped_job);
- else
- reset_current ();
- }
-
- /* Call a SIGCHLD trap handler for each child that exits, if one is set. */
- if (job_control && signal_is_trapped (SIGCHLD) && children_exited &&
- trap_list[SIGCHLD] != (char *)IGNORE_SIG)
- {
- if (posixly_correct && this_shell_builtin && this_shell_builtin == wait_builtin)
- {
- interrupt_immediately = 0;
- trap_handler (SIGCHLD); /* set pending_traps[SIGCHLD] */
- wait_signal_received = SIGCHLD;
- /* If we're in a signal handler, let CHECK_WAIT_INTR pick it up;
- run_pending_traps will call run_sigchld_trap later */
- if (sigchld == 0)
- longjmp (wait_intr_buf, 1);
- }
- /* If not in posix mode and not executing the wait builtin, queue the
- signal for later handling. Run the trap immediately if we are
- executing the wait builtin, but don't break out of `wait'. */
- else if (sigchld) /* called from signal handler */
- queue_sigchld_trap (children_exited);
- else if (running_trap)
- queue_sigchld_trap (children_exited);
- else if (this_shell_builtin == wait_builtin)
- run_sigchld_trap (children_exited);
- else
- queue_sigchld_trap (children_exited);
- }
-
- /* We have successfully recorded the useful information about this process
- that has just changed state. If we notify asynchronously, and the job
- that this process belongs to is no longer running, then notify the user
- of that fact now. */
- if (asynchronous_notification && interactive)
- notify_of_job_status ();
-
- return (children_exited);
-}
-
-/* Set the status of JOB and perform any necessary cleanup if the job is
- marked as JDEAD.
-
- Currently, the cleanup activity is restricted to handling any SIGINT
- received while waiting for a foreground job to finish. */
-static int
-set_job_status_and_cleanup (job)
- int job;
-{
- PROCESS *child;
- int tstatus, job_state, any_stopped, any_tstped, call_set_current;
- SigHandler *temp_handler;
-
- child = jobs[job]->pipe;
- jobs[job]->flags &= ~J_NOTIFIED;
-
- call_set_current = 0;
-
- /*
- * COMPUTE JOB STATUS
- */
-
- /* If all children are not running, but any of them is stopped, then
- the job is stopped, not dead. */
- job_state = any_stopped = any_tstped = 0;
- do
- {
- job_state |= PRUNNING (child);
-#if 0
- if (PEXITED (child) && (WIFSTOPPED (child->status)))
-#else
- /* Only checking for WIFSTOPPED now, not for PS_DONE */
- if (PSTOPPED (child))
-#endif
- {
- any_stopped = 1;
- any_tstped |= job_control && (WSTOPSIG (child->status) == SIGTSTP);
- }
- child = child->next;
- }
- while (child != jobs[job]->pipe);
-
- /* If job_state != 0, the job is still running, so don't bother with
- setting the process exit status and job state unless we're
- transitioning from stopped to running. */
- if (job_state != 0 && JOBSTATE(job) != JSTOPPED)
- return 0;
-
- /*
- * SET JOB STATUS
- */
-
- /* The job is either stopped or dead. Set the state of the job accordingly. */
- if (any_stopped)
- {
- jobs[job]->state = JSTOPPED;
- jobs[job]->flags &= ~J_FOREGROUND;
- call_set_current++;
- /* Suspending a job with SIGTSTP breaks all active loops. */
- if (any_tstped && loop_level)
- breaking = loop_level;
- }
- else if (job_state != 0) /* was stopped, now running */
- {
- jobs[job]->state = JRUNNING;
- call_set_current++;
- }
- else
- {
- jobs[job]->state = JDEAD;
- js.j_ndead++;
-
-#if 0
- if (IS_FOREGROUND (job))
- setjstatus (job);
-#endif
-
- /* If this job has a cleanup function associated with it, call it
- with `cleanarg' as the single argument, then set the function
- pointer to NULL so it is not inadvertently called twice. The
- cleanup function is responsible for deallocating cleanarg. */
- if (jobs[job]->j_cleanup)
- {
- (*jobs[job]->j_cleanup) (jobs[job]->cleanarg);
- jobs[job]->j_cleanup = (sh_vptrfunc_t *)NULL;
- }
- }
-
- /*
- * CLEANUP
- *
- * Currently, we just do special things if we got a SIGINT while waiting
- * for a foreground job to complete
- */
-
- if (JOBSTATE (job) == JDEAD)
- {
- /* If we're running a shell script and we get a SIGINT with a
- SIGINT trap handler, but the foreground job handles it and
- does not exit due to SIGINT, run the trap handler but do not
- otherwise act as if we got the interrupt. */
- if (wait_sigint_received && interactive_shell == 0 &&
- child_caught_sigint && IS_FOREGROUND (job) &&
- signal_is_trapped (SIGINT))
- {
- int old_frozen;
- wait_sigint_received = 0;
- last_command_exit_value = process_exit_status (child->status);
-
- old_frozen = jobs_list_frozen;
- jobs_list_frozen = 1;
- tstatus = maybe_call_trap_handler (SIGINT);
- jobs_list_frozen = old_frozen;
- }
-
- /* If the foreground job is killed by SIGINT when job control is not
- active, we need to perform some special handling.
-
- The check of wait_sigint_received is a way to determine if the
- SIGINT came from the keyboard (in which case the shell has already
- seen it, and wait_sigint_received is non-zero, because keyboard
- signals are sent to process groups) or via kill(2) to the foreground
- process by another process (or itself). If the shell did receive the
- SIGINT, it needs to perform normal SIGINT processing. */
- else if (wait_sigint_received &&
- child_caught_sigint == 0 &&
- IS_FOREGROUND (job) && IS_JOBCONTROL (job) == 0)
- {
- int old_frozen;
-
- wait_sigint_received = 0;
-
- /* If SIGINT is trapped, set the exit status so that the trap
- handler can see it. */
- if (signal_is_trapped (SIGINT))
- last_command_exit_value = process_exit_status (child->status);
-
- /* If the signal is trapped, let the trap handler get it no matter
- what and simply return if the trap handler returns.
- maybe_call_trap_handler() may cause dead jobs to be removed from
- the job table because of a call to execute_command. We work
- around this by setting JOBS_LIST_FROZEN. */
- old_frozen = jobs_list_frozen;
- jobs_list_frozen = 1;
- tstatus = maybe_call_trap_handler (SIGINT);
- jobs_list_frozen = old_frozen;
- if (tstatus == 0 && old_sigint_handler != INVALID_SIGNAL_HANDLER)
- {
- /* wait_sigint_handler () has already seen SIGINT and
- allowed the wait builtin to jump out. We need to
- call the original SIGINT handler, if necessary. If
- the original handler is SIG_DFL, we need to resend
- the signal to ourselves. */
-
- temp_handler = old_sigint_handler;
-
- /* Bogus. If we've reset the signal handler as the result
- of a trap caught on SIGINT, then old_sigint_handler
- will point to trap_handler, which now knows nothing about
- SIGINT (if we reset the sighandler to the default).
- In this case, we have to fix things up. What a crock. */
- if (temp_handler == trap_handler && signal_is_trapped (SIGINT) == 0)
- temp_handler = trap_to_sighandler (SIGINT);
- restore_sigint_handler ();
- if (temp_handler == SIG_DFL)
- termsig_handler (SIGINT); /* XXX */
- else if (temp_handler != SIG_IGN)
- (*temp_handler) (SIGINT);
- }
- }
- }
-
- return call_set_current;
-}
-
-/* Build the array of values for the $PIPESTATUS variable from the set of
- exit statuses of all processes in the job J. */
-static void
-setjstatus (j)
- int j;
-{
-#if defined (ARRAY_VARS)
- register int i;
- register PROCESS *p;
-
- for (i = 1, p = jobs[j]->pipe; p->next != jobs[j]->pipe; p = p->next, i++)
- ;
- i++;
- if (statsize < i)
- {
- pstatuses = (int *)xrealloc (pstatuses, i * sizeof (int));
- statsize = i;
- }
- i = 0;
- p = jobs[j]->pipe;
- do
- {
- pstatuses[i++] = process_exit_status (p->status);
- p = p->next;
- }
- while (p != jobs[j]->pipe);
-
- pstatuses[i] = -1; /* sentinel */
- set_pipestatus_array (pstatuses, i);
-#endif
-}
-
-void
-run_sigchld_trap (nchild)
- int nchild;
-{
- char *trap_command;
- int i;
-
- /* Turn off the trap list during the call to parse_and_execute ()
- to avoid potentially infinite recursive calls. Preserve the
- values of last_command_exit_value, last_made_pid, and the_pipeline
- around the execution of the trap commands. */
- trap_command = savestring (trap_list[SIGCHLD]);
-
- begin_unwind_frame ("SIGCHLD trap");
- unwind_protect_int (last_command_exit_value);
- unwind_protect_int (last_command_exit_signal);
- unwind_protect_var (last_made_pid);
- unwind_protect_int (interrupt_immediately);
- unwind_protect_int (jobs_list_frozen);
- unwind_protect_pointer (the_pipeline);
- unwind_protect_pointer (subst_assign_varlist);
-
- /* We have to add the commands this way because they will be run
- in reverse order of adding. We don't want maybe_set_sigchld_trap ()
- to reference freed memory. */
- add_unwind_protect (xfree, trap_command);
- add_unwind_protect (maybe_set_sigchld_trap, trap_command);
-
- subst_assign_varlist = (WORD_LIST *)NULL;
- the_pipeline = (PROCESS *)NULL;
-
- running_trap = SIGCHLD + 1;
-
- set_impossible_sigchld_trap ();
- jobs_list_frozen = 1;
- for (i = 0; i < nchild; i++)
- {
-#if 0
- interrupt_immediately = 1;
-#endif
- parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST|SEVAL_RESETLINE);
- }
-
- run_unwind_frame ("SIGCHLD trap");
- running_trap = 0;
-}
-
-/* Function to call when you want to notify people of changes
- in job status. This prints out all jobs which are pending
- notification to stderr, and marks those printed as already
- notified, thus making them candidates for cleanup. */
-static void
-notify_of_job_status ()
-{
- register int job, termsig;
- char *dir;
- sigset_t set, oset;
- WAIT s;
-
- if (jobs == 0 || js.j_jobslots == 0)
- return;
-
- if (old_ttou != 0)
- {
- sigemptyset (&set);
- sigaddset (&set, SIGCHLD);
- sigaddset (&set, SIGTTOU);
- sigemptyset (&oset);
- sigprocmask (SIG_BLOCK, &set, &oset);
- }
- else
- queue_sigchld++;
-
- /* XXX could use js.j_firstj here */
- for (job = 0, dir = (char *)NULL; job < js.j_jobslots; job++)
- {
- if (jobs[job] && IS_NOTIFIED (job) == 0)
- {
- s = raw_job_exit_status (job);
- termsig = WTERMSIG (s);
-
- /* POSIX.2 says we have to hang onto the statuses of at most the
- last CHILD_MAX background processes if the shell is running a
- script. If the shell is running a script, either from a file
- or standard input, don't print anything unless the job was
- killed by a signal. */
- if (startup_state == 0 && WIFSIGNALED (s) == 0 &&
- ((DEADJOB (job) && IS_FOREGROUND (job) == 0) || STOPPED (job)))
- continue;
-
-#if 0
- /* If job control is disabled, don't print the status messages.
- Mark dead jobs as notified so that they get cleaned up. If
- startup_state == 2, we were started to run `-c command', so
- don't print anything. */
- if ((job_control == 0 && interactive_shell) || startup_state == 2)
-#else
- /* If job control is disabled, don't print the status messages.
- Mark dead jobs as notified so that they get cleaned up. If
- startup_state == 2 and subshell_environment has the
- SUBSHELL_COMSUB bit turned on, we were started to run a command
- substitution, so don't print anything. */
- if ((job_control == 0 && interactive_shell) ||
- (startup_state == 2 && (subshell_environment & SUBSHELL_COMSUB)))
-#endif
- {
- /* POSIX.2 compatibility: if the shell is not interactive,
- hang onto the job corresponding to the last asynchronous
- pid until the user has been notified of its status or does
- a `wait'. */
- if (DEADJOB (job) && (interactive_shell || (find_last_pid (job, 0) != last_asynchronous_pid)))
- jobs[job]->flags |= J_NOTIFIED;
- continue;
- }
-
- /* Print info on jobs that are running in the background,
- and on foreground jobs that were killed by anything
- except SIGINT (and possibly SIGPIPE). */
- switch (JOBSTATE (job))
- {
- case JDEAD:
- if (interactive_shell == 0 && termsig && WIFSIGNALED (s) &&
- termsig != SIGINT &&
-#if defined (DONT_REPORT_SIGTERM)
- termsig != SIGTERM &&
-#endif
-#if defined (DONT_REPORT_SIGPIPE)
- termsig != SIGPIPE &&
-#endif
- signal_is_trapped (termsig) == 0)
- {
- /* Don't print `0' for a line number. */
- fprintf (stderr, _("%s: line %d: "), get_name_for_error (), (line_number == 0) ? 1 : line_number);
- pretty_print_job (job, JLIST_NONINTERACTIVE, stderr);
- }
- else if (IS_FOREGROUND (job))
- {
-#if !defined (DONT_REPORT_SIGPIPE)
- if (termsig && WIFSIGNALED (s) && termsig != SIGINT)
-#else
- if (termsig && WIFSIGNALED (s) && termsig != SIGINT && termsig != SIGPIPE)
-#endif
- {
- fprintf (stderr, "%s", j_strsignal (termsig));
-
- if (WIFCORED (s))
- fprintf (stderr, _(" (core dumped)"));
-
- fprintf (stderr, "\n");
- }
- }
- else if (job_control) /* XXX job control test added */
- {
- if (dir == 0)
- dir = current_working_directory ();
- pretty_print_job (job, JLIST_STANDARD, stderr);
- if (dir && strcmp (dir, jobs[job]->wd) != 0)
- fprintf (stderr,
- _("(wd now: %s)\n"), polite_directory_format (dir));
- }
-
- jobs[job]->flags |= J_NOTIFIED;
- break;
-
- case JSTOPPED:
- fprintf (stderr, "\n");
- if (dir == 0)
- dir = current_working_directory ();
- pretty_print_job (job, JLIST_STANDARD, stderr);
- if (dir && (strcmp (dir, jobs[job]->wd) != 0))
- fprintf (stderr,
- _("(wd now: %s)\n"), polite_directory_format (dir));
- jobs[job]->flags |= J_NOTIFIED;
- break;
-
- case JRUNNING:
- case JMIXED:
- break;
-
- default:
- programming_error ("notify_of_job_status");
- }
- }
- }
- if (old_ttou != 0)
- sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
- else
- queue_sigchld--;
-}
-
-/* Initialize the job control mechanism, and set up the tty stuff. */
-int
-initialize_job_control (force)
- int force;
-{
- pid_t t;
- int t_errno;
-
- t_errno = -1;
- shell_pgrp = getpgid (0);
-
- if (shell_pgrp == -1)
- {
- sys_error (_("initialize_job_control: getpgrp failed"));
- exit (1);
- }
-
- /* We can only have job control if we are interactive unless we force it. */
- if (interactive == 0 && force == 0)
- {
- job_control = 0;
- original_pgrp = NO_PID;
- shell_tty = fileno (stderr);
- }
- else
- {
- shell_tty = -1;
-
- /* If forced_interactive is set, we skip the normal check that stderr
- is attached to a tty, so we need to check here. If it's not, we
- need to see whether we have a controlling tty by opening /dev/tty,
- since trying to use job control tty pgrp manipulations on a non-tty
- is going to fail. */
- if (forced_interactive && isatty (fileno (stderr)) == 0)
- shell_tty = open ("/dev/tty", O_RDWR|O_NONBLOCK);
-
- /* Get our controlling terminal. If job_control is set, or
- interactive is set, then this is an interactive shell no
- matter where fd 2 is directed. */
- if (shell_tty == -1)
- shell_tty = dup (fileno (stderr)); /* fd 2 */
-
- if (shell_tty != -1)
- shell_tty = move_to_high_fd (shell_tty, 1, -1);
-
- /* Compensate for a bug in systems that compiled the BSD
- rlogind with DEBUG defined, like NeXT and Alliant. */
- if (shell_pgrp == 0)
- {
- shell_pgrp = getpid ();
- setpgid (0, shell_pgrp);
- tcsetpgrp (shell_tty, shell_pgrp);
- }
-
- while ((terminal_pgrp = tcgetpgrp (shell_tty)) != -1)
- {
- if (shell_pgrp != terminal_pgrp)
- {
- SigHandler *ottin;
-
- ottin = set_signal_handler(SIGTTIN, SIG_DFL);
- kill (0, SIGTTIN);
- set_signal_handler (SIGTTIN, ottin);
- continue;
- }
- break;
- }
-
- if (terminal_pgrp == -1)
- t_errno = errno;
-
- /* Make sure that we are using the new line discipline. */
- if (set_new_line_discipline (shell_tty) < 0)
- {
- sys_error (_("initialize_job_control: line discipline"));
- job_control = 0;
- }
- else
- {
- original_pgrp = shell_pgrp;
- shell_pgrp = getpid ();
-
- if ((original_pgrp != shell_pgrp) && (setpgid (0, shell_pgrp) < 0))
- {
- sys_error (_("initialize_job_control: setpgid"));
- shell_pgrp = original_pgrp;
- }
-
- job_control = 1;
-
- /* If (and only if) we just set our process group to our pid,
- thereby becoming a process group leader, and the terminal
- is not in the same process group as our (new) process group,
- then set the terminal's process group to our (new) process
- group. If that fails, set our process group back to what it
- was originally (so we can still read from the terminal) and
- turn off job control. */
- if (shell_pgrp != original_pgrp && shell_pgrp != terminal_pgrp)
- {
- if (give_terminal_to (shell_pgrp, 0) < 0)
- {
- t_errno = errno;
- setpgid (0, original_pgrp);
- shell_pgrp = original_pgrp;
- errno = t_errno;
- sys_error (_("cannot set terminal process group (%d)"), shell_pgrp);
- job_control = 0;
- }
- }
-
- if (job_control && ((t = tcgetpgrp (shell_tty)) == -1 || t != shell_pgrp))
- {
- if (t_errno != -1)
- errno = t_errno;
- sys_error (_("cannot set terminal process group (%d)"), t);
- job_control = 0;
- }
- }
- if (job_control == 0)
- internal_error (_("no job control in this shell"));
- }
-
- if (shell_tty != fileno (stderr))
- SET_CLOSE_ON_EXEC (shell_tty);
-
- set_signal_handler (SIGCHLD, sigchld_handler);
-
- change_flag ('m', job_control ? '-' : '+');
-
- if (interactive)
- get_tty_state ();
-
- if (js.c_childmax < 0)
- js.c_childmax = getmaxchild ();
- if (js.c_childmax < 0)
- js.c_childmax = DEFAULT_CHILD_MAX;
-
- return job_control;
-}
-
-#ifdef DEBUG
-void
-debug_print_pgrps ()
-{
- itrace("original_pgrp = %ld shell_pgrp = %ld terminal_pgrp = %ld",
- (long)original_pgrp, (long)shell_pgrp, (long)terminal_pgrp);
- itrace("tcgetpgrp(%d) -> %ld, getpgid(0) -> %ld",
- shell_tty, (long)tcgetpgrp (shell_tty), (long)getpgid(0));
-}
-#endif
-
-/* Set the line discipline to the best this system has to offer.
- Return -1 if this is not possible. */
-static int
-set_new_line_discipline (tty)
- int tty;
-{
-#if defined (NEW_TTY_DRIVER)
- int ldisc;
-
- if (ioctl (tty, TIOCGETD, &ldisc) < 0)
- return (-1);
-
- if (ldisc != NTTYDISC)
- {
- ldisc = NTTYDISC;
-
- if (ioctl (tty, TIOCSETD, &ldisc) < 0)
- return (-1);
- }
- return (0);
-#endif /* NEW_TTY_DRIVER */
-
-#if defined (TERMIO_TTY_DRIVER)
-# if defined (TERMIO_LDISC) && (NTTYDISC)
- if (ioctl (tty, TCGETA, &shell_tty_info) < 0)
- return (-1);
-
- if (shell_tty_info.c_line != NTTYDISC)
- {
- shell_tty_info.c_line = NTTYDISC;
- if (ioctl (tty, TCSETAW, &shell_tty_info) < 0)
- return (-1);
- }
-# endif /* TERMIO_LDISC && NTTYDISC */
- return (0);
-#endif /* TERMIO_TTY_DRIVER */
-
-#if defined (TERMIOS_TTY_DRIVER)
-# if defined (TERMIOS_LDISC) && defined (NTTYDISC)
- if (tcgetattr (tty, &shell_tty_info) < 0)
- return (-1);
-
- if (shell_tty_info.c_line != NTTYDISC)
- {
- shell_tty_info.c_line = NTTYDISC;
- if (tcsetattr (tty, TCSADRAIN, &shell_tty_info) < 0)
- return (-1);
- }
-# endif /* TERMIOS_LDISC && NTTYDISC */
- return (0);
-#endif /* TERMIOS_TTY_DRIVER */
-
-#if !defined (NEW_TTY_DRIVER) && !defined (TERMIO_TTY_DRIVER) && !defined (TERMIOS_TTY_DRIVER)
- return (-1);
-#endif
-}
-
-/* Setup this shell to handle C-C, etc. */
-void
-initialize_job_signals ()
-{
- if (interactive)
- {
- set_signal_handler (SIGINT, sigint_sighandler);
- set_signal_handler (SIGTSTP, SIG_IGN);
- set_signal_handler (SIGTTOU, SIG_IGN);
- set_signal_handler (SIGTTIN, SIG_IGN);
- }
- else if (job_control)
- {
- old_tstp = set_signal_handler (SIGTSTP, sigstop_sighandler);
- old_ttin = set_signal_handler (SIGTTIN, sigstop_sighandler);
- old_ttou = set_signal_handler (SIGTTOU, sigstop_sighandler);
- }
- /* Leave these things alone for non-interactive shells without job
- control. */
-}
-
-/* Here we handle CONT signals. */
-static sighandler
-sigcont_sighandler (sig)
- int sig;
-{
- initialize_job_signals ();
- set_signal_handler (SIGCONT, old_cont);
- kill (getpid (), SIGCONT);
-
- SIGRETURN (0);
-}
-
-/* Here we handle stop signals while we are running not as a login shell. */
-static sighandler
-sigstop_sighandler (sig)
- int sig;
-{
- set_signal_handler (SIGTSTP, old_tstp);
- set_signal_handler (SIGTTOU, old_ttou);
- set_signal_handler (SIGTTIN, old_ttin);
-
- old_cont = set_signal_handler (SIGCONT, sigcont_sighandler);
-
- give_terminal_to (shell_pgrp, 0);
-
- kill (getpid (), sig);
-
- SIGRETURN (0);
-}
-
-/* Give the terminal to PGRP. */
-int
-give_terminal_to (pgrp, force)
- pid_t pgrp;
- int force;
-{
- sigset_t set, oset;
- int r, e;
-
- r = 0;
- if (job_control || force)
- {
- sigemptyset (&set);
- sigaddset (&set, SIGTTOU);
- sigaddset (&set, SIGTTIN);
- sigaddset (&set, SIGTSTP);
- sigaddset (&set, SIGCHLD);
- sigemptyset (&oset);
- sigprocmask (SIG_BLOCK, &set, &oset);
-
- if (tcsetpgrp (shell_tty, pgrp) < 0)
- {
- /* Maybe we should print an error message? */
-#if 0
- sys_error ("tcsetpgrp(%d) failed: pid %ld to pgrp %ld",
- shell_tty, (long)getpid(), (long)pgrp);
-#endif
- r = -1;
- e = errno;
- }
- else
- terminal_pgrp = pgrp;
- sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
- }
-
- if (r == -1)
- errno = e;
-
- return r;
-}
-
-/* Give terminal to NPGRP iff it's currently owned by OPGRP. FLAGS are the
- flags to pass to give_terminal_to(). */
-static int
-maybe_give_terminal_to (opgrp, npgrp, flags)
- pid_t opgrp, npgrp;
- int flags;
-{
- int tpgrp;
-
- tpgrp = tcgetpgrp (shell_tty);
- if (tpgrp < 0 && errno == ENOTTY)
- return -1;
- if (tpgrp == npgrp)
- {
- terminal_pgrp = npgrp;
- return 0;
- }
- else if (tpgrp != opgrp)
- {
-#if defined (DEBUG)
- internal_warning ("maybe_give_terminal_to: terminal pgrp == %d shell pgrp = %d new pgrp = %d", tpgrp, opgrp, npgrp);
-#endif
- return -1;
- }
- else
- return (give_terminal_to (npgrp, flags));
-}
-
-/* Clear out any jobs in the job array. This is intended to be used by
- children of the shell, who should not have any job structures as baggage
- when they start executing (forking subshells for parenthesized execution
- and functions with pipes are the two that spring to mind). If RUNNING_ONLY
- is nonzero, only running jobs are removed from the table. */
-void
-delete_all_jobs (running_only)
- int running_only;
-{
- register int i;
- sigset_t set, oset;
-
- BLOCK_CHILD (set, oset);
-
- /* XXX - need to set j_lastj, j_firstj appropriately if running_only != 0. */
- if (js.j_jobslots)
- {
- js.j_current = js.j_previous = NO_JOB;
-
- /* XXX could use js.j_firstj here */
- for (i = 0; i < js.j_jobslots; i++)
- {
-#if defined (DEBUG)
- if (i < js.j_firstj && jobs[i])
- itrace("delete_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
- if (i > js.j_lastj && jobs[i])
- itrace("delete_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
-#endif
- if (jobs[i] && (running_only == 0 || (running_only && RUNNING(i))))
- delete_job (i, DEL_WARNSTOPPED);
- }
- if (running_only == 0)
- {
- free ((char *)jobs);
- js.j_jobslots = 0;
- js.j_firstj = js.j_lastj = js.j_njobs = 0;
- }
- }
-
- if (running_only == 0)
- bgp_clear ();
-
- UNBLOCK_CHILD (oset);
-}
-
-/* Mark all jobs in the job array so that they don't get a SIGHUP when the
- shell gets one. If RUNNING_ONLY is nonzero, mark only running jobs. */
-void
-nohup_all_jobs (running_only)
- int running_only;
-{
- register int i;
- sigset_t set, oset;
-
- BLOCK_CHILD (set, oset);
-
- if (js.j_jobslots)
- {
- /* XXX could use js.j_firstj here */
- for (i = 0; i < js.j_jobslots; i++)
- if (jobs[i] && (running_only == 0 || (running_only && RUNNING(i))))
- nohup_job (i);
- }
-
- UNBLOCK_CHILD (oset);
-}
-
-int
-count_all_jobs ()
-{
- int i, n;
- sigset_t set, oset;
-
- /* This really counts all non-dead jobs. */
- BLOCK_CHILD (set, oset);
- /* XXX could use js.j_firstj here */
- for (i = n = 0; i < js.j_jobslots; i++)
- {
-#if defined (DEBUG)
- if (i < js.j_firstj && jobs[i])
- itrace("count_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
- if (i > js.j_lastj && jobs[i])
- itrace("count_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
-#endif
- if (jobs[i] && DEADJOB(i) == 0)
- n++;
- }
- UNBLOCK_CHILD (oset);
- return n;
-}
-
-static void
-mark_all_jobs_as_dead ()
-{
- register int i;
- sigset_t set, oset;
-
- if (js.j_jobslots == 0)
- return;
-
- BLOCK_CHILD (set, oset);
-
- /* XXX could use js.j_firstj here */
- for (i = 0; i < js.j_jobslots; i++)
- if (jobs[i])
- {
- jobs[i]->state = JDEAD;
- js.j_ndead++;
- }
-
- UNBLOCK_CHILD (oset);
-}
-
-/* Mark all dead jobs as notified, so delete_job () cleans them out
- of the job table properly. POSIX.2 says we need to save the
- status of the last CHILD_MAX jobs, so we count the number of dead
- jobs and mark only enough as notified to save CHILD_MAX statuses. */
-static void
-mark_dead_jobs_as_notified (force)
- int force;
-{
- register int i, ndead, ndeadproc;
- sigset_t set, oset;
-
- if (js.j_jobslots == 0)
- return;
-
- BLOCK_CHILD (set, oset);
-
- /* If FORCE is non-zero, we don't have to keep CHILD_MAX statuses
- around; just run through the array. */
- if (force)
- {
- /* XXX could use js.j_firstj here */
- for (i = 0; i < js.j_jobslots; i++)
- {
- if (jobs[i] && DEADJOB (i) && (interactive_shell || (find_last_pid (i, 0) != last_asynchronous_pid)))
- jobs[i]->flags |= J_NOTIFIED;
- }
- UNBLOCK_CHILD (oset);
- return;
- }
-
- /* Mark enough dead jobs as notified to keep CHILD_MAX processes left in the
- array with the corresponding not marked as notified. This is a better
- way to avoid pid aliasing and reuse problems than keeping the POSIX-
- mandated CHILD_MAX jobs around. delete_job() takes care of keeping the
- bgpids list regulated. */
-
- /* Count the number of dead jobs */
- /* XXX could use js.j_firstj here */
- for (i = ndead = ndeadproc = 0; i < js.j_jobslots; i++)
- {
-#if defined (DEBUG)
- if (i < js.j_firstj && jobs[i])
- itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
- if (i > js.j_lastj && jobs[i])
- itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
-#endif
- if (jobs[i] && DEADJOB (i))
- {
- ndead++;
- ndeadproc += processes_in_job (i);
- }
- }
-
-#ifdef DEBUG
-# if 0
- if (ndeadproc != js.c_reaped)
- itrace("mark_dead_jobs_as_notified: ndeadproc (%d) != js.c_reaped (%d)", ndeadproc, js.c_reaped);
-# endif
- if (ndead != js.j_ndead)
- itrace("mark_dead_jobs_as_notified: ndead (%d) != js.j_ndead (%d)", ndead, js.j_ndead);
-#endif
-
- if (js.c_childmax < 0)
- js.c_childmax = getmaxchild ();
- if (js.c_childmax < 0)
- js.c_childmax = DEFAULT_CHILD_MAX;
-
- /* Don't do anything if the number of dead processes is less than CHILD_MAX
- and we're not forcing a cleanup. */
- if (ndeadproc <= js.c_childmax)
- {
- UNBLOCK_CHILD (oset);
- return;
- }
-
-#if 0
-itrace("mark_dead_jobs_as_notified: child_max = %d ndead = %d ndeadproc = %d", js.c_childmax, ndead, ndeadproc);
-#endif
-
- /* Mark enough dead jobs as notified that we keep CHILD_MAX jobs in
- the list. This isn't exactly right yet; changes need to be made
- to stop_pipeline so we don't mark the newer jobs after we've
- created CHILD_MAX slots in the jobs array. This needs to be
- integrated with a way to keep the jobs array from growing without
- bound. Maybe we wrap back around to 0 after we reach some max
- limit, and there are sufficient job slots free (keep track of total
- size of jobs array (js.j_jobslots) and running count of number of jobs
- in jobs array. Then keep a job index corresponding to the `oldest job'
- and start this loop there, wrapping around as necessary. In effect,
- we turn the list into a circular buffer. */
- /* XXX could use js.j_firstj here */
- for (i = 0; i < js.j_jobslots; i++)
- {
- if (jobs[i] && DEADJOB (i) && (interactive_shell || (find_last_pid (i, 0) != last_asynchronous_pid)))
- {
-#if defined (DEBUG)
- if (i < js.j_firstj && jobs[i])
- itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
- if (i > js.j_lastj && jobs[i])
- itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
-#endif
- /* If marking this job as notified would drop us down below
- child_max, don't mark it so we can keep at least child_max
- statuses. XXX -- need to check what Posix actually says
- about keeping statuses. */
- if ((ndeadproc -= processes_in_job (i)) <= js.c_childmax)
- break;
- jobs[i]->flags |= J_NOTIFIED;
- }
- }
-
- UNBLOCK_CHILD (oset);
-}
-
-/* Here to allow other parts of the shell (like the trap stuff) to
- freeze and unfreeze the jobs list. */
-void
-freeze_jobs_list ()
-{
- jobs_list_frozen = 1;
-}
-
-void
-unfreeze_jobs_list ()
-{
- jobs_list_frozen = 0;
-}
-
-/* Allow or disallow job control to take place. Returns the old value
- of job_control. */
-int
-set_job_control (arg)
- int arg;
-{
- int old;
-
- old = job_control;
- job_control = arg;
-
- /* If we're turning on job control, reset pipeline_pgrp so make_child will
- put new child processes into the right pgrp */
- if (job_control != old && job_control)
- pipeline_pgrp = 0;
-
- return (old);
-}
-
-/* Turn off all traces of job control. This is run by children of the shell
- which are going to do shellsy things, like wait (), etc. */
-void
-without_job_control ()
-{
- stop_making_children ();
- start_pipeline ();
-#if defined (PGRP_PIPE)
- sh_closepipe (pgrp_pipe);
-#endif
- delete_all_jobs (0);
- set_job_control (0);
-}
-
-/* If this shell is interactive, terminate all stopped jobs and
- restore the original terminal process group. This is done
- before the `exec' builtin calls shell_execve. */
-void
-end_job_control ()
-{
- if (interactive_shell) /* XXX - should it be interactive? */
- {
- terminate_stopped_jobs ();
-
- if (original_pgrp >= 0)
- give_terminal_to (original_pgrp, 1);
- }
-
- if (original_pgrp >= 0)
- setpgid (0, original_pgrp);
-}
-
-/* Restart job control by closing shell tty and reinitializing. This is
- called after an exec fails in an interactive shell and we do not exit. */
-void
-restart_job_control ()
-{
- if (shell_tty != -1)
- close (shell_tty);
- initialize_job_control (0);
-}
-
-void
-set_maxchild (nchild)
- int nchild;
-{
- static int lmaxchild = -1;
-
- if (lmaxchild < 0)
- lmaxchild = getmaxchild ();
- if (lmaxchild < 0)
- lmaxchild = DEFAULT_CHILD_MAX;
-
- /* Clamp value we set. Minimum is what Posix requires, maximum is defined
- above as MAX_CHILD_MAX. */
- if (nchild < lmaxchild)
- nchild = lmaxchild;
- else if (nchild > MAX_CHILD_MAX)
- nchild = MAX_CHILD_MAX;
-
- js.c_childmax = nchild;
-}
-
-/* Set the handler to run when the shell receives a SIGCHLD signal. */
-void
-set_sigchld_handler ()
-{
- set_signal_handler (SIGCHLD, sigchld_handler);
-}
-
-#if defined (PGRP_PIPE)
-/* Read from the read end of a pipe. This is how the process group leader
- blocks until all of the processes in a pipeline have been made. */
-static void
-pipe_read (pp)
- int *pp;
-{
- char ch;
-
- if (pp[1] >= 0)
- {
- close (pp[1]);
- pp[1] = -1;
- }
-
- if (pp[0] >= 0)
- {
- while (read (pp[0], &ch, 1) == -1 && errno == EINTR)
- ;
- }
-}
-
-/* Functional interface closes our local-to-job-control pipes. */
-void
-close_pgrp_pipe ()
-{
- sh_closepipe (pgrp_pipe);
-}
-
-void
-save_pgrp_pipe (p, clear)
- int *p;
- int clear;
-{
- p[0] = pgrp_pipe[0];
- p[1] = pgrp_pipe[1];
- if (clear)
- pgrp_pipe[0] = pgrp_pipe[1] = -1;
-}
-
-void
-restore_pgrp_pipe (p)
- int *p;
-{
- pgrp_pipe[0] = p[0];
- pgrp_pipe[1] = p[1];
-}
-
-#endif /* PGRP_PIPE */
+++ /dev/null
-# This makefile for Readline library documentation is in -*- text -*- mode.
-# Emacs likes it that way.
-RM = rm -f
-
-MAKEINFO = makeinfo
-TEXI2DVI = texi2dvi
-TEXI2HTML = texi2html
-QUIETPS = #set this to -q to shut up dvips
-DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
-
-INSTALL_DATA = cp
-infodir = /usr/local/info
-
-RLSRC = rlman.texinfo rluser.texinfo rltech.texinfo
-HISTSRC = hist.texinfo hsuser.texinfo hstech.texinfo
-
-DVIOBJ = readline.dvi history.dvi
-INFOOBJ = readline.info history.info
-PSOBJ = readline.ps history.ps
-HTMLOBJ = readline.html history.html
-
-all: info dvi html ps
-nodvi: info html
-
-readline.dvi: $(RLSRC)
- $(TEXI2DVI) rlman.texinfo
- mv rlman.dvi readline.dvi
-
-readline.info: $(RLSRC)
- $(MAKEINFO) --no-split -o $@ rlman.texinfo
-
-history.dvi: ${HISTSRC}
- $(TEXI2DVI) hist.texinfo
- mv hist.dvi history.dvi
-
-history.info: ${HISTSRC}
- $(MAKEINFO) --no-split -o $@ hist.texinfo
-
-readline.ps: readline.dvi
- $(RM) $@
- $(DVIPS) readline.dvi
-
-history.ps: history.dvi
- $(RM) $@
- $(DVIPS) history.dvi
-
-readline.html: ${RLSRC}
- $(TEXI2HTML) rlman.texinfo
- sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
- sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
- $(RM) rlman.html rlman_toc.html
-
-history.html: ${HISTSRC}
- $(TEXI2HTML) hist.texinfo
- sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
- sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
- $(RM) hist.html hist_toc.html
-
-info: $(INFOOBJ)
-dvi: $(DVIOBJ)
-ps: $(PSOBJ)
-html: $(HTMLOBJ)
-
-clean:
- $(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
- *.fns *.kys *.tps *.vrs *.o core
-
-distclean: clean
-mostlyclean: clean
-
-maintainer-clean: clean
- $(RM) *.dvi *.info *.info-* *.ps *.html
-
-install: info
- ${INSTALL_DATA} readline.info $(infodir)/readline.info
- ${INSTALL_DATA} history.info $(infodir)/history.info
+++ /dev/null
-@comment %**start of header (This is for running Texinfo on a region.)
-@setfilename rltech.info
-@comment %**end of header (This is for running Texinfo on a region.)
-
-@ifinfo
-This document describes the GNU Readline Library, a utility for aiding
-in the consistency of user interface across discrete programs that need
-to provide a command line interface.
-
-Copyright (C) 1988--2012 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-pare preserved on all copies.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-@end ignore
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-@end ifinfo
-
-@node Programming with GNU Readline
-@chapter Programming with GNU Readline
-
-This chapter describes the interface between the @sc{gnu} Readline Library and
-other programs. If you are a programmer, and you wish to include the
-features found in @sc{gnu} Readline
-such as completion, line editing, and interactive history manipulation
-in your own programs, this section is for you.
-
-@menu
-* Basic Behavior:: Using the default behavior of Readline.
-* Custom Functions:: Adding your own functions to Readline.
-* Readline Variables:: Variables accessible to custom
- functions.
-* Readline Convenience Functions:: Functions which Readline supplies to
- aid in writing your own custom
- functions.
-* Readline Signal Handling:: How Readline behaves when it receives signals.
-* Custom Completers:: Supplanting or supplementing Readline's
- completion functions.
-@end menu
-
-@node Basic Behavior
-@section Basic Behavior
-
-Many programs provide a command line interface, such as @code{mail},
-@code{ftp}, and @code{sh}. For such programs, the default behaviour of
-Readline is sufficient. This section describes how to use Readline in
-the simplest way possible, perhaps to replace calls in your code to
-@code{gets()} or @code{fgets()}.
-
-@findex readline
-@cindex readline, function
-
-The function @code{readline()} prints a prompt @var{prompt}
-and then reads and returns a single line of text from the user.
-If @var{prompt} is @code{NULL} or the empty string, no prompt is displayed.
-The line @code{readline} returns is allocated with @code{malloc()};
-the caller should @code{free()} the line when it has finished with it.
-The declaration for @code{readline} in ANSI C is
-
-@example
-@code{char *readline (const char *@var{prompt});}
-@end example
-
-@noindent
-So, one might say
-@example
-@code{char *line = readline ("Enter a line: ");}
-@end example
-@noindent
-in order to read a line of text from the user.
-The line returned has the final newline removed, so only the
-text remains.
-
-If @code{readline} encounters an @code{EOF} while reading the line, and the
-line is empty at that point, then @code{(char *)NULL} is returned.
-Otherwise, the line is ended just as if a newline had been typed.
-
-If you want the user to be able to get at the line later, (with
-@key{C-p} for example), you must call @code{add_history()} to save the
-line away in a @dfn{history} list of such lines.
-
-@example
-@code{add_history (line)};
-@end example
-
-@noindent
-For full details on the GNU History Library, see the associated manual.
-
-It is preferable to avoid saving empty lines on the history list, since
-users rarely have a burning need to reuse a blank line. Here is
-a function which usefully replaces the standard @code{gets()} library
-function, and has the advantage of no static buffer to overflow:
-
-@example
-/* A static variable for holding the line. */
-static char *line_read = (char *)NULL;
-
-/* Read a string, and return a pointer to it.
- Returns NULL on EOF. */
-char *
-rl_gets ()
-@{
- /* If the buffer has already been allocated,
- return the memory to the free pool. */
- if (line_read)
- @{
- free (line_read);
- line_read = (char *)NULL;
- @}
-
- /* Get a line from the user. */
- line_read = readline ("");
-
- /* If the line has any text in it,
- save it on the history. */
- if (line_read && *line_read)
- add_history (line_read);
-
- return (line_read);
-@}
-@end example
-
-This function gives the user the default behaviour of @key{TAB}
-completion: completion on file names. If you do not want Readline to
-complete on filenames, you can change the binding of the @key{TAB} key
-with @code{rl_bind_key()}.
-
-@example
-@code{int rl_bind_key (int @var{key}, rl_command_func_t *@var{function});}
-@end example
-
-@code{rl_bind_key()} takes two arguments: @var{key} is the character that
-you want to bind, and @var{function} is the address of the function to
-call when @var{key} is pressed. Binding @key{TAB} to @code{rl_insert()}
-makes @key{TAB} insert itself.
-@code{rl_bind_key()} returns non-zero if @var{key} is not a valid
-ASCII character code (between 0 and 255).
-
-Thus, to disable the default @key{TAB} behavior, the following suffices:
-@example
-@code{rl_bind_key ('\t', rl_insert);}
-@end example
-
-This code should be executed once at the start of your program; you
-might write a function called @code{initialize_readline()} which
-performs this and other desired initializations, such as installing
-custom completers (@pxref{Custom Completers}).
-
-@node Custom Functions
-@section Custom Functions
-
-Readline provides many functions for manipulating the text of
-the line, but it isn't possible to anticipate the needs of all
-programs. This section describes the various functions and variables
-defined within the Readline library which allow a user program to add
-customized functionality to Readline.
-
-Before declaring any functions that customize Readline's behavior, or
-using any functionality Readline provides in other code, an
-application writer should include the file @code{<readline/readline.h>}
-in any file that uses Readline's features. Since some of the definitions
-in @code{readline.h} use the @code{stdio} library, the file
-@code{<stdio.h>} should be included before @code{readline.h}.
-
-@code{readline.h} defines a C preprocessor variable that should
-be treated as an integer, @code{RL_READLINE_VERSION}, which may
-be used to conditionally compile application code depending on
-the installed Readline version. The value is a hexadecimal
-encoding of the major and minor version numbers of the library,
-of the form 0x@var{MMmm}. @var{MM} is the two-digit major
-version number; @var{mm} is the two-digit minor version number.
-For Readline 4.2, for example, the value of
-@code{RL_READLINE_VERSION} would be @code{0x0402}.
-
-@menu
-* Readline Typedefs:: C declarations to make code readable.
-* Function Writing:: Variables and calling conventions.
-@end menu
-
-@node Readline Typedefs
-@subsection Readline Typedefs
-
-For readabilty, we declare a number of new object types, all pointers
-to functions.
-
-The reason for declaring these new types is to make it easier to write
-code describing pointers to C functions with appropriately prototyped
-arguments and return values.
-
-For instance, say we want to declare a variable @var{func} as a pointer
-to a function which takes two @code{int} arguments and returns an
-@code{int} (this is the type of all of the Readline bindable functions).
-Instead of the classic C declaration
-
-@code{int (*func)();}
-
-@noindent
-or the ANSI-C style declaration
-
-@code{int (*func)(int, int);}
-
-@noindent
-we may write
-
-@code{rl_command_func_t *func;}
-
-The full list of function pointer types available is
-
-@table @code
-@item typedef int rl_command_func_t (int, int);
-
-@item typedef char *rl_compentry_func_t (const char *, int);
-
-@item typedef char **rl_completion_func_t (const char *, int, int);
-
-@item typedef char *rl_quote_func_t (char *, int, char *);
-
-@item typedef char *rl_dequote_func_t (char *, int);
-
-@item typedef int rl_compignore_func_t (char **);
-
-@item typedef void rl_compdisp_func_t (char **, int, int);
-
-@item typedef int rl_hook_func_t (void);
-
-@item typedef int rl_getc_func_t (FILE *);
-
-@item typedef int rl_linebuf_func_t (char *, int);
-
-@item typedef int rl_intfunc_t (int);
-@item #define rl_ivoidfunc_t rl_hook_func_t
-@item typedef int rl_icpfunc_t (char *);
-@item typedef int rl_icppfunc_t (char **);
-
-@item typedef void rl_voidfunc_t (void);
-@item typedef void rl_vintfunc_t (int);
-@item typedef void rl_vcpfunc_t (char *);
-@item typedef void rl_vcppfunc_t (char **);
-
-@end table
-
-@node Function Writing
-@subsection Writing a New Function
-
-In order to write new functions for Readline, you need to know the
-calling conventions for keyboard-invoked functions, and the names of the
-variables that describe the current state of the line read so far.
-
-The calling sequence for a command @code{foo} looks like
-
-@example
-@code{int foo (int count, int key)}
-@end example
-
-@noindent
-where @var{count} is the numeric argument (or 1 if defaulted) and
-@var{key} is the key that invoked this function.
-
-It is completely up to the function as to what should be done with the
-numeric argument. Some functions use it as a repeat count, some
-as a flag, and others to choose alternate behavior (refreshing the current
-line as opposed to refreshing the screen, for example). Some choose to
-ignore it. In general, if a
-function uses the numeric argument as a repeat count, it should be able
-to do something useful with both negative and positive arguments.
-At the very least, it should be aware that it can be passed a
-negative argument.
-
-A command function should return 0 if its action completes successfully,
-and a non-zero value if some error occurs.
-This is the convention obeyed by all of the builtin Readline bindable
-command functions.
-
-@node Readline Variables
-@section Readline Variables
-
-These variables are available to function writers.
-
-@deftypevar {char *} rl_line_buffer
-This is the line gathered so far. You are welcome to modify the
-contents of the line, but see @ref{Allowing Undoing}. The
-function @code{rl_extend_line_buffer} is available to increase
-the memory allocated to @code{rl_line_buffer}.
-@end deftypevar
-
-@deftypevar int rl_point
-The offset of the current cursor position in @code{rl_line_buffer}
-(the @emph{point}).
-@end deftypevar
-
-@deftypevar int rl_end
-The number of characters present in @code{rl_line_buffer}. When
-@code{rl_point} is at the end of the line, @code{rl_point} and
-@code{rl_end} are equal.
-@end deftypevar
-
-@deftypevar int rl_mark
-The @var{mark} (saved position) in the current line. If set, the mark
-and point define a @emph{region}.
-@end deftypevar
-
-@deftypevar int rl_done
-Setting this to a non-zero value causes Readline to return the current
-line immediately.
-@end deftypevar
-
-@deftypevar int rl_num_chars_to_read
-Setting this to a positive value before calling @code{readline()} causes
-Readline to return after accepting that many characters, rather
-than reading up to a character bound to @code{accept-line}.
-@end deftypevar
-
-@deftypevar int rl_pending_input
-Setting this to a value makes it the next keystroke read. This is a
-way to stuff a single character into the input stream.
-@end deftypevar
-
-@deftypevar int rl_dispatching
-Set to a non-zero value if a function is being called from a key binding;
-zero otherwise. Application functions can test this to discover whether
-they were called directly or by Readline's dispatching mechanism.
-@end deftypevar
-
-@deftypevar int rl_erase_empty_line
-Setting this to a non-zero value causes Readline to completely erase
-the current line, including any prompt, any time a newline is typed as
-the only character on an otherwise-empty line. The cursor is moved to
-the beginning of the newly-blank line.
-@end deftypevar
-
-@deftypevar {char *} rl_prompt
-The prompt Readline uses. This is set from the argument to
-@code{readline()}, and should not be assigned to directly.
-The @code{rl_set_prompt()} function (@pxref{Redisplay}) may
-be used to modify the prompt string after calling @code{readline()}.
-@end deftypevar
-
-@deftypevar {char *} rl_display_prompt
-The string displayed as the prompt. This is usually identical to
-@var{rl_prompt}, but may be changed temporarily by functions that
-use the prompt string as a message area, such as incremental search.
-@end deftypevar
-
-@deftypevar int rl_already_prompted
-If an application wishes to display the prompt itself, rather than have
-Readline do it the first time @code{readline()} is called, it should set
-this variable to a non-zero value after displaying the prompt.
-The prompt must also be passed as the argument to @code{readline()} so
-the redisplay functions can update the display properly.
-The calling application is responsible for managing the value; Readline
-never sets it.
-@end deftypevar
-
-@deftypevar {const char *} rl_library_version
-The version number of this revision of the library.
-@end deftypevar
-
-@deftypevar int rl_readline_version
-An integer encoding the current version of the library. The encoding is
-of the form 0x@var{MMmm}, where @var{MM} is the two-digit major version
-number, and @var{mm} is the two-digit minor version number.
-For example, for Readline-4.2, @code{rl_readline_version} would have the
-value 0x0402.
-@end deftypevar
-
-@deftypevar {int} rl_gnu_readline_p
-Always set to 1, denoting that this is @sc{gnu} readline rather than some
-emulation.
-@end deftypevar
-
-@deftypevar {const char *} rl_terminal_name
-The terminal type, used for initialization. If not set by the application,
-Readline sets this to the value of the @env{TERM} environment variable
-the first time it is called.
-@end deftypevar
-
-@deftypevar {const char *} rl_readline_name
-This variable is set to a unique name by each application using Readline.
-The value allows conditional parsing of the inputrc file
-(@pxref{Conditional Init Constructs}).
-@end deftypevar
-
-@deftypevar {FILE *} rl_instream
-The stdio stream from which Readline reads input.
-If @code{NULL}, Readline defaults to @var{stdin}.
-@end deftypevar
-
-@deftypevar {FILE *} rl_outstream
-The stdio stream to which Readline performs output.
-If @code{NULL}, Readline defaults to @var{stdout}.
-@end deftypevar
-
-@deftypevar int rl_prefer_env_winsize
-If non-zero, Readline gives values found in the @env{LINES} and
-@env{COLUMNS} environment variables greater precedence than values fetched
-from the kernel when computing the screen dimensions.
-@end deftypevar
-
-@deftypevar {rl_command_func_t *} rl_last_func
-The address of the last command function Readline executed. May be used to
-test whether or not a function is being executed twice in succession, for
-example.
-@end deftypevar
-
-@deftypevar {rl_hook_func_t *} rl_startup_hook
-If non-zero, this is the address of a function to call just
-before @code{readline} prints the first prompt.
-@end deftypevar
-
-@deftypevar {rl_hook_func_t *} rl_pre_input_hook
-If non-zero, this is the address of a function to call after
-the first prompt has been printed and just before @code{readline}
-starts reading input characters.
-@end deftypevar
-
-@deftypevar {rl_hook_func_t *} rl_event_hook
-If non-zero, this is the address of a function to call periodically
-when Readline is waiting for terminal input.
-By default, this will be called at most ten times a second if there
-is no keyboard input.
-@end deftypevar
-
-@deftypevar {rl_getc_func_t *} rl_getc_function
-If non-zero, Readline will call indirectly through this pointer
-to get a character from the input stream. By default, it is set to
-@code{rl_getc}, the default Readline character input function
-(@pxref{Character Input}).
-@end deftypevar
-
-@deftypevar {rl_hook_func_t *} rl_signal_event_hook
-If non-zero, this is the address of a function to call if a read system
-call is interrupted when Readline is reading terminal input.
-@end deftypevar
-
-@deftypevar {rl_hook_func_t *} rl_input_available_hook
-If non-zero, Readline will use this function's return value when it needs
-to determine whether or not there is available input on the current input
-source.
-Readline queries for available input when implementing intra-key-sequence
-timeouts during input and incremental searches.
-This may use an application-specific timeout before returning a value;
-Readline uses the value passed to @code{rl_set_keyboard_input_timeout()}
-or the value of the user-settable @var{keyseq-timeout} variable.
-This is designed for use by functions using Readline's callback interface
-(@pxref{Alternate Interface}), which may not use the traditional
-@code{read(2)} and file descriptor interface.
-@end deftypevar
-
-@deftypevar {rl_voidfunc_t *} rl_redisplay_function
-If non-zero, Readline will call indirectly through this pointer
-to update the display with the current contents of the editing buffer.
-By default, it is set to @code{rl_redisplay}, the default Readline
-redisplay function (@pxref{Redisplay}).
-@end deftypevar
-
-@deftypevar {rl_vintfunc_t *} rl_prep_term_function
-If non-zero, Readline will call indirectly through this pointer
-to initialize the terminal. The function takes a single argument, an
-@code{int} flag that says whether or not to use eight-bit characters.
-By default, this is set to @code{rl_prep_terminal}
-(@pxref{Terminal Management}).
-@end deftypevar
-
-@deftypevar {rl_voidfunc_t *} rl_deprep_term_function
-If non-zero, Readline will call indirectly through this pointer
-to reset the terminal. This function should undo the effects of
-@code{rl_prep_term_function}.
-By default, this is set to @code{rl_deprep_terminal}
-(@pxref{Terminal Management}).
-@end deftypevar
-
-@deftypevar {Keymap} rl_executing_keymap
-This variable is set to the keymap (@pxref{Keymaps}) in which the
-currently executing readline function was found.
-@end deftypevar
-
-@deftypevar {Keymap} rl_binding_keymap
-This variable is set to the keymap (@pxref{Keymaps}) in which the
-last key binding occurred.
-@end deftypevar
-
-@deftypevar {char *} rl_executing_macro
-This variable is set to the text of any currently-executing macro.
-@end deftypevar
-
-@deftypevar int rl_executing_key
-The key that caused the dispatch to the currently-executing Readline function.
-@end deftypevar
-
-@deftypevar {char *} rl_executing_keyseq
-The full key sequence that caused the dispatch to the currently-executing
-Readline function.
-@end deftypevar
-
-@deftypevar int rl_key_sequence_length
-The number of characters in @var{rl_executing_keyseq}.
-@end deftypevar
-
-@deftypevar {int} rl_readline_state
-A variable with bit values that encapsulate the current Readline state.
-A bit is set with the @code{RL_SETSTATE} macro, and unset with the
-@code{RL_UNSETSTATE} macro. Use the @code{RL_ISSTATE} macro to test
-whether a particular state bit is set. Current state bits include:
-
-@table @code
-@item RL_STATE_NONE
-Readline has not yet been called, nor has it begun to intialize.
-@item RL_STATE_INITIALIZING
-Readline is initializing its internal data structures.
-@item RL_STATE_INITIALIZED
-Readline has completed its initialization.
-@item RL_STATE_TERMPREPPED
-Readline has modified the terminal modes to do its own input and redisplay.
-@item RL_STATE_READCMD
-Readline is reading a command from the keyboard.
-@item RL_STATE_METANEXT
-Readline is reading more input after reading the meta-prefix character.
-@item RL_STATE_DISPATCHING
-Readline is dispatching to a command.
-@item RL_STATE_MOREINPUT
-Readline is reading more input while executing an editing command.
-@item RL_STATE_ISEARCH
-Readline is performing an incremental history search.
-@item RL_STATE_NSEARCH
-Readline is performing a non-incremental history search.
-@item RL_STATE_SEARCH
-Readline is searching backward or forward through the history for a string.
-@item RL_STATE_NUMERICARG
-Readline is reading a numeric argument.
-@item RL_STATE_MACROINPUT
-Readline is currently getting its input from a previously-defined keyboard
-macro.
-@item RL_STATE_MACRODEF
-Readline is currently reading characters defining a keyboard macro.
-@item RL_STATE_OVERWRITE
-Readline is in overwrite mode.
-@item RL_STATE_COMPLETING
-Readline is performing word completion.
-@item RL_STATE_SIGHANDLER
-Readline is currently executing the readline signal handler.
-@item RL_STATE_UNDOING
-Readline is performing an undo.
-@item RL_STATE_INPUTPENDING
-Readline has input pending due to a call to @code{rl_execute_next()}.
-@item RL_STATE_TTYCSAVED
-Readline has saved the values of the terminal's special characters.
-@item RL_STATE_CALLBACK
-Readline is currently using the alternate (callback) interface
-(@pxref{Alternate Interface}).
-@item RL_STATE_VIMOTION
-Readline is reading the argument to a vi-mode "motion" command.
-@item RL_STATE_MULTIKEY
-Readline is reading a multiple-keystroke command.
-@item RL_STATE_VICMDONCE
-Readline has entered vi command (movement) mode at least one time during
-the current call to @code{readline()}.
-@item RL_STATE_DONE
-Readline has read a key sequence bound to @code{accept-line}
-and is about to return the line to the caller.
-@end table
-
-@end deftypevar
-
-@deftypevar {int} rl_explicit_arg
-Set to a non-zero value if an explicit numeric argument was specified by
-the user. Only valid in a bindable command function.
-@end deftypevar
-
-@deftypevar {int} rl_numeric_arg
-Set to the value of any numeric argument explicitly specified by the user
-before executing the current Readline function. Only valid in a bindable
-command function.
-@end deftypevar
-
-@deftypevar {int} rl_editing_mode
-Set to a value denoting Readline's current editing mode. A value of
-@var{1} means Readline is currently in emacs mode; @var{0}
-means that vi mode is active.
-@end deftypevar
-
-
-@node Readline Convenience Functions
-@section Readline Convenience Functions
-
-@menu
-* Function Naming:: How to give a function you write a name.
-* Keymaps:: Making keymaps.
-* Binding Keys:: Changing Keymaps.
-* Associating Function Names and Bindings:: Translate function names to
- key sequences.
-* Allowing Undoing:: How to make your functions undoable.
-* Redisplay:: Functions to control line display.
-* Modifying Text:: Functions to modify @code{rl_line_buffer}.
-* Character Input:: Functions to read keyboard input.
-* Terminal Management:: Functions to manage terminal settings.
-* Utility Functions:: Generally useful functions and hooks.
-* Miscellaneous Functions:: Functions that don't fall into any category.
-* Alternate Interface:: Using Readline in a `callback' fashion.
-* A Readline Example:: An example Readline function.
-* Alternate Interface Example:: An example program using the alternate interface.
-@end menu
-
-@node Function Naming
-@subsection Naming a Function
-
-The user can dynamically change the bindings of keys while using
-Readline. This is done by representing the function with a descriptive
-name. The user is able to type the descriptive name when referring to
-the function. Thus, in an init file, one might find
-
-@example
-Meta-Rubout: backward-kill-word
-@end example
-
-This binds the keystroke @key{Meta-Rubout} to the function
-@emph{descriptively} named @code{backward-kill-word}. You, as the
-programmer, should bind the functions you write to descriptive names as
-well. Readline provides a function for doing that:
-
-@deftypefun int rl_add_defun (const char *name, rl_command_func_t *function, int key)
-Add @var{name} to the list of named functions. Make @var{function} be
-the function that gets called. If @var{key} is not -1, then bind it to
-@var{function} using @code{rl_bind_key()}.
-@end deftypefun
-
-Using this function alone is sufficient for most applications.
-It is the recommended way to add a few functions to the default
-functions that Readline has built in.
-If you need to do something other than adding a function to Readline,
-you may need to use the underlying functions described below.
-
-@node Keymaps
-@subsection Selecting a Keymap
-
-Key bindings take place on a @dfn{keymap}. The keymap is the
-association between the keys that the user types and the functions that
-get run. You can make your own keymaps, copy existing keymaps, and tell
-Readline which keymap to use.
-
-@deftypefun Keymap rl_make_bare_keymap (void)
-Returns a new, empty keymap. The space for the keymap is allocated with
-@code{malloc()}; the caller should free it by calling
-@code{rl_free_keymap()} when done.
-@end deftypefun
-
-@deftypefun Keymap rl_copy_keymap (Keymap map)
-Return a new keymap which is a copy of @var{map}.
-@end deftypefun
-
-@deftypefun Keymap rl_make_keymap (void)
-Return a new keymap with the printing characters bound to rl_insert,
-the lowercase Meta characters bound to run their equivalents, and
-the Meta digits bound to produce numeric arguments.
-@end deftypefun
-
-@deftypefun void rl_discard_keymap (Keymap keymap)
-Free the storage associated with the data in @var{keymap}.
-The caller should free @var{keymap}.
-@end deftypefun
-
-@deftypefun void rl_free_keymap (Keymap keymap)
-Free all storage associated with @var{keymap}. This calls
-@code{rl_discard_keymap} to free subordindate keymaps and macros.
-@end deftypefun
-
-Readline has several internal keymaps. These functions allow you to
-change which keymap is active.
-
-@deftypefun Keymap rl_get_keymap (void)
-Returns the currently active keymap.
-@end deftypefun
-
-@deftypefun void rl_set_keymap (Keymap keymap)
-Makes @var{keymap} the currently active keymap.
-@end deftypefun
-
-@deftypefun Keymap rl_get_keymap_by_name (const char *name)
-Return the keymap matching @var{name}. @var{name} is one which would
-be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
-@end deftypefun
-
-@deftypefun {char *} rl_get_keymap_name (Keymap keymap)
-Return the name matching @var{keymap}. @var{name} is one which would
-be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
-@end deftypefun
-
-@node Binding Keys
-@subsection Binding Keys
-
-Key sequences are associate with functions through the keymap.
-Readline has several internal keymaps: @code{emacs_standard_keymap},
-@code{emacs_meta_keymap}, @code{emacs_ctlx_keymap},
-@code{vi_movement_keymap}, and @code{vi_insertion_keymap}.
-@code{emacs_standard_keymap} is the default, and the examples in
-this manual assume that.
-
-Since @code{readline()} installs a set of default key bindings the first
-time it is called, there is always the danger that a custom binding
-installed before the first call to @code{readline()} will be overridden.
-An alternate mechanism is to install custom key bindings in an
-initialization function assigned to the @code{rl_startup_hook} variable
-(@pxref{Readline Variables}).
-
-These functions manage key bindings.
-
-@deftypefun int rl_bind_key (int key, rl_command_func_t *function)
-Binds @var{key} to @var{function} in the currently active keymap.
-Returns non-zero in the case of an invalid @var{key}.
-@end deftypefun
-
-@deftypefun int rl_bind_key_in_map (int key, rl_command_func_t *function, Keymap map)
-Bind @var{key} to @var{function} in @var{map}.
-Returns non-zero in the case of an invalid @var{key}.
-@end deftypefun
-
-@deftypefun int rl_bind_key_if_unbound (int key, rl_command_func_t *function)
-Binds @var{key} to @var{function} if it is not already bound in the
-currently active keymap.
-Returns non-zero in the case of an invalid @var{key} or if @var{key} is
-already bound.
-@end deftypefun
-
-@deftypefun int rl_bind_key_if_unbound_in_map (int key, rl_command_func_t *function, Keymap map)
-Binds @var{key} to @var{function} if it is not already bound in @var{map}.
-Returns non-zero in the case of an invalid @var{key} or if @var{key} is
-already bound.
-@end deftypefun
-
-@deftypefun int rl_unbind_key (int key)
-Bind @var{key} to the null function in the currently active keymap.
-Returns non-zero in case of error.
-@end deftypefun
-
-@deftypefun int rl_unbind_key_in_map (int key, Keymap map)
-Bind @var{key} to the null function in @var{map}.
-Returns non-zero in case of error.
-@end deftypefun
-
-@deftypefun int rl_unbind_function_in_map (rl_command_func_t *function, Keymap map)
-Unbind all keys that execute @var{function} in @var{map}.
-@end deftypefun
-
-@deftypefun int rl_unbind_command_in_map (const char *command, Keymap map)
-Unbind all keys that are bound to @var{command} in @var{map}.
-@end deftypefun
-
-@deftypefun int rl_bind_keyseq (const char *keyseq, rl_command_func_t *function)
-Bind the key sequence represented by the string @var{keyseq} to the function
-@var{function}, beginning in the current keymap.
-This makes new keymaps as necessary.
-The return value is non-zero if @var{keyseq} is invalid.
-@end deftypefun
-
-@deftypefun int rl_bind_keyseq_in_map (const char *keyseq, rl_command_func_t *function, Keymap map)
-Bind the key sequence represented by the string @var{keyseq} to the function
-@var{function}. This makes new keymaps as necessary.
-Initial bindings are performed in @var{map}.
-The return value is non-zero if @var{keyseq} is invalid.
-@end deftypefun
-
-@deftypefun int rl_set_key (const char *keyseq, rl_command_func_t *function, Keymap map)
-Equivalent to @code{rl_bind_keyseq_in_map}.
-@end deftypefun
-
-@deftypefun int rl_bind_keyseq_if_unbound (const char *keyseq, rl_command_func_t *function)
-Binds @var{keyseq} to @var{function} if it is not already bound in the
-currently active keymap.
-Returns non-zero in the case of an invalid @var{keyseq} or if @var{keyseq} is
-already bound.
-@end deftypefun
-
-@deftypefun int rl_bind_keyseq_if_unbound_in_map (const char *keyseq, rl_command_func_t *function, Keymap map)
-Binds @var{keyseq} to @var{function} if it is not already bound in @var{map}.
-Returns non-zero in the case of an invalid @var{keyseq} or if @var{keyseq} is
-already bound.
-@end deftypefun
-
-@deftypefun int rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
-Bind the key sequence represented by the string @var{keyseq} to the arbitrary
-pointer @var{data}. @var{type} says what kind of data is pointed to by
-@var{data}; this can be a function (@code{ISFUNC}), a macro
-(@code{ISMACR}), or a keymap (@code{ISKMAP}). This makes new keymaps as
-necessary. The initial keymap in which to do bindings is @var{map}.
-@end deftypefun
-
-@deftypefun int rl_parse_and_bind (char *line)
-Parse @var{line} as if it had been read from the @code{inputrc} file and
-perform any key bindings and variable assignments found
-(@pxref{Readline Init File}).
-@end deftypefun
-
-@deftypefun int rl_read_init_file (const char *filename)
-Read keybindings and variable assignments from @var{filename}
-(@pxref{Readline Init File}).
-@end deftypefun
-
-@node Associating Function Names and Bindings
-@subsection Associating Function Names and Bindings
-
-These functions allow you to find out what keys invoke named functions
-and the functions invoked by a particular key sequence. You may also
-associate a new function name with an arbitrary function.
-
-@deftypefun {rl_command_func_t *} rl_named_function (const char *name)
-Return the function with name @var{name}.
-@end deftypefun
-
-@deftypefun {rl_command_func_t *} rl_function_of_keyseq (const char *keyseq, Keymap map, int *type)
-Return the function invoked by @var{keyseq} in keymap @var{map}.
-If @var{map} is @code{NULL}, the current keymap is used. If @var{type} is
-not @code{NULL}, the type of the object is returned in the @code{int} variable
-it points to (one of @code{ISFUNC}, @code{ISKMAP}, or @code{ISMACR}).
-@end deftypefun
-
-@deftypefun {char **} rl_invoking_keyseqs (rl_command_func_t *function)
-Return an array of strings representing the key sequences used to
-invoke @var{function} in the current keymap.
-@end deftypefun
-
-@deftypefun {char **} rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map)
-Return an array of strings representing the key sequences used to
-invoke @var{function} in the keymap @var{map}.
-@end deftypefun
-
-@deftypefun void rl_function_dumper (int readable)
-Print the readline function names and the key sequences currently
-bound to them to @code{rl_outstream}. If @var{readable} is non-zero,
-the list is formatted in such a way that it can be made part of an
-@code{inputrc} file and re-read.
-@end deftypefun
-
-@deftypefun void rl_list_funmap_names (void)
-Print the names of all bindable Readline functions to @code{rl_outstream}.
-@end deftypefun
-
-@deftypefun {const char **} rl_funmap_names (void)
-Return a NULL terminated array of known function names. The array is
-sorted. The array itself is allocated, but not the strings inside. You
-should free the array, but not the pointers, using @code{free} or
-@code{rl_free} when you are done.
-@end deftypefun
-
-@deftypefun int rl_add_funmap_entry (const char *name, rl_command_func_t *function)
-Add @var{name} to the list of bindable Readline command names, and make
-@var{function} the function to be called when @var{name} is invoked.
-@end deftypefun
-
-@node Allowing Undoing
-@subsection Allowing Undoing
-
-Supporting the undo command is a painless thing, and makes your
-functions much more useful. It is certainly easy to try
-something if you know you can undo it.
-
-If your function simply inserts text once, or deletes text once, and
-uses @code{rl_insert_text()} or @code{rl_delete_text()} to do it, then
-undoing is already done for you automatically.
-
-If you do multiple insertions or multiple deletions, or any combination
-of these operations, you should group them together into one operation.
-This is done with @code{rl_begin_undo_group()} and
-@code{rl_end_undo_group()}.
-
-The types of events that can be undone are:
-
-@smallexample
-enum undo_code @{ UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END @};
-@end smallexample
-
-Notice that @code{UNDO_DELETE} means to insert some text, and
-@code{UNDO_INSERT} means to delete some text. That is, the undo code
-tells what to undo, not how to undo it. @code{UNDO_BEGIN} and
-@code{UNDO_END} are tags added by @code{rl_begin_undo_group()} and
-@code{rl_end_undo_group()}.
-
-@deftypefun int rl_begin_undo_group (void)
-Begins saving undo information in a group construct. The undo
-information usually comes from calls to @code{rl_insert_text()} and
-@code{rl_delete_text()}, but could be the result of calls to
-@code{rl_add_undo()}.
-@end deftypefun
-
-@deftypefun int rl_end_undo_group (void)
-Closes the current undo group started with @code{rl_begin_undo_group
-()}. There should be one call to @code{rl_end_undo_group()}
-for each call to @code{rl_begin_undo_group()}.
-@end deftypefun
-
-@deftypefun void rl_add_undo (enum undo_code what, int start, int end, char *text)
-Remember how to undo an event (according to @var{what}). The affected
-text runs from @var{start} to @var{end}, and encompasses @var{text}.
-@end deftypefun
-
-@deftypefun void rl_free_undo_list (void)
-Free the existing undo list.
-@end deftypefun
-
-@deftypefun int rl_do_undo (void)
-Undo the first thing on the undo list. Returns @code{0} if there was
-nothing to undo, non-zero if something was undone.
-@end deftypefun
-
-Finally, if you neither insert nor delete text, but directly modify the
-existing text (e.g., change its case), call @code{rl_modifying()}
-once, just before you modify the text. You must supply the indices of
-the text range that you are going to modify.
-
-@deftypefun int rl_modifying (int start, int end)
-Tell Readline to save the text between @var{start} and @var{end} as a
-single undo unit. It is assumed that you will subsequently modify
-that text.
-@end deftypefun
-
-@node Redisplay
-@subsection Redisplay
-
-@deftypefun void rl_redisplay (void)
-Change what's displayed on the screen to reflect the current contents
-of @code{rl_line_buffer}.
-@end deftypefun
-
-@deftypefun int rl_forced_update_display (void)
-Force the line to be updated and redisplayed, whether or not
-Readline thinks the screen display is correct.
-@end deftypefun
-
-@deftypefun int rl_on_new_line (void)
-Tell the update functions that we have moved onto a new (empty) line,
-usually after ouputting a newline.
-@end deftypefun
-
-@deftypefun int rl_on_new_line_with_prompt (void)
-Tell the update functions that we have moved onto a new line, with
-@var{rl_prompt} already displayed.
-This could be used by applications that want to output the prompt string
-themselves, but still need Readline to know the prompt string length for
-redisplay.
-It should be used after setting @var{rl_already_prompted}.
-@end deftypefun
-
-@deftypefun int rl_reset_line_state (void)
-Reset the display state to a clean state and redisplay the current line
-starting on a new line.
-@end deftypefun
-
-@deftypefun int rl_crlf (void)
-Move the cursor to the start of the next screen line.
-@end deftypefun
-
-@deftypefun int rl_show_char (int c)
-Display character @var{c} on @code{rl_outstream}.
-If Readline has not been set to display meta characters directly, this
-will convert meta characters to a meta-prefixed key sequence.
-This is intended for use by applications which wish to do their own
-redisplay.
-@end deftypefun
-
-@deftypefun int rl_message (const char *, @dots{})
-The arguments are a format string as would be supplied to @code{printf},
-possibly containing conversion specifications such as @samp{%d}, and
-any additional arguments necessary to satisfy the conversion specifications.
-The resulting string is displayed in the @dfn{echo area}. The echo area
-is also used to display numeric arguments and search strings.
-You should call @code{rl_save_prompt} to save the prompt information
-before calling this function.
-@end deftypefun
-
-@deftypefun int rl_clear_message (void)
-Clear the message in the echo area. If the prompt was saved with a call to
-@code{rl_save_prompt} before the last call to @code{rl_message},
-call @code{rl_restore_prompt} before calling this function.
-@end deftypefun
-
-@deftypefun void rl_save_prompt (void)
-Save the local Readline prompt display state in preparation for
-displaying a new message in the message area with @code{rl_message()}.
-@end deftypefun
-
-@deftypefun void rl_restore_prompt (void)
-Restore the local Readline prompt display state saved by the most
-recent call to @code{rl_save_prompt}.
-if @code{rl_save_prompt} was called to save the prompt before a call
-to @code{rl_message}, this function should be called before the
-corresponding call to @code{rl_clear_message}.
-@end deftypefun
-
-@deftypefun int rl_expand_prompt (char *prompt)
-Expand any special character sequences in @var{prompt} and set up the
-local Readline prompt redisplay variables.
-This function is called by @code{readline()}. It may also be called to
-expand the primary prompt if the @code{rl_on_new_line_with_prompt()}
-function or @code{rl_already_prompted} variable is used.
-It returns the number of visible characters on the last line of the
-(possibly multi-line) prompt.
-Applications may indicate that the prompt contains characters that take
-up no physical screen space when displayed by bracketing a sequence of
-such characters with the special markers @code{RL_PROMPT_START_IGNORE}
-and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h}. This may
-be used to embed terminal-specific escape sequences in prompts.
-@end deftypefun
-
-@deftypefun int rl_set_prompt (const char *prompt)
-Make Readline use @var{prompt} for subsequent redisplay. This calls
-@code{rl_expand_prompt()} to expand the prompt and sets @code{rl_prompt}
-to the result.
-@end deftypefun
-
-@node Modifying Text
-@subsection Modifying Text
-
-@deftypefun int rl_insert_text (const char *text)
-Insert @var{text} into the line at the current cursor position.
-Returns the number of characters inserted.
-@end deftypefun
-
-@deftypefun int rl_delete_text (int start, int end)
-Delete the text between @var{start} and @var{end} in the current line.
-Returns the number of characters deleted.
-@end deftypefun
-
-@deftypefun {char *} rl_copy_text (int start, int end)
-Return a copy of the text between @var{start} and @var{end} in
-the current line.
-@end deftypefun
-
-@deftypefun int rl_kill_text (int start, int end)
-Copy the text between @var{start} and @var{end} in the current line
-to the kill ring, appending or prepending to the last kill if the
-last command was a kill command. The text is deleted.
-If @var{start} is less than @var{end},
-the text is appended, otherwise prepended. If the last command was
-not a kill, a new kill ring slot is used.
-@end deftypefun
-
-@deftypefun int rl_push_macro_input (char *macro)
-Cause @var{macro} to be inserted into the line, as if it had been invoked
-by a key bound to a macro. Not especially useful; use
-@code{rl_insert_text()} instead.
-@end deftypefun
-
-@node Character Input
-@subsection Character Input
-
-@deftypefun int rl_read_key (void)
-Return the next character available from Readline's current input stream.
-This handles input inserted into
-the input stream via @var{rl_pending_input} (@pxref{Readline Variables})
-and @code{rl_stuff_char()}, macros, and characters read from the keyboard.
-While waiting for input, this function will call any function assigned to
-the @code{rl_event_hook} variable.
-@end deftypefun
-
-@deftypefun int rl_getc (FILE *stream)
-Return the next character available from @var{stream}, which is assumed to
-be the keyboard.
-@end deftypefun
-
-@deftypefun int rl_stuff_char (int c)
-Insert @var{c} into the Readline input stream. It will be "read"
-before Readline attempts to read characters from the terminal with
-@code{rl_read_key()}. Up to 512 characters may be pushed back.
-@code{rl_stuff_char} returns 1 if the character was successfully inserted;
-0 otherwise.
-@end deftypefun
-
-@deftypefun int rl_execute_next (int c)
-Make @var{c} be the next command to be executed when @code{rl_read_key()}
-is called. This sets @var{rl_pending_input}.
-@end deftypefun
-
-@deftypefun int rl_clear_pending_input (void)
-Unset @var{rl_pending_input}, effectively negating the effect of any
-previous call to @code{rl_execute_next()}. This works only if the
-pending input has not already been read with @code{rl_read_key()}.
-@end deftypefun
-
-@deftypefun int rl_set_keyboard_input_timeout (int u)
-While waiting for keyboard input in @code{rl_read_key()}, Readline will
-wait for @var{u} microseconds for input before calling any function
-assigned to @code{rl_event_hook}. @var{u} must be greater than or equal
-to zero (a zero-length timeout is equivalent to a poll).
-The default waiting period is one-tenth of a second.
-Returns the old timeout value.
-@end deftypefun
-
-@node Terminal Management
-@subsection Terminal Management
-
-@deftypefun void rl_prep_terminal (int meta_flag)
-Modify the terminal settings for Readline's use, so @code{readline()}
-can read a single character at a time from the keyboard.
-The @var{meta_flag} argument should be non-zero if Readline should
-read eight-bit input.
-@end deftypefun
-
-@deftypefun void rl_deprep_terminal (void)
-Undo the effects of @code{rl_prep_terminal()}, leaving the terminal in
-the state in which it was before the most recent call to
-@code{rl_prep_terminal()}.
-@end deftypefun
-
-@deftypefun void rl_tty_set_default_bindings (Keymap kmap)
-Read the operating system's terminal editing characters (as would be
-displayed by @code{stty}) to their Readline equivalents.
-The bindings are performed in @var{kmap}.
-@end deftypefun
-
-@deftypefun void rl_tty_unset_default_bindings (Keymap kmap)
-Reset the bindings manipulated by @code{rl_tty_set_default_bindings} so
-that the terminal editing characters are bound to @code{rl_insert}.
-The bindings are performed in @var{kmap}.
-@end deftypefun
-
-@deftypefun int rl_reset_terminal (const char *terminal_name)
-Reinitialize Readline's idea of the terminal settings using
-@var{terminal_name} as the terminal type (e.g., @code{vt100}).
-If @var{terminal_name} is @code{NULL}, the value of the @code{TERM}
-environment variable is used.
-@end deftypefun
-
-@node Utility Functions
-@subsection Utility Functions
-
-@deftypefun int rl_save_state (struct readline_state *sp)
-Save a snapshot of Readline's internal state to @var{sp}.
-The contents of the @var{readline_state} structure are documented
-in @file{readline.h}.
-The caller is responsible for allocating the structure.
-@end deftypefun
-
-@deftypefun int rl_restore_state (struct readline_state *sp)
-Restore Readline's internal state to that stored in @var{sp}, which must
-have been saved by a call to @code{rl_save_state}.
-The contents of the @var{readline_state} structure are documented
-in @file{readline.h}.
-The caller is responsible for freeing the structure.
-@end deftypefun
-
-@deftypefun void rl_free (void *mem)
-Deallocate the memory pointed to by @var{mem}. @var{mem} must have been
-allocated by @code{malloc}.
-@end deftypefun
-
-@deftypefun void rl_replace_line (const char *text, int clear_undo)
-Replace the contents of @code{rl_line_buffer} with @var{text}.
-The point and mark are preserved, if possible.
-If @var{clear_undo} is non-zero, the undo list associated with the
-current line is cleared.
-@end deftypefun
-
-@deftypefun void rl_extend_line_buffer (int len)
-Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
-characters, possibly reallocating it if necessary.
-@end deftypefun
-
-@deftypefun int rl_initialize (void)
-Initialize or re-initialize Readline's internal state.
-It's not strictly necessary to call this; @code{readline()} calls it before
-reading any input.
-@end deftypefun
-
-@deftypefun int rl_ding (void)
-Ring the terminal bell, obeying the setting of @code{bell-style}.
-@end deftypefun
-
-@deftypefun int rl_alphabetic (int c)
-Return 1 if @var{c} is an alphabetic character.
-@end deftypefun
-
-@deftypefun void rl_display_match_list (char **matches, int len, int max)
-A convenience function for displaying a list of strings in
-columnar format on Readline's output stream. @code{matches} is the list
-of strings, in argv format, such as a list of completion matches.
-@code{len} is the number of strings in @code{matches}, and @code{max}
-is the length of the longest string in @code{matches}. This function uses
-the setting of @code{print-completions-horizontally} to select how the
-matches are displayed (@pxref{Readline Init File Syntax}).
-When displaying completions, this function sets the number of columns used
-for display to the value of @code{completion-display-width}, the value of
-the environment variable @env{COLUMNS}, or the screen width, in that order.
-@end deftypefun
-
-The following are implemented as macros, defined in @code{chardefs.h}.
-Applications should refrain from using them.
-
-@deftypefun int _rl_uppercase_p (int c)
-Return 1 if @var{c} is an uppercase alphabetic character.
-@end deftypefun
-
-@deftypefun int _rl_lowercase_p (int c)
-Return 1 if @var{c} is a lowercase alphabetic character.
-@end deftypefun
-
-@deftypefun int _rl_digit_p (int c)
-Return 1 if @var{c} is a numeric character.
-@end deftypefun
-
-@deftypefun int _rl_to_upper (int c)
-If @var{c} is a lowercase alphabetic character, return the corresponding
-uppercase character.
-@end deftypefun
-
-@deftypefun int _rl_to_lower (int c)
-If @var{c} is an uppercase alphabetic character, return the corresponding
-lowercase character.
-@end deftypefun
-
-@deftypefun int _rl_digit_value (int c)
-If @var{c} is a number, return the value it represents.
-@end deftypefun
-
-@node Miscellaneous Functions
-@subsection Miscellaneous Functions
-
-@deftypefun int rl_macro_bind (const char *keyseq, const char *macro, Keymap map)
-Bind the key sequence @var{keyseq} to invoke the macro @var{macro}.
-The binding is performed in @var{map}. When @var{keyseq} is invoked, the
-@var{macro} will be inserted into the line. This function is deprecated;
-use @code{rl_generic_bind()} instead.
-@end deftypefun
-
-@deftypefun void rl_macro_dumper (int readable)
-Print the key sequences bound to macros and their values, using
-the current keymap, to @code{rl_outstream}.
-If @var{readable} is non-zero, the list is formatted in such a way
-that it can be made part of an @code{inputrc} file and re-read.
-@end deftypefun
-
-@deftypefun int rl_variable_bind (const char *variable, const char *value)
-Make the Readline variable @var{variable} have @var{value}.
-This behaves as if the readline command
-@samp{set @var{variable} @var{value}} had been executed in an @code{inputrc}
-file (@pxref{Readline Init File Syntax}).
-@end deftypefun
-
-@deftypefun {char *} rl_variable_value (const char *variable)
-Return a string representing the value of the Readline variable @var{variable}.
-For boolean variables, this string is either @samp{on} or @samp{off}.
-@end deftypefun
-
-@deftypefun void rl_variable_dumper (int readable)
-Print the readline variable names and their current values
-to @code{rl_outstream}.
-If @var{readable} is non-zero, the list is formatted in such a way
-that it can be made part of an @code{inputrc} file and re-read.
-@end deftypefun
-
-@deftypefun int rl_set_paren_blink_timeout (int u)
-Set the time interval (in microseconds) that Readline waits when showing
-a balancing character when @code{blink-matching-paren} has been enabled.
-@end deftypefun
-
-@deftypefun {char *} rl_get_termcap (const char *cap)
-Retrieve the string value of the termcap capability @var{cap}.
-Readline fetches the termcap entry for the current terminal name and
-uses those capabilities to move around the screen line and perform other
-terminal-specific operations, like erasing a line. Readline does not
-use all of a terminal's capabilities, and this function will return
-values for only those capabilities Readline uses.
-@end deftypefun
-
-@deftypefun {void} rl_clear_history (void)
-Clear the history list by deleting all of the entries, in the same manner
-as the History library's @code{clear_history()} function.
-This differs from @code{clear_history} because it frees private data
-Readline saves in the history list.
-@end deftypefun
-
-@node Alternate Interface
-@subsection Alternate Interface
-
-An alternate interface is available to plain @code{readline()}. Some
-applications need to interleave keyboard I/O with file, device, or
-window system I/O, typically by using a main loop to @code{select()}
-on various file descriptors. To accomodate this need, readline can
-also be invoked as a `callback' function from an event loop. There
-are functions available to make this easy.
-
-@deftypefun void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler)
-Set up the terminal for readline I/O and display the initial
-expanded value of @var{prompt}. Save the value of @var{lhandler} to
-use as a handler function to call when a complete line of input has been
-entered.
-The handler function receives the text of the line as an argument.
-@end deftypefun
-
-@deftypefun void rl_callback_read_char (void)
-Whenever an application determines that keyboard input is available, it
-should call @code{rl_callback_read_char()}, which will read the next
-character from the current input source.
-If that character completes the line, @code{rl_callback_read_char} will
-invoke the @var{lhandler} function installed by
-@code{rl_callback_handler_install} to process the line.
-Before calling the @var{lhandler} function, the terminal settings are
-reset to the values they had before calling
-@code{rl_callback_handler_install}.
-If the @var{lhandler} function returns,
-and the line handler remains installed,
-the terminal settings are modified for Readline's use again.
-@code{EOF} is indicated by calling @var{lhandler} with a
-@code{NULL} line.
-@end deftypefun
-
-@deftypefun void rl_callback_handler_remove (void)
-Restore the terminal to its initial state and remove the line handler.
-This may be called from within a callback as well as independently.
-If the @var{lhandler} installed by @code{rl_callback_handler_install}
-does not exit the program, either this function or the function referred
-to by the value of @code{rl_deprep_term_function} should be called before
-the program exits to reset the terminal settings.
-@end deftypefun
-
-@node A Readline Example
-@subsection A Readline Example
-
-Here is a function which changes lowercase characters to their uppercase
-equivalents, and uppercase characters to lowercase. If
-this function was bound to @samp{M-c}, then typing @samp{M-c} would
-change the case of the character under point. Typing @samp{M-1 0 M-c}
-would change the case of the following 10 characters, leaving the cursor on
-the last character changed.
-
-@example
-/* Invert the case of the COUNT following characters. */
-int
-invert_case_line (count, key)
- int count, key;
-@{
- register int start, end, i;
-
- start = rl_point;
-
- if (rl_point >= rl_end)
- return (0);
-
- if (count < 0)
- @{
- direction = -1;
- count = -count;
- @}
- else
- direction = 1;
-
- /* Find the end of the range to modify. */
- end = start + (count * direction);
-
- /* Force it to be within range. */
- if (end > rl_end)
- end = rl_end;
- else if (end < 0)
- end = 0;
-
- if (start == end)
- return (0);
-
- if (start > end)
- @{
- int temp = start;
- start = end;
- end = temp;
- @}
-
- /* Tell readline that we are modifying the line,
- so it will save the undo information. */
- rl_modifying (start, end);
-
- for (i = start; i != end; i++)
- @{
- if (_rl_uppercase_p (rl_line_buffer[i]))
- rl_line_buffer[i] = _rl_to_lower (rl_line_buffer[i]);
- else if (_rl_lowercase_p (rl_line_buffer[i]))
- rl_line_buffer[i] = _rl_to_upper (rl_line_buffer[i]);
- @}
- /* Move point to on top of the last character changed. */
- rl_point = (direction == 1) ? end - 1 : start;
- return (0);
-@}
-@end example
-
-@node Alternate Interface Example
-@subsection Alternate Interface Example
-
-Here is a complete program that illustrates Readline's alternate interface.
-It reads lines from the terminal and displays them, providing the
-standard history and TAB completion functions.
-It understands the EOF character or "exit" to exit the program.
-
-@example
-/* Standard include files. stdio.h is required. */
-#include <stdlib.h>
-#include <unistd.h>
-
-/* Used for select(2) */
-#include <sys/types.h>
-#include <sys/select.h>
-
-#include <stdio.h>
-
-/* Standard readline include files. */
-#include <readline/readline.h>
-#include <readline/history.h>
-
-static void cb_linehandler (char *);
-
-int running;
-const char *prompt = "rltest$ ";
-
-/* Callback function called for each line when accept-line executed, EOF
- seen, or EOF character read. This sets a flag and returns; it could
- also call exit(3). */
-static void
-cb_linehandler (char *line)
-@{
- /* Can use ^D (stty eof) or `exit' to exit. */
- if (line == NULL || strcmp (line, "exit") == 0)
- @{
- if (line == 0)
- printf ("\n");
- printf ("exit\n");
- /* This function needs to be called to reset the terminal settings,
- and calling it from the line handler keeps one extra prompt from
- being displayed. */
- rl_callback_handler_remove ();
-
- running = 0;
- @}
- else
- @{
- if (*line)
- add_history (line);
- printf ("input line: %s\n", line);
- free (line);
- @}
-@}
-
-int
-main (int c, char **v)
-@{
- fd_set fds;
- int r;
-
- /* Install the line handler. */
- rl_callback_handler_install (prompt, cb_linehandler);
-
- /* Enter a simple event loop. This waits until something is available
- to read on readline's input stream (defaults to standard input) and
- calls the builtin character read callback to read it. It does not
- have to modify the user's terminal settings. */
- running = 1;
- while (running)
- @{
- FD_ZERO (&fds);
- FD_SET (fileno (rl_instream), &fds);
-
- r = select (FD_SETSIZE, &fds, NULL, NULL, NULL);
- if (r < 0)
- @{
- perror ("rltest: select");
- break;
- @}
-
- if (FD_ISSET (fileno (rl_instream), &fds))
- rl_callback_read_char ();
- @}
-
- printf ("rltest: Event loop has exited\n");
- return 0;
-@}
-@end example
-
-@node Readline Signal Handling
-@section Readline Signal Handling
-
-Signals are asynchronous events sent to a process by the Unix kernel,
-sometimes on behalf of another process. They are intended to indicate
-exceptional events, like a user pressing the interrupt key on his terminal,
-or a network connection being broken. There is a class of signals that can
-be sent to the process currently reading input from the keyboard. Since
-Readline changes the terminal attributes when it is called, it needs to
-perform special processing when such a signal is received in order to
-restore the terminal to a sane state, or provide application writers with
-functions to do so manually.
-
-Readline contains an internal signal handler that is installed for a
-number of signals (@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM},
-@code{SIGHUP},
-@code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}).
-When one of these signals is received, the signal handler
-will reset the terminal attributes to those that were in effect before
-@code{readline()} was called, reset the signal handling to what it was
-before @code{readline()} was called, and resend the signal to the calling
-application.
-If and when the calling application's signal handler returns, Readline
-will reinitialize the terminal and continue to accept input.
-When a @code{SIGINT} is received, the Readline signal handler performs
-some additional work, which will cause any partially-entered line to be
-aborted (see the description of @code{rl_free_line_state()} below).
-
-There is an additional Readline signal handler, for @code{SIGWINCH}, which
-the kernel sends to a process whenever the terminal's size changes (for
-example, if a user resizes an @code{xterm}). The Readline @code{SIGWINCH}
-handler updates Readline's internal screen size information, and then calls
-any @code{SIGWINCH} signal handler the calling application has installed.
-Readline calls the application's @code{SIGWINCH} signal handler without
-resetting the terminal to its original state. If the application's signal
-handler does more than update its idea of the terminal size and return (for
-example, a @code{longjmp} back to a main processing loop), it @emph{must}
-call @code{rl_cleanup_after_signal()} (described below), to restore the
-terminal state.
-
-Readline provides two variables that allow application writers to
-control whether or not it will catch certain signals and act on them
-when they are received. It is important that applications change the
-values of these variables only when calling @code{readline()}, not in
-a signal handler, so Readline's internal signal state is not corrupted.
-
-@deftypevar int rl_catch_signals
-If this variable is non-zero, Readline will install signal handlers for
-@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @code{SIGHUP}, @code{SIGALRM},
-@code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}.
-
-The default value of @code{rl_catch_signals} is 1.
-@end deftypevar
-
-@deftypevar int rl_catch_sigwinch
-If this variable is non-zero, Readline will install a signal handler for
-@code{SIGWINCH}.
-
-The default value of @code{rl_catch_sigwinch} is 1.
-@end deftypevar
-
-If an application does not wish to have Readline catch any signals, or
-to handle signals other than those Readline catches (@code{SIGHUP},
-for example),
-Readline provides convenience functions to do the necessary terminal
-and internal state cleanup upon receipt of a signal.
-
-@deftypefun void rl_cleanup_after_signal (void)
-This function will reset the state of the terminal to what it was before
-@code{readline()} was called, and remove the Readline signal handlers for
-all signals, depending on the values of @code{rl_catch_signals} and
-@code{rl_catch_sigwinch}.
-@end deftypefun
-
-@deftypefun void rl_free_line_state (void)
-This will free any partial state associated with the current input line
-(undo information, any partial history entry, any partially-entered
-keyboard macro, and any partially-entered numeric argument). This
-should be called before @code{rl_cleanup_after_signal()}. The
-Readline signal handler for @code{SIGINT} calls this to abort the
-current input line.
-@end deftypefun
-
-@deftypefun void rl_reset_after_signal (void)
-This will reinitialize the terminal and reinstall any Readline signal
-handlers, depending on the values of @code{rl_catch_signals} and
-@code{rl_catch_sigwinch}.
-@end deftypefun
-
-If an application does not wish Readline to catch @code{SIGWINCH}, it may
-call @code{rl_resize_terminal()} or @code{rl_set_screen_size()} to force
-Readline to update its idea of the terminal size when a @code{SIGWINCH}
-is received.
-
-@deftypefun void rl_echo_signal_char (int sig)
-If an application wishes to install its own signal handlers, but still
-have readline display characters that generate signals, calling this
-function with @var{sig} set to @code{SIGINT}, @code{SIGQUIT}, or
-@code{SIGTSTP} will display the character generating that signal.
-@end deftypefun
-
-@deftypefun void rl_resize_terminal (void)
-Update Readline's internal screen size by reading values from the kernel.
-@end deftypefun
-
-@deftypefun void rl_set_screen_size (int rows, int cols)
-Set Readline's idea of the terminal size to @var{rows} rows and
-@var{cols} columns. If either @var{rows} or @var{columns} is less than
-or equal to 0, Readline's idea of that terminal dimension is unchanged.
-@end deftypefun
-
-If an application does not want to install a @code{SIGWINCH} handler, but
-is still interested in the screen dimensions, Readline's idea of the screen
-size may be queried.
-
-@deftypefun void rl_get_screen_size (int *rows, int *cols)
-Return Readline's idea of the terminal's size in the
-variables pointed to by the arguments.
-@end deftypefun
-
-@deftypefun void rl_reset_screen_size (void)
-Cause Readline to reobtain the screen size and recalculate its dimensions.
-@end deftypefun
-
-The following functions install and remove Readline's signal handlers.
-
-@deftypefun int rl_set_signals (void)
-Install Readline's signal handler for @code{SIGINT}, @code{SIGQUIT},
-@code{SIGTERM}, @code{SIGHUP}, @code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN},
-@code{SIGTTOU}, and @code{SIGWINCH}, depending on the values of
-@code{rl_catch_signals} and @code{rl_catch_sigwinch}.
-@end deftypefun
-
-@deftypefun int rl_clear_signals (void)
-Remove all of the Readline signal handlers installed by
-@code{rl_set_signals()}.
-@end deftypefun
-
-@node Custom Completers
-@section Custom Completers
-@cindex application-specific completion functions
-
-Typically, a program that reads commands from the user has a way of
-disambiguating commands and data. If your program is one of these, then
-it can provide completion for commands, data, or both.
-The following sections describe how your program and Readline
-cooperate to provide this service.
-
-@menu
-* How Completing Works:: The logic used to do completion.
-* Completion Functions:: Functions provided by Readline.
-* Completion Variables:: Variables which control completion.
-* A Short Completion Example:: An example of writing completer subroutines.
-@end menu
-
-@node How Completing Works
-@subsection How Completing Works
-
-In order to complete some text, the full list of possible completions
-must be available. That is, it is not possible to accurately
-expand a partial word without knowing all of the possible words
-which make sense in that context. The Readline library provides
-the user interface to completion, and two of the most common
-completion functions: filename and username. For completing other types
-of text, you must write your own completion function. This section
-describes exactly what such functions must do, and provides an example.
-
-There are three major functions used to perform completion:
-
-@enumerate
-@item
-The user-interface function @code{rl_complete()}. This function is
-called with the same arguments as other bindable Readline functions:
-@var{count} and @var{invoking_key}.
-It isolates the word to be completed and calls
-@code{rl_completion_matches()} to generate a list of possible completions.
-It then either lists the possible completions, inserts the possible
-completions, or actually performs the
-completion, depending on which behavior is desired.
-
-@item
-The internal function @code{rl_completion_matches()} uses an
-application-supplied @dfn{generator} function to generate the list of
-possible matches, and then returns the array of these matches.
-The caller should place the address of its generator function in
-@code{rl_completion_entry_function}.
-
-@item
-The generator function is called repeatedly from
-@code{rl_completion_matches()}, returning a string each time. The
-arguments to the generator function are @var{text} and @var{state}.
-@var{text} is the partial word to be completed. @var{state} is zero the
-first time the function is called, allowing the generator to perform
-any necessary initialization, and a positive non-zero integer for
-each subsequent call. The generator function returns
-@code{(char *)NULL} to inform @code{rl_completion_matches()} that there are
-no more possibilities left. Usually the generator function computes the
-list of possible completions when @var{state} is zero, and returns them
-one at a time on subsequent calls. Each string the generator function
-returns as a match must be allocated with @code{malloc()}; Readline
-frees the strings when it has finished with them.
-Such a generator function is referred to as an
-@dfn{application-specific completion function}.
-
-@end enumerate
-
-@deftypefun int rl_complete (int ignore, int invoking_key)
-Complete the word at or before point. You have supplied the function
-that does the initial simple matching selection algorithm (see
-@code{rl_completion_matches()}). The default is to do filename completion.
-@end deftypefun
-
-@deftypevar {rl_compentry_func_t *} rl_completion_entry_function
-This is a pointer to the generator function for
-@code{rl_completion_matches()}.
-If the value of @code{rl_completion_entry_function} is
-@code{NULL} then the default filename generator
-function, @code{rl_filename_completion_function()}, is used.
-An @dfn{application-specific completion function} is a function whose
-address is assigned to @code{rl_completion_entry_function} and whose
-return values are used to generate possible completions.
-@end deftypevar
-
-@node Completion Functions
-@subsection Completion Functions
-
-Here is the complete list of callable completion functions present in
-Readline.
-
-@deftypefun int rl_complete_internal (int what_to_do)
-Complete the word at or before point. @var{what_to_do} says what to do
-with the completion. A value of @samp{?} means list the possible
-completions. @samp{TAB} means do standard completion. @samp{*} means
-insert all of the possible completions. @samp{!} means to display
-all of the possible completions, if there is more than one, as well as
-performing partial completion. @samp{@@} is similar to @samp{!}, but
-possible completions are not listed if the possible completions share
-a common prefix.
-@end deftypefun
-
-@deftypefun int rl_complete (int ignore, int invoking_key)
-Complete the word at or before point. You have supplied the function
-that does the initial simple matching selection algorithm (see
-@code{rl_completion_matches()} and @code{rl_completion_entry_function}).
-The default is to do filename
-completion. This calls @code{rl_complete_internal()} with an
-argument depending on @var{invoking_key}.
-@end deftypefun
-
-@deftypefun int rl_possible_completions (int count, int invoking_key)
-List the possible completions. See description of @code{rl_complete
-()}. This calls @code{rl_complete_internal()} with an argument of
-@samp{?}.
-@end deftypefun
-
-@deftypefun int rl_insert_completions (int count, int invoking_key)
-Insert the list of possible completions into the line, deleting the
-partially-completed word. See description of @code{rl_complete()}.
-This calls @code{rl_complete_internal()} with an argument of @samp{*}.
-@end deftypefun
-
-@deftypefun int rl_completion_mode (rl_command_func_t *cfunc)
-Returns the apppriate value to pass to @code{rl_complete_internal()}
-depending on whether @var{cfunc} was called twice in succession and
-the values of the @code{show-all-if-ambiguous} and
-@code{show-all-if-unmodified} variables.
-Application-specific completion functions may use this function to present
-the same interface as @code{rl_complete()}.
-@end deftypefun
-
-@deftypefun {char **} rl_completion_matches (const char *text, rl_compentry_func_t *entry_func)
-Returns an array of strings which is a list of completions for
-@var{text}. If there are no completions, returns @code{NULL}.
-The first entry in the returned array is the substitution for @var{text}.
-The remaining entries are the possible completions. The array is
-terminated with a @code{NULL} pointer.
-
-@var{entry_func} is a function of two args, and returns a
-@code{char *}. The first argument is @var{text}. The second is a
-state argument; it is zero on the first call, and non-zero on subsequent
-calls. @var{entry_func} returns a @code{NULL} pointer to the caller
-when there are no more matches.
-@end deftypefun
-
-@deftypefun {char *} rl_filename_completion_function (const char *text, int state)
-A generator function for filename completion in the general case.
-@var{text} is a partial filename.
-The Bash source is a useful reference for writing application-specific
-completion functions (the Bash completion functions call this and other
-Readline functions).
-@end deftypefun
-
-@deftypefun {char *} rl_username_completion_function (const char *text, int state)
-A completion generator for usernames. @var{text} contains a partial
-username preceded by a random character (usually @samp{~}). As with all
-completion generators, @var{state} is zero on the first call and non-zero
-for subsequent calls.
-@end deftypefun
-
-@node Completion Variables
-@subsection Completion Variables
-
-@deftypevar {rl_compentry_func_t *} rl_completion_entry_function
-A pointer to the generator function for @code{rl_completion_matches()}.
-@code{NULL} means to use @code{rl_filename_completion_function()},
-the default filename completer.
-@end deftypevar
-
-@deftypevar {rl_completion_func_t *} rl_attempted_completion_function
-A pointer to an alternative function to create matches.
-The function is called with @var{text}, @var{start}, and @var{end}.
-@var{start} and @var{end} are indices in @code{rl_line_buffer} defining
-the boundaries of @var{text}, which is a character string.
-If this function exists and returns @code{NULL}, or if this variable is
-set to @code{NULL}, then @code{rl_complete()} will call the value of
-@code{rl_completion_entry_function} to generate matches, otherwise the
-array of strings returned will be used.
-If this function sets the @code{rl_attempted_completion_over}
-variable to a non-zero value, Readline will not perform its default
-completion even if this function returns no matches.
-@end deftypevar
-
-@deftypevar {rl_quote_func_t *} rl_filename_quoting_function
-A pointer to a function that will quote a filename in an
-application-specific fashion. This is called if filename completion is being
-attempted and one of the characters in @code{rl_filename_quote_characters}
-appears in a completed filename. The function is called with
-@var{text}, @var{match_type}, and @var{quote_pointer}. The @var{text}
-is the filename to be quoted. The @var{match_type} is either
-@code{SINGLE_MATCH}, if there is only one completion match, or
-@code{MULT_MATCH}. Some functions use this to decide whether or not to
-insert a closing quote character. The @var{quote_pointer} is a pointer
-to any opening quote character the user typed. Some functions choose
-to reset this character.
-@end deftypevar
-
-@deftypevar {rl_dequote_func_t *} rl_filename_dequoting_function
-A pointer to a function that will remove application-specific quoting
-characters from a filename before completion is attempted, so those
-characters do not interfere with matching the text against names in
-the filesystem. It is called with @var{text}, the text of the word
-to be dequoted, and @var{quote_char}, which is the quoting character
-that delimits the filename (usually @samp{'} or @samp{"}). If
-@var{quote_char} is zero, the filename was not in an embedded string.
-@end deftypevar
-
-@deftypevar {rl_linebuf_func_t *} rl_char_is_quoted_p
-A pointer to a function to call that determines whether or not a specific
-character in the line buffer is quoted, according to whatever quoting
-mechanism the program calling Readline uses. The function is called with
-two arguments: @var{text}, the text of the line, and @var{index}, the
-index of the character in the line. It is used to decide whether a
-character found in @code{rl_completer_word_break_characters} should be
-used to break words for the completer.
-@end deftypevar
-
-@deftypevar {rl_compignore_func_t *} rl_ignore_some_completions_function
-This function, if defined, is called by the completer when real filename
-completion is done, after all the matching names have been generated.
-It is passed a @code{NULL} terminated array of matches.
-The first element (@code{matches[0]}) is the
-maximal substring common to all matches. This function can
-re-arrange the list of matches as required, but each element deleted
-from the array must be freed.
-@end deftypevar
-
-@deftypevar {rl_icppfunc_t *} rl_directory_completion_hook
-This function, if defined, is allowed to modify the directory portion
-of filenames Readline completes.
-It could be used to expand symbolic links or shell variables in pathnames.
-It is called with the address of a string (the current directory name) as an
-argument, and may modify that string.
-If the string is replaced with a new string, the old value should be freed.
-Any modified directory name should have a trailing slash.
-The modified value will be used as part of the completion, replacing
-the directory portion of the pathname the user typed.
-At the least, even if no other expansion is performed, this function should
-remove any quote characters from the directory name, because its result will
-be passed directly to @code{opendir()}.
-
-The directory completion hook returns an integer that should be non-zero if
-the function modifies its directory argument.
-The function should not modify the directory argument if it returns 0.
-@end deftypevar
-
-@deftypevar {rl_icppfunc_t *} rl_directory_rewrite_hook;
-If non-zero, this is the address of a function to call when completing
-a directory name. This function takes the address of the directory name
-to be modified as an argument. Unlike @code{rl_directory_completion_hook},
-it only modifies the directory name used in @code{opendir}, not what is
-displayed when the possible completions are printed or inserted. It is
-called before rl_directory_completion_hook.
-At the least, even if no other expansion is performed, this function should
-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 should not modify the directory argument if it returns 0.
-@end deftypevar
-
-@deftypevar {rl_icppfunc_t *} rl_filename_stat_hook
-If non-zero, this is the address of a function for the completer to
-call before deciding which character to append to a completed name.
-This function modifies its filename name argument, and the modified value
-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 should not modify the directory argument if it returns 0.
-@end deftypevar
-
-@deftypevar {rl_dequote_func_t *} rl_filename_rewrite_hook
-If non-zero, this is the address of a function called when reading
-directory entries from the filesystem for completion and comparing
-them to the partial word to be completed. The function should
-perform any necesary application or system-specific conversion on
-the filename, such as converting between character sets or converting
-from a filesystem format to a character input format.
-The function takes two arguments: @var{fname}, the filename to be converted,
-and @var{fnlen}, its length in bytes.
-It must either return its first argument (if no conversion takes place)
-or the converted filename in newly-allocated memory. The converted
-form is used to compare against the word to be completed, and, if it
-matches, is added to the list of matches. Readline will free the
-allocated string.
-@end deftypevar
-
-@deftypevar {rl_compdisp_func_t *} rl_completion_display_matches_hook
-If non-zero, then this is the address of a function to call when
-completing a word would normally display the list of possible matches.
-This function is called in lieu of Readline displaying the list.
-It takes three arguments:
-(@code{char **}@var{matches}, @code{int} @var{num_matches}, @code{int} @var{max_length})
-where @var{matches} is the array of matching strings,
-@var{num_matches} is the number of strings in that array, and
-@var{max_length} is the length of the longest string in that array.
-Readline provides a convenience function, @code{rl_display_match_list},
-that takes care of doing the display to Readline's output stream. That
-function may be called from this hook.
-@end deftypevar
-
-@deftypevar {const char *} rl_basic_word_break_characters
-The basic list of characters that signal a break between words for the
-completer routine. The default value of this variable is the characters
-which break words for completion in Bash:
-@code{" \t\n\"\\'`@@$><=;|&@{("}.
-@end deftypevar
-
-@deftypevar {const char *} rl_basic_quote_characters
-A list of quote characters which can cause a word break.
-@end deftypevar
-
-@deftypevar {const char *} rl_completer_word_break_characters
-The list of characters that signal a break between words for
-@code{rl_complete_internal()}. The default list is the value of
-@code{rl_basic_word_break_characters}.
-@end deftypevar
-
-@deftypevar {rl_cpvfunc_t *} rl_completion_word_break_hook
-If non-zero, this is the address of a function to call when Readline is
-deciding where to separate words for word completion. It should return
-a character string like @code{rl_completer_word_break_characters} to be
-used to perform the current completion. The function may choose to set
-@code{rl_completer_word_break_characters} itself. If the function
-returns @code{NULL}, @code{rl_completer_word_break_characters} is used.
-@end deftypevar
-
-@deftypevar {const char *} rl_completer_quote_characters
-A list of characters which can be used to quote a substring of the line.
-Completion occurs on the entire substring, and within the substring
-@code{rl_completer_word_break_characters} are treated as any other character,
-unless they also appear within this list.
-@end deftypevar
-
-@deftypevar {const char *} rl_filename_quote_characters
-A list of characters that cause a filename to be quoted by the completer
-when they appear in a completed filename. The default is the null string.
-@end deftypevar
-
-@deftypevar {const char *} rl_special_prefixes
-The list of characters that are word break characters, but should be
-left in @var{text} when it is passed to the completion function.
-Programs can use this to help determine what kind of completing to do.
-For instance, Bash sets this variable to "$@@" so that it can complete
-shell variables and hostnames.
-@end deftypevar
-
-@deftypevar int rl_completion_query_items
-Up to this many items will be displayed in response to a
-possible-completions call. After that, readline asks the user if she is sure
-she wants to see them all. The default value is 100. A negative value
-indicates that Readline should never ask the user.
-@end deftypevar
-
-@deftypevar {int} rl_completion_append_character
-When a single completion alternative matches at the end of the command
-line, this character is appended to the inserted completion text. The
-default is a space character (@samp{ }). Setting this to the null
-character (@samp{\0}) prevents anything being appended automatically.
-This can be changed in application-specific completion functions to
-provide the ``most sensible word separator character'' according to
-an application-specific command line syntax specification.
-@end deftypevar
-
-@deftypevar int rl_completion_suppress_append
-If non-zero, @var{rl_completion_append_character} is not appended to
-matches at the end of the command line, as described above.
-It is set to 0 before any application-specific completion function
-is called, and may only be changed within such a function.
-@end deftypevar
-
-@deftypevar int rl_completion_quote_character
-When Readline is completing quoted text, as delimited by one of the
-characters in @var{rl_completer_quote_characters}, it sets this variable
-to the quoting character found.
-This is set before any application-specific completion function is called.
-@end deftypevar
-
-@deftypevar int rl_completion_suppress_quote
-If non-zero, Readline does not append a matching quote character when
-performing completion on a quoted string.
-It is set to 0 before any application-specific completion function
-is called, and may only be changed within such a function.
-@end deftypevar
-
-@deftypevar int rl_completion_found_quote
-When Readline is completing quoted text, it sets this variable
-to a non-zero value if the word being completed contains or is delimited
-by any quoting characters, including backslashes.
-This is set before any application-specific completion function is called.
-@end deftypevar
-
-@deftypevar int rl_completion_mark_symlink_dirs
-If non-zero, a slash will be appended to completed filenames that are
-symbolic links to directory names, subject to the value of the
-user-settable @var{mark-directories} variable.
-This variable exists so that application-specific completion functions
-can override the user's global preference (set via the
-@var{mark-symlinked-directories} Readline variable) if appropriate.
-This variable is set to the user's preference before any
-application-specific completion function is called, so unless that
-function modifies the value, the user's preferences are honored.
-@end deftypevar
-
-@deftypevar int rl_ignore_completion_duplicates
-If non-zero, then duplicates in the matches are removed.
-The default is 1.
-@end deftypevar
-
-@deftypevar int rl_filename_completion_desired
-Non-zero means that the results of the matches are to be treated as
-filenames. This is @emph{always} zero when completion is attempted,
-and can only be changed
-within an application-specific completion function. If it is set to a
-non-zero value by such a function, directory names have a slash appended
-and Readline attempts to quote completed filenames if they contain any
-characters in @code{rl_filename_quote_characters} and
-@code{rl_filename_quoting_desired} is set to a non-zero value.
-@end deftypevar
-
-@deftypevar int rl_filename_quoting_desired
-Non-zero means that the results of the matches are to be quoted using
-double quotes (or an application-specific quoting mechanism) if the
-completed filename contains any characters in
-@code{rl_filename_quote_chars}. This is @emph{always} non-zero
-when completion is attempted, and can only be changed within an
-application-specific completion function.
-The quoting is effected via a call to the function pointed to
-by @code{rl_filename_quoting_function}.
-@end deftypevar
-
-@deftypevar int rl_attempted_completion_over
-If an application-specific completion function assigned to
-@code{rl_attempted_completion_function} sets this variable to a non-zero
-value, Readline will not perform its default filename completion even
-if the application's completion function returns no matches.
-It should be set only by an application's completion function.
-@end deftypevar
-
-@deftypevar int rl_sort_completion_matches
-If an application sets this variable to 0, Readline will not sort the
-list of completions (which implies that it cannot remove any duplicate
-completions). The default value is 1, which means that Readline will
-sort the completions and, depending on the value of
-@code{rl_ignore_completion_duplicates}, will attempt to remove duplicate
-matches.
-@end deftypevar
-
-@deftypevar int rl_completion_type
-Set to a character describing the type of completion Readline is currently
-attempting; see the description of @code{rl_complete_internal()}
-(@pxref{Completion Functions}) for the list of characters.
-This is set to the appropriate value before any application-specific
-completion function is called, allowing such functions to present
-the same interface as @code{rl_complete()}.
-@end deftypevar
-
-@deftypevar int rl_completion_invoking_key
-Set to the final character in the key sequence that invoked one of the
-completion functions that call @code{rl_complete_internal()}. This is
-set to the appropriate value before any application-specific completion
-function is called.
-@end deftypevar
-
-@deftypevar int rl_inhibit_completion
-If this variable is non-zero, completion is inhibited. The completion
-character will be inserted as any other bound to @code{self-insert}.
-@end deftypevar
-
-@node A Short Completion Example
-@subsection A Short Completion Example
-
-Here is a small application demonstrating the use of the GNU Readline
-library. It is called @code{fileman}, and the source code resides in
-@file{examples/fileman.c}. This sample application provides
-completion of command names, line editing features, and access to the
-history list.
-
-@page
-@smallexample
-/* fileman.c -- A tiny application which demonstrates how to use the
- GNU Readline library. This application interactively allows users
- to manipulate files and their modes. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-#ifdef HAVE_SYS_FILE_H
-# include <sys/file.h>
-#endif
-#include <sys/stat.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-
-#if defined (HAVE_STRING_H)
-# include <string.h>
-#else /* !HAVE_STRING_H */
-# include <strings.h>
-#endif /* !HAVE_STRING_H */
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#include <time.h>
-
-#include <readline/readline.h>
-#include <readline/history.h>
-
-extern char *xmalloc PARAMS((size_t));
-
-/* The names of functions that actually do the manipulation. */
-int com_list PARAMS((char *));
-int com_view PARAMS((char *));
-int com_rename PARAMS((char *));
-int com_stat PARAMS((char *));
-int com_pwd PARAMS((char *));
-int com_delete PARAMS((char *));
-int com_help PARAMS((char *));
-int com_cd PARAMS((char *));
-int com_quit PARAMS((char *));
-
-/* A structure which contains information on the commands this program
- can understand. */
-
-typedef struct @{
- char *name; /* User printable name of the function. */
- rl_icpfunc_t *func; /* Function to call to do the job. */
- char *doc; /* Documentation for this function. */
-@} COMMAND;
-
-COMMAND commands[] = @{
- @{ "cd", com_cd, "Change to directory DIR" @},
- @{ "delete", com_delete, "Delete FILE" @},
- @{ "help", com_help, "Display this text" @},
- @{ "?", com_help, "Synonym for `help'" @},
- @{ "list", com_list, "List files in DIR" @},
- @{ "ls", com_list, "Synonym for `list'" @},
- @{ "pwd", com_pwd, "Print the current working directory" @},
- @{ "quit", com_quit, "Quit using Fileman" @},
- @{ "rename", com_rename, "Rename FILE to NEWNAME" @},
- @{ "stat", com_stat, "Print out statistics on FILE" @},
- @{ "view", com_view, "View the contents of FILE" @},
- @{ (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL @}
-@};
-
-/* Forward declarations. */
-char *stripwhite ();
-COMMAND *find_command ();
-
-/* The name of this program, as taken from argv[0]. */
-char *progname;
-
-/* When non-zero, this global means the user is done using this program. */
-int done;
-
-char *
-dupstr (s)
- char *s;
-@{
- char *r;
-
- r = xmalloc (strlen (s) + 1);
- strcpy (r, s);
- return (r);
-@}
-
-main (argc, argv)
- int argc;
- char **argv;
-@{
- char *line, *s;
-
- progname = argv[0];
-
- initialize_readline (); /* Bind our completer. */
-
- /* Loop reading and executing lines until the user quits. */
- for ( ; done == 0; )
- @{
- line = readline ("FileMan: ");
-
- if (!line)
- break;
-
- /* Remove leading and trailing whitespace from the line.
- Then, if there is anything left, add it to the history list
- and execute it. */
- s = stripwhite (line);
-
- if (*s)
- @{
- add_history (s);
- execute_line (s);
- @}
-
- free (line);
- @}
- exit (0);
-@}
-
-/* Execute a command line. */
-int
-execute_line (line)
- char *line;
-@{
- register int i;
- COMMAND *command;
- char *word;
-
- /* Isolate the command word. */
- i = 0;
- while (line[i] && whitespace (line[i]))
- i++;
- word = line + i;
-
- while (line[i] && !whitespace (line[i]))
- i++;
-
- if (line[i])
- line[i++] = '\0';
-
- command = find_command (word);
-
- if (!command)
- @{
- fprintf (stderr, "%s: No such command for FileMan.\n", word);
- return (-1);
- @}
-
- /* Get argument to command, if any. */
- while (whitespace (line[i]))
- i++;
-
- word = line + i;
-
- /* Call the function. */
- return ((*(command->func)) (word));
-@}
-
-/* Look up NAME as the name of a command, and return a pointer to that
- command. Return a NULL pointer if NAME isn't a command name. */
-COMMAND *
-find_command (name)
- char *name;
-@{
- register int i;
-
- for (i = 0; commands[i].name; i++)
- if (strcmp (name, commands[i].name) == 0)
- return (&commands[i]);
-
- return ((COMMAND *)NULL);
-@}
-
-/* Strip whitespace from the start and end of STRING. Return a pointer
- into STRING. */
-char *
-stripwhite (string)
- char *string;
-@{
- register char *s, *t;
-
- for (s = string; whitespace (*s); s++)
- ;
-
- if (*s == 0)
- return (s);
-
- t = s + strlen (s) - 1;
- while (t > s && whitespace (*t))
- t--;
- *++t = '\0';
-
- return s;
-@}
-
-/* **************************************************************** */
-/* */
-/* Interface to Readline Completion */
-/* */
-/* **************************************************************** */
-
-char *command_generator PARAMS((const char *, int));
-char **fileman_completion PARAMS((const char *, int, int));
-
-/* Tell the GNU Readline library how to complete. We want to try to complete
- on command names if this is the first word in the line, or on filenames
- if not. */
-initialize_readline ()
-@{
- /* Allow conditional parsing of the ~/.inputrc file. */
- rl_readline_name = "FileMan";
-
- /* Tell the completer that we want a crack first. */
- rl_attempted_completion_function = fileman_completion;
-@}
-
-/* Attempt to complete on the contents of TEXT. START and END bound the
- region of rl_line_buffer that contains the word to complete. TEXT is
- the word to complete. We can use the entire contents of rl_line_buffer
- in case we want to do some simple parsing. Return the array of matches,
- or NULL if there aren't any. */
-char **
-fileman_completion (text, start, end)
- const char *text;
- int start, end;
-@{
- char **matches;
-
- matches = (char **)NULL;
-
- /* If this word is at the start of the line, then it is a command
- to complete. Otherwise it is the name of a file in the current
- directory. */
- if (start == 0)
- matches = rl_completion_matches (text, command_generator);
-
- return (matches);
-@}
-
-/* Generator function for command completion. STATE lets us know whether
- to start from scratch; without any state (i.e. STATE == 0), then we
- start at the top of the list. */
-char *
-command_generator (text, state)
- const char *text;
- int state;
-@{
- static int list_index, len;
- char *name;
-
- /* If this is a new word to complete, initialize now. This includes
- saving the length of TEXT for efficiency, and initializing the index
- variable to 0. */
- if (!state)
- @{
- list_index = 0;
- len = strlen (text);
- @}
-
- /* Return the next name which partially matches from the command list. */
- while (name = commands[list_index].name)
- @{
- list_index++;
-
- if (strncmp (name, text, len) == 0)
- return (dupstr(name));
- @}
-
- /* If no names matched, then return NULL. */
- return ((char *)NULL);
-@}
-
-/* **************************************************************** */
-/* */
-/* FileMan Commands */
-/* */
-/* **************************************************************** */
-
-/* String to pass to system (). This is for the LIST, VIEW and RENAME
- commands. */
-static char syscom[1024];
-
-/* List the file(s) named in arg. */
-com_list (arg)
- char *arg;
-@{
- if (!arg)
- arg = "";
-
- sprintf (syscom, "ls -FClg %s", arg);
- return (system (syscom));
-@}
-
-com_view (arg)
- char *arg;
-@{
- if (!valid_argument ("view", arg))
- return 1;
-
-#if defined (__MSDOS__)
- /* more.com doesn't grok slashes in pathnames */
- sprintf (syscom, "less %s", arg);
-#else
- sprintf (syscom, "more %s", arg);
-#endif
- return (system (syscom));
-@}
-
-com_rename (arg)
- char *arg;
-@{
- too_dangerous ("rename");
- return (1);
-@}
-
-com_stat (arg)
- char *arg;
-@{
- struct stat finfo;
-
- if (!valid_argument ("stat", arg))
- return (1);
-
- if (stat (arg, &finfo) == -1)
- @{
- perror (arg);
- return (1);
- @}
-
- printf ("Statistics for `%s':\n", arg);
-
- printf ("%s has %d link%s, and is %d byte%s in length.\n",
- arg,
- finfo.st_nlink,
- (finfo.st_nlink == 1) ? "" : "s",
- finfo.st_size,
- (finfo.st_size == 1) ? "" : "s");
- printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
- printf (" Last access at: %s", ctime (&finfo.st_atime));
- printf (" Last modified at: %s", ctime (&finfo.st_mtime));
- return (0);
-@}
-
-com_delete (arg)
- char *arg;
-@{
- too_dangerous ("delete");
- return (1);
-@}
-
-/* Print out help for ARG, or for all of the commands if ARG is
- not present. */
-com_help (arg)
- char *arg;
-@{
- register int i;
- int printed = 0;
-
- for (i = 0; commands[i].name; i++)
- @{
- if (!*arg || (strcmp (arg, commands[i].name) == 0))
- @{
- printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
- printed++;
- @}
- @}
-
- if (!printed)
- @{
- printf ("No commands match `%s'. Possibilties are:\n", arg);
-
- for (i = 0; commands[i].name; i++)
- @{
- /* Print in six columns. */
- if (printed == 6)
- @{
- printed = 0;
- printf ("\n");
- @}
-
- printf ("%s\t", commands[i].name);
- printed++;
- @}
-
- if (printed)
- printf ("\n");
- @}
- return (0);
-@}
-
-/* Change to the directory ARG. */
-com_cd (arg)
- char *arg;
-@{
- if (chdir (arg) == -1)
- @{
- perror (arg);
- return 1;
- @}
-
- com_pwd ("");
- return (0);
-@}
-
-/* Print out the current working directory. */
-com_pwd (ignore)
- char *ignore;
-@{
- char dir[1024], *s;
-
- s = getcwd (dir, sizeof(dir) - 1);
- if (s == 0)
- @{
- printf ("Error getting pwd: %s\n", dir);
- return 1;
- @}
-
- printf ("Current directory is %s\n", dir);
- return 0;
-@}
-
-/* The user wishes to quit using this program. Just set DONE non-zero. */
-com_quit (arg)
- char *arg;
-@{
- done = 1;
- return (0);
-@}
-
-/* Function which tells you that you can't do this. */
-too_dangerous (caller)
- char *caller;
-@{
- fprintf (stderr,
- "%s: Too dangerous for me to distribute. Write it yourself.\n",
- caller);
-@}
-
-/* Return non-zero if ARG is a valid argument for CALLER, else print
- an error message and return zero. */
-int
-valid_argument (caller, arg)
- char *caller, *arg;
-@{
- if (!arg || !*arg)
- @{
- fprintf (stderr, "%s: Argument required.\n", caller);
- return (0);
- @}
-
- return (1);
-@}
-@end smallexample
+++ /dev/null
-@ignore
-Copyright (C) 1988-2012 Free Software Foundation, Inc.
-@end ignore
-
-@set EDITION 6.2
-@set VERSION 6.2
-@set UPDATED 15 November 2012
-@set UPDATED-MONTH November 2012
-
-@set LASTCHANGE Thu Nov 15 21:03:04 EST 2012
+++ /dev/null
-:; ./shx
-
-sh:
-<&$fd ok
-nlbq Mon Aug 3 02:45:00 EDT 1992
-bang geoff
-quote 712824302
-setbq defmsgid=<1992Aug3.024502.6176@host>
-bgwait sleep done... wait 6187
-
-
-bash:
-<&$fd ok
-nlbq Mon Aug 3 02:45:09 EDT 1992
-bang geoff
-quote 712824311
-setbq defmsgid=<1992Aug3.024512.6212@host>
-bgwait sleep done... wait 6223
-
-
-ash:
-<&$fd shx1: 4: Syntax error: Bad fd number
-nlbq Mon Aug 3 02:45:19 EDT 1992
-bang geoff
-quote getdate: `"now"' not a valid date
-
-setbq defmsgid=<1992Aug3.` echo 024521
-bgwait sleep done... wait 6241
-
-
-ksh:
-<&$fd ok
-nlbq ./shx: 6248 Memory fault - core dumped
-bang geoff
-quote getdate: `"now"' not a valid date
-
-setbq defmsgid=<1992Aug3.024530.6257@host>
-bgwait no such job: 6265
-wait 6265
-sleep done...
-
-zsh:
-<&$fd ok
-nlbq Mon Aug 3 02:45:36 EDT 1992
-bang shx3: event not found: /s/ [4]
-quote 712824337
-setbq defmsgid=<..6290@host>
-bgwait shx7: unmatched " [9]
-sleep done...
-:;
+++ /dev/null
-#! /bin/sh
-for cmd in sh bash ash ksh zsh
-do
- echo
- echo $cmd:
- for demo in shx?
- do
- $cmd $demo
- done
-done
+++ /dev/null
-/* trap.c -- Not the trap command, but useful functions for manipulating
- those objects. The trap command is in builtins/trap.def. */
-
-/* Copyright (C) 1987-2013 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "config.h"
-
-#if defined (HAVE_UNISTD_H)
-# include <unistd.h>
-#endif
-
-#include "bashtypes.h"
-#include "bashansi.h"
-
-#include <stdio.h>
-#include <errno.h>
-
-#include "bashintl.h"
-
-#include <signal.h>
-
-#include "trap.h"
-
-#include "shell.h"
-#include "flags.h"
-#include "input.h" /* for save_token_state, restore_token_state */
-#include "jobs.h"
-#include "signames.h"
-#include "builtins.h"
-#include "builtins/common.h"
-#include "builtins/builtext.h"
-
-#if defined (READLINE)
-# include <readline/readline.h>
-# include "bashline.h"
-#endif
-
-#ifndef errno
-extern int errno;
-#endif
-
-/* Flags which describe the current handling state of a signal. */
-#define SIG_INHERITED 0x0 /* Value inherited from parent. */
-#define SIG_TRAPPED 0x1 /* Currently trapped. */
-#define SIG_HARD_IGNORE 0x2 /* Signal was ignored on shell entry. */
-#define SIG_SPECIAL 0x4 /* Treat this signal specially. */
-#define SIG_NO_TRAP 0x8 /* Signal cannot be trapped. */
-#define SIG_INPROGRESS 0x10 /* Signal handler currently executing. */
-#define SIG_CHANGED 0x20 /* Trap value changed in trap handler. */
-#define SIG_IGNORED 0x40 /* The signal is currently being ignored. */
-
-#define SPECIAL_TRAP(s) ((s) == EXIT_TRAP || (s) == DEBUG_TRAP || (s) == ERROR_TRAP || (s) == RETURN_TRAP)
-
-/* An array of such flags, one for each signal, describing what the
- shell will do with a signal. DEBUG_TRAP == NSIG; some code below
- assumes this. */
-static int sigmodes[BASH_NSIG];
-
-static void free_trap_command __P((int));
-static void change_signal __P((int, char *));
-
-static int _run_trap_internal __P((int, char *));
-
-static void free_trap_string __P((int));
-static void reset_signal __P((int));
-static void restore_signal __P((int));
-static void reset_or_restore_signal_handlers __P((sh_resetsig_func_t *));
-
-/* Variables used here but defined in other files. */
-extern int last_command_exit_value;
-extern int line_number;
-
-extern int sigalrm_seen;
-extern procenv_t alrmbuf;
-
-extern char *this_command_name;
-extern sh_builtin_func_t *this_shell_builtin;
-extern procenv_t wait_intr_buf;
-extern int return_catch_flag, return_catch_value;
-extern int subshell_level;
-extern WORD_LIST *subst_assign_varlist;
-
-/* The list of things to do originally, before we started trapping. */
-SigHandler *original_signals[NSIG];
-
-/* For each signal, a slot for a string, which is a command to be
- executed when that signal is recieved. The slot can also contain
- DEFAULT_SIG, which means do whatever you were going to do before
- you were so rudely interrupted, or IGNORE_SIG, which says ignore
- this signal. */
-char *trap_list[BASH_NSIG];
-
-/* A bitmap of signals received for which we have trap handlers. */
-int pending_traps[NSIG];
-
-/* Set to the number of the signal we're running the trap for + 1.
- Used in execute_cmd.c and builtins/common.c to clean up when
- parse_and_execute does not return normally after executing the
- trap command (e.g., when `return' is executed in the trap command). */
-int running_trap;
-
-/* Set to last_command_exit_value before running a trap. */
-int trap_saved_exit_value;
-
-/* The (trapped) signal received while executing in the `wait' builtin */
-int wait_signal_received;
-
-int trapped_signal_received;
-
-#define GETORIGSIG(sig) \
- do { \
- original_signals[sig] = (SigHandler *)set_signal_handler (sig, SIG_DFL); \
- set_signal_handler (sig, original_signals[sig]); \
- if (original_signals[sig] == SIG_IGN) \
- sigmodes[sig] |= SIG_HARD_IGNORE; \
- } while (0)
-
-#define SETORIGSIG(sig,handler) \
- do { \
- original_signals[sig] = handler; \
- if (original_signals[sig] == SIG_IGN) \
- sigmodes[sig] |= SIG_HARD_IGNORE; \
- } while (0)
-
-#define GET_ORIGINAL_SIGNAL(sig) \
- if (sig && sig < NSIG && original_signals[sig] == IMPOSSIBLE_TRAP_HANDLER) \
- GETORIGSIG(sig)
-
-void
-initialize_traps ()
-{
- register int i;
-
- initialize_signames();
-
- trap_list[EXIT_TRAP] = trap_list[DEBUG_TRAP] = trap_list[ERROR_TRAP] = trap_list[RETURN_TRAP] = (char *)NULL;
- sigmodes[EXIT_TRAP] = sigmodes[DEBUG_TRAP] = sigmodes[ERROR_TRAP] = sigmodes[RETURN_TRAP] = SIG_INHERITED;
- original_signals[EXIT_TRAP] = IMPOSSIBLE_TRAP_HANDLER;
-
- for (i = 1; i < NSIG; i++)
- {
- pending_traps[i] = 0;
- trap_list[i] = (char *)DEFAULT_SIG;
- sigmodes[i] = SIG_INHERITED; /* XXX - only set, not used */
- original_signals[i] = IMPOSSIBLE_TRAP_HANDLER;
- }
-
- /* Show which signals are treated specially by the shell. */
-#if defined (SIGCHLD)
- GETORIGSIG (SIGCHLD);
- sigmodes[SIGCHLD] |= (SIG_SPECIAL | SIG_NO_TRAP);
-#endif /* SIGCHLD */
-
- GETORIGSIG (SIGINT);
- sigmodes[SIGINT] |= SIG_SPECIAL;
-
-#if defined (__BEOS__)
- /* BeOS sets SIGINT to SIG_IGN! */
- original_signals[SIGINT] = SIG_DFL;
- sigmodes[SIGINT] &= ~SIG_HARD_IGNORE;
-#endif
-
- GETORIGSIG (SIGQUIT);
- sigmodes[SIGQUIT] |= SIG_SPECIAL;
-
- if (interactive)
- {
- GETORIGSIG (SIGTERM);
- sigmodes[SIGTERM] |= SIG_SPECIAL;
- }
-}
-
-#ifdef DEBUG
-/* Return a printable representation of the trap handler for SIG. */
-static char *
-trap_handler_string (sig)
- int sig;
-{
- if (trap_list[sig] == (char *)DEFAULT_SIG)
- return "DEFAULT_SIG";
- else if (trap_list[sig] == (char *)IGNORE_SIG)
- return "IGNORE_SIG";
- else if (trap_list[sig] == (char *)IMPOSSIBLE_TRAP_HANDLER)
- return "IMPOSSIBLE_TRAP_HANDLER";
- else if (trap_list[sig])
- return trap_list[sig];
- else
- return "NULL";
-}
-#endif
-
-/* Return the print name of this signal. */
-char *
-signal_name (sig)
- int sig;
-{
- char *ret;
-
- /* on cygwin32, signal_names[sig] could be null */
- ret = (sig >= BASH_NSIG || sig < 0 || signal_names[sig] == NULL)
- ? _("invalid signal number")
- : signal_names[sig];
-
- return ret;
-}
-
-/* Turn a string into a signal number, or a number into
- a signal number. If STRING is "2", "SIGINT", or "INT",
- then (int)2 is returned. Return NO_SIG if STRING doesn't
- contain a valid signal descriptor. */
-int
-decode_signal (string, flags)
- char *string;
- int flags;
-{
- intmax_t sig;
- char *name;
-
- if (legal_number (string, &sig))
- return ((sig >= 0 && sig < NSIG) ? (int)sig : NO_SIG);
-
- /* A leading `SIG' may be omitted. */
- for (sig = 0; sig < BASH_NSIG; sig++)
- {
- name = signal_names[sig];
- if (name == 0 || name[0] == '\0')
- continue;
-
- /* Check name without the SIG prefix first case sensitivly or
- insensitively depending on whether flags includes DSIG_NOCASE */
- if (STREQN (name, "SIG", 3))
- {
- name += 3;
-
- if ((flags & DSIG_NOCASE) && strcasecmp (string, name) == 0)
- return ((int)sig);
- else if ((flags & DSIG_NOCASE) == 0 && strcmp (string, name) == 0)
- return ((int)sig);
- /* If we can't use the `SIG' prefix to match, punt on this
- name now. */
- else if ((flags & DSIG_SIGPREFIX) == 0)
- continue;
- }
-
- /* Check name with SIG prefix case sensitively or insensitively
- depending on whether flags includes DSIG_NOCASE */
- name = signal_names[sig];
- if ((flags & DSIG_NOCASE) && strcasecmp (string, name) == 0)
- return ((int)sig);
- else if ((flags & DSIG_NOCASE) == 0 && strcmp (string, name) == 0)
- return ((int)sig);
- }
-
- return (NO_SIG);
-}
-
-/* Non-zero when we catch a trapped signal. */
-static int catch_flag;
-
-void
-run_pending_traps ()
-{
- register int sig;
- int old_exit_value, *token_state;
- WORD_LIST *save_subst_varlist;
-#if defined (ARRAY_VARS)
- ARRAY *ps;
-#endif
-
- if (catch_flag == 0) /* simple optimization */
- return;
-
- if (running_trap > 0)
- return; /* no recursive trap invocations */
-
- catch_flag = trapped_signal_received = 0;
-
- /* Preserve $? when running trap. */
- old_exit_value = last_command_exit_value;
-#if defined (ARRAY_VARS)
- ps = save_pipestatus_array ();
-#endif
-
- for (sig = 1; sig < NSIG; sig++)
- {
- /* XXX this could be made into a counter by using
- while (pending_traps[sig]--) instead of the if statement. */
- if (pending_traps[sig])
- {
- sigset_t set, oset;
-
- BLOCK_SIGNAL (sig, set, oset);
-
- running_trap = sig + 1;
-
- if (sig == SIGINT)
- {
- run_interrupt_trap ();
- CLRINTERRUPT;
- }
-#if defined (JOB_CONTROL) && defined (SIGCHLD)
- else if (sig == SIGCHLD &&
- trap_list[SIGCHLD] != (char *)IMPOSSIBLE_TRAP_HANDLER &&
- (sigmodes[SIGCHLD] & SIG_INPROGRESS) == 0)
- {
- sigmodes[SIGCHLD] |= SIG_INPROGRESS;
- run_sigchld_trap (pending_traps[sig]); /* use as counter */
- sigmodes[SIGCHLD] &= ~SIG_INPROGRESS;
- }
- else if (sig == SIGCHLD &&
- trap_list[SIGCHLD] == (char *)IMPOSSIBLE_TRAP_HANDLER &&
- (sigmodes[SIGCHLD] & SIG_INPROGRESS) != 0)
- {
- /* This can happen when run_pending_traps is called while
- running a SIGCHLD trap handler. */
- running_trap = 0;
- UNBLOCK_SIGNAL (oset);
- continue; /* XXX */
- }
-#endif
- else if (trap_list[sig] == (char *)DEFAULT_SIG ||
- trap_list[sig] == (char *)IGNORE_SIG ||
- trap_list[sig] == (char *)IMPOSSIBLE_TRAP_HANDLER)
- {
- /* This is possible due to a race condition. Say a bash
- process has SIGTERM trapped. A subshell is spawned
- using { list; } & and the parent does something and kills
- the subshell with SIGTERM. It's possible for the subshell
- to set pending_traps[SIGTERM] to 1 before the code in
- execute_cmd.c eventually calls restore_original_signals
- to reset the SIGTERM signal handler in the subshell. The
- next time run_pending_traps is called, pending_traps[SIGTERM]
- will be 1, but the trap handler in trap_list[SIGTERM] will
- be invalid (probably DEFAULT_SIG, but it could be IGNORE_SIG).
- Unless we catch this, the subshell will dump core when
- trap_list[SIGTERM] == DEFAULT_SIG, because DEFAULT_SIG is
- usually 0x0. */
- internal_warning (_("run_pending_traps: bad value in trap_list[%d]: %p"),
- sig, trap_list[sig]);
- if (trap_list[sig] == (char *)DEFAULT_SIG)
- {
- internal_warning (_("run_pending_traps: signal handler is SIG_DFL, resending %d (%s) to myself"), sig, signal_name (sig));
- kill (getpid (), sig);
- }
- }
- else
- {
- token_state = save_token_state ();
- save_subst_varlist = subst_assign_varlist;
- subst_assign_varlist = 0;
-
-#if defined (JOB_CONTROL)
- save_pipeline (1); /* XXX only provides one save level */
-#endif
- evalstring (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
-#if defined (JOB_CONTROL)
- restore_pipeline (1);
-#endif
-
- restore_token_state (token_state);
- free (token_state);
-
- subst_assign_varlist = save_subst_varlist;
- }
-
- pending_traps[sig] = 0;
- running_trap = 0;
-
- UNBLOCK_SIGNAL (oset);
- }
- }
-
-#if defined (ARRAY_VARS)
- restore_pipestatus_array (ps);
-#endif
- last_command_exit_value = old_exit_value;
-}
-
-sighandler
-trap_handler (sig)
- int sig;
-{
- int oerrno;
-
- if ((sigmodes[sig] & SIG_TRAPPED) == 0)
- {
-#if defined (DEBUG)
- internal_warning ("trap_handler: signal %d: signal not trapped", sig);
-#endif
- SIGRETURN (0);
- }
-
- if ((sig >= NSIG) ||
- (trap_list[sig] == (char *)DEFAULT_SIG) ||
- (trap_list[sig] == (char *)IGNORE_SIG))
- programming_error (_("trap_handler: bad signal %d"), sig);
- else
- {
- oerrno = errno;
-#if defined (MUST_REINSTALL_SIGHANDLERS)
-# if defined (JOB_CONTROL) && defined (SIGCHLD)
- if (sig != SIGCHLD)
-# endif /* JOB_CONTROL && SIGCHLD */
- set_signal_handler (sig, trap_handler);
-#endif /* MUST_REINSTALL_SIGHANDLERS */
-
- catch_flag = 1;
- pending_traps[sig]++;
-
- trapped_signal_received = sig;
-
- if (this_shell_builtin && (this_shell_builtin == wait_builtin))
- {
- wait_signal_received = sig;
- if (interrupt_immediately)
- longjmp (wait_intr_buf, 1);
- }
-
-#if defined (READLINE)
- /* Set the event hook so readline will call it after the signal handlers
- finish executing, so if this interrupted character input we can get
- quick response. */
- if (RL_ISSTATE (RL_STATE_SIGHANDLER) && interrupt_immediately == 0)
- bashline_set_event_hook ();
-#endif
-
- if (interrupt_immediately)
- run_pending_traps ();
-
- errno = oerrno;
- }
-
- SIGRETURN (0);
-}
-
-int
-first_pending_trap ()
-{
- register int i;
-
- for (i = 1; i < NSIG; i++)
- if (pending_traps[i])
- return i;
- return -1;
-}
-
-int
-any_signals_trapped ()
-{
- register int i;
-
- for (i = 1; i < NSIG; i++)
- if (sigmodes[i] & SIG_TRAPPED)
- return i;
- return -1;
-}
-
-void
-check_signals ()
-{
- CHECK_ALRM; /* set by the read builtin */
- QUIT;
-}
-
-/* Convenience functions the rest of the shell can use */
-void
-check_signals_and_traps ()
-{
- check_signals ();
-
- run_pending_traps ();
-}
-
-#if defined (JOB_CONTROL) && defined (SIGCHLD)
-
-#ifdef INCLUDE_UNUSED
-/* Make COMMAND_STRING be executed when SIGCHLD is caught. */
-void
-set_sigchld_trap (command_string)
- char *command_string;
-{
- set_signal (SIGCHLD, command_string);
-}
-#endif
-
-/* Make COMMAND_STRING be executed when SIGCHLD is caught iff SIGCHLD
- is not already trapped. IMPOSSIBLE_TRAP_HANDLER is used as a sentinel
- to make sure that a SIGCHLD trap handler run via run_sigchld_trap can
- reset the disposition to the default and not have the original signal
- accidentally restored, undoing the user's command. */
-void
-maybe_set_sigchld_trap (command_string)
- char *command_string;
-{
- if ((sigmodes[SIGCHLD] & SIG_TRAPPED) == 0 && trap_list[SIGCHLD] == (char *)IMPOSSIBLE_TRAP_HANDLER)
- set_signal (SIGCHLD, command_string);
-}
-
-/* Temporarily set the SIGCHLD trap string to IMPOSSIBLE_TRAP_HANDLER. Used
- as a sentinel in run_sigchld_trap and maybe_set_sigchld_trap to see whether
- or not a SIGCHLD trap handler reset SIGCHLD disposition to the default. */
-void
-set_impossible_sigchld_trap ()
-{
- restore_default_signal (SIGCHLD);
- change_signal (SIGCHLD, (char *)IMPOSSIBLE_TRAP_HANDLER);
- sigmodes[SIGCHLD] &= ~SIG_TRAPPED; /* maybe_set_sigchld_trap checks this */
-}
-
-/* Act as if we received SIGCHLD NCHILD times and increment
- pending_traps[SIGCHLD] by that amount. This allows us to still run the
- SIGCHLD trap once for each exited child. */
-void
-queue_sigchld_trap (nchild)
- int nchild;
-{
- if (nchild > 0)
- {
- catch_flag = 1;
- pending_traps[SIGCHLD] += nchild;
- trapped_signal_received = SIGCHLD;
- }
-}
-#endif /* JOB_CONTROL && SIGCHLD */
-
-void
-set_debug_trap (command)
- char *command;
-{
- set_signal (DEBUG_TRAP, command);
-}
-
-void
-set_error_trap (command)
- char *command;
-{
- set_signal (ERROR_TRAP, command);
-}
-
-void
-set_return_trap (command)
- char *command;
-{
- set_signal (RETURN_TRAP, command);
-}
-
-#ifdef INCLUDE_UNUSED
-void
-set_sigint_trap (command)
- char *command;
-{
- set_signal (SIGINT, command);
-}
-#endif
-
-/* Reset the SIGINT handler so that subshells that are doing `shellsy'
- things, like waiting for command substitution or executing commands
- in explicit subshells ( ( cmd ) ), can catch interrupts properly. */
-SigHandler *
-set_sigint_handler ()
-{
- if (sigmodes[SIGINT] & SIG_HARD_IGNORE)
- return ((SigHandler *)SIG_IGN);
-
- else if (sigmodes[SIGINT] & SIG_IGNORED)
- return ((SigHandler *)set_signal_handler (SIGINT, SIG_IGN)); /* XXX */
-
- else if (sigmodes[SIGINT] & SIG_TRAPPED)
- return ((SigHandler *)set_signal_handler (SIGINT, trap_handler));
-
- /* The signal is not trapped, so set the handler to the shell's special
- interrupt handler. */
- else if (interactive) /* XXX - was interactive_shell */
- return (set_signal_handler (SIGINT, sigint_sighandler));
- else
- return (set_signal_handler (SIGINT, termsig_sighandler));
-}
-
-/* Return the correct handler for signal SIG according to the values in
- sigmodes[SIG]. */
-SigHandler *
-trap_to_sighandler (sig)
- int sig;
-{
- if (sigmodes[sig] & (SIG_IGNORED|SIG_HARD_IGNORE))
- return (SIG_IGN);
- else if (sigmodes[sig] & SIG_TRAPPED)
- return (trap_handler);
- else
- return (SIG_DFL);
-}
-
-/* Set SIG to call STRING as a command. */
-void
-set_signal (sig, string)
- int sig;
- char *string;
-{
- sigset_t set, oset;
-
- if (SPECIAL_TRAP (sig))
- {
- change_signal (sig, savestring (string));
- if (sig == EXIT_TRAP && interactive == 0)
- initialize_terminating_signals ();
- return;
- }
-
- /* A signal ignored on entry to the shell cannot be trapped or reset, but
- no error is reported when attempting to do so. -- Posix.2 */
- if (sigmodes[sig] & SIG_HARD_IGNORE)
- return;
-
- /* Make sure we have original_signals[sig] if the signal has not yet
- been trapped. */
- if ((sigmodes[sig] & SIG_TRAPPED) == 0)
- {
- /* If we aren't sure of the original value, check it. */
- if (original_signals[sig] == IMPOSSIBLE_TRAP_HANDLER)
- GETORIGSIG (sig);
- if (original_signals[sig] == SIG_IGN)
- return;
- }
-
- /* Only change the system signal handler if SIG_NO_TRAP is not set.
- The trap command string is changed in either case. The shell signal
- handlers for SIGINT and SIGCHLD run the user specified traps in an
- environment in which it is safe to do so. */
- if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
- {
- BLOCK_SIGNAL (sig, set, oset);
- change_signal (sig, savestring (string));
- set_signal_handler (sig, trap_handler);
- UNBLOCK_SIGNAL (oset);
- }
- else
- change_signal (sig, savestring (string));
-}
-
-static void
-free_trap_command (sig)
- int sig;
-{
- if ((sigmodes[sig] & SIG_TRAPPED) && trap_list[sig] &&
- (trap_list[sig] != (char *)IGNORE_SIG) &&
- (trap_list[sig] != (char *)DEFAULT_SIG) &&
- (trap_list[sig] != (char *)IMPOSSIBLE_TRAP_HANDLER))
- free (trap_list[sig]);
-}
-
-/* If SIG has a string assigned to it, get rid of it. Then give it
- VALUE. */
-static void
-change_signal (sig, value)
- int sig;
- char *value;
-{
- if ((sigmodes[sig] & SIG_INP<ROGRESS) == 0)
- free_trap_command (sig);
- trap_list[sig] = value;
-
- sigmodes[sig] |= SIG_TRAPPED;
- if (value == (char *)IGNORE_SIG)
- sigmodes[sig] |= SIG_IGNORED;
- else
- sigmodes[sig] &= ~SIG_IGNORED;
- if (sigmodes[sig] & SIG_INPROGRESS)
- sigmodes[sig] |= SIG_CHANGED;
-}
-
-void
-get_original_signal (sig)
- int sig;
-{
- /* If we aren't sure the of the original value, then get it. */
- if (sig > 0 && sig < NSIG && original_signals[sig] == (SigHandler *)IMPOSSIBLE_TRAP_HANDLER)
- GETORIGSIG (sig);
-}
-
-void
-get_all_original_signals ()
-{
- register int i;
-
- for (i = 1; i < NSIG; i++)
- GET_ORIGINAL_SIGNAL (i);
-}
-
-void
-set_original_signal (sig, handler)
- int sig;
- SigHandler *handler;
-{
- if (sig > 0 && sig < NSIG && original_signals[sig] == (SigHandler *)IMPOSSIBLE_TRAP_HANDLER)
- SETORIGSIG (sig, handler);
-}
-
-/* Restore the default action for SIG; i.e., the action the shell
- would have taken before you used the trap command. This is called
- from trap_builtin (), which takes care to restore the handlers for
- the signals the shell treats specially. */
-void
-restore_default_signal (sig)
- int sig;
-{
- if (SPECIAL_TRAP (sig))
- {
- if ((sig != DEBUG_TRAP && sig != ERROR_TRAP && sig != RETURN_TRAP) ||
- (sigmodes[sig] & SIG_INPROGRESS) == 0)
- free_trap_command (sig);
- trap_list[sig] = (char *)NULL;
- sigmodes[sig] &= ~SIG_TRAPPED;
- if (sigmodes[sig] & SIG_INPROGRESS)
- sigmodes[sig] |= SIG_CHANGED;
- return;
- }
-
- GET_ORIGINAL_SIGNAL (sig);
-
- /* A signal ignored on entry to the shell cannot be trapped or reset, but
- no error is reported when attempting to do so. Thanks Posix.2. */
- if (sigmodes[sig] & SIG_HARD_IGNORE)
- return;
-
- /* If we aren't trapping this signal, don't bother doing anything else. */
- if ((sigmodes[sig] & SIG_TRAPPED) == 0)
- return;
-
- /* Only change the signal handler for SIG if it allows it. */
- if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
- set_signal_handler (sig, original_signals[sig]);
-
- /* Change the trap command in either case. */
- change_signal (sig, (char *)DEFAULT_SIG);
-
- /* Mark the signal as no longer trapped. */
- sigmodes[sig] &= ~SIG_TRAPPED;
-}
-
-/* Make this signal be ignored. */
-void
-ignore_signal (sig)
- int sig;
-{
- if (SPECIAL_TRAP (sig) && ((sigmodes[sig] & SIG_IGNORED) == 0))
- {
- change_signal (sig, (char *)IGNORE_SIG);
- return;
- }
-
- GET_ORIGINAL_SIGNAL (sig);
-
- /* A signal ignored on entry to the shell cannot be trapped or reset.
- No error is reported when the user attempts to do so. */
- if (sigmodes[sig] & SIG_HARD_IGNORE)
- return;
-
- /* If already trapped and ignored, no change necessary. */
- if (sigmodes[sig] & SIG_IGNORED)
- return;
-
- /* Only change the signal handler for SIG if it allows it. */
- if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
- set_signal_handler (sig, SIG_IGN);
-
- /* Change the trap command in either case. */
- change_signal (sig, (char *)IGNORE_SIG);
-}
-
-/* Handle the calling of "trap 0". The only sticky situation is when
- the command to be executed includes an "exit". This is why we have
- to provide our own place for top_level to jump to. */
-int
-run_exit_trap ()
-{
- char *trap_command;
- int code, function_code, retval;
-#if defined (ARRAY_VARS)
- ARRAY *ps;
-#endif
-
- trap_saved_exit_value = last_command_exit_value;
-#if defined (ARRAY_VARS)
- ps = save_pipestatus_array ();
-#endif
- function_code = 0;
-
- /* Run the trap only if signal 0 is trapped and not ignored, and we are not
- currently running in the trap handler (call to exit in the list of
- commands given to trap 0). */
- if ((sigmodes[EXIT_TRAP] & SIG_TRAPPED) &&
- (sigmodes[EXIT_TRAP] & (SIG_IGNORED|SIG_INPROGRESS)) == 0)
- {
- trap_command = savestring (trap_list[EXIT_TRAP]);
- sigmodes[EXIT_TRAP] &= ~SIG_TRAPPED;
- sigmodes[EXIT_TRAP] |= SIG_INPROGRESS;
-
- retval = trap_saved_exit_value;
- running_trap = 1;
-
- code = setjmp_nosigs (top_level);
-
- /* If we're in a function, make sure return longjmps come here, too. */
- if (return_catch_flag)
- function_code = setjmp_nosigs (return_catch);
-
- if (code == 0 && function_code == 0)
- {
- reset_parser ();
- parse_and_execute (trap_command, "exit trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
- }
- else if (code == ERREXIT)
- retval = last_command_exit_value;
- else if (code == EXITPROG)
- retval = last_command_exit_value;
- else if (function_code != 0)
- retval = return_catch_value;
- else
- retval = trap_saved_exit_value;
-
- running_trap = 0;
- return retval;
- }
-
-#if defined (ARRAY_VARS)
- restore_pipestatus_array (ps);
-#endif
- return (trap_saved_exit_value);
-}
-
-void
-run_trap_cleanup (sig)
- int sig;
-{
- sigmodes[sig] &= ~(SIG_INPROGRESS|SIG_CHANGED);
-}
-
-/* Run a trap command for SIG. SIG is one of the signals the shell treats
- specially. Returns the exit status of the executed trap command list. */
-static int
-_run_trap_internal (sig, tag)
- int sig;
- char *tag;
-{
- char *trap_command, *old_trap;
- int trap_exit_value, *token_state;
- volatile int save_return_catch_flag, function_code;
- int flags;
- procenv_t save_return_catch;
- WORD_LIST *save_subst_varlist;
-#if defined (ARRAY_VARS)
- ARRAY *ps;
-#endif
-
- trap_exit_value = function_code = 0;
- /* Run the trap only if SIG is trapped and not ignored, and we are not
- currently executing in the trap handler. */
- if ((sigmodes[sig] & SIG_TRAPPED) && ((sigmodes[sig] & SIG_IGNORED) == 0) &&
- (trap_list[sig] != (char *)IMPOSSIBLE_TRAP_HANDLER) &&
- ((sigmodes[sig] & SIG_INPROGRESS) == 0))
- {
- old_trap = trap_list[sig];
- sigmodes[sig] |= SIG_INPROGRESS;
- sigmodes[sig] &= ~SIG_CHANGED; /* just to be sure */
- trap_command = savestring (old_trap);
-
- running_trap = sig + 1;
- trap_saved_exit_value = last_command_exit_value;
-#if defined (ARRAY_VARS)
- ps = save_pipestatus_array ();
-#endif
-
- token_state = save_token_state ();
- save_subst_varlist = subst_assign_varlist;
- subst_assign_varlist = 0;
-
- /* If we're in a function, make sure return longjmps come here, too. */
- save_return_catch_flag = return_catch_flag;
- if (return_catch_flag)
- {
- COPY_PROCENV (return_catch, save_return_catch);
- function_code = setjmp_nosigs (return_catch);
- }
-
- flags = SEVAL_NONINT|SEVAL_NOHIST;
- if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP)
- flags |= SEVAL_RESETLINE;
- if (function_code == 0)
- parse_and_execute (trap_command, tag, flags);
-
- restore_token_state (token_state);
- free (token_state);
-
- subst_assign_varlist = save_subst_varlist;
-
- trap_exit_value = last_command_exit_value;
- last_command_exit_value = trap_saved_exit_value;
-#if defined (ARRAY_VARS)
- restore_pipestatus_array (ps);
-#endif
- running_trap = 0;
-
- sigmodes[sig] &= ~SIG_INPROGRESS;
-
- if (sigmodes[sig] & SIG_CHANGED)
- {
-#if 0
- /* Special traps like EXIT, DEBUG, RETURN are handled explicitly in
- the places where they can be changed using unwind-protects. For
- example, look at execute_cmd.c:execute_function(). */
- if (SPECIAL_TRAP (sig) == 0)
-#endif
- free (old_trap);
- sigmodes[sig] &= ~SIG_CHANGED;
- }
-
- if (save_return_catch_flag)
- {
- return_catch_flag = save_return_catch_flag;
- return_catch_value = trap_exit_value;
- COPY_PROCENV (save_return_catch, return_catch);
- if (function_code)
- longjmp (return_catch, 1);
- }
- }
-
- return trap_exit_value;
-}
-
-int
-run_debug_trap ()
-{
- int trap_exit_value;
- pid_t save_pgrp;
- int save_pipe[2];
-
- /* XXX - question: should the DEBUG trap inherit the RETURN trap? */
- trap_exit_value = 0;
- if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0))
- {
-#if defined (JOB_CONTROL)
- save_pgrp = pipeline_pgrp;
- pipeline_pgrp = 0;
- save_pipeline (1);
-# if defined (PGRP_PIPE)
- save_pgrp_pipe (save_pipe, 1);
-# endif
- stop_making_children ();
-#endif
-
- trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap");
-
-#if defined (JOB_CONTROL)
- pipeline_pgrp = save_pgrp;
- restore_pipeline (1);
-# if defined (PGRP_PIPE)
- close_pgrp_pipe ();
- restore_pgrp_pipe (save_pipe);
-# endif
- if (pipeline_pgrp > 0)
- give_terminal_to (pipeline_pgrp, 1);
- notify_and_cleanup ();
-#endif
-
-#if defined (DEBUGGER)
- /* If we're in the debugger and the DEBUG trap returns 2 while we're in
- a function or sourced script, we force a `return'. */
- if (debugging_mode && trap_exit_value == 2 && return_catch_flag)
- {
- return_catch_value = trap_exit_value;
- longjmp (return_catch, 1);
- }
-#endif
- }
- return trap_exit_value;
-}
-
-void
-run_error_trap ()
-{
- if ((sigmodes[ERROR_TRAP] & SIG_TRAPPED) && ((sigmodes[ERROR_TRAP] & SIG_IGNORED) == 0) && (sigmodes[ERROR_TRAP] & SIG_INPROGRESS) == 0)
- _run_trap_internal (ERROR_TRAP, "error trap");
-}
-
-void
-run_return_trap ()
-{
- int old_exit_value;
-
-#if 0
- if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && (sigmodes[DEBUG_TRAP] & SIG_INPROGRESS))
- return;
-#endif
-
- if ((sigmodes[RETURN_TRAP] & SIG_TRAPPED) && ((sigmodes[RETURN_TRAP] & SIG_IGNORED) == 0) && (sigmodes[RETURN_TRAP] & SIG_INPROGRESS) == 0)
- {
- old_exit_value = last_command_exit_value;
- _run_trap_internal (RETURN_TRAP, "return trap");
- last_command_exit_value = old_exit_value;
- }
-}
-
-/* Run a trap set on SIGINT. This is called from throw_to_top_level (), and
- declared here to localize the trap functions. */
-void
-run_interrupt_trap ()
-{
- _run_trap_internal (SIGINT, "interrupt trap");
-}
-
-/* Free all the allocated strings in the list of traps and reset the trap
- values to the default. Intended to be called from subshells that want
- to complete work done by reset_signal_handlers upon execution of a
- subsequent `trap' command that changes a signal's disposition. We need
- to make sure that we duplicate the behavior of
- reset_or_restore_signal_handlers and not change the disposition of signals
- that are set to be ignored. */
-void
-free_trap_strings ()
-{
- register int i;
-
- for (i = 0; i < BASH_NSIG; i++)
- {
- if (trap_list[i] != (char *)IGNORE_SIG)
- free_trap_string (i);
- }
- trap_list[DEBUG_TRAP] = trap_list[EXIT_TRAP] = trap_list[ERROR_TRAP] = trap_list[RETURN_TRAP] = (char *)NULL;
-}
-
-/* Free a trap command string associated with SIG without changing signal
- disposition. Intended to be called from free_trap_strings() */
-static void
-free_trap_string (sig)
- int sig;
-{
- change_signal (sig, (char *)DEFAULT_SIG);
- sigmodes[sig] &= ~SIG_TRAPPED;
-}
-
-/* Reset the handler for SIG to the original value but leave the trap string
- in place. */
-static void
-reset_signal (sig)
- int sig;
-{
- set_signal_handler (sig, original_signals[sig]);
- sigmodes[sig] &= ~SIG_TRAPPED;
-}
-
-/* Set the handler signal SIG to the original and free any trap
- command associated with it. */
-static void
-restore_signal (sig)
- int sig;
-{
- set_signal_handler (sig, original_signals[sig]);
- change_signal (sig, (char *)DEFAULT_SIG);
- sigmodes[sig] &= ~SIG_TRAPPED;
-}
-
-static void
-reset_or_restore_signal_handlers (reset)
- sh_resetsig_func_t *reset;
-{
- register int i;
-
- /* Take care of the exit trap first */
- if (sigmodes[EXIT_TRAP] & SIG_TRAPPED)
- {
- sigmodes[EXIT_TRAP] &= ~SIG_TRAPPED;
- if (reset != reset_signal)
- {
- free_trap_command (EXIT_TRAP);
- trap_list[EXIT_TRAP] = (char *)NULL;
- }
- }
-
- for (i = 1; i < NSIG; i++)
- {
- if (sigmodes[i] & SIG_TRAPPED)
- {
- if (trap_list[i] == (char *)IGNORE_SIG)
- set_signal_handler (i, SIG_IGN);
- else
- (*reset) (i);
- }
- else if (sigmodes[i] & SIG_SPECIAL)
- (*reset) (i);
- }
-
- /* Command substitution and other child processes don't inherit the
- debug, error, or return traps. If we're in the debugger, and the
- `functrace' or `errtrace' options have been set, then let command
- substitutions inherit them. Let command substitution inherit the
- RETURN trap if we're in the debugger and tracing functions. */
- if (function_trace_mode == 0)
- {
- sigmodes[DEBUG_TRAP] &= ~SIG_TRAPPED;
- sigmodes[RETURN_TRAP] &= ~SIG_TRAPPED;
- }
- if (error_trace_mode == 0)
- sigmodes[ERROR_TRAP] &= ~SIG_TRAPPED;
-}
-
-/* Reset trapped signals to their original values, but don't free the
- trap strings. Called by the command substitution code and other places
- that create a "subshell environment". */
-void
-reset_signal_handlers ()
-{
- reset_or_restore_signal_handlers (reset_signal);
-}
-
-/* Reset all trapped signals to their original values. Signals set to be
- ignored with trap '' SIGNAL should be ignored, so we make sure that they
- are. Called by child processes after they are forked. */
-void
-restore_original_signals ()
-{
- reset_or_restore_signal_handlers (restore_signal);
-}
-
-/* If a trap handler exists for signal SIG, then call it; otherwise just
- return failure. Returns 1 if it called the trap handler. */
-int
-maybe_call_trap_handler (sig)
- int sig;
-{
- /* Call the trap handler for SIG if the signal is trapped and not ignored. */
- if ((sigmodes[sig] & SIG_TRAPPED) && ((sigmodes[sig] & SIG_IGNORED) == 0))
- {
- switch (sig)
- {
- case SIGINT:
- run_interrupt_trap ();
- break;
- case EXIT_TRAP:
- run_exit_trap ();
- break;
- case DEBUG_TRAP:
- run_debug_trap ();
- break;
- case ERROR_TRAP:
- run_error_trap ();
- break;
- default:
- trap_handler (sig);
- break;
- }
- return (1);
- }
- else
- return (0);
-}
-
-int
-signal_is_trapped (sig)
- int sig;
-{
- return (sigmodes[sig] & SIG_TRAPPED);
-}
-
-int
-signal_is_pending (sig)
- int sig;
-{
- return (pending_traps[sig]);
-}
-
-int
-signal_is_special (sig)
- int sig;
-{
- return (sigmodes[sig] & SIG_SPECIAL);
-}
-
-int
-signal_is_ignored (sig)
- int sig;
-{
- return (sigmodes[sig] & SIG_IGNORED);
-}
-
-int
-signal_is_hard_ignored (sig)
- int sig;
-{
- return (sigmodes[sig] & SIG_HARD_IGNORE);
-}
-
-void
-set_signal_ignored (sig)
- int sig;
-{
- sigmodes[sig] |= SIG_HARD_IGNORE;
- original_signals[sig] = SIG_IGN;
-}
-
-int
-signal_in_progress (sig)
- int sig;
-{
- return (sigmodes[sig] & SIG_INPROGRESS);
-}