fix for dequoting words in pretty-print mode; posix mode changes for readonly/export invalid identifier errors

This commit is contained in:
Chet Ramey
2024-01-02 10:42:34 -05:00
parent aa2d23cfac
commit fa0b002927
20 changed files with 1531 additions and 1361 deletions
+32
View File
@@ -8203,3 +8203,35 @@ parse.y
- decode_prompt_string: use save_lastarg() and bind_lastarg() to preserve
the value of $_ across prompt string decoding.
Patch from Grisha Levit <grishalevit@gmail.com>
12/21
-----
lib/readline/doc/readline.3
- updates to some vi-mode bindings
Patch from Josh Brobst <josh@brob.st>
builtins/setattr.def
- set_or_show_attributes: in posix mode, supplying an argument that is
not an identifier when not acting on functions is a utility error.
This will cause a non-interactive shell to exit
12/27
-----
print_cmd.c
- command_print_word_list,print_select_command_head,print_case_command_head,
print_function_def: if we're in pretty-print mode, dequote words
before printing them
Report from Seth Sabar <sethsabar@gmail.com>
shell.c
- execute_profile_file,execute_bashrc_file: separate the (duplicated)
code that sources the various profile and bashrc files out into
separate functions
- find_bashrc_file: new function, returns the name of the interactive
shell startup file that should be executed if --rcfile (--init-file)
is not supplied; currently returns DEFAULT_BASHRC
- bashrc_file: default to NULL, making it just the filename supplied as
an argument to --rcfile/--init-file
- execute_bashrc_file: execute whatever find_bashrc_file() returns
if bashrc_file is NULL
From a patch from Allison Karlitskaya <allison.karlitskaya@redhat.com>
+1
View File
@@ -1145,6 +1145,7 @@ tests/errors7.sub f
tests/errors8.sub f
tests/errors9.sub f
tests/errors10.sub f
tests/errors11.sub f
tests/execscript f
tests/exec.right f
tests/exec1.sub f 755
+32 -27
View File
@@ -223,114 +223,119 @@ The following list is what's changed when 'POSIX mode' is in effect:
42. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
43. The 'trap' builtin displays signal names without the leading
43. If the 'export' and 'readonly' builtin commands get an argument
that is not a valid identifier, and they are not operating on shell
functions, they return an error. This will cause a non-interactive
shell to exit because these are special builtins.
44. The 'trap' builtin displays signal names without the leading
'SIG'.
44. The 'trap' builtin doesn't check the first argument for a possible
45. 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.
45. 'trap -p' without arguments displays signals whose dispositions
46. 'trap -p' without arguments displays signals whose dispositions
are set to SIG_DFL and those that were ignored when the shell
started, not just trapped signals.
46. The '.' and 'source' builtins do not search the current directory
47. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
47. Enabling POSIX mode has the effect of setting the
48. 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.
48. Enabling POSIX mode has the effect of setting the 'shift_verbose'
49. 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.
49. When the 'alias' builtin displays alias definitions, it does not
50. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
50. When the 'set' builtin is invoked without options, it does not
51. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
51. When the 'set' builtin is invoked without options, it displays
52. 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.
52. When the 'cd' builtin is invoked in logical mode, and the pathname
53. 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.
53. When the 'cd' builtin cannot change a directory because the length
54. 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.
54. The 'pwd' builtin verifies that the value it prints is the same as
55. 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.
55. When listing the history, the 'fc' builtin does not include an
56. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
56. The default editor used by 'fc' is 'ed'.
57. The default editor used by 'fc' is 'ed'.
57. If there are too many arguments supplied to 'fc -s', 'fc' prints
58. If there are too many arguments supplied to 'fc -s', 'fc' prints
an error message and returns failure.
58. The 'type' and 'command' builtins will not report a non-executable
59. 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'.
59. The 'vi' editing mode will invoke the 'vi' editor directly when
60. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
60. When the 'xpg_echo' option is enabled, Bash does not attempt to
61. 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.
61. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
62. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
62. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
63. 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.
63. The 'read' builtin may be interrupted by a signal for which a trap
64. 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.
64. The 'printf' builtin uses 'double' (via 'strtod') to convert
65. The 'printf' builtin uses 'double' (via 'strtod') to convert
arguments corresponding to floating point conversion specifiers,
instead of 'long double' if it's available. The 'L' length
modifier forces 'printf' to use 'long double' if it's available.
65. Bash removes an exited background process's status from the list
66. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
66. A double quote character ('"') is treated specially when it
67. A double quote character ('"') is treated specially when it
appears in a backquoted command substitution in the body of a
here-document that undergoes expansion. That means, for example,
that a backslash preceding a double quote character will escape it
and the backslash will be removed.
67. The 'test' builtin compares strings using the current locale when
68. The 'test' builtin compares strings using the current locale when
processing the '<' and '>' binary operators.
68. The 'test' builtin's '-t' unary primary requires an argument.
69. The 'test' builtin's '-t' unary primary requires an argument.
Historical versions of 'test' made the argument optional in certain
cases, and Bash attempts to accommodate those for backwards
compatibility.
69. Command substitutions don't set the '?' special parameter. The
70. Command substitutions don't set the '?' special parameter. The
exit status of a simple command without a command word is still the
exit status of the last command substitution that occurred while
evaluating the variable assignments and redirections in that
+2 -2
View File
@@ -27,8 +27,8 @@ $SHORT_DOC complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G glo
Specify how arguments are to be completed by Readline.
For each NAME, specify how arguments are to be completed. If no options
are supplied, existing completion specifications are printed in a way that
allows them to be reused as input.
or NAMEs are supplied, display existing completion specifications in a way
that allows them to be reused as input.
Options:
-p print existing completion specifications in a reusable format
+18 -5
View File
@@ -121,7 +121,7 @@ int
set_or_show_attributes (WORD_LIST *list, int attribute, int nodefs)
{
register SHELL_VAR *var;
int assign, undo, any_failed, assign_error, opt;
int assign, undo, any_failed, assign_error, util_error, opt, retval;
int functions_only, arrays_only, assoc_only;
int aflags;
char *name;
@@ -133,7 +133,9 @@ set_or_show_attributes (WORD_LIST *list, int attribute, int nodefs)
#endif
functions_only = arrays_only = assoc_only = 0;
undo = any_failed = assign_error = 0;
undo = any_failed = assign_error = util_error = 0;
retval = EXECUTION_SUCCESS;
/* Read arguments from the front of the list. */
reset_internal_getopt ();
while ((opt = internal_getopt (list, ATTROPTS)) != -1)
@@ -216,6 +218,11 @@ set_or_show_attributes (WORD_LIST *list, int attribute, int nodefs)
sh_invalidid (name);
if (assign)
assign_error++;
else if (posixly_correct)
{
util_error++;
break; /* exit immediately on bad identifier */
}
else
any_failed++;
list = list->next;
@@ -338,9 +345,15 @@ set_or_show_attributes (WORD_LIST *list, int attribute, int nodefs)
}
}
return (assign_error ? EX_BADASSIGN
: ((any_failed == 0) ? EXECUTION_SUCCESS
: EXECUTION_FAILURE));
/* various failure modes */
if (assign_error)
retval = EX_BADASSIGN;
else if (util_error) /* only posix mode sets this */
retval = EX_UTILERROR;
else if (any_failed)
retval = EXECUTION_FAILURE;
return (retval);
}
/* Show all variable variables (v == 1) or functions (v == 0) with
+3 -3
View File
@@ -6620,9 +6620,9 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE
levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM--
PPAATT.
Bash-5.0 is the final version for which there will be an individual
shopt option for the previous version. Users should use BBAASSHH__CCOOMMPPAATT on
bash-5.0 and later versions.
Bash-5.0 was the final version for which there will be an individual
shopt option for the previous version. Users should control the compat-
ibility level with BBAASSHH__CCOOMMPPAATT.
The following table describes the behavior changes controlled by each
compatibility level setting. The ccoommppaatt_N_N tag is used as shorthand for
+6 -5
View File
@@ -8275,7 +8275,8 @@ matches were generated.
\fBcomplete\fP \fB\-pr\fP [\fB\-DEI\fP] [\fIname\fP ...]
.PD
Specify how arguments to each \fIname\fP should be completed.
If the \fB\-p\fP option is supplied, or if no options are supplied,
If the \fB\-p\fP option is supplied, or if no options or \fIname\fPs
are supplied,
existing completion specifications are printed in a way that allows
them to be reused as input.
The \fB\-r\fP option removes a completion specification for
@@ -11688,11 +11689,11 @@ Eventually, the options will be removed in favor of
.SM
.BR BASH_COMPAT .
.PP
Bash-5.0 is the final version for which there will be an individual shopt
option for the previous version. Users should use
Bash-5.0 was the final version for which there will be an individual shopt
option for the previous version. Users should control the compatibility
level with
.SM
.B BASH_COMPAT
on bash-5.0 and later versions.
.BR BASH_COMPAT .
.PP
The following table describes the behavior changes controlled by each
compatibility level setting.
+90 -85
View File
@@ -7469,114 +7469,119 @@ startup files.
42. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
43. The 'trap' builtin displays signal names without the leading
43. If the 'export' and 'readonly' builtin commands get an argument
that is not a valid identifier, and they are not operating on shell
functions, they return an error. This will cause a non-interactive
shell to exit because these are special builtins.
44. The 'trap' builtin displays signal names without the leading
'SIG'.
44. The 'trap' builtin doesn't check the first argument for a possible
45. 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.
45. 'trap -p' without arguments displays signals whose dispositions
46. 'trap -p' without arguments displays signals whose dispositions
are set to SIG_DFL and those that were ignored when the shell
started, not just trapped signals.
46. The '.' and 'source' builtins do not search the current directory
47. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
47. Enabling POSIX mode has the effect of setting the
48. 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.
48. Enabling POSIX mode has the effect of setting the 'shift_verbose'
49. 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.
49. When the 'alias' builtin displays alias definitions, it does not
50. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
50. When the 'set' builtin is invoked without options, it does not
51. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
51. When the 'set' builtin is invoked without options, it displays
52. 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.
52. When the 'cd' builtin is invoked in logical mode, and the pathname
53. 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.
53. When the 'cd' builtin cannot change a directory because the length
54. 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.
54. The 'pwd' builtin verifies that the value it prints is the same as
55. 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.
55. When listing the history, the 'fc' builtin does not include an
56. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
56. The default editor used by 'fc' is 'ed'.
57. The default editor used by 'fc' is 'ed'.
57. If there are too many arguments supplied to 'fc -s', 'fc' prints
58. If there are too many arguments supplied to 'fc -s', 'fc' prints
an error message and returns failure.
58. The 'type' and 'command' builtins will not report a non-executable
59. 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'.
59. The 'vi' editing mode will invoke the 'vi' editor directly when
60. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
60. When the 'xpg_echo' option is enabled, Bash does not attempt to
61. 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.
61. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
62. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
62. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
63. 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.
63. The 'read' builtin may be interrupted by a signal for which a trap
64. 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.
64. The 'printf' builtin uses 'double' (via 'strtod') to convert
65. The 'printf' builtin uses 'double' (via 'strtod') to convert
arguments corresponding to floating point conversion specifiers,
instead of 'long double' if it's available. The 'L' length
modifier forces 'printf' to use 'long double' if it's available.
65. Bash removes an exited background process's status from the list
66. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
66. A double quote character ('"') is treated specially when it
67. A double quote character ('"') is treated specially when it
appears in a backquoted command substitution in the body of a
here-document that undergoes expansion. That means, for example,
that a backslash preceding a double quote character will escape it
and the backslash will be removed.
67. The 'test' builtin compares strings using the current locale when
68. The 'test' builtin compares strings using the current locale when
processing the '<' and '>' binary operators.
68. The 'test' builtin's '-t' unary primary requires an argument.
69. The 'test' builtin's '-t' unary primary requires an argument.
Historical versions of 'test' made the argument optional in certain
cases, and Bash attempts to accommodate those for backwards
compatibility.
69. Command substitutions don't set the '?' special parameter. The
70. Command substitutions don't set the '?' special parameter. The
exit status of a simple command without a command word is still the
exit status of the last command substitution that occurred while
evaluating the variable assignments and redirections in that
@@ -7642,9 +7647,9 @@ compatibility level.
compatibility levels. Eventually, the options will be removed in favor
of 'BASH_COMPAT'.
Bash-5.0 is the final version for which there will be an individual
shopt option for the previous version. Users should use 'BASH_COMPAT'
on bash-5.0 and later versions.
Bash-5.0 was the final version for which there will be an individual
shopt option for the previous version. Users should control the
compatibility level with 'BASH_COMPAT'.
The following table describes the behavior changes controlled by each
compatibility level setting. The 'compat'NN tag is used as shorthand
@@ -12985,61 +12990,61 @@ Node: Directory Stack Builtins300715
Node: Controlling the Prompt304972
Node: The Restricted Shell307934
Node: Bash POSIX Mode310541
Node: Shell Compatibility Mode327183
Node: Job Control335428
Node: Job Control Basics335885
Node: Job Control Builtins340884
Node: Job Control Variables346676
Node: Command Line Editing347829
Node: Introduction and Notation349497
Node: Readline Interaction351117
Node: Readline Bare Essentials352305
Node: Readline Movement Commands354091
Node: Readline Killing Commands355048
Node: Readline Arguments356966
Node: Searching358007
Node: Readline Init File360190
Node: Readline Init File Syntax361448
Node: Conditional Init Constructs385470
Node: Sample Init File389663
Node: Bindable Readline Commands392784
Node: Commands For Moving393985
Node: Commands For History396033
Node: Commands For Text401024
Node: Commands For Killing404999
Node: Numeric Arguments407700
Node: Commands For Completion408836
Node: Keyboard Macros413024
Node: Miscellaneous Commands413709
Node: Readline vi Mode420075
Node: Programmable Completion420979
Node: Programmable Completion Builtins428756
Node: A Programmable Completion Example439873
Node: Using History Interactively445118
Node: Bash History Facilities445799
Node: Bash History Builtins448807
Node: History Interaction453895
Node: Event Designators458144
Node: Word Designators459679
Node: Modifiers461541
Node: Installing Bash463346
Node: Basic Installation464480
Node: Compilers and Options468199
Node: Compiling For Multiple Architectures468937
Node: Installation Names470626
Node: Specifying the System Type472732
Node: Sharing Defaults473446
Node: Operation Controls474116
Node: Optional Features475071
Node: Reporting Bugs486288
Node: Major Differences From The Bourne Shell487619
Node: GNU Free Documentation License504474
Node: Indexes529648
Node: Builtin Index530099
Node: Reserved Word Index537197
Node: Variable Index539642
Node: Function Index556773
Node: Concept Index570629
Node: Shell Compatibility Mode327455
Node: Job Control335703
Node: Job Control Basics336160
Node: Job Control Builtins341159
Node: Job Control Variables346951
Node: Command Line Editing348104
Node: Introduction and Notation349772
Node: Readline Interaction351392
Node: Readline Bare Essentials352580
Node: Readline Movement Commands354366
Node: Readline Killing Commands355323
Node: Readline Arguments357241
Node: Searching358282
Node: Readline Init File360465
Node: Readline Init File Syntax361723
Node: Conditional Init Constructs385745
Node: Sample Init File389938
Node: Bindable Readline Commands393059
Node: Commands For Moving394260
Node: Commands For History396308
Node: Commands For Text401299
Node: Commands For Killing405274
Node: Numeric Arguments407975
Node: Commands For Completion409111
Node: Keyboard Macros413299
Node: Miscellaneous Commands413984
Node: Readline vi Mode420350
Node: Programmable Completion421254
Node: Programmable Completion Builtins429031
Node: A Programmable Completion Example440148
Node: Using History Interactively445393
Node: Bash History Facilities446074
Node: Bash History Builtins449082
Node: History Interaction454170
Node: Event Designators458419
Node: Word Designators459954
Node: Modifiers461816
Node: Installing Bash463621
Node: Basic Installation464755
Node: Compilers and Options468474
Node: Compiling For Multiple Architectures469212
Node: Installation Names470901
Node: Specifying the System Type473007
Node: Sharing Defaults473721
Node: Operation Controls474391
Node: Optional Features475346
Node: Reporting Bugs486563
Node: Major Differences From The Bourne Shell487894
Node: GNU Free Documentation License504749
Node: Indexes529923
Node: Builtin Index530374
Node: Reserved Word Index537472
Node: Variable Index539917
Node: Function Index557048
Node: Concept Index570904

End Tag Table
+90 -85
View File
@@ -7470,114 +7470,119 @@ startup files.
42. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
43. The 'trap' builtin displays signal names without the leading
43. If the 'export' and 'readonly' builtin commands get an argument
that is not a valid identifier, and they are not operating on shell
functions, they return an error. This will cause a non-interactive
shell to exit because these are special builtins.
44. The 'trap' builtin displays signal names without the leading
'SIG'.
44. The 'trap' builtin doesn't check the first argument for a possible
45. 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.
45. 'trap -p' without arguments displays signals whose dispositions
46. 'trap -p' without arguments displays signals whose dispositions
are set to SIG_DFL and those that were ignored when the shell
started, not just trapped signals.
46. The '.' and 'source' builtins do not search the current directory
47. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
47. Enabling POSIX mode has the effect of setting the
48. 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.
48. Enabling POSIX mode has the effect of setting the 'shift_verbose'
49. 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.
49. When the 'alias' builtin displays alias definitions, it does not
50. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
50. When the 'set' builtin is invoked without options, it does not
51. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
51. When the 'set' builtin is invoked without options, it displays
52. 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.
52. When the 'cd' builtin is invoked in logical mode, and the pathname
53. 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.
53. When the 'cd' builtin cannot change a directory because the length
54. 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.
54. The 'pwd' builtin verifies that the value it prints is the same as
55. 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.
55. When listing the history, the 'fc' builtin does not include an
56. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
56. The default editor used by 'fc' is 'ed'.
57. The default editor used by 'fc' is 'ed'.
57. If there are too many arguments supplied to 'fc -s', 'fc' prints
58. If there are too many arguments supplied to 'fc -s', 'fc' prints
an error message and returns failure.
58. The 'type' and 'command' builtins will not report a non-executable
59. 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'.
59. The 'vi' editing mode will invoke the 'vi' editor directly when
60. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
60. When the 'xpg_echo' option is enabled, Bash does not attempt to
61. 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.
61. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
62. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
62. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
63. 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.
63. The 'read' builtin may be interrupted by a signal for which a trap
64. 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.
64. The 'printf' builtin uses 'double' (via 'strtod') to convert
65. The 'printf' builtin uses 'double' (via 'strtod') to convert
arguments corresponding to floating point conversion specifiers,
instead of 'long double' if it's available. The 'L' length
modifier forces 'printf' to use 'long double' if it's available.
65. Bash removes an exited background process's status from the list
66. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
66. A double quote character ('"') is treated specially when it
67. A double quote character ('"') is treated specially when it
appears in a backquoted command substitution in the body of a
here-document that undergoes expansion. That means, for example,
that a backslash preceding a double quote character will escape it
and the backslash will be removed.
67. The 'test' builtin compares strings using the current locale when
68. The 'test' builtin compares strings using the current locale when
processing the '<' and '>' binary operators.
68. The 'test' builtin's '-t' unary primary requires an argument.
69. The 'test' builtin's '-t' unary primary requires an argument.
Historical versions of 'test' made the argument optional in certain
cases, and Bash attempts to accommodate those for backwards
compatibility.
69. Command substitutions don't set the '?' special parameter. The
70. Command substitutions don't set the '?' special parameter. The
exit status of a simple command without a command word is still the
exit status of the last command substitution that occurred while
evaluating the variable assignments and redirections in that
@@ -7643,9 +7648,9 @@ compatibility level.
compatibility levels. Eventually, the options will be removed in favor
of 'BASH_COMPAT'.
Bash-5.0 is the final version for which there will be an individual
shopt option for the previous version. Users should use 'BASH_COMPAT'
on bash-5.0 and later versions.
Bash-5.0 was the final version for which there will be an individual
shopt option for the previous version. Users should control the
compatibility level with 'BASH_COMPAT'.
The following table describes the behavior changes controlled by each
compatibility level setting. The 'compat'NN tag is used as shorthand
@@ -12986,61 +12991,61 @@ Node: Directory Stack Builtins300937
Node: Controlling the Prompt305197
Node: The Restricted Shell308162
Node: Bash POSIX Mode310772
Node: Shell Compatibility Mode327417
Node: Job Control335665
Node: Job Control Basics336125
Node: Job Control Builtins341127
Node: Job Control Variables346922
Node: Command Line Editing348078
Node: Introduction and Notation349749
Node: Readline Interaction351372
Node: Readline Bare Essentials352563
Node: Readline Movement Commands354352
Node: Readline Killing Commands355312
Node: Readline Arguments357233
Node: Searching358277
Node: Readline Init File360463
Node: Readline Init File Syntax361724
Node: Conditional Init Constructs385749
Node: Sample Init File389945
Node: Bindable Readline Commands393069
Node: Commands For Moving394273
Node: Commands For History396324
Node: Commands For Text401318
Node: Commands For Killing405296
Node: Numeric Arguments408000
Node: Commands For Completion409139
Node: Keyboard Macros413330
Node: Miscellaneous Commands414018
Node: Readline vi Mode420387
Node: Programmable Completion421294
Node: Programmable Completion Builtins429074
Node: A Programmable Completion Example440194
Node: Using History Interactively445442
Node: Bash History Facilities446126
Node: Bash History Builtins449137
Node: History Interaction454228
Node: Event Designators458480
Node: Word Designators460018
Node: Modifiers461883
Node: Installing Bash463691
Node: Basic Installation464828
Node: Compilers and Options468550
Node: Compiling For Multiple Architectures469291
Node: Installation Names470983
Node: Specifying the System Type473092
Node: Sharing Defaults473809
Node: Operation Controls474482
Node: Optional Features475440
Node: Reporting Bugs486660
Node: Major Differences From The Bourne Shell487994
Node: GNU Free Documentation License504852
Node: Indexes530029
Node: Builtin Index530483
Node: Reserved Word Index537584
Node: Variable Index540032
Node: Function Index557166
Node: Concept Index571025
Node: Shell Compatibility Mode327689
Node: Job Control335940
Node: Job Control Basics336400
Node: Job Control Builtins341402
Node: Job Control Variables347197
Node: Command Line Editing348353
Node: Introduction and Notation350024
Node: Readline Interaction351647
Node: Readline Bare Essentials352838
Node: Readline Movement Commands354627
Node: Readline Killing Commands355587
Node: Readline Arguments357508
Node: Searching358552
Node: Readline Init File360738
Node: Readline Init File Syntax361999
Node: Conditional Init Constructs386024
Node: Sample Init File390220
Node: Bindable Readline Commands393344
Node: Commands For Moving394548
Node: Commands For History396599
Node: Commands For Text401593
Node: Commands For Killing405571
Node: Numeric Arguments408275
Node: Commands For Completion409414
Node: Keyboard Macros413605
Node: Miscellaneous Commands414293
Node: Readline vi Mode420662
Node: Programmable Completion421569
Node: Programmable Completion Builtins429349
Node: A Programmable Completion Example440469
Node: Using History Interactively445717
Node: Bash History Facilities446401
Node: Bash History Builtins449412
Node: History Interaction454503
Node: Event Designators458755
Node: Word Designators460293
Node: Modifiers462158
Node: Installing Bash463966
Node: Basic Installation465103
Node: Compilers and Options468825
Node: Compiling For Multiple Architectures469566
Node: Installation Names471258
Node: Specifying the System Type473367
Node: Sharing Defaults474084
Node: Operation Controls474757
Node: Optional Features475715
Node: Reporting Bugs486935
Node: Major Differences From The Bourne Shell488269
Node: GNU Free Documentation License505127
Node: Indexes530304
Node: Builtin Index530758
Node: Reserved Word Index537859
Node: Variable Index540307
Node: Function Index557441
Node: Concept Index571300

End Tag Table
+10 -3
View File
@@ -8680,6 +8680,13 @@ prefix.
The @code{export} and @code{readonly} builtin commands display their
output in the format required by @sc{posix}.
@item
If the @code{export} and @code{readonly} builtin commands get an argument
that is not a valid identifier, and they are not operating on shell
functions, they return an error.
This will cause a non-interactive shell to exit because these are
special builtins.
@item
The @code{trap} builtin displays signal names without the leading
@code{SIG}.
@@ -8895,9 +8902,9 @@ Starting with bash-4.4, Bash has begun deprecating older compatibility
levels.
Eventually, the options will be removed in favor of @env{BASH_COMPAT}.
Bash-5.0 is the final version for which there will be an individual shopt
option for the previous version. Users should use @env{BASH_COMPAT}
on bash-5.0 and later versions.
Bash-5.0 was the final version for which there will be an individual shopt
option for the previous version.
Users should control the compatibility level with @env{BASH_COMPAT}.
The following table describes the behavior changes controlled by each
compatibility level setting.
+1001 -998
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Thu Dec 14 11:05:10 EST 2023
@set LASTCHANGE Thu Dec 21 12:07:50 EST 2023
@set EDITION 5.3
@set VERSION 5.3
@set UPDATED 14 December 2023
@set UPDATED 21 December 2023
@set UPDATED-MONTH December 2023
+9 -7
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Mon Jul 17 16:46:23 EDT 2023
.\" Last Change: Thu Dec 21 09:29:52 EST 2023
.\"
.TH READLINE 3 "2023 July 17" "GNU Readline 8.3"
.TH READLINE 3 "2023 December 21" "GNU Readline 8.3"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -1464,15 +1464,17 @@ VI Insert Mode functions
"C-I" complete
"C-J" accept-line
"C-M" accept-line
"C-N" menu-complete
"C-P" menu-complete-backward
"C-R" reverse-search-history
"C-S" forward-search-history
"C-T" transpose-chars
"C-U" unix-line-discard
"C-V" quoted-insert
"C-W" unix-word-rubout
"C-W" vi-unix-word-rubout
"C-Y" yank
"C-[" vi-movement-mode
"C-_" undo
"C-_" vi-undo
"\^ " to "\(ti" self-insert
"C-?" backward-delete-char
.PP
@@ -1494,7 +1496,7 @@ VI Command Mode functions
"C-T" transpose-chars
"C-U" unix-line-discard
"C-V" quoted-insert
"C-W" unix-word-rubout
"C-W" vi-unix-word-rubout
"C-Y" yank
"C-_" vi-undo
"\^ " forward-char
@@ -1528,7 +1530,7 @@ VI Command Mode functions
"T" vi-char-search
"U" revert-line
"W" vi-next-word
"X" backward-delete-char
"X" vi-rubout
"Y" vi-yank-to
"\e" vi-complete
"\(ha" vi-first-print
@@ -1543,7 +1545,7 @@ VI Command Mode functions
"h" backward-char
"i" vi-insertion-mode
"j" next-history
"k" prev-history
"k" previous-history
"l" forward-char
"m" vi-set-mark
"n" vi-search-again
+2 -1
View File
@@ -2161,7 +2161,8 @@ matches were generated.
@end example
Specify how arguments to each @var{name} should be completed.
If the @option{-p} option is supplied, or if no options are supplied, existing
If the @option{-p} option is supplied, or if no options or @var{name}s
are supplied, existing
completion specifications are printed in a way that allows them to be
reused as input.
The @option{-r} option removes a completion specification for
+2 -2
View File
@@ -39,9 +39,9 @@ extern "C" {
#endif
/* Hex-encoded Readline version number. */
#define RL_READLINE_VERSION 0x0802 /* Readline 8.2 */
#define RL_READLINE_VERSION 0x0803 /* Readline 8.3 */
#define RL_VERSION_MAJOR 8
#define RL_VERSION_MINOR 2
#define RL_VERSION_MINOR 3
/* Readline data structures. */
+31 -7
View File
@@ -585,7 +585,17 @@ xtrace_print_word_list (WORD_LIST *list, int xtflags)
static void
command_print_word_list (WORD_LIST *list, char *separator)
{
_print_word_list (list, separator, cprintf);
WORD_LIST *nlist;
/* A start at removing CTLESC from commands that haven't been expanded. */
if (pretty_print_mode)
{
nlist = list ? dequote_list (list) : list;
_print_word_list (nlist, separator, cprintf);
/* we're just pretty-printing, so this can be destructive */
}
else
_print_word_list (list, separator, cprintf);
}
void
@@ -645,7 +655,12 @@ print_arith_for_command (ARITH_FOR_COM *arith_for_command)
void
print_select_command_head (SELECT_COM *select_command)
{
cprintf ("select %s in ", select_command->name->word);
WORD_DESC *w;
w = (pretty_print_mode) ? dequote_word (select_command->name) : select_command->name;
/* we're just pretty-printing, so this can be destructive */
cprintf ("select %s in ", w->word);
command_print_word_list (select_command->map_list, " ");
}
@@ -715,7 +730,12 @@ print_group_command (GROUP_COM *group_command)
void
print_case_command_head (CASE_COM *case_command)
{
cprintf ("case %s in ", case_command->word->word);
WORD_DESC *w;
w = (pretty_print_mode) ? dequote_word (case_command->word) : case_command->word;
/* we're just pretty-printing, so this can be destructive */
cprintf ("case %s in ", w->word);
}
void
@@ -1288,16 +1308,20 @@ print_function_def (FUNCTION_DEF *func)
{
COMMAND *cmdcopy;
REDIRECT *func_redirects;
WORD_DESC *w;
w = pretty_print_mode ? dequote_word (func->name) : func->name;
/* we're just pretty-printing, so this can be destructive */
func_redirects = NULL;
/* When in posix mode, print functions as posix specifies them, but prefix
`function' to words that are not valid POSIX identifiers. */
if (posixly_correct == 0)
cprintf ("function %s () \n", func->name->word);
else if (valid_function_name (func->name->word, posixly_correct) == 0)
cprintf ("function %s () \n", func->name->word);
cprintf ("function %s () \n", w->word);
else if (valid_function_name (w->word, posixly_correct) == 0)
cprintf ("function %s () \n", w->word);
else
cprintf ("%s () \n", func->name->word);
cprintf ("%s () \n", w->word);
begin_unwind_frame ("function-def");
add_unwind_protect (uw_reset_locals, 0);
+55 -43
View File
@@ -196,8 +196,8 @@ int have_devfd = HAVE_DEV_FD;
int have_devfd = 0;
#endif
/* The name of the .(shell)rc file. */
static char *bashrc_file = DEFAULT_BASHRC;
/* The name of the .(shell)rc file, DEFAULT_BASHRC is sourced by default */
static char *bashrc_file;
/* Non-zero means to act more like the Bourne shell on startup. */
static int act_like_sh;
@@ -321,6 +321,8 @@ static void add_shopt_to_alist (char *, int);
static void run_shopt_alist (void);
static void execute_env_file (char *);
static void execute_profile_file (void);
static void execute_bashrc_file (void);
static void run_startup_files (void);
static int open_shell_script (char *);
static void set_bash_input (void);
@@ -1090,6 +1092,7 @@ set_exit_status (int s)
*/
static void
execute_env_file (char *env_file)
{
char *fn;
@@ -1103,6 +1106,50 @@ execute_env_file (char *env_file)
}
}
/* Execute /etc/profile and one of the personal login shell initialization files. */
static void
execute_profile_file (void)
{
maybe_execute_file (SYS_PROFILE, 1);
if (act_like_sh) /* sh */
maybe_execute_file ("~/.profile", 1);
else if ((maybe_execute_file ("~/.bash_profile", 1) == 0) &&
(maybe_execute_file ("~/.bash_login", 1) == 0)) /* bash */
maybe_execute_file ("~/.profile", 1);
}
/* Return the name of the default interactive shell startup file. We just
return the name of the historical bash startup file, but we could look
at a BASHRC variable or some more elaborate scheme. */
static inline char *
find_bashrc_file (void)
{
return DEFAULT_BASHRC;
}
static void
execute_bashrc_file (void)
{
#ifdef SYS_BASHRC
# if defined (__OPENNT)
maybe_execute_file (_prefixInstallPath(SYS_BASHRC, NULL, 0), 1);
# else
maybe_execute_file (SYS_BASHRC, 1);
# endif
#endif
if (bashrc_file)
maybe_execute_file (bashrc_file, 1);
else
{
char *fn;
if (fn = find_bashrc_file ())
maybe_execute_file (fn, 1); /* don't have to free this yet */
}
}
static void
run_startup_files (void)
{
@@ -1111,7 +1158,7 @@ run_startup_files (void)
#endif
int sourced_login, run_by_ssh;
#if 1 /* TAG:bash-5.3 andrew.gregory.8@gmail.com 2/21/2022 */
/* TAG:bash-5.3 andrew.gregory.8@gmail.com 2/21/2022 */
/* get the rshd/sshd case out of the way first. */
if (interactive_shell == 0 && no_rc == 0 && login_shell == 0 &&
act_like_sh == 0 && command_execution_string && shell_level < 2)
@@ -1121,7 +1168,6 @@ run_startup_files (void)
(find_variable ("SSH2_CLIENT") != (SHELL_VAR *)0);
#else
run_by_ssh = 0;
#endif
#endif
ssh_reading_startup_files = 0;
@@ -1134,14 +1180,7 @@ run_startup_files (void)
#endif
{
ssh_reading_startup_files = 1;
#ifdef SYS_BASHRC
# if defined (__OPENNT)
maybe_execute_file (_prefixInstallPath(SYS_BASHRC, NULL, 0), 1);
# else
maybe_execute_file (SYS_BASHRC, 1);
# endif
#endif
maybe_execute_file (bashrc_file, 1);
execute_bashrc_file ();
ssh_reading_startup_files = 0;
return;
}
@@ -1170,15 +1209,7 @@ run_startup_files (void)
/* Execute /etc/profile and one of the personal login shell
initialization files. */
if (no_profile == 0)
{
maybe_execute_file (SYS_PROFILE, 1);
if (act_like_sh) /* sh */
maybe_execute_file ("~/.profile", 1);
else if ((maybe_execute_file ("~/.bash_profile", 1) == 0) &&
(maybe_execute_file ("~/.bash_login", 1) == 0)) /* bash */
maybe_execute_file ("~/.profile", 1);
}
execute_profile_file ();
sourced_login = 1;
}
@@ -1203,32 +1234,13 @@ run_startup_files (void)
/* We don't execute .bashrc for login shells. */
no_rc++;
/* Execute /etc/profile and one of the personal login shell
initialization files. */
if (no_profile == 0)
{
maybe_execute_file (SYS_PROFILE, 1);
if (act_like_sh) /* sh */
maybe_execute_file ("~/.profile", 1);
else if ((maybe_execute_file ("~/.bash_profile", 1) == 0) &&
(maybe_execute_file ("~/.bash_login", 1) == 0)) /* bash */
maybe_execute_file ("~/.profile", 1);
}
execute_profile_file ();
}
/* bash */
if (act_like_sh == 0 && no_rc == 0)
{
#ifdef SYS_BASHRC
# if defined (__OPENNT)
maybe_execute_file (_prefixInstallPath(SYS_BASHRC, NULL, 0), 1);
# else
maybe_execute_file (SYS_BASHRC, 1);
# endif
#endif
maybe_execute_file (bashrc_file, 1);
}
execute_bashrc_file ();
/* sh */
else if (act_like_sh && privileged_mode == 0 && sourced_env++ == 0)
execute_env_file (get_string_value ("ENV"));
@@ -2009,7 +2021,7 @@ shell_reinitialize (void)
/* Ensure that the default startup file is used. (Except that we don't
execute this file for reinitialized shells). */
bashrc_file = DEFAULT_BASHRC;
bashrc_file = NULL;
/* Delete all variables and functions. They will be reinitialized when
the environment is parsed. */
+100 -78
View File
@@ -45,106 +45,100 @@ exec: usage: exec [-cl] [-a name] [command [argument ...]] [redirection ...]
hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
./errors.tests: line 153: hash: -d: option requires an argument
./errors.tests: line 157: hash: hashing disabled
./errors.tests: line 160: export: `AA[4]': not a valid identifier
./errors.tests: line 161: readonly: `AA[4]': not a valid identifier
./errors.tests: line 162: export: `invalid-var=4': not a valid identifier
./errors.tests: line 163: readonly: `invalid-var=4': not a valid identifier
./errors.tests: line 164: export: `invalid-var': not a valid identifier
./errors.tests: line 165: readonly: `invalid-var': not a valid identifier
./errors.tests: line 168: unset: [-2]: bad array subscript
./errors.tests: line 172: AA: readonly variable
./errors.tests: line 176: AA: readonly variable
./errors.tests: line 184: shift: 5: shift count out of range
./errors.tests: line 185: shift: -2: shift count out of range
./errors.tests: line 186: shift: 5: shift count out of range
./errors.tests: line 187: shift: -2: shift count out of range
./errors.tests: line 190: shopt: no_such_option: invalid shell option name
./errors.tests: line 191: shopt: no_such_option: invalid shell option name
./errors.tests: line 192: shopt: no_such_option: invalid option name
./errors.tests: line 195: umask: 09: octal number out of range
./errors.tests: line 196: umask: `:': invalid symbolic mode character
./errors.tests: line 197: umask: `:': invalid symbolic mode operator
./errors.tests: line 200: umask: -i: invalid option
./errors.tests: line 160: unset: [-2]: bad array subscript
./errors.tests: line 164: AA: readonly variable
./errors.tests: line 168: AA: readonly variable
./errors.tests: line 176: shift: 5: shift count out of range
./errors.tests: line 177: shift: -2: shift count out of range
./errors.tests: line 178: shift: 5: shift count out of range
./errors.tests: line 179: shift: -2: shift count out of range
./errors.tests: line 182: shopt: no_such_option: invalid shell option name
./errors.tests: line 183: shopt: no_such_option: invalid shell option name
./errors.tests: line 184: shopt: no_such_option: invalid option name
./errors.tests: line 187: umask: 09: octal number out of range
./errors.tests: line 188: umask: `:': invalid symbolic mode character
./errors.tests: line 189: umask: `:': invalid symbolic mode operator
./errors.tests: line 192: umask: -i: invalid option
umask: usage: umask [-p] [-S] [mode]
./errors.tests: line 204: umask: `p': invalid symbolic mode character
./errors.tests: line 213: VAR: readonly variable
./errors.tests: line 216: declare: VAR: readonly variable
./errors.tests: line 217: declare: VAR: readonly variable
./errors.tests: line 219: declare: unset: not found
./errors.tests: line 222: VAR: readonly variable
./errors.tests: line 196: umask: `p': invalid symbolic mode character
./errors.tests: line 205: VAR: readonly variable
./errors.tests: line 208: declare: VAR: readonly variable
./errors.tests: line 209: declare: VAR: readonly variable
./errors.tests: line 211: declare: unset: not found
./errors.tests: line 214: VAR: readonly variable
comsub: -c: line 1: syntax error near unexpected token `)'
comsub: -c: line 1: `: $( for z in 1 2 3; do )'
comsub: -c: line 1: syntax error near unexpected token `done'
comsub: -c: line 1: `: $( for z in 1 2 3; done )'
./errors.tests: line 229: cd: HOME not set
./errors.tests: line 230: cd: /tmp/xyz.bash: No such file or directory
./errors.tests: line 232: cd: OLDPWD not set
./errors.tests: line 233: cd: /bin/sh: Not a directory
./errors.tests: line 235: cd: /tmp/cd-notthere: No such file or directory
./errors.tests: line 237: cd: too many arguments
./errors.tests: line 221: cd: HOME not set
./errors.tests: line 222: cd: /tmp/xyz.bash: No such file or directory
./errors.tests: line 224: cd: OLDPWD not set
./errors.tests: line 225: cd: /bin/sh: Not a directory
./errors.tests: line 227: cd: /tmp/cd-notthere: No such file or directory
./errors.tests: line 229: cd: too many arguments
bash: line 1: PWD: readonly variable
1
bash: line 1: OLDPWD: readonly variable
1
./errors.tests: line 244: .: filename argument required
./errors.tests: line 236: .: filename argument required
.: usage: . filename [arguments]
./errors.tests: line 245: source: filename argument required
./errors.tests: line 237: source: filename argument required
source: usage: source filename [arguments]
./errors.tests: line 248: .: -i: invalid option
./errors.tests: line 240: .: -i: invalid option
.: usage: . filename [arguments]
./errors.tests: line 251: set: -q: invalid option
./errors.tests: line 243: set: -q: invalid option
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors.tests: line 254: enable: sh: not a shell builtin
./errors.tests: line 254: enable: bash: not a shell builtin
./errors.tests: line 257: shopt: cannot set and unset shell options simultaneously
./errors.tests: line 260: read: -x: invalid option
./errors.tests: line 246: enable: sh: not a shell builtin
./errors.tests: line 246: enable: bash: not a shell builtin
./errors.tests: line 249: shopt: cannot set and unset shell options simultaneously
./errors.tests: line 252: read: -x: invalid option
read: usage: read [-Eers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
./errors.tests: line 263: read: var: invalid timeout specification
./errors.tests: line 266: read: `/bin/sh': not a valid identifier
./errors.tests: line 267: read: `/bin/sh': not a valid identifier
./errors.tests: line 268: read: `invalid-name': not a valid identifier
./errors.tests: line 271: VAR: readonly variable
./errors.tests: line 274: read: XX: invalid file descriptor specification
./errors.tests: line 275: read: 42: invalid file descriptor: Bad file descriptor
./errors.tests: line 278: mapfile: XX: invalid file descriptor specification
./errors.tests: line 279: mapfile: 42: invalid file descriptor: Bad file descriptor
./errors.tests: line 283: mapfile: empty array variable name
./errors.tests: line 284: mapfile: `invalid-var': not a valid identifier
./errors.tests: line 287: readonly: -x: invalid option
./errors.tests: line 255: read: var: invalid timeout specification
./errors.tests: line 258: read: `/bin/sh': not a valid identifier
./errors.tests: line 259: read: `/bin/sh': not a valid identifier
./errors.tests: line 260: read: `invalid-name': not a valid identifier
./errors.tests: line 263: VAR: readonly variable
./errors.tests: line 266: read: XX: invalid file descriptor specification
./errors.tests: line 267: read: 42: invalid file descriptor: Bad file descriptor
./errors.tests: line 270: mapfile: XX: invalid file descriptor specification
./errors.tests: line 271: mapfile: 42: invalid file descriptor: Bad file descriptor
./errors.tests: line 275: mapfile: empty array variable name
./errors.tests: line 276: mapfile: `invalid-var': not a valid identifier
./errors.tests: line 279: readonly: -x: invalid option
readonly: usage: readonly [-aAf] [name[=value] ...] or readonly -p
./errors.tests: line 290: eval: -i: invalid option
./errors.tests: line 282: eval: -i: invalid option
eval: usage: eval [arg ...]
./errors.tests: line 291: command: -i: invalid option
./errors.tests: line 283: command: -i: invalid option
command: usage: command [-pVv] command [arg ...]
./errors.tests: line 294: /bin/sh + 0: arithmetic syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 295: /bin/sh + 0: arithmetic syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 298: trap: NOSIG: invalid signal specification
./errors.tests: line 301: trap: -s: invalid option
./errors.tests: line 286: /bin/sh + 0: arithmetic syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 287: /bin/sh + 0: arithmetic syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 290: trap: NOSIG: invalid signal specification
./errors.tests: line 293: trap: -s: invalid option
trap: usage: trap [-Plp] [[action] signal_spec ...]
./errors.tests: line 307: return: can only `return' from a function or sourced script
./errors.tests: line 311: break: 0: loop count out of range
./errors.tests: line 315: continue: 0: loop count out of range
./errors.tests: line 320: builtin: -x: invalid option
./errors.tests: line 299: return: can only `return' from a function or sourced script
./errors.tests: line 303: break: 0: loop count out of range
./errors.tests: line 307: continue: 0: loop count out of range
./errors.tests: line 312: builtin: -x: invalid option
builtin: usage: builtin [shell-builtin [arg ...]]
./errors.tests: line 323: builtin: bash: not a shell builtin
./errors.tests: line 327: bg: no job control
./errors.tests: line 328: fg: no job control
./errors.tests: line 315: builtin: bash: not a shell builtin
./errors.tests: line 319: bg: no job control
./errors.tests: line 320: fg: no job control
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
./errors.tests: line 332: kill: -s: option requires an argument
./errors.tests: line 334: kill: S: invalid signal specification
./errors.tests: line 336: kill: `': not a pid or valid job spec
./errors.tests: line 324: kill: -s: option requires an argument
./errors.tests: line 326: kill: S: invalid signal specification
./errors.tests: line 328: kill: `': not a pid or valid job spec
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
./errors.tests: line 340: kill: SIGBAD: invalid signal specification
./errors.tests: line 342: kill: BAD: invalid signal specification
./errors.tests: line 344: kill: @12: arguments must be process or job IDs
./errors.tests: line 347: unset: BASH_LINENO: cannot unset
./errors.tests: line 347: unset: BASH_SOURCE: cannot unset
./errors.tests: line 350: set: trackall: invalid option name
./errors.tests: line 351: set: -q: invalid option
./errors.tests: line 332: kill: SIGBAD: invalid signal specification
./errors.tests: line 334: kill: BAD: invalid signal specification
./errors.tests: line 336: kill: @12: arguments must be process or job IDs
./errors.tests: line 339: unset: BASH_LINENO: cannot unset
./errors.tests: line 339: unset: BASH_SOURCE: cannot unset
./errors.tests: line 342: set: trackall: invalid option name
./errors.tests: line 343: set: -q: invalid option
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors.tests: line 352: set: -i: invalid option
./errors.tests: line 344: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors.tests: line 356: xx: readonly variable
./errors.tests: line 348: xx: readonly variable
1
./errors1.sub: line 14: .: -i: invalid option
.: usage: . filename [arguments]
@@ -308,6 +302,34 @@ errors: line 3: break: too many arguments
after break: 2
errors: line 3: continue: too many arguments
after continue: 2
bash: line 1: readonly: `non-identifier': not a valid identifier
after: 1
bash: line 1: export: `non-identifier': not a valid identifier
after: 1
bash: line 1: readonly: `non-identifier': not a valid identifier
bash: line 1: readonly: `invalid+ident': not a valid identifier
after: 1
bash: line 1: export: `non-identifier': not a valid identifier
bash: line 1: export: `invalid+ident': not a valid identifier
after: 1
sh: line 1: readonly: `non-identifier': not a valid identifier
sh: line 1: export: `non-identifier': not a valid identifier
sh: line 1: readonly: `non-identifier': not a valid identifier
sh: line 1: export: `non-identifier': not a valid identifier
bash: line 1: readonly: `non-identifier': not a valid identifier
command: 1
bash: line 1: export: `non-identifier': not a valid identifier
command: 1
sh: line 1: readonly: `non-identifier': not a valid identifier
command: 1
sh: line 1: export: `non-identifier': not a valid identifier
command: 1
bash: line 1: export: `AA[4]': not a valid identifier
array: 1
bash: line 1: readonly: `AA[4]': not a valid identifier
array: 1
sh: line 1: export: `AA[4]': not a valid identifier
sh: line 1: readonly: `AA[4]': not a valid identifier
bash: line 1: return: can only `return' from a function or sourced script
after return
bash: line 1: return: can only `return' from a function or sourced script
@@ -316,4 +338,4 @@ sh: line 1: unset: `a-b': not a valid identifier
sh: line 1: /nosuchfile: No such file or directory
sh: line 1: trap: SIGNOSIG: invalid signal specification
after trap
./errors.tests: line 398: `!!': not a valid identifier
./errors.tests: line 393: `!!': not a valid identifier
+3 -8
View File
@@ -156,14 +156,6 @@ hash -d
set +o hashall
hash -p ${THIS_SH} ${THIS_SH##*/}
# bad identifiers to declare/readonly/export
export AA[4]
readonly AA[4]
export invalid-var=4
readonly invalid-var=4
export invalid-var
readonly invalid-var
declare -a AA
unset AA[-2]
@@ -376,6 +368,9 @@ ${THIS_SH} ./errors9.sub
# invalid numeric arguments and too many arguments
${THIS_SH} ./errors10.sub
# invalid identifiers to readonly/export
${THIS_SH} ./errors11.sub
${THIS_SH} -c 'return ; echo after return' bash
${THIS_SH} -o posix -c 'return ; echo after return' bash
+42
View File
@@ -0,0 +1,42 @@
# 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/>.
#
: ${THIS_SH:=./bash}
${THIS_SH} -c 'readonly non-identifier ; echo after: $?' bash
${THIS_SH} -c 'export non-identifier ; echo after: $?' bash
${THIS_SH} -c 'readonly non-identifier invalid+ident ; echo after: $?' bash
${THIS_SH} -c 'export non-identifier invalid+ident ; echo after: $?' bash
${THIS_SH} -o posix -c 'readonly non-identifier ; echo after: $?' sh
${THIS_SH} -o posix -c 'export non-identifier ; echo after: $?' sh
${THIS_SH} -o posix -c 'readonly non-identifier invalid+ident ; echo after: $?' sh
${THIS_SH} -o posix -c 'export non-identifier invalid+ident ; echo after: $?' sh
${THIS_SH} -c 'command readonly non-identifier ; echo command: $?' bash
${THIS_SH} -c 'command export non-identifier ; echo command: $?' bash
${THIS_SH} -o posix -c 'command readonly non-identifier ; echo command: $?' sh
${THIS_SH} -o posix -c 'command export non-identifier ; echo command: $?' sh
# invalid array references
${THIS_SH} -c 'export AA[4] ; echo array: $?' bash
${THIS_SH} -c 'readonly AA[4] ; echo array: $?' bash
${THIS_SH} -o posix -c 'export AA[4] ; echo array: $?' sh
${THIS_SH} -o posix -c 'readonly AA[4] ; echo array: $?' sh