interim fix for generic list functions to avoid pointer aliasing issues; documentation updates

This commit is contained in:
Chet Ramey
2026-05-08 11:36:36 -04:00
parent 330223688c
commit 669b32f676
36 changed files with 1124 additions and 889 deletions
+51 -45
View File
@@ -152,80 +152,86 @@ IINNVVOOCCAATTIIOONN
includes ii if the shell is interactive, so a shell script or a startup
file can test this state.
The following paragraphs describe how bbaasshh executes its startup files.
If any of the files exist but cannot be read, bbaasshh reports an error.
Tildes are expanded in filenames as described below under TTiillddee EExxppaann--
A _n_o_n_-_i_n_t_e_r_a_c_t_i_v_e _s_h_e_l_l is, not surprisingly, one that does not satisfy
the tests for interactivity given above. A non-interactive shell is
usually started to run commands from a script file supplied as an argu-
ment (a _s_h_e_l_l _s_c_r_i_p_t) or from a string supplied with the --cc option.
The following paragraphs describe how bbaasshh executes its startup files.
If any of the files exist but cannot be read, bbaasshh reports an error.
Tildes in filenames are expanded as described below under TTiillddee EExxppaann--
ssiioonn in the EEXXPPAANNSSIIOONN section.
When bbaasshh is invoked as an interactive login shell, or as a non-inter-
active shell with the ----llooggiinn option, it first reads and executes com-
mands from the file _/_e_t_c_/_p_r_o_f_i_l_e, if that file exists. After reading
When bbaasshh is invoked as an interactive login shell, or as a non-inter-
active shell with the ----llooggiinn option, it first reads and executes com-
mands from the file _/_e_t_c_/_p_r_o_f_i_l_e, if that file exists. After reading
that file, it looks for _~_/_._b_a_s_h___p_r_o_f_i_l_e, _~_/_._b_a_s_h___l_o_g_i_n, and _~_/_._p_r_o_f_i_l_e,
in that order, and reads and executes commands from the first one that
exists and is readable. The ----nnoopprrooffiillee option may be used when the
in that order, and reads and executes commands from the first one that
exists and is readable. The ----nnoopprrooffiillee option may be used when the
shell is started to inhibit this behavior.
When an interactive login shell exits, or a non-interactive login shell
executes the eexxiitt builtin command, bbaasshh reads and executes commands
executes the eexxiitt builtin command, bbaasshh reads and executes commands
from the file _~_/_._b_a_s_h___l_o_g_o_u_t, if it exists.
When an interactive shell that is not a login shell is started, bbaasshh
reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists. The
----nnoorrcc option inhibits this behavior. The ----rrccffiillee _f_i_l_e option causes
When an interactive shell that is not a login shell is started, bbaasshh
reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists. The
----nnoorrcc option inhibits this behavior. The ----rrccffiillee _f_i_l_e option causes
bbaasshh to use _f_i_l_e instead of _~_/_._b_a_s_h_r_c.
When bbaasshh is started non-interactively, to run a shell script, for ex-
ample, it looks for the variable BBAASSHH__EENNVV in the environment, expands
its value if it appears there, and uses the expanded value as the name
of a file to read and execute. BBaasshh behaves as if the following com-
mand were executed:
When bbaasshh is started non-interactively, it looks for the variable
BBAASSHH__EENNVV in the environment, expands its value if it appears there, and
uses the expanded value as the name of a file to read and execute.
BBaasshh behaves as if the following command were executed:
if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
but does not use the value of the PPAATTHH variable to search for the file-
name.
If bbaasshh is invoked with the name sshh, it tries to mimic the startup be-
havior of historical versions of sshh as closely as possible, while con-
forming to the POSIX standard as well. When invoked as an interactive
login shell, or a non-interactive shell with the ----llooggiinn option, it
first attempts to read and execute commands from _/_e_t_c_/_p_r_o_f_i_l_e and
If bbaasshh is invoked with the name sshh, it tries to mimic the startup be-
havior of historical versions of sshh as closely as possible, while con-
forming to the POSIX standard as well. When invoked as an interactive
login shell, or a non-interactive shell with the ----llooggiinn option, it
first attempts to read and execute commands from _/_e_t_c_/_p_r_o_f_i_l_e and
_~_/_._p_r_o_f_i_l_e, in that order. The ----nnoopprrooffiillee option inhibits this behav-
ior. When invoked as an interactive shell with the name sshh, bbaasshh looks
for the variable EENNVV, expands its value if it is defined, and uses the
expanded value as the name of a file to read and execute. Since a
shell invoked as sshh does not attempt to read and execute commands from
any other startup files, the ----rrccffiillee option has no effect. A non-in-
teractive shell invoked with the name sshh does not attempt to read any
for the variable EENNVV, expands its value if it is defined, and uses the
expanded value as the name of a file to read and execute. Since a
shell invoked as sshh does not attempt to read and execute commands from
any other startup files, the ----rrccffiillee option has no effect. A non-in-
teractive shell invoked with the name sshh does not attempt to read any
other startup files.
When invoked as sshh, bbaasshh enters posix mode after reading the startup
When invoked as sshh, bbaasshh enters posix mode after reading the startup
files.
When bbaasshh is started in posix mode, as with the ----ppoossiixx command line
When bbaasshh is started in posix mode, as with the ----ppoossiixx command line
option, it follows the POSIX standard for startup files. In this mode,
interactive shells expand the EENNVV variable and read and execute com-
mands from the file whose name is the expanded value. No other startup
files are read.
interactive shells expand the EENNVV variable and read and execute com-
mands from the file whose name is the expanded value. A posix-mode
shell does not attempt to read any other startup files, even when in-
voked as a login shell.
BBaasshh attempts to determine when it is being run with its standard input
connected to a network connection, as when executed by the historical
and rarely-seen remote shell daemon, usually _r_s_h_d, or the secure shell
daemon _s_s_h_d. If bbaasshh determines it is being run non-interactively in
this fashion, it reads and executes commands from _~_/_._b_a_s_h_r_c, if that
file exists and is readable. BBaasshh does not read this file if invoked
as sshh. The ----nnoorrcc option inhibits this behavior, and the ----rrccffiillee op-
tion makes bbaasshh use a different file instead of _~_/_._b_a_s_h_r_c, but neither
_r_s_h_d nor _s_s_h_d generally invoke the shell with those options or allow
connected to a network connection, as when executed by the secure shell
daemon _s_s_h_d or the historical and rarely-seen remote shell daemon, usu-
ally _r_s_h_d. If bbaasshh determines it is being run non-interactively in
this fashion, it reads and executes commands from _~_/_._b_a_s_h_r_c, if that
file exists and is readable. BBaasshh does not read this file if invoked
as sshh. The ----nnoorrcc option inhibits this behavior, and the ----rrccffiillee op-
tion makes bbaasshh use a different file instead of _~_/_._b_a_s_h_r_c, but neither
_s_s_h_d nor _r_s_h_d generally invoke the shell with those options or allow
them to be specified.
If the shell is started with the effective user (group) id not equal to
the real user (group) id, and the --pp option is not supplied, no startup
files are read, shell functions are not inherited from the environment,
the SSHHEELLLLOOPPTTSS, BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they ap-
pear in the environment, are ignored, and the effective user id is set
to the real user id. If the --pp option is supplied at invocation, the
startup behavior is the same, but the effective user id is not reset.
the SSHHEELLLLOOPPTTSS, BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they ap-
pear in the environment, are ignored, and the effective user id is set
to the real user id. If the --pp option is supplied at invocation, the
startup behavior is the same, but bbaasshh does not reset the effective
user id.
DDEEFFIINNIITTIIOONNSS
The following definitions are used throughout the rest of this docu-
@@ -7622,4 +7628,4 @@ BBUUGGSS
Array variables may not (yet) be exported.
GNU Bash 5.3 2026 March 3 _B_A_S_H(1)
GNU Bash 5.3 2026 April 29 _B_A_S_H(1)