diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 90451e4f..5cfbebdd 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -7085,5 +7085,89 @@ sig.c run_pending_traps the next time a trap handler for that signal runs. Bug report from Martijn Dekker + 1/14/2020 + --------- +bashline.c + - find_cmd_start: don't treat the open brace in brace expansion as a + command start character; only treat open brace specially if it can + be a reserved word. Fixes bug reported back in October, 2019 in + https://savannah.gnu.org/support/index.php?110063 + + 1/15 + ---- +lib/readline/readline.c + - _rl_dispatch_subseq,_rl_subseq_result: if we push back a character + with _rl_unget_char or otherwise go back up the chain without a + sequence match, make sure we back up in rl_executing_keyseq. + Report and fix from Koichi Murase + +builtins/bind.def + - unbind_keyseq: if we unbind something that ends up pointing to a + shadow keymap, restore the ANYOTHERKEY binding that we used when + binding it. + Report and fix from Koichi Murase + +bashline.c + - bash_execute_unix_command: if we walked cmd_xmap for rl_executing_keyseq + and ended up pointing to a keymap (type == ISKMAP) we want the + binding for ANYOTHERKEY instead. + Report and fix from Koichi Murase + +lib/readline/bind.c + - rl_bind_key: if we're trying to bind a key sequence containing '\0' + using the old-style binding syntax (C-SPC), make sure we quote the + NULL so it will make it through rl_translate_keyseq(). + Report and fix from Koichi Murase + - rl_bind_key: if we're overwriting a binding for a macro, make sure to + free the old macro value. + Report and fix from Koichi Murase + - rl_generic_bind: if we're overwriting a macro saved to ANYOTHERKEY in + a shadow keymap created by rl_generic_bind, make sure to free the + macro data. + Report and fix from Koichi Murase + +trap.c + - run_pending_traps: save and restore the value of running_trap around + cycle through pending signals so recursive trap handler calls don't + set running_trap to 0 + - _run_trap_internal: allow some signals the shell treats specially + (e.g., SIGINT) to run recursive handlers + - _run_trap_internal: don't turn off SIG_INPROGRESS flag if it was on + for this signal when _run_trap_internal was called + - _run_trap_internal: save and restore the value of running_trap around + running the trap handler, except for SIGCHLD. Fixes bug reported by + Martijn Dekker + + 1/16 + ---- +general.c + - posix_initialize: if turning posix mode off, restore settings from + any saved set, if one exists, instead of setting a default environment + + 1/17 + ---- +parse.y,subst.c + - process_substitution: now available in POSIX mode. Most recently + requested by Martijn Dekker ; requested several + times in the past + +doc/bashref.texi + - posix mode: remove restriction that posix mode is not available + +lib/readline/vi_mode.c + - rl_domove_motion_callback: make sure to extend rl_line_buffer so it + can hold the dummy blank character we're appending. From a fuzzing + report by Tillmann Osswald + - vi_yank_dispatch: after we do an undo, make sure to fix point to be + less than the (new) rl_end + +lib/readline/text.c + - rl_forward_word: make sure that MB_NEXTCHAR doesn't go past rl_end on + invalid multibyte sequences + + 1/18 + ---- +test.c + - for the `-v' operator, use a clever trick from Martijn Dekker and + just test whether N is between 0 and $#. - diff --git a/POSIX b/POSIX index f3f4a0b7..d2836070 100644 --- a/POSIX +++ b/POSIX @@ -115,120 +115,118 @@ The following list is what's changed when 'POSIX mode' is in effect: read with the '.' or 'source' builtins, or in a string processed by the 'eval' builtin. - 30. Process substitution is not available. - - 31. While variable indirection is available, it may not be applied to + 30. While variable indirection is available, it may not be applied to the '#' and '?' special parameters. - 32. When expanding the '*' special parameter in a pattern context + 31. When expanding the '*' special parameter in a pattern context where the expansion is double-quoted does not treat the '$*' as if it were double-quoted. - 33. Assignment statements preceding POSIX special builtins persist in + 32. Assignment statements preceding POSIX special builtins persist in the shell environment after the builtin completes. - 34. Assignment statements preceding shell function calls persist in + 33. Assignment statements preceding shell function calls persist in the shell environment after the function returns, as if a POSIX special builtin command had been executed. - 35. The 'command' builtin does not prevent builtins that take + 34. The 'command' builtin does not prevent builtins that take assignment statements as arguments from expanding them as assignment statements; when not in POSIX mode, assignment builtins lose their assignment statement expansion properties when preceded by 'command'. - 36. The 'bg' builtin uses the required format to describe each job + 35. The 'bg' builtin uses the required format to describe each job placed in the background, which does not include an indication of whether the job is the current or previous job. - 37. The output of 'kill -l' prints all the signal names on a single + 36. The output of 'kill -l' prints all the signal names on a single line, separated by spaces, without the 'SIG' prefix. - 38. The 'kill' builtin does not accept signal names with a 'SIG' + 37. The 'kill' builtin does not accept signal names with a 'SIG' prefix. - 39. The 'export' and 'readonly' builtin commands display their output + 38. The 'export' and 'readonly' builtin commands display their output in the format required by POSIX. - 40. The 'trap' builtin displays signal names without the leading + 39. The 'trap' builtin displays signal names without the leading 'SIG'. - 41. The 'trap' builtin doesn't check the first argument for a possible + 40. The 'trap' builtin doesn't check the first argument for a possible signal specification and revert the signal handling to the original disposition if it is, unless that argument consists solely of digits and is a valid signal number. If users want to reset the handler for a given signal to the original disposition, they should use '-' as the first argument. - 42. The '.' and 'source' builtins do not search the current directory + 41. The '.' and 'source' builtins do not search the current directory for the filename argument if it is not found by searching 'PATH'. - 43. Enabling POSIX mode has the effect of setting the + 42. Enabling POSIX mode has the effect of setting the 'inherit_errexit' option, so subshells spawned to execute command substitutions inherit the value of the '-e' option from the parent shell. When the 'inherit_errexit' option is not enabled, Bash clears the '-e' option in such subshells. - 44. Enabling POSIX mode has the effect of setting the 'shift_verbose' + 43. Enabling POSIX mode has the effect of setting the 'shift_verbose' option, so numeric arguments to 'shift' that exceed the number of positional parameters will result in an error message. - 45. When the 'alias' builtin displays alias definitions, it does not + 44. When the 'alias' builtin displays alias definitions, it does not display them with a leading 'alias ' unless the '-p' option is supplied. - 46. When the 'set' builtin is invoked without options, it does not + 45. When the 'set' builtin is invoked without options, it does not display shell function names and definitions. - 47. When the 'set' builtin is invoked without options, it displays + 46. When the 'set' builtin is invoked without options, it displays variable values without quotes, unless they contain shell metacharacters, even if the result contains nonprinting characters. - 48. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname + 47. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname constructed from '$PWD' and the directory name supplied as an argument does not refer to an existing directory, 'cd' will fail instead of falling back to PHYSICAL mode. - 49. When the 'cd' builtin cannot change a directory because the length + 48. When the 'cd' builtin cannot change a directory because the length of the pathname constructed from '$PWD' and the directory name supplied as an argument exceeds PATH_MAX when all symbolic links are expanded, 'cd' will fail instead of attempting to use only the supplied directory name. - 50. The 'pwd' builtin verifies that the value it prints is the same as + 49. The 'pwd' builtin verifies that the value it prints is the same as the current directory, even if it is not asked to check the file system with the '-P' option. - 51. When listing the history, the 'fc' builtin does not include an + 50. When listing the history, the 'fc' builtin does not include an indication of whether or not a history entry has been modified. - 52. The default editor used by 'fc' is 'ed'. + 51. The default editor used by 'fc' is 'ed'. - 53. The 'type' and 'command' builtins will not report a non-executable + 52. The 'type' and 'command' builtins will not report a non-executable file as having been found, though the shell will attempt to execute such a file if it is the only so-named file found in '$PATH'. - 54. The 'vi' editing mode will invoke the 'vi' editor directly when + 53. The 'vi' editing mode will invoke the 'vi' editor directly when the 'v' command is run, instead of checking '$VISUAL' and '$EDITOR'. - 55. When the 'xpg_echo' option is enabled, Bash does not attempt to + 54. When the 'xpg_echo' option is enabled, Bash does not attempt to interpret any arguments to 'echo' as options. Each argument is displayed, after escape characters are converted. - 56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' + 55. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' and '-f' options. - 57. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not + 56. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not interrupt the 'wait' builtin and cause it to return immediately. The trap command is run once for each child that exits. - 58. The 'read' builtin may be interrupted by a signal for which a trap + 57. The 'read' builtin may be interrupted by a signal for which a trap has been set. If Bash receives a trapped signal while executing 'read', the trap handler executes and 'read' returns an exit status greater than 128. - 59. Bash removes an exited background process's status from the list + 58. Bash removes an exited background process's status from the list of such statuses after the 'wait' builtin is used to obtain it. There is other POSIX behavior that Bash does not implement by default diff --git a/bashline.c b/bashline.c index 419986eb..a80d765c 100644 --- a/bashline.c +++ b/bashline.c @@ -1,6 +1,6 @@ /* bashline.c -- Bash's interface to the readline library. */ -/* Copyright (C) 1987-2019 Free Software Foundation, Inc. +/* Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -1432,7 +1432,7 @@ find_cmd_start (start) rl_line_buffer[s]) { /* Handle >| token crudely; treat as > not | */ - if (rl_line_buffer[s] == '|' && rl_line_buffer[s-1] == '>') + if (s > 0 && rl_line_buffer[s] == '|' && rl_line_buffer[s-1] == '>') { ns = skip_to_delim (rl_line_buffer, s+1, COMMAND_SEPARATORS, SD_NOJMP|SD_COMPLETE/*|SD_NOSKIPCMD*/); if (ns > start || rl_line_buffer[ns] == 0) @@ -1440,6 +1440,28 @@ find_cmd_start (start) os = ns+1; continue; } + /* The only reserved word in COMMAND_SEPARATORS is `{', so handle that + specially, making sure it's in a spot acceptable for reserved words */ + if (s >= os && rl_line_buffer[s] == '{') + { + int pc, nc; /* index of previous non-whitespace, next char */ + for (pc = (s > os) ? s - 1 : os; pc > os && whitespace(rl_line_buffer[pc]); pc--) + ; + nc = rl_line_buffer[s+1]; + /* must be preceded by a command separator or be the first non- + whitespace character since the last command separator, and + followed by a shell break character (not another `{') to be a reserved word. */ + if ((pc > os && (rl_line_buffer[s-1] == '{' || strchr (COMMAND_SEPARATORS, rl_line_buffer[pc]) == 0)) || + (shellbreak(nc) == 0)) /* }} */ + { + /* Not a reserved word, look for another delim */ + ns = skip_to_delim (rl_line_buffer, s+1, COMMAND_SEPARATORS, SD_NOJMP|SD_COMPLETE/*|SD_NOSKIPCMD*/); + if (ns > start || rl_line_buffer[ns] == 0) + return os; + os = ns+1; + continue; + } + } os = s+1; } return os; @@ -4284,7 +4306,10 @@ bash_execute_unix_command (count, key) have to walk cmd_xmap using the entire key sequence. */ cmd_xmap = get_cmd_xmap_from_keymap (rl_get_keymap ()); cmd = (char *)rl_function_of_keyseq_len (rl_executing_keyseq, rl_key_sequence_length, cmd_xmap, &type); - + + if (type == ISKMAP && (type = ((Keymap) cmd)[ANYOTHERKEY].type) == ISMACR) + cmd = (char*)((Keymap) cmd)[ANYOTHERKEY].function; + if (cmd == 0 || type != ISMACR) { rl_crlf (); diff --git a/builtins/bind.def b/builtins/bind.def index ea1f47cf..ced1e1b8 100644 --- a/builtins/bind.def +++ b/builtins/bind.def @@ -1,7 +1,7 @@ This file is bind.def, from which is created bind.c. It implements the builtin "bind" in Bash. -Copyright (C) 1987-2015 Free Software Foundation, Inc. +Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -368,7 +368,7 @@ unbind_keyseq (seq) char *seq; { char *kseq; - int kslen; + int kslen, type; rl_command_func_t *f; kseq = (char *)xmalloc ((2 * strlen (seq)) + 1); @@ -378,11 +378,13 @@ unbind_keyseq (seq) builtin_error (_("`%s': cannot unbind"), seq); return EXECUTION_FAILURE; } - if ((f = rl_function_of_keyseq_len (kseq, kslen, (Keymap)0, (int *)0)) == 0) + if ((f = rl_function_of_keyseq_len (kseq, kslen, (Keymap)0, &type)) == 0) { free (kseq); return (EXECUTION_SUCCESS); } + if (type == ISKMAP) + f = ((Keymap) f)[ANYOTHERKEY].function; /* I wish this didn't have to translate the key sequence again, but readline doesn't have a binding function that takes a translated key sequence as diff --git a/builtins/trap.def b/builtins/trap.def index 2848b776..b6bc05be 100644 --- a/builtins/trap.def +++ b/builtins/trap.def @@ -1,7 +1,7 @@ This file is trap.def, from which is created trap.c. It implements the builtin "trap" in Bash. -Copyright (C) 1987-2019 Free Software Foundation, Inc. +Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. diff --git a/doc/bash.info b/doc/bash.info index 89d92e50..b3d41684 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -6734,120 +6734,118 @@ startup files. read with the '.' or 'source' builtins, or in a string processed by the 'eval' builtin. - 30. Process substitution is not available. - - 31. While variable indirection is available, it may not be applied to + 30. While variable indirection is available, it may not be applied to the '#' and '?' special parameters. - 32. When expanding the '*' special parameter in a pattern context + 31. When expanding the '*' special parameter in a pattern context where the expansion is double-quoted does not treat the '$*' as if it were double-quoted. - 33. Assignment statements preceding POSIX special builtins persist in + 32. Assignment statements preceding POSIX special builtins persist in the shell environment after the builtin completes. - 34. Assignment statements preceding shell function calls persist in + 33. Assignment statements preceding shell function calls persist in the shell environment after the function returns, as if a POSIX special builtin command had been executed. - 35. The 'command' builtin does not prevent builtins that take + 34. The 'command' builtin does not prevent builtins that take assignment statements as arguments from expanding them as assignment statements; when not in POSIX mode, assignment builtins lose their assignment statement expansion properties when preceded by 'command'. - 36. The 'bg' builtin uses the required format to describe each job + 35. The 'bg' builtin uses the required format to describe each job placed in the background, which does not include an indication of whether the job is the current or previous job. - 37. The output of 'kill -l' prints all the signal names on a single + 36. The output of 'kill -l' prints all the signal names on a single line, separated by spaces, without the 'SIG' prefix. - 38. The 'kill' builtin does not accept signal names with a 'SIG' + 37. The 'kill' builtin does not accept signal names with a 'SIG' prefix. - 39. The 'export' and 'readonly' builtin commands display their output + 38. The 'export' and 'readonly' builtin commands display their output in the format required by POSIX. - 40. The 'trap' builtin displays signal names without the leading + 39. The 'trap' builtin displays signal names without the leading 'SIG'. - 41. The 'trap' builtin doesn't check the first argument for a possible + 40. The 'trap' builtin doesn't check the first argument for a possible signal specification and revert the signal handling to the original disposition if it is, unless that argument consists solely of digits and is a valid signal number. If users want to reset the handler for a given signal to the original disposition, they should use '-' as the first argument. - 42. The '.' and 'source' builtins do not search the current directory + 41. The '.' and 'source' builtins do not search the current directory for the filename argument if it is not found by searching 'PATH'. - 43. Enabling POSIX mode has the effect of setting the + 42. Enabling POSIX mode has the effect of setting the 'inherit_errexit' option, so subshells spawned to execute command substitutions inherit the value of the '-e' option from the parent shell. When the 'inherit_errexit' option is not enabled, Bash clears the '-e' option in such subshells. - 44. Enabling POSIX mode has the effect of setting the 'shift_verbose' + 43. Enabling POSIX mode has the effect of setting the 'shift_verbose' option, so numeric arguments to 'shift' that exceed the number of positional parameters will result in an error message. - 45. When the 'alias' builtin displays alias definitions, it does not + 44. When the 'alias' builtin displays alias definitions, it does not display them with a leading 'alias ' unless the '-p' option is supplied. - 46. When the 'set' builtin is invoked without options, it does not + 45. When the 'set' builtin is invoked without options, it does not display shell function names and definitions. - 47. When the 'set' builtin is invoked without options, it displays + 46. When the 'set' builtin is invoked without options, it displays variable values without quotes, unless they contain shell metacharacters, even if the result contains nonprinting characters. - 48. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname + 47. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname constructed from '$PWD' and the directory name supplied as an argument does not refer to an existing directory, 'cd' will fail instead of falling back to PHYSICAL mode. - 49. When the 'cd' builtin cannot change a directory because the length + 48. When the 'cd' builtin cannot change a directory because the length of the pathname constructed from '$PWD' and the directory name supplied as an argument exceeds PATH_MAX when all symbolic links are expanded, 'cd' will fail instead of attempting to use only the supplied directory name. - 50. The 'pwd' builtin verifies that the value it prints is the same as + 49. The 'pwd' builtin verifies that the value it prints is the same as the current directory, even if it is not asked to check the file system with the '-P' option. - 51. When listing the history, the 'fc' builtin does not include an + 50. When listing the history, the 'fc' builtin does not include an indication of whether or not a history entry has been modified. - 52. The default editor used by 'fc' is 'ed'. + 51. The default editor used by 'fc' is 'ed'. - 53. The 'type' and 'command' builtins will not report a non-executable + 52. The 'type' and 'command' builtins will not report a non-executable file as having been found, though the shell will attempt to execute such a file if it is the only so-named file found in '$PATH'. - 54. The 'vi' editing mode will invoke the 'vi' editor directly when + 53. The 'vi' editing mode will invoke the 'vi' editor directly when the 'v' command is run, instead of checking '$VISUAL' and '$EDITOR'. - 55. When the 'xpg_echo' option is enabled, Bash does not attempt to + 54. When the 'xpg_echo' option is enabled, Bash does not attempt to interpret any arguments to 'echo' as options. Each argument is displayed, after escape characters are converted. - 56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' + 55. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' and '-f' options. - 57. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not + 56. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not interrupt the 'wait' builtin and cause it to return immediately. The trap command is run once for each child that exits. - 58. The 'read' builtin may be interrupted by a signal for which a trap + 57. The 'read' builtin may be interrupted by a signal for which a trap has been set. If Bash receives a trapped signal while executing 'read', the trap handler executes and 'read' returns an exit status greater than 128. - 59. Bash removes an exited background process's status from the list + 58. Bash removes an exited background process's status from the list of such statuses after the 'wait' builtin is used to obtain it. There is other POSIX behavior that Bash does not implement by default @@ -11846,60 +11844,60 @@ Node: Directory Stack Builtins273455 Node: Controlling the Prompt276423 Node: The Restricted Shell279344 Node: Bash POSIX Mode281826 -Node: Job Control292759 -Node: Job Control Basics293219 -Node: Job Control Builtins298183 -Node: Job Control Variables303329 -Node: Command Line Editing304485 -Node: Introduction and Notation306156 -Node: Readline Interaction307779 -Node: Readline Bare Essentials308970 -Node: Readline Movement Commands310753 -Node: Readline Killing Commands311713 -Node: Readline Arguments313631 -Node: Searching314675 -Node: Readline Init File316861 -Node: Readline Init File Syntax318120 -Node: Conditional Init Constructs338650 -Node: Sample Init File342846 -Node: Bindable Readline Commands345963 -Node: Commands For Moving347167 -Node: Commands For History349026 -Node: Commands For Text353321 -Node: Commands For Killing356709 -Node: Numeric Arguments359524 -Node: Commands For Completion360663 -Node: Keyboard Macros364854 -Node: Miscellaneous Commands365541 -Node: Readline vi Mode371494 -Node: Programmable Completion372401 -Node: Programmable Completion Builtins380181 -Node: A Programmable Completion Example390876 -Node: Using History Interactively396123 -Node: Bash History Facilities396807 -Node: Bash History Builtins399812 -Node: History Interaction404344 -Node: Event Designators407964 -Node: Word Designators409318 -Node: Modifiers411078 -Node: Installing Bash412889 -Node: Basic Installation414026 -Node: Compilers and Options417284 -Node: Compiling For Multiple Architectures418025 -Node: Installation Names419718 -Node: Specifying the System Type420536 -Node: Sharing Defaults421252 -Node: Operation Controls421925 -Node: Optional Features422883 -Node: Reporting Bugs433401 -Node: Major Differences From The Bourne Shell434595 -Node: GNU Free Documentation License451447 -Node: Indexes476624 -Node: Builtin Index477078 -Node: Reserved Word Index483905 -Node: Variable Index486353 -Node: Function Index502177 -Node: Concept Index515616 +Node: Job Control292713 +Node: Job Control Basics293173 +Node: Job Control Builtins298137 +Node: Job Control Variables303283 +Node: Command Line Editing304439 +Node: Introduction and Notation306110 +Node: Readline Interaction307733 +Node: Readline Bare Essentials308924 +Node: Readline Movement Commands310707 +Node: Readline Killing Commands311667 +Node: Readline Arguments313585 +Node: Searching314629 +Node: Readline Init File316815 +Node: Readline Init File Syntax318074 +Node: Conditional Init Constructs338604 +Node: Sample Init File342800 +Node: Bindable Readline Commands345917 +Node: Commands For Moving347121 +Node: Commands For History348980 +Node: Commands For Text353275 +Node: Commands For Killing356663 +Node: Numeric Arguments359478 +Node: Commands For Completion360617 +Node: Keyboard Macros364808 +Node: Miscellaneous Commands365495 +Node: Readline vi Mode371448 +Node: Programmable Completion372355 +Node: Programmable Completion Builtins380135 +Node: A Programmable Completion Example390830 +Node: Using History Interactively396077 +Node: Bash History Facilities396761 +Node: Bash History Builtins399766 +Node: History Interaction404298 +Node: Event Designators407918 +Node: Word Designators409272 +Node: Modifiers411032 +Node: Installing Bash412843 +Node: Basic Installation413980 +Node: Compilers and Options417238 +Node: Compiling For Multiple Architectures417979 +Node: Installation Names419672 +Node: Specifying the System Type420490 +Node: Sharing Defaults421206 +Node: Operation Controls421879 +Node: Optional Features422837 +Node: Reporting Bugs433355 +Node: Major Differences From The Bourne Shell434549 +Node: GNU Free Documentation License451401 +Node: Indexes476578 +Node: Builtin Index477032 +Node: Reserved Word Index483859 +Node: Variable Index486307 +Node: Function Index502131 +Node: Concept Index515570  End Tag Table diff --git a/doc/bashref.dvi b/doc/bashref.dvi index b53210ab..9c5c9a00 100644 Binary files a/doc/bashref.dvi and b/doc/bashref.dvi differ diff --git a/doc/bashref.html b/doc/bashref.html index 8b3a3fb7..54b41131 100644 --- a/doc/bashref.html +++ b/doc/bashref.html @@ -8993,8 +8993,6 @@ results in an invalid expression. with the . or source builtins, or in a string processed by the eval builtin. -
  • Process substitution is not available. -
  • While variable indirection is available, it may not be applied to the ‘#’ and ‘?’ special parameters. diff --git a/doc/bashref.info b/doc/bashref.info index d097e5a9..0ae8deb7 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -6734,120 +6734,118 @@ startup files. read with the '.' or 'source' builtins, or in a string processed by the 'eval' builtin. - 30. Process substitution is not available. - - 31. While variable indirection is available, it may not be applied to + 30. While variable indirection is available, it may not be applied to the '#' and '?' special parameters. - 32. When expanding the '*' special parameter in a pattern context + 31. When expanding the '*' special parameter in a pattern context where the expansion is double-quoted does not treat the '$*' as if it were double-quoted. - 33. Assignment statements preceding POSIX special builtins persist in + 32. Assignment statements preceding POSIX special builtins persist in the shell environment after the builtin completes. - 34. Assignment statements preceding shell function calls persist in + 33. Assignment statements preceding shell function calls persist in the shell environment after the function returns, as if a POSIX special builtin command had been executed. - 35. The 'command' builtin does not prevent builtins that take + 34. The 'command' builtin does not prevent builtins that take assignment statements as arguments from expanding them as assignment statements; when not in POSIX mode, assignment builtins lose their assignment statement expansion properties when preceded by 'command'. - 36. The 'bg' builtin uses the required format to describe each job + 35. The 'bg' builtin uses the required format to describe each job placed in the background, which does not include an indication of whether the job is the current or previous job. - 37. The output of 'kill -l' prints all the signal names on a single + 36. The output of 'kill -l' prints all the signal names on a single line, separated by spaces, without the 'SIG' prefix. - 38. The 'kill' builtin does not accept signal names with a 'SIG' + 37. The 'kill' builtin does not accept signal names with a 'SIG' prefix. - 39. The 'export' and 'readonly' builtin commands display their output + 38. The 'export' and 'readonly' builtin commands display their output in the format required by POSIX. - 40. The 'trap' builtin displays signal names without the leading + 39. The 'trap' builtin displays signal names without the leading 'SIG'. - 41. The 'trap' builtin doesn't check the first argument for a possible + 40. The 'trap' builtin doesn't check the first argument for a possible signal specification and revert the signal handling to the original disposition if it is, unless that argument consists solely of digits and is a valid signal number. If users want to reset the handler for a given signal to the original disposition, they should use '-' as the first argument. - 42. The '.' and 'source' builtins do not search the current directory + 41. The '.' and 'source' builtins do not search the current directory for the filename argument if it is not found by searching 'PATH'. - 43. Enabling POSIX mode has the effect of setting the + 42. Enabling POSIX mode has the effect of setting the 'inherit_errexit' option, so subshells spawned to execute command substitutions inherit the value of the '-e' option from the parent shell. When the 'inherit_errexit' option is not enabled, Bash clears the '-e' option in such subshells. - 44. Enabling POSIX mode has the effect of setting the 'shift_verbose' + 43. Enabling POSIX mode has the effect of setting the 'shift_verbose' option, so numeric arguments to 'shift' that exceed the number of positional parameters will result in an error message. - 45. When the 'alias' builtin displays alias definitions, it does not + 44. When the 'alias' builtin displays alias definitions, it does not display them with a leading 'alias ' unless the '-p' option is supplied. - 46. When the 'set' builtin is invoked without options, it does not + 45. When the 'set' builtin is invoked without options, it does not display shell function names and definitions. - 47. When the 'set' builtin is invoked without options, it displays + 46. When the 'set' builtin is invoked without options, it displays variable values without quotes, unless they contain shell metacharacters, even if the result contains nonprinting characters. - 48. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname + 47. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname constructed from '$PWD' and the directory name supplied as an argument does not refer to an existing directory, 'cd' will fail instead of falling back to PHYSICAL mode. - 49. When the 'cd' builtin cannot change a directory because the length + 48. When the 'cd' builtin cannot change a directory because the length of the pathname constructed from '$PWD' and the directory name supplied as an argument exceeds PATH_MAX when all symbolic links are expanded, 'cd' will fail instead of attempting to use only the supplied directory name. - 50. The 'pwd' builtin verifies that the value it prints is the same as + 49. The 'pwd' builtin verifies that the value it prints is the same as the current directory, even if it is not asked to check the file system with the '-P' option. - 51. When listing the history, the 'fc' builtin does not include an + 50. When listing the history, the 'fc' builtin does not include an indication of whether or not a history entry has been modified. - 52. The default editor used by 'fc' is 'ed'. + 51. The default editor used by 'fc' is 'ed'. - 53. The 'type' and 'command' builtins will not report a non-executable + 52. The 'type' and 'command' builtins will not report a non-executable file as having been found, though the shell will attempt to execute such a file if it is the only so-named file found in '$PATH'. - 54. The 'vi' editing mode will invoke the 'vi' editor directly when + 53. The 'vi' editing mode will invoke the 'vi' editor directly when the 'v' command is run, instead of checking '$VISUAL' and '$EDITOR'. - 55. When the 'xpg_echo' option is enabled, Bash does not attempt to + 54. When the 'xpg_echo' option is enabled, Bash does not attempt to interpret any arguments to 'echo' as options. Each argument is displayed, after escape characters are converted. - 56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' + 55. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' and '-f' options. - 57. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not + 56. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not interrupt the 'wait' builtin and cause it to return immediately. The trap command is run once for each child that exits. - 58. The 'read' builtin may be interrupted by a signal for which a trap + 57. The 'read' builtin may be interrupted by a signal for which a trap has been set. If Bash receives a trapped signal while executing 'read', the trap handler executes and 'read' returns an exit status greater than 128. - 59. Bash removes an exited background process's status from the list + 58. Bash removes an exited background process's status from the list of such statuses after the 'wait' builtin is used to obtain it. There is other POSIX behavior that Bash does not implement by default @@ -11846,60 +11844,60 @@ Node: Directory Stack Builtins273455 Node: Controlling the Prompt276423 Node: The Restricted Shell279344 Node: Bash POSIX Mode281826 -Node: Job Control292759 -Node: Job Control Basics293219 -Node: Job Control Builtins298183 -Node: Job Control Variables303329 -Node: Command Line Editing304485 -Node: Introduction and Notation306156 -Node: Readline Interaction307779 -Node: Readline Bare Essentials308970 -Node: Readline Movement Commands310753 -Node: Readline Killing Commands311713 -Node: Readline Arguments313631 -Node: Searching314675 -Node: Readline Init File316861 -Node: Readline Init File Syntax318120 -Node: Conditional Init Constructs338650 -Node: Sample Init File342846 -Node: Bindable Readline Commands345963 -Node: Commands For Moving347167 -Node: Commands For History349026 -Node: Commands For Text353321 -Node: Commands For Killing356709 -Node: Numeric Arguments359524 -Node: Commands For Completion360663 -Node: Keyboard Macros364854 -Node: Miscellaneous Commands365541 -Node: Readline vi Mode371494 -Node: Programmable Completion372401 -Node: Programmable Completion Builtins380181 -Node: A Programmable Completion Example390876 -Node: Using History Interactively396123 -Node: Bash History Facilities396807 -Node: Bash History Builtins399812 -Node: History Interaction404344 -Node: Event Designators407964 -Node: Word Designators409318 -Node: Modifiers411078 -Node: Installing Bash412889 -Node: Basic Installation414026 -Node: Compilers and Options417284 -Node: Compiling For Multiple Architectures418025 -Node: Installation Names419718 -Node: Specifying the System Type420536 -Node: Sharing Defaults421252 -Node: Operation Controls421925 -Node: Optional Features422883 -Node: Reporting Bugs433401 -Node: Major Differences From The Bourne Shell434595 -Node: GNU Free Documentation License451447 -Node: Indexes476624 -Node: Builtin Index477078 -Node: Reserved Word Index483905 -Node: Variable Index486353 -Node: Function Index502177 -Node: Concept Index515616 +Node: Job Control292713 +Node: Job Control Basics293173 +Node: Job Control Builtins298137 +Node: Job Control Variables303283 +Node: Command Line Editing304439 +Node: Introduction and Notation306110 +Node: Readline Interaction307733 +Node: Readline Bare Essentials308924 +Node: Readline Movement Commands310707 +Node: Readline Killing Commands311667 +Node: Readline Arguments313585 +Node: Searching314629 +Node: Readline Init File316815 +Node: Readline Init File Syntax318074 +Node: Conditional Init Constructs338604 +Node: Sample Init File342800 +Node: Bindable Readline Commands345917 +Node: Commands For Moving347121 +Node: Commands For History348980 +Node: Commands For Text353275 +Node: Commands For Killing356663 +Node: Numeric Arguments359478 +Node: Commands For Completion360617 +Node: Keyboard Macros364808 +Node: Miscellaneous Commands365495 +Node: Readline vi Mode371448 +Node: Programmable Completion372355 +Node: Programmable Completion Builtins380135 +Node: A Programmable Completion Example390830 +Node: Using History Interactively396077 +Node: Bash History Facilities396761 +Node: Bash History Builtins399766 +Node: History Interaction404298 +Node: Event Designators407918 +Node: Word Designators409272 +Node: Modifiers411032 +Node: Installing Bash412843 +Node: Basic Installation413980 +Node: Compilers and Options417238 +Node: Compiling For Multiple Architectures417979 +Node: Installation Names419672 +Node: Specifying the System Type420490 +Node: Sharing Defaults421206 +Node: Operation Controls421879 +Node: Optional Features422837 +Node: Reporting Bugs433355 +Node: Major Differences From The Bourne Shell434549 +Node: GNU Free Documentation License451401 +Node: Indexes476578 +Node: Builtin Index477032 +Node: Reserved Word Index483859 +Node: Variable Index486307 +Node: Function Index502131 +Node: Concept Index515570  End Tag Table diff --git a/doc/bashref.log b/doc/bashref.log index 6de9d2ee..2c0dd8ec 100644 --- a/doc/bashref.log +++ b/doc/bashref.log @@ -1,9 +1,11 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/MacPorts 2019.50896_1) (preloaded format=pdftex 2019.11.6) 6 JAN 2020 09:08 +This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/MacPorts 2019.50896_1) (preloaded format=pdfetex 2019.11.6) 17 JAN 2020 11:15 entering extended mode restricted \write18 enabled. + file:line:error style messages enabled. %&-line parsing enabled. -**/usr/homes/chet/src/bash/src/doc/bashref.texi -(/usr/homes/chet/src/bash/src/doc/bashref.texi (./texinfo.tex +**\nonstopmode \input /usr/homes/chet/src/bash/src/doc/bashref.texi +(/usr/homes/chet/src/bash/src/doc/bashref.texi +(/Users/chet/src/bash/src/doc/texinfo.tex Loading texinfo [version 2015-11-22.14]: \outerhsize=\dimen16 \outervsize=\dimen17 @@ -159,19 +161,22 @@ This is `epsf.tex' v2.7.4 <14 February 2011> texinfo.tex: doing @include of version.texi -(./version.texi) [1{/opt/local/var/db/texmf/fonts/map/pdftex/updmap/pdftex.map} -] [2] (./bashref.toc [-1] [-2] [-3]) [-4] (./bashref.toc) (./bashref.toc) -Chapter 1 +(/Users/chet/src/bash/src/doc/version.texi) [1{/opt/local/var/db/texmf/fonts/ma +p/pdftex/updmap/pdftex.map}] [2] (/Users/chet/src/bash/src/doc/bashref.toc +[-1] [-2] [-3]) [-4] (/Users/chet/src/bash/src/doc/bashref.toc) +(/Users/chet/src/bash/src/doc/bashref.toc) Chapter 1 \openout0 = `bashref.toc'. - (./bashref.aux) + +(/Users/chet/src/bash/src/doc/bashref.aux) \openout1 = `bashref.aux'. Chapter 2 [1] [2] @cpindfile=@write2 \openout2 = `bashref.cp'. - [3] Chapter 3 [4] [5] [6] + [3] Chapter 3 +[4] [5] [6] @vrindfile=@write3 \openout3 = `bashref.vr'. @@ -179,19 +184,18 @@ Chapter 1 @rwindfile=@write4 \openout4 = `bashref.rw'. - -[8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] -[23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] -[38] [39] [40] [41] [42] Chapter 4 [43] + [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] +[20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] +[35] [36] [37] [38] [39] [40] [41] [42] Chapter 4 [43] @btindfile=@write5 \openout5 = `bashref.bt'. - [44] [45] [46] [47] [48] [49] [50] -[51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] -[66] [67] [68] [69] [70] [71] [72] Chapter 5 [73] [74] [75] [76] [77] [78] -[79] [80] [81] [82] [83] [84] Chapter 6 [85] [86] [87] [88] [89] [90] [91] -[92] [93] [94] [95] [96] [97] [98] [99] [100] [101] [102] [103] Chapter 7 -[104] [105] [106] [107] + [44] [45] [46] [47] +[48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] +[63] [64] [65] [66] [67] [68] [69] [70] [71] [72] Chapter 5 [73] [74] [75] +[76] [77] [78] [79] [80] [81] [82] [83] [84] Chapter 6 [85] [86] [87] [88] +[89] [90] [91] [92] [93] [94] [95] [96] [97] [98] [99] [100] [101] [102] +[103] Chapter 7 [104] [105] [106] [107] texinfo.tex: doing @include of rluser.texi @@ -263,8 +267,8 @@ texinfo.tex: doing @include of hsuser.texi [163] Appendix C [164] texinfo.tex: doing @include of fdl.texi - (./fdl.texi [165] [166] [167] [168] [169] [170] [171]) -Appendix D [172] [173] [174] [175] [176] + (/Users/chet/src/bash/src/doc/fdl.texi [165] [166] +[167] [168] [169] [170] [171]) Appendix D [172] [173] [174] [175] [176] Overfull \vbox (0.67252pt too high) has occurred while \output is active \vbox(340.17245+0.0)x207.80492 .\glue(\topskip) 0.0 @@ -280,13 +284,13 @@ Overfull \vbox (0.67252pt too high) has occurred while \output is active [177] [178] [179] [180] [181] ) Here is how much of TeX's memory you used: - 4068 strings out of 497098 - 46669 string characters out of 6206775 + 4069 strings out of 497098 + 47090 string characters out of 6206772 137084 words of memory out of 5000000 4848 multiletter control sequences out of 15000+600000 34315 words of font info for 116 fonts, out of 8000000 for 9000 51 hyphenation exceptions out of 8191 - 16i,6n,16p,319b,968s stack positions out of 5000i,500n,10000p,200000b,80000s + 16i,6n,16p,339b,968s stack positions out of 5000i,500n,10000p,200000b,80000s {/opt/local/share/texmf-texlive/fonts/enc/dvips/ cm-super/cm-super-t1.enc} -Output written on bashref.pdf (187 pages, 759178 bytes). +Output written on bashref.pdf (187 pages, 759156 bytes). PDF statistics: 2644 PDF objects out of 2984 (max. 8388607) 2411 compressed objects within 25 object streams diff --git a/doc/bashref.pdf b/doc/bashref.pdf index f96fd14d..1c3e69d9 100644 Binary files a/doc/bashref.pdf and b/doc/bashref.pdf differ diff --git a/doc/bashref.ps b/doc/bashref.ps index dded7b4b..fe5a5e5a 100644 --- a/doc/bashref.ps +++ b/doc/bashref.ps @@ -1,7 +1,7 @@ %!PS-Adobe-2.0 %%Creator: dvips(k) 5.999 Copyright 2019 Radical Eye Software %%Title: bashref.dvi -%%CreationDate: Mon Jan 6 13:53:44 2020 +%%CreationDate: Fri Jan 17 16:15:33 2020 %%Pages: 187 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 @@ -12,7 +12,7 @@ %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi %DVIPSParameters: dpi=600 -%DVIPSSource: TeX output 2020.01.06:0853 +%DVIPSSource: TeX output 2020.01.17:1115 %%BeginProcSet: tex.pro 0 0 %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S @@ -15507,80 +15507,79 @@ b(A)31 b(non-in)m(teractiv)m(e)j(shell)d(exits)h(with)e(an)h(error)g (assignmen)m(t)h(statemen)m(ts.)69 b(A)39 b(v)-5 b(ariable)40 b(assignmen)m(t)330 518 y(error)30 b(o)s(ccurs,)g(for)g(example,)i (when)d(trying)i(to)g(assign)f(a)h(v)-5 b(alue)31 b(to)g(a)g(readonly)f -(v)-5 b(ariable.)154 650 y(24.)61 b(A)31 b(non-in)m(teractiv)m(e)j +(v)-5 b(ariable.)154 656 y(24.)61 b(A)31 b(non-in)m(teractiv)m(e)j (shell)d(exits)h(with)e(an)h(error)g(status)g(if)g(a)g(v)-5 b(ariable)32 b(assignmen)m(t)g(error)e(o)s(ccurs)330 -759 y(in)g(an)g(assignmen)m(t)i(statemen)m(t)g(preceding)e(a)h(sp)s +766 y(in)g(an)g(assignmen)m(t)i(statemen)m(t)g(preceding)e(a)h(sp)s (ecial)g(builtin,)f(but)g(not)g(with)h(an)m(y)f(other)h(simple)330 -869 y(command.)154 1000 y(25.)61 b(A)43 b(non-in)m(teractiv)m(e)i +876 y(command.)154 1014 y(25.)61 b(A)43 b(non-in)m(teractiv)m(e)i (shell)e(exits)h(with)f(an)f(error)h(status)g(if)g(the)g(iteration)h(v) --5 b(ariable)44 b(in)f(a)g Ft(for)330 1110 y Fu(statemen)m(t)32 +-5 b(ariable)44 b(in)f(a)g Ft(for)330 1124 y Fu(statemen)m(t)32 b(or)f(the)f(selection)i(v)-5 b(ariable)32 b(in)e(a)g Ft(select)f Fu(statemen)m(t)j(is)f(a)f(readonly)h(v)-5 -b(ariable.)154 1241 y(26.)61 b(Non-in)m(teractiv)m(e)34 +b(ariable.)154 1262 y(26.)61 b(Non-in)m(teractiv)m(e)34 b(shells)c(exit)h(if)g Fr(\014lename)k Fu(in)30 b Ft(.)g -Fr(\014lename)36 b Fu(is)31 b(not)f(found.)154 1373 y(27.)61 +Fr(\014lename)36 b Fu(is)31 b(not)f(found.)154 1401 y(27.)61 b(Non-in)m(teractiv)m(e)41 b(shells)d(exit)h(if)f(a)g(syn)m(tax)g (error)g(in)f(an)h(arithmetic)h(expansion)f(results)f(in)h(an)330 -1482 y(in)m(v)-5 b(alid)31 b(expression.)154 1614 y(28.)61 +1510 y(in)m(v)-5 b(alid)31 b(expression.)154 1649 y(28.)61 b(Non-in)m(teractiv)m(e)34 b(shells)c(exit)h(if)g(a)f(parameter)h -(expansion)g(error)f(o)s(ccurs.)154 1745 y(29.)61 b(Non-in)m(teractiv)m +(expansion)g(error)f(o)s(ccurs.)154 1787 y(29.)61 b(Non-in)m(teractiv)m (e)27 b(shells)c(exit)i(if)e(there)h(is)f(a)h(syn)m(tax)g(error)f(in)g (a)h(script)f(read)g(with)h(the)f Ft(.)g Fu(or)h Ft(source)330 -1855 y Fu(builtins,)30 b(or)g(in)g(a)h(string)g(pro)s(cessed)e(b)m(y)i -(the)f Ft(eval)f Fu(builtin.)154 1987 y(30.)61 b(Pro)s(cess)30 -b(substitution)g(is)h(not)f(a)m(v)-5 b(ailable.)154 2118 -y(31.)61 b(While)32 b(v)-5 b(ariable)32 b(indirection)f(is)g(a)m(v)-5 -b(ailable,)34 b(it)d(ma)m(y)h(not)f(b)s(e)g(applied)g(to)g(the)h(`)p +1897 y Fu(builtins,)30 b(or)g(in)g(a)h(string)g(pro)s(cessed)e(b)m(y)i +(the)f Ft(eval)f Fu(builtin.)154 2035 y(30.)61 b(While)32 +b(v)-5 b(ariable)32 b(indirection)f(is)g(a)m(v)-5 b(ailable,)34 +b(it)d(ma)m(y)h(not)f(b)s(e)g(applied)g(to)g(the)h(`)p Ft(#)p Fu(')f(and)f(`)p Ft(?)p Fu(')h(sp)s(ecial)330 -2228 y(parameters.)154 2359 y(32.)61 b(When)28 b(expanding)g(the)g(`)p +2145 y(parameters.)154 2283 y(31.)61 b(When)28 b(expanding)g(the)g(`)p Ft(*)p Fu(')g(sp)s(ecial)h(parameter)f(in)g(a)h(pattern)f(con)m(text)i -(where)e(the)g(expansion)g(is)330 2469 y(double-quoted)i(do)s(es)g(not) +(where)e(the)g(expansion)g(is)330 2393 y(double-quoted)i(do)s(es)g(not) h(treat)h(the)e Ft($*)g Fu(as)h(if)f(it)h(w)m(ere)g(double-quoted.)154 -2600 y(33.)61 b(Assignmen)m(t)23 b(statemen)m(ts)h(preceding)e +2531 y(32.)61 b(Assignmen)m(t)23 b(statemen)m(ts)h(preceding)e Fm(posix)f Fu(sp)s(ecial)i(builtins)f(p)s(ersist)g(in)f(the)i(shell)f -(en)m(vironmen)m(t)330 2710 y(after)31 b(the)f(builtin)g(completes.)154 -2841 y(34.)61 b(Assignmen)m(t)35 b(statemen)m(ts)h(preceding)f(shell)f +(en)m(vironmen)m(t)330 2641 y(after)31 b(the)f(builtin)g(completes.)154 +2779 y(33.)61 b(Assignmen)m(t)35 b(statemen)m(ts)h(preceding)f(shell)f (function)g(calls)i(p)s(ersist)e(in)g(the)h(shell)f(en)m(vironmen)m(t) -330 2951 y(after)d(the)f(function)h(returns,)e(as)i(if)f(a)h +330 2889 y(after)d(the)f(function)h(returns,)e(as)i(if)f(a)h Fm(posix)e Fu(sp)s(ecial)i(builtin)f(command)g(had)g(b)s(een)g -(executed.)154 3082 y(35.)61 b(The)31 b Ft(command)e +(executed.)154 3027 y(34.)61 b(The)31 b Ft(command)e Fu(builtin)i(do)s(es)g(not)h(prev)m(en)m(t)f(builtins)g(that)h(tak)m(e) -h(assignmen)m(t)f(statemen)m(ts)h(as)f(ar-)330 3192 y(gumen)m(ts)40 +h(assignmen)m(t)f(statemen)m(ts)h(as)f(ar-)330 3137 y(gumen)m(ts)40 b(from)e(expanding)h(them)g(as)h(assignmen)m(t)g(statemen)m(ts;)46 -b(when)38 b(not)i(in)f Fm(posix)f Fu(mo)s(de,)330 3302 +b(when)38 b(not)i(in)f Fm(posix)f Fu(mo)s(de,)330 3246 y(assignmen)m(t)k(builtins)e(lose)h(their)g(assignmen)m(t)h(statemen)m -(t)h(expansion)d(prop)s(erties)g(when)g(pre-)330 3411 -y(ceded)31 b(b)m(y)f Ft(command)p Fu(.)154 3543 y(36.)61 +(t)h(expansion)d(prop)s(erties)g(when)g(pre-)330 3356 +y(ceded)31 b(b)m(y)f Ft(command)p Fu(.)154 3494 y(35.)61 b(The)27 b Ft(bg)g Fu(builtin)g(uses)g(the)h(required)f(format)h(to)g (describ)s(e)f(eac)m(h)i(job)e(placed)h(in)f(the)h(bac)m(kground,)330 -3652 y(whic)m(h)h(do)s(es)g(not)g(include)g(an)g(indication)h(of)f +3604 y(whic)m(h)h(do)s(es)g(not)g(include)g(an)g(indication)h(of)f (whether)f(the)h(job)g(is)g(the)h(curren)m(t)e(or)h(previous)g(job.)154 -3784 y(37.)61 b(The)23 b(output)f(of)i(`)p Ft(kill)29 +3742 y(36.)61 b(The)23 b(output)f(of)i(`)p Ft(kill)29 b(-l)p Fu(')23 b(prin)m(ts)f(all)i(the)g(signal)f(names)g(on)g(a)h -(single)g(line,)h(separated)e(b)m(y)g(spaces,)330 3893 +(single)g(line,)h(separated)e(b)m(y)g(spaces,)330 3852 y(without)30 b(the)h(`)p Ft(SIG)p Fu(')f(pre\014x.)154 -4025 y(38.)61 b(The)30 b Ft(kill)f Fu(builtin)h(do)s(es)g(not)h(accept) +3990 y(37.)61 b(The)30 b Ft(kill)f Fu(builtin)h(do)s(es)g(not)h(accept) h(signal)f(names)f(with)g(a)h(`)p Ft(SIG)p Fu(')f(pre\014x.)154 -4156 y(39.)61 b(The)38 b Ft(export)f Fu(and)g Ft(readonly)f +4129 y(38.)61 b(The)38 b Ft(export)f Fu(and)g Ft(readonly)f Fu(builtin)i(commands)g(displa)m(y)h(their)f(output)g(in)g(the)h -(format)g(re-)330 4266 y(quired)30 b(b)m(y)g Fm(posix)p -Fu(.)154 4398 y(40.)61 b(The)30 b Ft(trap)f Fu(builtin)h(displa)m(ys)g +(format)g(re-)330 4238 y(quired)30 b(b)m(y)g Fm(posix)p +Fu(.)154 4377 y(39.)61 b(The)30 b Ft(trap)f Fu(builtin)h(displa)m(ys)g (signal)i(names)e(without)g(the)h(leading)g Ft(SIG)p -Fu(.)154 4529 y(41.)61 b(The)39 b Ft(trap)e Fu(builtin)i(do)s(esn't)g +Fu(.)154 4515 y(40.)61 b(The)39 b Ft(trap)e Fu(builtin)i(do)s(esn't)g (c)m(hec)m(k)h(the)g(\014rst)e(argumen)m(t)i(for)e(a)i(p)s(ossible)e -(signal)i(sp)s(eci\014cation)330 4639 y(and)30 b(rev)m(ert)i(the)e +(signal)i(sp)s(eci\014cation)330 4625 y(and)30 b(rev)m(ert)i(the)e (signal)i(handling)e(to)h(the)g(original)h(disp)s(osition)e(if)h(it)g -(is,)g(unless)f(that)h(argumen)m(t)330 4748 y(consists)e(solely)g(of)g +(is,)g(unless)f(that)h(argumen)m(t)330 4734 y(consists)e(solely)g(of)g (digits)g(and)f(is)g(a)h(v)-5 b(alid)29 b(signal)g(n)m(um)m(b)s(er.)38 b(If)28 b(users)g(w)m(an)m(t)h(to)g(reset)g(the)g(handler)330 -4858 y(for)h(a)g(giv)m(en)h(signal)g(to)f(the)h(original)g(disp)s +4844 y(for)h(a)g(giv)m(en)h(signal)g(to)f(the)h(original)g(disp)s (osition,)f(they)g(should)f(use)h(`)p Ft(-)p Fu(')g(as)g(the)g(\014rst) -f(argumen)m(t.)154 4989 y(42.)61 b(The)21 b Ft(.)h Fu(and)f +f(argumen)m(t.)154 4982 y(41.)61 b(The)21 b Ft(.)h Fu(and)f Ft(source)f Fu(builtins)h(do)g(not)h(searc)m(h)h(the)f(curren)m(t)f (directory)h(for)g(the)g(\014lename)f(argumen)m(t)330 -5099 y(if)30 b(it)h(is)g(not)f(found)f(b)m(y)i(searc)m(hing)g -Ft(PATH)p Fu(.)154 5230 y(43.)61 b(Enabling)21 b Fm(posix)g +5092 y(if)30 b(it)h(is)g(not)f(found)f(b)m(y)i(searc)m(hing)g +Ft(PATH)p Fu(.)154 5230 y(42.)61 b(Enabling)21 b Fm(posix)g Fu(mo)s(de)g(has)g(the)g(e\013ect)i(of)e(setting)i(the)e Ft(inherit_errexit)d Fu(option,)23 b(so)f(subshells)330 5340 y(spa)m(wned)27 b(to)i(execute)g(command)e(substitutions)h @@ -15592,30 +15591,30 @@ b(Bash)30 b(F)-8 b(eatures)2439 b(103)330 299 y(paren)m(t)37 b(shell.)62 b(When)37 b(the)g Ft(inherit_errexit)c Fu(option)38 b(is)f(not)h(enabled,)h(Bash)e(clears)h(the)g Ft(-e)330 408 y Fu(option)31 b(in)f(suc)m(h)g(subshells.)154 542 -y(44.)61 b(Enabling)32 b Fm(posix)f Fu(mo)s(de)h(has)g(the)h(e\013ect)g +y(43.)61 b(Enabling)32 b Fm(posix)f Fu(mo)s(de)h(has)g(the)h(e\013ect)g (of)g(setting)g(the)g Ft(shift_verbose)28 b Fu(option,)34 b(so)e(n)m(umeric)330 652 y(argumen)m(ts)f(to)g Ft(shift)f Fu(that)h(exceed)h(the)e(n)m(um)m(b)s(er)g(of)h(p)s(ositional)g (parameters)g(will)g(result)g(in)f(an)330 762 y(error)g(message.)154 -896 y(45.)61 b(When)43 b(the)g Ft(alias)f Fu(builtin)g(displa)m(ys)i +896 y(44.)61 b(When)43 b(the)g Ft(alias)f Fu(builtin)g(displa)m(ys)i (alias)g(de\014nitions,)i(it)d(do)s(es)g(not)g(displa)m(y)h(them)f (with)g(a)330 1005 y(leading)31 b(`)p Ft(alias)e Fu(')i(unless)f(the)g -Ft(-p)g Fu(option)h(is)f(supplied.)154 1139 y(46.)61 +Ft(-p)g Fu(option)h(is)f(supplied.)154 1139 y(45.)61 b(When)40 b(the)g Ft(set)f Fu(builtin)h(is)g(in)m(v)m(ok)m(ed)h (without)f(options,)j(it)e(do)s(es)f(not)g(displa)m(y)g(shell)g (function)330 1249 y(names)30 b(and)g(de\014nitions.)154 -1383 y(47.)61 b(When)36 b(the)g Ft(set)g Fu(builtin)g(is)g(in)m(v)m(ok) +1383 y(46.)61 b(When)36 b(the)g Ft(set)g Fu(builtin)g(is)g(in)m(v)m(ok) m(ed)i(without)e(options,)i(it)f(displa)m(ys)f(v)-5 b(ariable)37 b(v)-5 b(alues)37 b(without)330 1492 y(quotes,)26 b(unless)d(they)i (con)m(tain)g(shell)f(metac)m(haracters,)k(ev)m(en)d(if)f(the)g(result) g(con)m(tains)i(nonprin)m(ting)330 1602 y(c)m(haracters.)154 -1736 y(48.)61 b(When)35 b(the)g Ft(cd)f Fu(builtin)h(is)g(in)m(v)m(ok)m +1736 y(47.)61 b(When)35 b(the)g Ft(cd)f Fu(builtin)h(is)g(in)m(v)m(ok)m (ed)i(in)d Fr(logical)41 b Fu(mo)s(de,)36 b(and)f(the)g(pathname)g (constructed)g(from)330 1845 y Ft($PWD)i Fu(and)h(the)h(directory)f (name)h(supplied)e(as)i(an)f(argumen)m(t)h(do)s(es)f(not)g(refer)h(to)g (an)f(existing)330 1955 y(directory)-8 b(,)32 b Ft(cd)d Fu(will)i(fail)g(instead)g(of)f(falling)h(bac)m(k)h(to)f -Fr(ph)m(ysical)j Fu(mo)s(de.)154 2089 y(49.)61 b(When)37 +Fr(ph)m(ysical)j Fu(mo)s(de.)154 2089 y(48.)61 b(When)37 b(the)h Ft(cd)f Fu(builtin)g(cannot)h(c)m(hange)h(a)f(directory)g(b)s (ecause)g(the)g(length)g(of)f(the)h(pathname)330 2198 y(constructed)52 b(from)f Ft($PWD)f Fu(and)g(the)i(directory)g(name)f @@ -15623,46 +15622,46 @@ y(constructed)52 b(from)f Ft($PWD)f Fu(and)g(the)i(directory)g(name)f y Fr(P)-8 b(A)g(TH)p 584 2308 28 4 v 41 w(MAX)42 b Fu(when)31 b(all)j(sym)m(b)s(olic)e(links)h(are)f(expanded,)h Ft(cd)f Fu(will)g(fail)h(instead)g(of)g(attempting)330 2418 y(to)e(use)f(only)h -(the)f(supplied)f(directory)i(name.)154 2552 y(50.)61 +(the)f(supplied)f(directory)i(name.)154 2552 y(49.)61 b(The)36 b Ft(pwd)f Fu(builtin)h(v)m(eri\014es)h(that)g(the)f(v)-5 b(alue)37 b(it)g(prin)m(ts)e(is)i(the)f(same)h(as)f(the)h(curren)m(t)f (directory)-8 b(,)330 2661 y(ev)m(en)31 b(if)f(it)h(is)g(not)f(ask)m (ed)h(to)g(c)m(hec)m(k)h(the)f(\014le)f(system)h(with)f(the)h -Ft(-P)e Fu(option.)154 2795 y(51.)61 b(When)35 b(listing)g(the)g +Ft(-P)e Fu(option.)154 2795 y(50.)61 b(When)35 b(listing)g(the)g (history)-8 b(,)36 b(the)f Ft(fc)g Fu(builtin)f(do)s(es)g(not)h (include)g(an)f(indication)i(of)f(whether)f(or)330 2905 y(not)d(a)f(history)h(en)m(try)f(has)g(b)s(een)g(mo)s(di\014ed.)154 -3039 y(52.)61 b(The)30 b(default)g(editor)h(used)f(b)m(y)g -Ft(fc)g Fu(is)g Ft(ed)p Fu(.)154 3173 y(53.)61 b(The)37 +3039 y(51.)61 b(The)30 b(default)g(editor)h(used)f(b)m(y)g +Ft(fc)g Fu(is)g Ft(ed)p Fu(.)154 3173 y(52.)61 b(The)37 b Ft(type)g Fu(and)g Ft(command)f Fu(builtins)i(will)g(not)g(rep)s(ort) f(a)i(non-executable)g(\014le)f(as)g(ha)m(ving)h(b)s(een)330 3282 y(found,)26 b(though)h(the)g(shell)g(will)g(attempt)h(to)g (execute)g(suc)m(h)f(a)g(\014le)g(if)g(it)g(is)g(the)g(only)g(so-named) g(\014le)330 3392 y(found)i(in)h Ft($PATH)p Fu(.)154 -3526 y(54.)61 b(The)33 b Ft(vi)f Fu(editing)i(mo)s(de)f(will)g(in)m(v)m +3526 y(53.)61 b(The)33 b Ft(vi)f Fu(editing)i(mo)s(de)f(will)g(in)m(v)m (ok)m(e)i(the)e Ft(vi)g Fu(editor)h(directly)f(when)f(the)i(`)p Ft(v)p Fu(')f(command)g(is)g(run,)330 3635 y(instead)e(of)f(c)m(hec)m (king)i Ft($VISUAL)d Fu(and)g Ft($EDITOR)p Fu(.)154 3769 -y(55.)61 b(When)41 b(the)g Ft(xpg_echo)e Fu(option)i(is)g(enabled,)j +y(54.)61 b(When)41 b(the)g Ft(xpg_echo)e Fu(option)i(is)g(enabled,)j (Bash)d(do)s(es)g(not)g(attempt)h(to)g(in)m(terpret)f(an)m(y)h(ar-)330 3879 y(gumen)m(ts)35 b(to)g Ft(echo)e Fu(as)i(options.)54 b(Eac)m(h)35 b(argumen)m(t)g(is)f(displa)m(y)m(ed,)j(after)e(escap)s(e) g(c)m(haracters)h(are)330 3988 y(con)m(v)m(erted.)154 -4122 y(56.)61 b(The)30 b Ft(ulimit)f Fu(builtin)g(uses)h(a)h(blo)s(c)m +4122 y(55.)61 b(The)30 b Ft(ulimit)f Fu(builtin)g(uses)h(a)h(blo)s(c)m (k)g(size)g(of)g(512)g(b)m(ytes)g(for)f(the)h Ft(-c)f -Fu(and)g Ft(-f)f Fu(options.)154 4256 y(57.)61 b(The)39 +Fu(and)g Ft(-f)f Fu(options.)154 4256 y(56.)61 b(The)39 b(arriv)-5 b(al)41 b(of)f Ft(SIGCHLD)e Fu(when)h(a)h(trap)g(is)g(set)h (on)f Ft(SIGCHLD)e Fu(do)s(es)h(not)h(in)m(terrupt)g(the)g Ft(wait)330 4366 y Fu(builtin)c(and)h(cause)g(it)h(to)f(return)f (immediately)-8 b(.)62 b(The)37 b(trap)f(command)h(is)g(run)e(once)j (for)f(eac)m(h)330 4475 y(c)m(hild)31 b(that)g(exits.)154 -4609 y(58.)61 b(The)27 b Ft(read)f Fu(builtin)g(ma)m(y)i(b)s(e)e(in)m +4609 y(57.)61 b(The)27 b Ft(read)f Fu(builtin)g(ma)m(y)i(b)s(e)e(in)m (terrupted)h(b)m(y)g(a)h(signal)f(for)g(whic)m(h)g(a)h(trap)f(has)g(b)s (een)f(set.)40 b(If)27 b(Bash)330 4719 y(receiv)m(es)41 b(a)f(trapp)s(ed)e(signal)i(while)f(executing)h Ft(read)p Fu(,)h(the)e(trap)h(handler)e(executes)i(and)f Ft(read)330 4829 y Fu(returns)29 b(an)h(exit)i(status)e(greater)i(than)e(128.)154 -4963 y(59.)61 b(Bash)27 b(remo)m(v)m(es)h(an)e(exited)i(bac)m(kground)e +4963 y(58.)61 b(Bash)27 b(remo)m(v)m(es)h(an)e(exited)i(bac)m(kground)e (pro)s(cess's)h(status)g(from)f(the)h(list)g(of)g(suc)m(h)f(statuses)h (after)330 5072 y(the)k Ft(wait)e Fu(builtin)h(is)g(used)g(to)h(obtain) g(it.)275 5230 y(There)j(is)g(other)h Fm(posix)f Fu(b)s(eha)m(vior)h diff --git a/doc/bashref.texi b/doc/bashref.texi index 0ebaf110..3c5cdbcb 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -7773,9 +7773,6 @@ Non-interactive shells exit if there is a syntax error in a script read with the @code{.} or @code{source} builtins, or in a string processed by the @code{eval} builtin. -@item -Process substitution is not available. - @item While variable indirection is available, it may not be applied to the @samp{#} and @samp{?} special parameters. diff --git a/general.c b/general.c index 49c6e4ce..76400e27 100644 --- a/general.c +++ b/general.c @@ -97,7 +97,7 @@ static struct { 0 }; -static char *saved_posix_vars; +static char *saved_posix_vars = 0; void posix_initialize (on) @@ -113,7 +113,13 @@ posix_initialize (on) } /* Things that should be turned on when posix mode is disabled. */ - if (on == 0) + else if (saved_posix_vars) /* on == 0, restore saved settings */ + { + set_posix_options (saved_posix_vars); + free (saved_posix_vars); + saved_posix_vars = 0; + } + else /* on == 0, restore a default set of settings */ { source_searches_cwd = 1; expand_aliases = interactive_shell; diff --git a/lib/readline/bind.c b/lib/readline/bind.c index f25db5c1..4faf9840 100644 --- a/lib/readline/bind.c +++ b/lib/readline/bind.c @@ -1,6 +1,6 @@ /* bind.c -- key binding and startup file support for the readline library. */ -/* Copyright (C) 1987-2019 Free Software Foundation, Inc. +/* Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -166,10 +166,12 @@ rl_bind_key (int key, rl_command_func_t *function) /* If it's bound to a function or macro, just overwrite. Otherwise we have to treat it as a key sequence so rl_generic_bind handles shadow keymaps - for us. If we are binding '\' make sure to escape it so it makes it - through the call to rl_translate_keyseq. */ + for us. If we are binding '\' or \C-@ (NUL) make sure to escape it so + it makes it through the call to rl_translate_keyseq. */ if (_rl_keymap[key].type != ISKMAP) { + if (_rl_keymap[key].type == ISMACR) + xfree ((char *)_rl_keymap[key].function); _rl_keymap[key].type = ISFUNC; _rl_keymap[key].function = function; } @@ -178,8 +180,17 @@ rl_bind_key (int key, rl_command_func_t *function) l = 0; bind_keyseq: if (key == '\\') - keyseq[l++] = '\\'; - keyseq[l++] = key; + { + keyseq[l++] = '\\'; + keyseq[l++] = '\\'; + } + else if (key == '\0') + { + keyseq[l++] = '\\'; + keyseq[l++] = '0'; + } + else + keyseq[l++] = key; keyseq[l] = '\0'; rl_bind_keyseq (keyseq, function); } @@ -451,9 +462,7 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) } else { - if (map[ic].type == ISMACR) - xfree ((char *)map[ic].function); - else if (map[ic].type == ISKMAP) + if (map[ic].type == ISKMAP) { prevmap = map; map = FUNCTION_TO_KEYMAP (map, ic); @@ -466,6 +475,8 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) if (type == ISFUNC && data == 0) data = (char *)_rl_null_function; } + if (map[ic].type == ISMACR) + xfree ((char *)map[ic].function); map[ic].function = KEYMAP_TO_FUNCTION (data); map[ic].type = type; diff --git a/lib/readline/display.c b/lib/readline/display.c index 4631047b..147bf102 100644 --- a/lib/readline/display.c +++ b/lib/readline/display.c @@ -223,7 +223,7 @@ static int msg_bufsiz = 0; static int forced_display; /* Default and initial buffer size. Can grow. */ -static int line_size = DEFAULT_LINE_BUFFER_SIZE; +static int line_size = DEFAULT_LINE_BUFFER_SIZE; /* Set to a non-zero value if horizontal scrolling has been enabled automatically because the terminal was resized to height 1. */ @@ -1678,6 +1678,8 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv consume the first character of old. Fix up `old' so it reflects the new screen contents. We use +1 in the memmove call to copy the trailing NUL. */ + /* (strlen(old+oldbytes) == (omax - oldbytes - 1)) */ + memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1); memcpy (old, new, newbytes); j = newbytes - oldbytes; diff --git a/lib/readline/funmap.c b/lib/readline/funmap.c index 3b836720..0dab3897 100644 --- a/lib/readline/funmap.c +++ b/lib/readline/funmap.c @@ -1,6 +1,6 @@ /* funmap.c -- attach names to functions. */ -/* Copyright (C) 1987-2017 Free Software Foundation, Inc. +/* Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. diff --git a/lib/readline/posixdir.h b/lib/readline/posixdir.h deleted file mode 100644 index af5be801..00000000 --- a/lib/readline/posixdir.h +++ /dev/null @@ -1,71 +0,0 @@ -/* posixdir.h -- Posix directory reading includes and defines. */ - -/* Copyright (C) 1987,1991,2012 Free Software Foundation, Inc. - - This file is part of GNU Bash, the Bourne Again SHell. - - Bash is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Bash is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Bash. If not, see . -*/ - -/* This file should be included instead of or . */ - -#if !defined (_POSIXDIR_H_) -#define _POSIXDIR_H_ - -#if defined (HAVE_DIRENT_H) -# include -# if defined (HAVE_STRUCT_DIRENT_D_NAMLEN) -# define D_NAMLEN(d) ((d)->d_namlen) -# else -# define D_NAMLEN(d) (strlen ((d)->d_name)) -# endif /* !HAVE_STRUCT_DIRENT_D_NAMLEN */ -#else -# if defined (HAVE_SYS_NDIR_H) -# include -# endif -# if defined (HAVE_SYS_DIR_H) -# include -# endif -# if defined (HAVE_NDIR_H) -# include -# endif -# if !defined (dirent) -# define dirent direct -# endif /* !dirent */ -# define D_NAMLEN(d) ((d)->d_namlen) -#endif /* !HAVE_DIRENT_H */ - -/* The bash code fairly consistently uses d_fileno; make sure it's available */ -#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (HAVE_STRUCT_DIRENT_D_FILENO) -# define d_fileno d_ino -#endif - -/* Posix does not require that the d_ino field be present, and some - systems do not provide it. */ -#if !defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO) -# define REAL_DIR_ENTRY(dp) 1 -#else -# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0) -#endif /* _POSIX_SOURCE */ - -#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (BROKEN_DIRENT_D_INO) -# define D_INO_AVAILABLE -#endif - -/* Signal the rest of the code that it can safely use dirent.d_fileno */ -#if defined (D_INO_AVAILABLE) || defined (HAVE_STRUCT_DIRENT_D_FILENO) -# define D_FILENO_AVAILABLE 1 -#endif - -#endif /* !_POSIXDIR_H_ */ diff --git a/lib/readline/posixdir.h b/lib/readline/posixdir.h new file mode 120000 index 00000000..8b163845 --- /dev/null +++ b/lib/readline/posixdir.h @@ -0,0 +1 @@ +../../include/posixdir.h \ No newline at end of file diff --git a/lib/readline/readline.c b/lib/readline/readline.c index 0805fd4b..1adc383b 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -1,7 +1,7 @@ /* readline.c -- a general facility for reading lines of input with emacs style editing and completion. */ -/* Copyright (C) 1987-2019 Free Software Foundation, Inc. +/* Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -870,6 +870,8 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq) _rl_prev_macro_key (); else _rl_unget_char (key); + if (rl_key_sequence_length > 0) + rl_executing_keyseq[--rl_key_sequence_length] = '\0'; return -2; } else if (got_subseq) @@ -882,6 +884,8 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq) _rl_prev_macro_key (); else _rl_unget_char (key); + if (rl_key_sequence_length > 0) + rl_executing_keyseq[--rl_key_sequence_length] = '\0'; return -1; } else @@ -974,7 +978,11 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq) _rl_pushed_input_available () == 0 && _rl_dispatching_keymap[ANYOTHERKEY].function && _rl_input_queued (_rl_keyseq_timeout*1000) == 0) - return (_rl_subseq_result (-2, map, key, got_subseq)); + { + if (rl_key_sequence_length > 0) + rl_executing_keyseq[--rl_key_sequence_length] = '\0'; + return (_rl_subseq_result (-2, map, key, got_subseq)); + } newkey = _rl_subseq_getchar (key); if (newkey < 0) @@ -1065,6 +1073,8 @@ _rl_subseq_result (int r, Keymap map, int key, int got_subseq) _rl_prev_macro_key (); else _rl_unget_char (key); + if (rl_key_sequence_length > 0) + rl_executing_keyseq[--rl_key_sequence_length] = '\0'; _rl_dispatching_keymap = map; return -2; } @@ -1075,6 +1085,8 @@ _rl_subseq_result (int r, Keymap map, int key, int got_subseq) _rl_prev_macro_key (); else _rl_unget_char (key); + if (rl_key_sequence_length > 0) + rl_executing_keyseq[--rl_key_sequence_length] = '\0'; _rl_dispatching_keymap = map; return -1; } diff --git a/lib/readline/text.c b/lib/readline/text.c index ff6ab688..5fe80892 100644 --- a/lib/readline/text.c +++ b/lib/readline/text.c @@ -479,6 +479,8 @@ rl_forward_word (int count, int key) while (count) { + if (rl_point > rl_end) + rl_point = rl_end; if (rl_point == rl_end) return 0; @@ -498,6 +500,8 @@ rl_forward_word (int count, int key) } } + if (rl_point > rl_end) + rl_point = rl_end; if (rl_point == rl_end) return 0; diff --git a/lib/readline/vi_mode.c b/lib/readline/vi_mode.c index dd4c3e8c..53eed15e 100644 --- a/lib/readline/vi_mode.c +++ b/lib/readline/vi_mode.c @@ -1162,6 +1162,7 @@ rl_domove_motion_callback (_rl_vimotion_cxt *m) /* Append a blank character temporarily so that the motion routines work right at the end of the line. Original value of rl_end is saved as m->end. */ + rl_extend_line_buffer (rl_end + 1); rl_line_buffer[rl_end++] = ' '; rl_line_buffer[rl_end] = '\0'; @@ -1193,8 +1194,7 @@ _rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m) /* Remove the blank that we added in rl_domove_motion_callback. */ rl_end = m->end; rl_line_buffer[rl_end] = '\0'; - if (rl_point > rl_end) - rl_point = rl_end; + _rl_fix_point (0); /* No change in position means the command failed. */ if (rl_mark == rl_point) @@ -1518,6 +1518,8 @@ vi_yank_dispatch (_rl_vimotion_cxt *m) rl_do_undo (); rl_point = m->start; + _rl_fix_point (1); + return (0); } diff --git a/parse.y b/parse.y index 35a78aa0..f80a0348 100644 --- a/parse.y +++ b/parse.y @@ -1,6 +1,6 @@ /* parse.y - Yacc grammar for bash. */ -/* Copyright (C) 1989-2017 Free Software Foundation, Inc. +/* Copyright (C) 1989-2020 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -3462,7 +3462,7 @@ itrace("shell_getc: bash_input.location.string = `%s'", bash_input.location.stri #if defined (PROCESS_SUBSTITUTION) /* Check for the constructs which introduce process substitution. Shells running in `posix mode' don't do process substitution. */ - if MBTEST(posixly_correct || ((character != '>' && character != '<') || peek_char != '(')) /*)*/ + if MBTEST((character != '>' && character != '<') || peek_char != '(') /*)*/ #endif /* PROCESS_SUBSTITUTION */ return (character); } diff --git a/po/zh_TW.po b/po/zh_TW.po index 7c45bf1c..0555bc6e 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -11,7 +11,7 @@ msgstr "" "Project-Id-Version: bash 5.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-12-19 15:52-0500\n" -"PO-Revision-Date: 2019-12-06 23:37+0800\n" +"PO-Revision-Date: 2020-01-19 00:50+0800\n" "Last-Translator: pan93412 \n" "Language-Team: Chinese (traditional) \n" "Language: zh_TW\n" @@ -118,7 +118,7 @@ msgstr "「%s」:不明函數名稱" #: builtins/bind.def:312 #, c-format msgid "%s is not bound to any keys.\n" -msgstr "%s 未與任何鍵繫結。\n" +msgstr "%s 未與任何按鍵綁定。\n" #: builtins/bind.def:316 #, c-format @@ -128,7 +128,7 @@ msgstr "%s 可以被呼叫,藉由" #: builtins/bind.def:353 builtins/bind.def:368 #, c-format msgid "`%s': cannot unbind" -msgstr "「%s」: 無法解除繫結" +msgstr "「%s」: 無法解除綁定" #: builtins/break.def:77 builtins/break.def:119 msgid "loop count" @@ -975,7 +975,7 @@ msgstr "錯誤的跳轉" #: error.c:503 #, c-format msgid "%s: unbound variable" -msgstr "%s: 未繫結的變數" +msgstr "%s: 未綁定的變數" #: eval.c:245 #, c-format @@ -1147,7 +1147,7 @@ msgstr "start_pipeline: 行程群組管道" #: jobs.c:1084 #, c-format msgid "forked pid %d appears in running job %d" -msgstr "產生的行程識別號 %d 顯示為執行中的工作 %d" +msgstr "產生的行程識別碼 %d 顯示為執行中的工作 %d" #: jobs.c:1203 #, c-format @@ -1162,12 +1162,12 @@ msgstr "add_process: 行程 %5ld(%s) 進入 the_pipeline" #: jobs.c:1310 #, c-format msgid "add_process: pid %5ld (%s) marked as still alive" -msgstr "add_process: 行程識別號 %5ld(%s) 標註為仍活著" +msgstr "add_process: 行程識別碼 %5ld(%s) 標註為仍活著" #: jobs.c:1639 #, c-format msgid "describe_pid: %ld: no such pid" -msgstr "describe_pid: %ld: 無此行程識別號" +msgstr "describe_pid: %ld: 無此行程識別碼" #: jobs.c:1654 #, c-format @@ -1223,7 +1223,7 @@ msgstr "子行程 setpgid (%ld 到 %ld)" #: jobs.c:2399 nojobs.c:657 #, c-format msgid "wait: pid %ld is not a child of this shell" -msgstr "wait: 行程識別號 %ld 不是目前 shell 的子行程" +msgstr "wait: 行程識別碼 %ld 不是目前 shell 的子行程" #: jobs.c:2695 #, c-format @@ -2169,7 +2169,7 @@ msgstr "unalias [-a] 名稱 [名稱 …]" #: builtins.c:53 msgid "bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]" -msgstr "bind [-lpvsPSVX] [-m 按鍵映射] [-f 檔名] [-q 名稱] [-u 名稱] [-r 鍵序列] [-x 鍵序列:shell- 指令] [鍵序列:readline- 函數 或 readline- 指令]" +msgstr "bind [-lpvsPSVX] [-m 按鍵映射] [-f 檔名] [-q 名稱] [-u 名稱] [-r 按鍵序列] [-x 按鍵序列:shell-指令] [按鍵序列:readline-函數 或 readline-指令]" #: builtins.c:56 msgid "break [n]" @@ -2277,7 +2277,7 @@ msgstr "disown [-h] [-ar] [jobspec ... | pid ...]" #: builtins.c:134 msgid "kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]" -msgstr "kill [-s 訊號規格 | -n 訊號編號 | - 訊號規格] 行程識別號 | 工作規格 … 或 kill -l [訊號規格]" +msgstr "kill [-s 訊號規格 | -n 訊號編號 | -訊號規格] 行程識別碼 | 工作規格 … 或 kill -l [訊號規格]" #: builtins.c:136 msgid "let arg [arg ...]" @@ -2353,7 +2353,7 @@ msgstr "wait [-fn] [編號 …]" #: builtins.c:181 msgid "wait [pid ...]" -msgstr "wait [行程識別號 …]" +msgstr "wait [行程識別碼 …]" #: builtins.c:184 msgid "for NAME [in WORDS ... ] ; do COMMANDS; done" @@ -2541,9 +2541,9 @@ msgid "" " Exit Status:\n" " bind returns 0 unless an unrecognized option is given or an error occurs." msgstr "" -"設定 Readline 鍵繫結和變數。\n" +"設定 Readline 按鍵綁定和變數。\n" " \n" -" 繫結一個鍵序列到一個 Readline 函數或者巨集,或者設定一個\n" +" 綁定一個按鍵序列到一個 Readline 函數或者巨集,或者設定一個\n" " Readline 變數。非選項參數的語法和 ~/.inputrc 檔案中的等\n" " 同,但是必須做為一個參數被傳遞,\n" " 例如,bind '\"\\C-x\\C-r\": re-read-init-file'。\n" @@ -2553,21 +2553,21 @@ msgstr "" " 可被接受的按鍵映射名字有 emacs、emacs-standard、emacs-meta、\n" " emacs-ctlx、vi、vi-move、vi-command、和 vi-insert。\n" " -l 列出函數名稱。\n" -" -P 列出函數名稱和繫結。\n" -" -p 以可以重新用作輸入的格式列出函數名稱和繫結。\n" -" -S 列出可以啟動巨集的鍵序列以及它們的值\n" +" -P 列出函數名稱和綁定。\n" +" -p 以可以重新用作輸入的格式列出函數名稱和綁定。\n" +" -S 列出可以啟動巨集的按鍵序列以及它們的值\n" " -s 以可以重新用作輸入的格式列出可以啟動巨集的鍵以及它們的值。\n" " -V 列出變數名稱和它們的值\n" " -v 以可以重新用作輸入的格式列出變數的名稱和它們的值\n" " -q 函數名 查詢指定的函數可以由哪些鍵啟動。\n" -" -u 函數名 反繫結所有繫結至指定函數的鍵。\n" -" -r 鍵序列 取消指定鍵序列的繫結。\n" -" -f 檔名 從指定檔案中讀取鍵繫結。\n" -" -x 鍵序列:shell 指令\t當指定的鍵序列被輸入時,執行指定的 shell 指令。\n" -" -X 以可被重用的形式列出用 -x 繫結的鍵序列和指令。\n" +" -u 函數名 反綁定所有綁定至指定函數的鍵。\n" +" -r 按鍵序列 取消指定按鍵序列的綁定。\n" +" -f 檔名 從指定檔案中讀取按鍵綁定。\n" +" -x 按鍵序列:shell 指令\t當指定的按鍵序列被輸入時,執行指定的 shell 指令。\n" +" -X 以可被重用的形式列出用 -x 綁定的按鍵序列和指令。\n" " \n" " 退出狀態:\n" -" 除非使用了無法辨認的選項或者錯誤發生,否則回傳 0。" +" 除非使用了無法識別的選項或者錯誤發生,否則回傳 0。" #: builtins.c:330 msgid "" @@ -3472,14 +3472,14 @@ msgstr "" " 不帶選項時,所有活動工作的狀態都會顯示。\n" " \n" " 選項:\n" -" -l\t在正常資訊基礎上列出行程識別號\n" +" -l\t在正常資訊基礎上列出行程識別碼\n" " -n\t僅列出上次通告之後變更了狀態的行程\n" -" -p\t僅列出行程識別號\n" +" -p\t僅列出行程識別碼\n" " -r\t限制僅輸出執行中的工作\n" " -s\t限制僅輸出停止的工作\n" " \n" " 如果使用了 -x 選項,<參數> 中的所有工作規格會被取代為該工作\n" -" 的行程群組首領的行程識別號,然後執行 COMMAND 指令。\n" +" 的行程群組首領的行程識別碼,然後執行 COMMAND 指令。\n" " \n" " 退出狀態:\n" " 回傳成功,除非使用了無效的選項或者有錯誤發生。\n" @@ -3539,7 +3539,7 @@ msgid "" msgstr "" "向一個工作傳送一個訊號。\n" " \n" -" 向以 PID 行程識別號或者 JOBSPEC 工作規格指定的行程傳送一個以\n" +" 向以 PID 行程識別碼或者 JOBSPEC 工作規格指定的行程傳送一個以\n" " SIGSPEC 訊號規格或 SIGNUM 訊號編號命名的訊號。如果沒有指定\n" " SIGSPEC 或 SIGNUM,那麼假定傳送 SIGTERM 訊號。\n" " \n" @@ -3549,7 +3549,7 @@ msgstr "" " -l\t列出訊號名稱;如果參數後跟「-l」則被假設為訊號編號,\n" " \t而相應的訊號名稱會被列出\n" " \n" -" Kill 成為 shell 內建物件有兩個理由:它允許使用工作編號而不是行程識別號,\n" +" Kill 成為 shell 內建物件有兩個理由:它允許使用工作編號而不是行程識別碼,\n" " 並且在可以建立的行程數上限達到時允許行程被砍除。\n" " \n" " 退出狀態:\n" @@ -4525,10 +4525,10 @@ msgstr "" "等待行程完成並且回傳退出狀態。\n" " \n" " 等待指定行程並通報它的終止狀態。如果沒有提供 PID,則目前所有的活躍\n" -" 子行程都會被等待,並且回傳碼為零。PID 必須為行程識別號。\n" +" 子行程都會被等待,並且回傳碼為零。PID 必須為行程識別碼。\n" " \n" " 退出狀態:\n" -" 回傳行程 ID 的狀態;如果 PID 是無效的行程識別號或者指定了無效的選項則失敗。" +" 回傳行程 ID 的狀態;如果 PID 是無效的行程識別碼或者指定了無效的選項則失敗。" #: builtins.c:1538 msgid "" @@ -5179,16 +5179,16 @@ msgid "" " Returns success unless an invalid option is given or a write or assignment\n" " error occurs." msgstr "" -"在 FORMAT 的控制下格式化並印出 <參數>。\n" +"在 <格式> 的控制下格式化並印出 <參數>。\n" " \n" " 選項:\n" " -v var\t將輸出指派給 shell 變數 VAR 而不顯示在標準輸出上\n" " \n" -" FORMAT 是包含三種物件的字串:簡單地被複製到標準輸出的普通字元;\n" +" <格式> 是包含三種物件的字串:簡單地被複製到標準輸出的普通字元;\n" " 被變換之後複製到標準輸入的逸出字元;以及每個都會影響到下個參數的印出格式化規格。\n" " \n" " 在 printf(1) 中描述的標準控制規格之外,printf 解析:\n" -"、 \n" +" \n" " %b\t擴充套件對應參數中的反斜線逸出序列\n" " %q\t以可做為 shell 輸入的格式引用參數\n" " %(fmt)T\t以 FMT 為提供 strftime(3) 的格式輸出日期與時間字串 \n" diff --git a/subst.c b/subst.c index 6c5b32c1..716011a0 100644 --- a/subst.c +++ b/subst.c @@ -10046,7 +10046,7 @@ add_string: { /* XXX - technically this should only be expanded at the start of a word */ - if (string[++sindex] != LPAREN || (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (word->flags & (W_DQUOTE|W_NOPROCSUB)) || posixly_correct) + if (string[++sindex] != LPAREN || (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (word->flags & (W_DQUOTE|W_NOPROCSUB))) { sindex--; /* add_character: label increments sindex */ goto add_character; diff --git a/test.c b/test.c index 9cbc0436..a0b143b7 100644 --- a/test.c +++ b/test.c @@ -639,14 +639,7 @@ unary_test (op, arg) } #if 0 /* TAG:bash-5.1 from Martijn Dekker */ else if (legal_number (arg, &r)) /* -v n == is $n set? */ - { - char *t; - int ret; - t = get_dollar_var_value (r); - ret = t ? TRUE : FALSE; - free (t); - return ret; - } + return ((r >= 0 && r <= number_of_args()) ? TRUE : FALSE); #endif v = find_variable (arg); if (v && invisible_p (v) == 0 && array_p (v)) diff --git a/trap.c b/trap.c index 3cb67cdf..a4c991bc 100644 --- a/trap.c +++ b/trap.c @@ -1,7 +1,7 @@ /* trap.c -- Not the trap command, but useful functions for manipulating those objects. The trap command is in builtins/trap.def. */ -/* Copyright (C) 1987-2018 Free Software Foundation, Inc. +/* Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -294,6 +294,7 @@ run_pending_traps () { register int sig; int old_exit_value, x; + int old_running; WORD_LIST *save_subst_varlist; HASH_TABLE *save_tempenv; sh_parser_state_t pstate; @@ -330,6 +331,7 @@ run_pending_traps () #if defined (ARRAY_VARS) ps = save_pipestatus_array (); #endif + old_running = running_trap; for (sig = 1; sig < NSIG; sig++) { @@ -440,7 +442,7 @@ run_pending_traps () } pending_traps[sig] = 0; /* XXX - move before evalstring? */ - running_trap = 0; + running_trap = old_running; } } @@ -966,7 +968,8 @@ _run_trap_internal (sig, tag) { char *trap_command, *old_trap; int trap_exit_value; - volatile int save_return_catch_flag, function_code, old_int; + volatile int save_return_catch_flag, function_code; + int old_modes, old_running, old_int; int flags; procenv_t save_return_catch; WORD_LIST *save_subst_varlist; @@ -976,13 +979,15 @@ _run_trap_internal (sig, tag) ARRAY *ps; #endif + old_modes = old_running = -1; + trap_exit_value = function_code = 0; trap_saved_exit_value = last_command_exit_value; /* 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) && -#if 0 +#if 1 /* Uncomment this to allow some special signals to recursively execute trap handlers. */ (RECURSIVE_SIG (sig) || (sigmodes[sig] & SIG_INPROGRESS) == 0)) @@ -991,6 +996,9 @@ _run_trap_internal (sig, tag) #endif { old_trap = trap_list[sig]; + old_modes = sigmodes[sig]; + old_running = running_trap; + sigmodes[sig] |= SIG_INPROGRESS; sigmodes[sig] &= ~SIG_CHANGED; /* just to be sure */ trap_command = savestring (old_trap); @@ -1050,8 +1058,10 @@ _run_trap_internal (sig, tag) temporary_env = save_tempenv; - sigmodes[sig] &= ~SIG_INPROGRESS; - running_trap = 0; + if ((old_modes & SIG_INPROGRESS) == 0) + sigmodes[sig] &= ~SIG_INPROGRESS; + + running_trap = old_running; interrupt_state = old_int; if (sigmodes[sig] & SIG_CHANGED)