restricted shells deny hash -p' and assigning to BASH_CMDS; fix bug that stripped double quotes embedded in some double-quoted word expansions too early; don't try to restore redirections before exiting a subshell unless there's an exit trap; fix bug that discarded too many unwind-protect frames if an error was encountered in a nested trap while errexit' is set

This commit is contained in:
Chet Ramey committed 2026-11-17 10:08:21 -05:00
1 parent f7043f647e
commit edeabcfb38
18 files changed
+1695 -1531

No files matched your search

+49
View File
@@ -13548,3 +13548,52 @@ lib/readline/util.c,lib/readline/rlprivate.h
- _rl_abort_internal: now a void function with noreturn attribute;
changed callers to accommodate
11/06
-----
variables.c,builtins/hash.def
- in a restricted shell, disallow `hash -p' and assigning to BASH_CMDS.
Report from https://savannah.gnu.org/bugs/index.php?68870
11/9
----
subst.h
- SX_SKIPDQ: new flag value for string_extract_double_quoted, means to
leave unescaped double quotes intact in the returned string for the
caller to handle
subst.c
- string_extract_double_quoted: if (FLAGS & SX_SKIPDQ), treat unescaped
double quotes in the string the same as SX_STRIPDQ, but leave them
in the returned string
- expand_word_internal: if we have an unescaped double quote in a
double-quoted string, add it only if FLAGS does not include
W_EXPANDRHS, indicating that we're expanding the rhs of a parameter
expansion and the caller will deal with them
- parameter_brace_expand_rhs: if processing a double-quoted string,
call string_extract_double_quoted with SX_SKIPDQ to leave unescaped
double quotes in place for a subsequent expand_string_for_rhs to
deal with. Fixes bug with double-quoted variable expansions on the
rhs potentially expanding the wrong variable name
Report from https://savannah.gnu.org/bugs/index.php?68886
11/10
-----
execute_cmd.c
- execute_subshell_builtin_or_function: if we're not going to be running
an exit trap, don't bother trying to make redirections undoable
Report from Koichi Murase <myoga.murase@gmail.com>
11/11
-----
execute_cmd.c
- parameter_brace_expand_rhs: make the use of SX_STRIPDQ/SX_SKIPDQ
dependent on the compatibility level; if <= 53, use the same
SX_STRIPDQ flag as in previous versions
builtins/evalstring.c
- parse_and_execute: when encountering an error while executing a
shell function with errexit enabled, we should only discard the
most recent `pe_dispose' unwind-protect if COMMAND is non-null,
since that is when we set it and we don't want to stomp on a
previous unwind-protect frame
Report from Константин Адзер <adzerki@gmail.com>
+5 -4
View File
@@ -386,10 +386,11 @@ parse_and_execute (char *string, const char *from_file, int flags)
XXX - change that if we want the function context to be
unwound. */
if (exit_immediately_on_error && variable_context)
{
discard_unwind_frame ("pe_dispose");
reset_local_contexts (); /* not in a function */
}
{
if (command)
discard_unwind_frame ("pe_dispose");
reset_local_contexts (); /* not in a function */
}
should_jump_to_top_level = 1;
goto out;
case FORCE_EOF:
+5 -21
View File
@@ -156,27 +156,11 @@ hash_builtin (WORD_LIST *list)
#if defined (RESTRICTED_SHELL)
if (restricted && pathname)
{
if (absolute_program (pathname))
{
newfn = printable_filename (pathname, 0);
sh_restricted (newfn);
if (newfn != pathname)
free (newfn);
return (EXECUTION_FAILURE);
}
/* If we are changing the hash table in a restricted shell, make sure the
target pathname can be found using a $PATH search. */
w = find_user_command (pathname);
if (w == 0 || *w == 0 || executable_file (w) == 0)
{
newfn = printable_filename (pathname, 0);
sh_notfound (newfn);
if (newfn != pathname)
free (newfn);
free (w);
return (EXECUTION_FAILURE);
}
free (w);
newfn = printable_filename (pathname, 0);
sh_restricted (newfn);
if (newfn != pathname)
free (newfn);
return (EXECUTION_FAILURE);
}
#endif
+687 -678
View File
File diff suppressed because it is too large. Load diff
+18 -3
View File
@@ -5,7 +5,7 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Wed Sep 9 14:19:33 EDT 2026
.\" Last Change: Wed Nov 11 09:46:48 EST 2026
.\"
.\" For bash_builtins, strip all but "SHELL BUILTIN COMMANDS" section
.\" For rbash, strip all but "RESTRICTED SHELL" section
@@ -22,7 +22,7 @@
.ds zX \" empty
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2026 September 9" "GNU Bash 5.4"
.TH BASH 1 "2026 November 11" "GNU Bash 5.4"
.\"
.ie \n(.g \{\
.ds ' \(aq
@@ -13595,6 +13595,21 @@ displays any key sequences bound to those commands, instead of treating
the arguments as key sequences to bind.
.RE
.PD
.TP
\fBcompat53\fP
.PD 0
.RS
.IP \(bu
When expanding the right-hand side of a word expansion operator
(e.g.,
.Q - )
that is enclosed in double quotes,
embedded double quotes delimit variable expansions instead of being
stripped.
Previous versions stripped them for compatibility with historical
versions of the Bourne shell.
.RE
.PD
.\" bash_builtins
.if \n(zZ=1 .ig zZ
.SH "RESTRICTED SHELL"
@@ -13646,7 +13661,7 @@ Specifying a filename containing a slash as an argument to the
.B history
builtin command.
.IP \(bu
Specifying a filename containing a slash as an argument to the
Using the
.B \-p
option to the
.B hash
+162 -153
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 7.3 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.4, 27 August 2026).
Bash shell (version 5.4, 11 November 2026).
This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash
This is Edition 5.4, last updated 11 November 2026, of ‘The GNU Bash
Reference Manual’, for ‘Bash’, Version 5.4.
Copyright © 1988-2026 Free Software Foundation, Inc.
@@ -26,10 +26,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.4, 27 August 2026). The Bash home page is
Bash shell (version 5.4, 11 November 2026). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash
This is Edition 5.4, last updated 11 November 2026, of ‘The GNU Bash
Reference Manual’, for ‘Bash’, Version 5.4.
Bash contains features that appear in other popular shells, and some
@@ -3598,7 +3598,7 @@ standard.
If COMMAND is supplied, it replaces the shell without creating a
new process. COMMAND cannot be a shell builtin or function. The
ARGUMENTS become the arguments to COMMAND If the ‘-l’ option is
ARGUMENTS become the arguments to COMMAND. If the ‘-l’ option is
supplied, the shell places a dash at the beginning of the zeroth
argument passed to COMMAND. This is what the ‘login’ program does.
The ‘-c’ option causes COMMAND to be executed with an empty
@@ -4399,7 +4399,7 @@ standard.
there is an error loading a new builtin from a shared object.
‘help’
help [-dms] [PATTERN]
help [-dmsL] [PATTERN]
Display helpful information about builtin commands. If PATTERN is
specified, ‘help’ gives detailed help on all commands matching
@@ -4415,6 +4415,10 @@ standard.
format
‘-s’
Display only a short usage synopsis for each PATTERN
‘-L’
When displaying a list of all the builtins and shell compound
commands, display each item using a single column instead of
using multiple columns.
If PATTERN contains pattern matching characters (*note Pattern
Matching::) it's treated as a shell pattern and ‘help’ prints the
@@ -7646,7 +7650,6 @@ can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘PS4
only useful when the prompt will be supplied to Readline, and is
ignored and removed otherwise, so it shouldn't be used in ‘PS0’ or
‘PS4’, or when line editing is not enabled.
‘\]’
End a sequence of non-printing characters begun with ‘\[’
@@ -7685,8 +7688,7 @@ with the exception that the following are disallowed or not performed:
search path.
• Specifying a filename containing a slash as an argument to the
‘history’ builtin command.
• Specifying a filename containing a slash as an argument to the ‘-p’
option to the ‘hash’ builtin command.
• Using the ‘-p’ option to the ‘hash’ builtin command.
• Importing function definitions from the shell environment at
startup.
• Parsing the value of ‘SHELLOPTS’ from the shell environment at
@@ -8299,6 +8301,13 @@ required for bash-5.1 and later versions.
while sourcing a script. Newer versions defer notification
until script execution completes.
‘compat53 (set using BASH_COMPAT)’
• When expanding the right-hand side of a word expansion
operator (e.g., ‘-’) that is enclosed in double quotes,
embedded double quotes delimit variable expansions instead of
being stripped. Previous versions stripped them for
compatibility with historical versions of the Bourne shell.

File: bash.info, Node: Job Control, Next: Command Line Editing, Prev: Bash Features, Up: Top
@@ -13096,19 +13105,19 @@ D.1 Index of Shell Builtin Commands
(line 28)
* kill: Job Control Builtins.
(line 61)
* let: Bash Builtins. (line 404)
* local: Bash Builtins. (line 413)
* logout: Bash Builtins. (line 438)
* mapfile: Bash Builtins. (line 443)
* let: Bash Builtins. (line 408)
* local: Bash Builtins. (line 417)
* logout: Bash Builtins. (line 442)
* mapfile: Bash Builtins. (line 447)
* popd: Directory Stack Builtins.
(line 37)
* printf: Bash Builtins. (line 488)
* printf: Bash Builtins. (line 492)
* pushd: Directory Stack Builtins.
(line 71)
* pwd: Bourne Shell Builtins.
(line 265)
* read: Bash Builtins. (line 571)
* readarray: Bash Builtins. (line 682)
* read: Bash Builtins. (line 575)
* readarray: Bash Builtins. (line 686)
* readonly: Bourne Shell Builtins.
(line 277)
* return: Bourne Shell Builtins.
@@ -13117,7 +13126,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 327)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 691)
* source: Bash Builtins. (line 695)
* suspend: Job Control Builtins.
(line 141)
* test: Bourne Shell Builtins.
@@ -13128,12 +13137,12 @@ D.1 Index of Shell Builtin Commands
(line 446)
* true: Bourne Shell Builtins.
(line 512)
* type: Bash Builtins. (line 696)
* typeset: Bash Builtins. (line 733)
* ulimit: Bash Builtins. (line 739)
* type: Bash Builtins. (line 700)
* typeset: Bash Builtins. (line 737)
* ulimit: Bash Builtins. (line 743)
* umask: Bourne Shell Builtins.
(line 517)
* unalias: Bash Builtins. (line 847)
* unalias: Bash Builtins. (line 851)
* unset: Bourne Shell Builtins.
(line 535)
* wait: Job Control Builtins.
@@ -13823,138 +13832,138 @@ D.5 Concept Index

Tag Table:
Node: Top897
Node: Introduction2834
Node: What is Bash?3047
Node: What is a shell?4180
Node: Definitions6790
Node: Basic Shell Features10117
Node: Shell Syntax11341
Node: Shell Operation12368
Node: Quoting13659
Node: Escape Character14997
Node: Single Quotes15532
Node: Double Quotes15881
Node: ANSI-C Quoting17226
Node: Locale Translation18620
Node: Creating Internationalized Scripts20023
Node: Comments24221
Node: Shell Commands24988
Node: Reserved Words25927
Node: Simple Commands27070
Node: Pipelines27732
Node: Lists30988
Node: Compound Commands32937
Node: Looping Constructs33946
Node: Conditional Constructs36495
Node: Command Grouping51807
Node: Coprocesses53299
Node: GNU Parallel55985
Node: Shell Functions56903
Node: Shell Parameters65351
Node: Positional Parameters70252
Node: Special Parameters71342
Node: Shell Expansions74803
Node: Brace Expansion76992
Node: Tilde Expansion80328
Node: Shell Parameter Expansion83283
Node: Command Substitution104131
Node: Arithmetic Expansion107982
Node: Process Substitution109166
Node: Word Splitting110333
Node: Filename Expansion112777
Node: Pattern Matching116001
Node: Quote Removal121767
Node: Redirections122071
Node: Executing Commands132340
Node: Simple Command Expansion133007
Node: Command Search and Execution135115
Node: Command Execution Environment137559
Node: Environment141085
Node: Exit Status142988
Node: Signals145047
Node: Shell Scripts149995
Node: Shell Builtin Commands153299
Node: Bourne Shell Builtins155640
Node: Bash Builtins182353
Node: Modifying Shell Behavior220088
Node: The Set Builtin220430
Node: The Shopt Builtin232556
Node: Special Builtins250104
Node: Shell Variables251093
Node: Bourne Shell Variables251527
Node: Bash Variables254035
Node: Bash Features293339
Node: Invoking Bash294353
Node: Bash Startup Files301583
Node: Interactive Shells306943
Node: What is an Interactive Shell?307351
Node: Is this Shell Interactive?308013
Node: Interactive Shell Behavior308837
Node: Bash Conditional Expressions312598
Node: Shell Arithmetic318015
Node: Aliases321342
Node: Arrays324476
Node: The Directory Stack332579
Node: Directory Stack Builtins333376
Node: Controlling the Prompt337821
Node: The Restricted Shell340940
Node: Bash POSIX Mode344033
Node: Shell Compatibility Mode363992
Node: Job Control372999
Node: Job Control Basics373456
Node: Job Control Builtins379824
Node: Job Control Variables386612
Node: Command Line Editing387843
Node: Introduction and Notation389546
Node: Readline Interaction391898
Node: Readline Bare Essentials393086
Node: Readline Movement Commands394894
Node: Readline Killing Commands395890
Node: Readline Arguments397913
Node: Searching399003
Node: Readline Init File401246
Node: Readline Init File Syntax402549
Node: Conditional Init Constructs429500
Node: Sample Init File433885
Node: Bindable Readline Commands437005
Node: Commands For Moving438543
Node: Commands For History441007
Node: Commands For Text447164
Node: Commands For Killing451289
Node: Numeric Arguments454077
Node: Commands For Completion455229
Node: Keyboard Macros460925
Node: Miscellaneous Commands461626
Node: Readline vi Mode469169
Node: Programmable Completion470146
Node: Programmable Completion Builtins479882
Node: A Programmable Completion Example491619
Node: Using History Interactively496964
Node: Bash History Facilities497645
Node: Bash History Builtins502311
Node: History Interaction509906
Node: Event Designators514856
Node: Word Designators516434
Node: Modifiers518826
Node: Installing Bash520763
Node: Basic Installation521879
Node: Compilers and Options525755
Node: Compiling For Multiple Architectures526505
Node: Installation Names528258
Node: Specifying the System Type530492
Node: Sharing Defaults531238
Node: Operation Controls531952
Node: Optional Features532971
Node: Reporting Bugs545694
Node: Major Differences From The Bourne Shell547051
Node: GNU Free Documentation License568478
Node: Indexes593655
Node: Builtin Index594106
Node: Reserved Word Index601204
Node: Variable Index603649
Node: Function Index621062
Node: Concept Index635487
Node: Top901
Node: Introduction2842
Node: What is Bash?3055
Node: What is a shell?4188
Node: Definitions6798
Node: Basic Shell Features10125
Node: Shell Syntax11349
Node: Shell Operation12376
Node: Quoting13667
Node: Escape Character15005
Node: Single Quotes15540
Node: Double Quotes15889
Node: ANSI-C Quoting17234
Node: Locale Translation18628
Node: Creating Internationalized Scripts20031
Node: Comments24229
Node: Shell Commands24996
Node: Reserved Words25935
Node: Simple Commands27078
Node: Pipelines27740
Node: Lists30996
Node: Compound Commands32945
Node: Looping Constructs33954
Node: Conditional Constructs36503
Node: Command Grouping51815
Node: Coprocesses53307
Node: GNU Parallel55993
Node: Shell Functions56911
Node: Shell Parameters65359
Node: Positional Parameters70260
Node: Special Parameters71350
Node: Shell Expansions74811
Node: Brace Expansion77000
Node: Tilde Expansion80336
Node: Shell Parameter Expansion83291
Node: Command Substitution104139
Node: Arithmetic Expansion107990
Node: Process Substitution109174
Node: Word Splitting110341
Node: Filename Expansion112785
Node: Pattern Matching116009
Node: Quote Removal121775
Node: Redirections122079
Node: Executing Commands132348
Node: Simple Command Expansion133015
Node: Command Search and Execution135123
Node: Command Execution Environment137567
Node: Environment141093
Node: Exit Status142996
Node: Signals145055
Node: Shell Scripts150003
Node: Shell Builtin Commands153307
Node: Bourne Shell Builtins155648
Node: Bash Builtins182363
Node: Modifying Shell Behavior220290
Node: The Set Builtin220632
Node: The Shopt Builtin232758
Node: Special Builtins250306
Node: Shell Variables251295
Node: Bourne Shell Variables251729
Node: Bash Variables254237
Node: Bash Features293541
Node: Invoking Bash294555
Node: Bash Startup Files301785
Node: Interactive Shells307145
Node: What is an Interactive Shell?307553
Node: Is this Shell Interactive?308215
Node: Interactive Shell Behavior309039
Node: Bash Conditional Expressions312800
Node: Shell Arithmetic318217
Node: Aliases321544
Node: Arrays324678
Node: The Directory Stack332781
Node: Directory Stack Builtins333578
Node: Controlling the Prompt338023
Node: The Restricted Shell341141
Node: Bash POSIX Mode344176
Node: Shell Compatibility Mode364135
Node: Job Control373524
Node: Job Control Basics373981
Node: Job Control Builtins380349
Node: Job Control Variables387137
Node: Command Line Editing388368
Node: Introduction and Notation390071
Node: Readline Interaction392423
Node: Readline Bare Essentials393611
Node: Readline Movement Commands395419
Node: Readline Killing Commands396415
Node: Readline Arguments398438
Node: Searching399528
Node: Readline Init File401771
Node: Readline Init File Syntax403074
Node: Conditional Init Constructs430025
Node: Sample Init File434410
Node: Bindable Readline Commands437530
Node: Commands For Moving439068
Node: Commands For History441532
Node: Commands For Text447689
Node: Commands For Killing451814
Node: Numeric Arguments454602
Node: Commands For Completion455754
Node: Keyboard Macros461450
Node: Miscellaneous Commands462151
Node: Readline vi Mode469694
Node: Programmable Completion470671
Node: Programmable Completion Builtins480407
Node: A Programmable Completion Example492144
Node: Using History Interactively497489
Node: Bash History Facilities498170
Node: Bash History Builtins502836
Node: History Interaction510431
Node: Event Designators515381
Node: Word Designators516959
Node: Modifiers519351
Node: Installing Bash521288
Node: Basic Installation522404
Node: Compilers and Options526280
Node: Compiling For Multiple Architectures527030
Node: Installation Names528783
Node: Specifying the System Type531017
Node: Sharing Defaults531763
Node: Operation Controls532477
Node: Optional Features533496
Node: Reporting Bugs546219
Node: Major Differences From The Bourne Shell547576
Node: GNU Free Documentation License569003
Node: Indexes594180
Node: Builtin Index594631
Node: Reserved Word Index601729
Node: Variable Index604174
Node: Function Index621587
Node: Concept Index636012

End Tag Table
+162 -153
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 7.3 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.4, 27 August 2026).
Bash shell (version 5.4, 11 November 2026).
This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash
This is Edition 5.4, last updated 11 November 2026, of ‘The GNU Bash
Reference Manual’, for ‘Bash’, Version 5.4.
Copyright © 1988-2026 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.4, 27 August 2026). The Bash home page is
Bash shell (version 5.4, 11 November 2026). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash
This is Edition 5.4, last updated 11 November 2026, of ‘The GNU Bash
Reference Manual’, for ‘Bash’, Version 5.4.
Bash contains features that appear in other popular shells, and some
@@ -3599,7 +3599,7 @@ standard.
If COMMAND is supplied, it replaces the shell without creating a
new process. COMMAND cannot be a shell builtin or function. The
ARGUMENTS become the arguments to COMMAND If the ‘-l’ option is
ARGUMENTS become the arguments to COMMAND. If the ‘-l’ option is
supplied, the shell places a dash at the beginning of the zeroth
argument passed to COMMAND. This is what the ‘login’ program does.
The ‘-c’ option causes COMMAND to be executed with an empty
@@ -4400,7 +4400,7 @@ standard.
there is an error loading a new builtin from a shared object.
‘help’
help [-dms] [PATTERN]
help [-dmsL] [PATTERN]
Display helpful information about builtin commands. If PATTERN is
specified, ‘help’ gives detailed help on all commands matching
@@ -4416,6 +4416,10 @@ standard.
format
‘-s’
Display only a short usage synopsis for each PATTERN
‘-L’
When displaying a list of all the builtins and shell compound
commands, display each item using a single column instead of
using multiple columns.
If PATTERN contains pattern matching characters (*note Pattern
Matching::) it's treated as a shell pattern and ‘help’ prints the
@@ -7647,7 +7651,6 @@ can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘PS4
only useful when the prompt will be supplied to Readline, and is
ignored and removed otherwise, so it shouldn't be used in ‘PS0’ or
‘PS4’, or when line editing is not enabled.
‘\]’
End a sequence of non-printing characters begun with ‘\[’
@@ -7686,8 +7689,7 @@ with the exception that the following are disallowed or not performed:
search path.
• Specifying a filename containing a slash as an argument to the
‘history’ builtin command.
• Specifying a filename containing a slash as an argument to the ‘-p’
option to the ‘hash’ builtin command.
• Using the ‘-p’ option to the ‘hash’ builtin command.
• Importing function definitions from the shell environment at
startup.
• Parsing the value of ‘SHELLOPTS’ from the shell environment at
@@ -8300,6 +8302,13 @@ required for bash-5.1 and later versions.
while sourcing a script. Newer versions defer notification
until script execution completes.
‘compat53 (set using BASH_COMPAT)’
• When expanding the right-hand side of a word expansion
operator (e.g., ‘-’) that is enclosed in double quotes,
embedded double quotes delimit variable expansions instead of
being stripped. Previous versions stripped them for
compatibility with historical versions of the Bourne shell.

File: bashref.info, Node: Job Control, Next: Command Line Editing, Prev: Bash Features, Up: Top
@@ -13097,19 +13106,19 @@ D.1 Index of Shell Builtin Commands
(line 28)
* kill: Job Control Builtins.
(line 61)
* let: Bash Builtins. (line 404)
* local: Bash Builtins. (line 413)
* logout: Bash Builtins. (line 438)
* mapfile: Bash Builtins. (line 443)
* let: Bash Builtins. (line 408)
* local: Bash Builtins. (line 417)
* logout: Bash Builtins. (line 442)
* mapfile: Bash Builtins. (line 447)
* popd: Directory Stack Builtins.
(line 37)
* printf: Bash Builtins. (line 488)
* printf: Bash Builtins. (line 492)
* pushd: Directory Stack Builtins.
(line 71)
* pwd: Bourne Shell Builtins.
(line 265)
* read: Bash Builtins. (line 571)
* readarray: Bash Builtins. (line 682)
* read: Bash Builtins. (line 575)
* readarray: Bash Builtins. (line 686)
* readonly: Bourne Shell Builtins.
(line 277)
* return: Bourne Shell Builtins.
@@ -13118,7 +13127,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 327)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 691)
* source: Bash Builtins. (line 695)
* suspend: Job Control Builtins.
(line 141)
* test: Bourne Shell Builtins.
@@ -13129,12 +13138,12 @@ D.1 Index of Shell Builtin Commands
(line 446)
* true: Bourne Shell Builtins.
(line 512)
* type: Bash Builtins. (line 696)
* typeset: Bash Builtins. (line 733)
* ulimit: Bash Builtins. (line 739)
* type: Bash Builtins. (line 700)
* typeset: Bash Builtins. (line 737)
* ulimit: Bash Builtins. (line 743)
* umask: Bourne Shell Builtins.
(line 517)
* unalias: Bash Builtins. (line 847)
* unalias: Bash Builtins. (line 851)
* unset: Bourne Shell Builtins.
(line 535)
* wait: Job Control Builtins.
@@ -13824,138 +13833,138 @@ D.5 Concept Index

Tag Table:
Node: Top900
Node: Introduction2840
Node: What is Bash?3056
Node: What is a shell?4192
Node: Definitions6805
Node: Basic Shell Features10135
Node: Shell Syntax11362
Node: Shell Operation12392
Node: Quoting13686
Node: Escape Character15027
Node: Single Quotes15565
Node: Double Quotes15917
Node: ANSI-C Quoting17265
Node: Locale Translation18662
Node: Creating Internationalized Scripts20068
Node: Comments24269
Node: Shell Commands25039
Node: Reserved Words25981
Node: Simple Commands27127
Node: Pipelines27792
Node: Lists31051
Node: Compound Commands33003
Node: Looping Constructs34015
Node: Conditional Constructs36567
Node: Command Grouping51882
Node: Coprocesses53377
Node: GNU Parallel56066
Node: Shell Functions56987
Node: Shell Parameters65438
Node: Positional Parameters70342
Node: Special Parameters71435
Node: Shell Expansions74899
Node: Brace Expansion77091
Node: Tilde Expansion80430
Node: Shell Parameter Expansion83388
Node: Command Substitution104239
Node: Arithmetic Expansion108093
Node: Process Substitution109280
Node: Word Splitting110450
Node: Filename Expansion112897
Node: Pattern Matching116124
Node: Quote Removal121893
Node: Redirections122200
Node: Executing Commands132472
Node: Simple Command Expansion133142
Node: Command Search and Execution135253
Node: Command Execution Environment137700
Node: Environment141229
Node: Exit Status143135
Node: Signals145197
Node: Shell Scripts150148
Node: Shell Builtin Commands153455
Node: Bourne Shell Builtins155799
Node: Bash Builtins182515
Node: Modifying Shell Behavior220253
Node: The Set Builtin220598
Node: The Shopt Builtin232727
Node: Special Builtins250278
Node: Shell Variables251270
Node: Bourne Shell Variables251707
Node: Bash Variables254218
Node: Bash Features293525
Node: Invoking Bash294542
Node: Bash Startup Files301775
Node: Interactive Shells307138
Node: What is an Interactive Shell?307549
Node: Is this Shell Interactive?308214
Node: Interactive Shell Behavior309041
Node: Bash Conditional Expressions312805
Node: Shell Arithmetic318225
Node: Aliases321555
Node: Arrays324692
Node: The Directory Stack332798
Node: Directory Stack Builtins333598
Node: Controlling the Prompt338046
Node: The Restricted Shell341168
Node: Bash POSIX Mode344264
Node: Shell Compatibility Mode364226
Node: Job Control373236
Node: Job Control Basics373696
Node: Job Control Builtins380067
Node: Job Control Variables386858
Node: Command Line Editing388092
Node: Introduction and Notation389798
Node: Readline Interaction392153
Node: Readline Bare Essentials393344
Node: Readline Movement Commands395155
Node: Readline Killing Commands396154
Node: Readline Arguments398180
Node: Searching399273
Node: Readline Init File401519
Node: Readline Init File Syntax402825
Node: Conditional Init Constructs429779
Node: Sample Init File434167
Node: Bindable Readline Commands437290
Node: Commands For Moving438831
Node: Commands For History441298
Node: Commands For Text447458
Node: Commands For Killing451586
Node: Numeric Arguments454377
Node: Commands For Completion455532
Node: Keyboard Macros461231
Node: Miscellaneous Commands461935
Node: Readline vi Mode469481
Node: Programmable Completion470461
Node: Programmable Completion Builtins480200
Node: A Programmable Completion Example491940
Node: Using History Interactively497288
Node: Bash History Facilities497972
Node: Bash History Builtins502641
Node: History Interaction510239
Node: Event Designators515192
Node: Word Designators516773
Node: Modifiers519168
Node: Installing Bash521108
Node: Basic Installation522227
Node: Compilers and Options526106
Node: Compiling For Multiple Architectures526859
Node: Installation Names528615
Node: Specifying the System Type530852
Node: Sharing Defaults531601
Node: Operation Controls532318
Node: Optional Features533340
Node: Reporting Bugs546066
Node: Major Differences From The Bourne Shell547426
Node: GNU Free Documentation License568856
Node: Indexes594036
Node: Builtin Index594490
Node: Reserved Word Index601591
Node: Variable Index604039
Node: Function Index621455
Node: Concept Index635883
Node: Top904
Node: Introduction2848
Node: What is Bash?3064
Node: What is a shell?4200
Node: Definitions6813
Node: Basic Shell Features10143
Node: Shell Syntax11370
Node: Shell Operation12400
Node: Quoting13694
Node: Escape Character15035
Node: Single Quotes15573
Node: Double Quotes15925
Node: ANSI-C Quoting17273
Node: Locale Translation18670
Node: Creating Internationalized Scripts20076
Node: Comments24277
Node: Shell Commands25047
Node: Reserved Words25989
Node: Simple Commands27135
Node: Pipelines27800
Node: Lists31059
Node: Compound Commands33011
Node: Looping Constructs34023
Node: Conditional Constructs36575
Node: Command Grouping51890
Node: Coprocesses53385
Node: GNU Parallel56074
Node: Shell Functions56995
Node: Shell Parameters65446
Node: Positional Parameters70350
Node: Special Parameters71443
Node: Shell Expansions74907
Node: Brace Expansion77099
Node: Tilde Expansion80438
Node: Shell Parameter Expansion83396
Node: Command Substitution104247
Node: Arithmetic Expansion108101
Node: Process Substitution109288
Node: Word Splitting110458
Node: Filename Expansion112905
Node: Pattern Matching116132
Node: Quote Removal121901
Node: Redirections122208
Node: Executing Commands132480
Node: Simple Command Expansion133150
Node: Command Search and Execution135261
Node: Command Execution Environment137708
Node: Environment141237
Node: Exit Status143143
Node: Signals145205
Node: Shell Scripts150156
Node: Shell Builtin Commands153463
Node: Bourne Shell Builtins155807
Node: Bash Builtins182525
Node: Modifying Shell Behavior220455
Node: The Set Builtin220800
Node: The Shopt Builtin232929
Node: Special Builtins250480
Node: Shell Variables251472
Node: Bourne Shell Variables251909
Node: Bash Variables254420
Node: Bash Features293727
Node: Invoking Bash294744
Node: Bash Startup Files301977
Node: Interactive Shells307340
Node: What is an Interactive Shell?307751
Node: Is this Shell Interactive?308416
Node: Interactive Shell Behavior309243
Node: Bash Conditional Expressions313007
Node: Shell Arithmetic318427
Node: Aliases321757
Node: Arrays324894
Node: The Directory Stack333000
Node: Directory Stack Builtins333800
Node: Controlling the Prompt338248
Node: The Restricted Shell341369
Node: Bash POSIX Mode344407
Node: Shell Compatibility Mode364369
Node: Job Control373761
Node: Job Control Basics374221
Node: Job Control Builtins380592
Node: Job Control Variables387383
Node: Command Line Editing388617
Node: Introduction and Notation390323
Node: Readline Interaction392678
Node: Readline Bare Essentials393869
Node: Readline Movement Commands395680
Node: Readline Killing Commands396679
Node: Readline Arguments398705
Node: Searching399798
Node: Readline Init File402044
Node: Readline Init File Syntax403350
Node: Conditional Init Constructs430304
Node: Sample Init File434692
Node: Bindable Readline Commands437815
Node: Commands For Moving439356
Node: Commands For History441823
Node: Commands For Text447983
Node: Commands For Killing452111
Node: Numeric Arguments454902
Node: Commands For Completion456057
Node: Keyboard Macros461756
Node: Miscellaneous Commands462460
Node: Readline vi Mode470006
Node: Programmable Completion470986
Node: Programmable Completion Builtins480725
Node: A Programmable Completion Example492465
Node: Using History Interactively497813
Node: Bash History Facilities498497
Node: Bash History Builtins503166
Node: History Interaction510764
Node: Event Designators515717
Node: Word Designators517298
Node: Modifiers519693
Node: Installing Bash521633
Node: Basic Installation522752
Node: Compilers and Options526631
Node: Compiling For Multiple Architectures527384
Node: Installation Names529140
Node: Specifying the System Type531377
Node: Sharing Defaults532126
Node: Operation Controls532843
Node: Optional Features533865
Node: Reporting Bugs546591
Node: Major Differences From The Bourne Shell547951
Node: GNU Free Documentation License569381
Node: Indexes594561
Node: Builtin Index595015
Node: Reserved Word Index602116
Node: Variable Index604564
Node: Function Index621980
Node: Concept Index636408

End Tag Table
+14 -1
View File
@@ -9254,7 +9254,8 @@ to specify a search path.
Specifying a filename containing a slash as an argument to the @code{history}
builtin command.
@item
Specifying a filename containing a slash as an argument to the @option{-p}
Using the
@option{-p}
option to the @code{hash} builtin command.
@item
Importing function definitions from the shell environment at startup.
@@ -10059,6 +10060,18 @@ default.
@end ignore
@end itemize
@item compat53 (set using BASH_COMPAT)
@itemize @bullet
@item
When expanding the right-hand side of a word expansion operator
(e.g., @samp{-}) that is enclosed in double quotes,
embedded double quotes delimit variable expansions instead of being
stripped.
Previous versions stripped them for compatibility with historical
versions of the Bourne shell.
@end itemize
@end table
@node Job Control
+7 -8
View File
@@ -26,34 +26,33 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
* Specifying a filename containing a slash as an argument to the hhiiss--
ttoorryy builtin command.
* Specifying a filename containing a slash as an argument to the --pp
option to the hhaasshh builtin command.
* Using the --pp option to the hhaasshh builtin command.
* Importing function definitions from the shell environment at
* Importing function definitions from the shell environment at
startup.
* Parsing the values of BBAASSHHOOPPTTSS and SSHHEELLLLOOPPTTSS from the shell environ-
ment at startup.
* Redirecting output using the >, >|, <>, >&, &>, and >> redirection
* Redirecting output using the >, >|, <>, >&, &>, and >> redirection
operators.
* Using the eexxeecc builtin command to replace the shell with another
* Using the eexxeecc builtin command to replace the shell with another
command.
* Adding or deleting builtin commands with the --ff and --dd options to
* Adding or deleting builtin commands with the --ff and --dd options to
the eennaabbllee builtin command.
* Using the eennaabbllee builtin command to enable disabled shell builtins.
* Specifying the --pp option to the ccoommmmaanndd builtin command.
* Turning off restricted mode with sseett ++rr or sshhoopptt --uu rree--
* Turning off restricted mode with sseett ++rr or sshhoopptt --uu rree--
ssttrriicctteedd__sshheellll.
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed, rrbbaasshh turns
When a command that is found to be a shell script is executed, rrbbaasshh turns
off any restrictions in the shell spawned to execute the script.
SSEEEE AALLSSOO
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2026 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Wed Sep 9 14:20:26 EDT 2026
@set LASTCHANGE Wed Nov 11 09:47:03 EST 2026
@set EDITION 5.4
@set VERSION 5.4
@set UPDATED 9 September 2026
@set UPDATED-MONTH September 2026
@set UPDATED 11 November 2026
@set UPDATED-MONTH November 2026
+9 -1
View File
@@ -5699,7 +5699,12 @@ execute_subshell_builtin_or_function (WORD_LIST *words, REDIRECT *redirects,
do_piping (pipe_in, pipe_out);
if (do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE) != 0)
if (signal_is_trapped (0))
r = do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE);
else
r = do_redirections (redirects, RX_ACTIVE);
if (r != 0)
exit (EXECUTION_FAILURE);
has_exec_redirects = (builtin == exec_builtin) && redirection_undo_list;
@@ -5783,6 +5788,9 @@ execute_subshell_builtin_or_function (WORD_LIST *words, REDIRECT *redirects,
redirection_undo_list = signal_is_trapped (0) ? saved_undo_list : NULL;
discard_unwind_frame ("subshell-saved-redirects");
}
else if (signal_is_trapped (0) == 0)
redirection_undo_list = NULL;
undo_partial_redirects ();
subshell_exit (subshell_exit_value);
+1 -1
View File
@@ -129,7 +129,7 @@ static int path_isdir (const char *);
static char *rl_quote_filename (char *, int, char *);
static void _rl_complete_sigcleanup (int, void *);
static void _rl_abort_completion (void) __attribute__((noreturn));
static void _rl_abort_completion (void); __attribute__((noreturn));
static void set_completion_defaults (int);
static int get_y_or_n (int);
BIN
View File
Binary file not shown.
+540 -471
View File
File diff suppressed because it is too large. Load diff
+22 -8
View File
@@ -845,10 +845,16 @@ string_extract (const char *string, size_t *sindex, const char *charlist, int fl
/* Extract the contents of STRING as if it is enclosed in double quotes.
SINDEX, when passed in, is the offset of the character immediately
following the opening double quote; on exit, SINDEX is left pointing after
the closing double quote. If STRIPDQ is non-zero, unquoted double
quotes are stripped and the string is terminated by a null byte.
Backslashes between the embedded double quotes are processed. If STRIPDQ
is zero, an unquoted `"' terminates the string. */
the closing double quote. FLAGS can be any of the SX_XXX flags in subst.h.
If (flags & SX_STRIPDQ) is non-zero, unescaped double quotes are stripped
and the string is terminated by a null byte.
If (flags & SX_SKIPDQ) is non-zero, unescaped double quotes are left in
place to be handled by the caller, but otherwise the behavior is the same
as for SX_STRIPDQ.
SX_STRIPDQ and SX_SKIPDQ are mutually exclusive; SX_STRIPDQ has higher priority.
Backslashes between the embedded double quotes are processed. If flags
contains neither SX_STRIPDQ nor SX_SKIPDQ, an unescaped `"' terminates
the string. */
static char *
string_extract_double_quoted (const char *string, size_t *sindex, int flags)
{
@@ -864,7 +870,7 @@ string_extract_double_quoted (const char *string, size_t *sindex, int flags)
slen = strlen (string + *sindex) + *sindex;
send = string + slen;
stripdq = (flags & SX_STRIPDQ);
stripdq = (flags & SX_STRIPDQ) ? 1 : ((flags & SX_SKIPDQ) ? 2 : 0);
pass_next = backquote = dquote = 0;
temp = (char *)xmalloc (1 + slen - *sindex);
@@ -991,12 +997,17 @@ add_one_character:
goto add_one_character;
/* c == '"' */
if (stripdq)
if (stripdq == 1)
{
dquote ^= 1;
i++;
continue;
}
else if (stripdq == 2)
{
dquote ^= 1;
goto add_one_character;
}
break;
}
@@ -8284,8 +8295,11 @@ parameter_brace_expand_rhs (char *name, char *value,
embedded unescaped double quotes (for sh backwards compatibility). */
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *value)
{
int flag;
sindex = 0;
temp = string_extract_double_quoted (value, &sindex, SX_STRIPDQ);
flag = (shell_compatibility_level <= 53) ? SX_STRIPDQ : SX_SKIPDQ;
temp = string_extract_double_quoted (value, &sindex, flag);
}
else
temp = value;
@@ -12058,7 +12072,7 @@ add_twochars:
case '"':
/* XXX - revisit this */
if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) && ((quoted & Q_ARITH) == 0))
if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) && ((quoted & Q_ARITH) == 0) && ((word->flags & W_EXPANDRHS) == 0))
goto add_character;
t_index = ++sindex;
+1
View File
@@ -75,6 +75,7 @@
#define SX_COMPLETE 0x0400 /* extracting word for completion */
#define SX_STRIPDQ 0x0800 /* strip double quotes when extracting double-quoted string */
#define SX_NOERROR 0x1000 /* don't print parser error messages */
#define SX_SKIPDQ 0x2000 /* leave embedded double quotes intact when extracting double-quoted string */
/* Remove backslashes which are quoting backquotes from STRING. Modifies
STRING, and returns a pointer to it. */
+3 -3
View File
@@ -1,10 +1,10 @@
rsh1.sub
./rsh1.sub: line 22: /bin/sh: restricted
./rsh1.sub: line 24: sh: not found
./rsh1.sub: line 22: x: restricted
./rsh1.sub: line 24: a: restricted
./rsh1.sub: line 25: a: command not found
rsh2.sub
./rsh2.sub: line 23: hash: /bin/sh: restricted
./rsh2.sub: line 25: hash: sh: not found
./rsh2.sub: line 25: hash: sh: restricted
./rsh2.sub: line 26: a: command not found
./rsh.tests: line 26: cd: restricted
./rsh.tests: line 27: PATH: readonly variable
+7 -23
View File
@@ -1719,31 +1719,15 @@ static SHELL_VAR *
assign_hashcmd (SHELL_VAR *self, char *value, arrayind_t ind, char *key)
{
#if defined (RESTRICTED_SHELL)
char *full_path, *newfn;
if (restricted)
{
if (absolute_program (value))
{
newfn = printable_filename (value, 0);
sh_restricted (newfn);
if (newfn != value)
free (newfn);
return (SHELL_VAR *)NULL;
}
/* If we are changing the hash table in a restricted shell, make sure the
target pathname can be found using a $PATH search. */
full_path = find_user_command (value);
if (full_path == 0 || *full_path == 0 || executable_file (full_path) == 0)
{
newfn = printable_filename (value, 0);
sh_notfound (newfn);
if (newfn != value)
free (newfn);
free (full_path);
return ((SHELL_VAR *)NULL);
}
free (full_path);
char *newfn;
newfn = printable_filename (key, 0);
sh_restricted (newfn);
if (newfn != key)
free (newfn);
return ((SHELL_VAR *)NULL);
}
#endif
phash_insert (key, value, 0, 0);