commit bash-snap-20170616 snapshot

This commit is contained in:
Chet Ramey
2017-06-16 14:57:40 -04:00
parent db0eba9aa8
commit 6374eecf23
11 changed files with 263 additions and 161 deletions
+48
View File
@@ -14054,3 +14054,51 @@ jobs.c
- wait_for: when waiting for the next child to exit (ANY_PID), make
sure to restore the old SIGINT handler before returning. Fixes
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864649
6/14
----
lib/readline/display.c
- expand_prompt: make sure `ret' is NULL-terminated before calling
_rl_prev_mbchar_internal, since that calls strlen, which requires
the passed string to be NULL-terminated. Another fuzzing bug.
6/15
----
lib/readline/isearch.c
- _rl_isearch_fini: use rl_replace_line instead of strcpy so rl_end
gets set right
- _rl_isearch_fini: after restoring rl_point, call _rl_fix_point so
we don't set rl_point > rl_end. Fixes a fuzzing bug
lib/readline/mbutil.c
- _rl_find_next_mbchar_internal: if _rl_adjust_point returns < 0,
just punt, treat the value as a byte, and advance point by 1
lib/readline/util.c
- rl_tilde_expand: rearrange code in the whitespace loop so that
`start' gets tested first and we don't try to dereference
rl_line_buffer[-1]. Another fuzzing bug from dualbus@gmail.com
bashline.c
- bash_dequote_filename: make sure that pointers that are used as
indices into sh_syntaxtab are cast to unsigned char first, to
avoid problems with signed chars > 128. Fixes a fuzzing bug.
lib/readline/kill.c
- _rl_copy_to_kill_ring: when reallocating the kill ring, make sure to
allocate one more than the max number of kills so the loop that
copies the kill ring entries down runs right (and to mirror the
initial allocation). Fixes a fuzzing bug.
lib/readline/isearch.c
- _rl_isearch_dispatch: make sure that cxt->sline_index never goes < 0
even when searching a line in reverse. Fixes a fuzzing bug
6/16
----
parse.y
- xparse_dolparen: short-circuit immediately if passed a empty string
lib/readline/display.c
- update_line: when wrapping multibyte characters, make sure we deal
with WCWIDTH returning -1. Fixes a fuzzing bug
+1 -1
View File
@@ -3886,7 +3886,7 @@ bash_dequote_filename (text, quote_char)
*r++ = *p;
/* Backslashes are preserved within double quotes unless the
character is one that is defined to be escaped */
else if (quoted == '"' && ((sh_syntaxtab[p[1]] & CBSDQUOTE) == 0))
else if (quoted == '"' && ((sh_syntaxtab[(unsigned char)p[1]] & CBSDQUOTE) == 0))
*r++ = *p;
*r++ = *++p;
+1
View File
@@ -114,6 +114,7 @@ bind_builtin (list)
Keymap kmap, saved_keymap;
int flags, opt;
char *initfile, *map_name, *fun_name, *unbind_name, *remove_seq, *cmd_seq, *t;
rl_command_func_t *func;
if (no_line_editing)
{
+163 -152
View File
@@ -3965,8 +3965,8 @@ HHIISSTTOORRYY
SSIIZZEE is unset, or set to null, a non-numeric value, or a numeric value
less than zero, the history file is not truncated. When the history
file is read, lines beginning with the history comment character fol-
lowed immediately by a digit are interpreted as timestamps for the pre-
ceding history line. These timestamps are optionally displayed depend-
lowed immediately by a digit are interpreted as timestamps for the fol-
lowing history line. These timestamps are optionally displayed depend-
ing on the value of the HHIISSTTTTIIMMEEFFOORRMMAATT variable. When a shell with
history enabled exits, the last $$HHIISSTTSSIIZZEE lines are copied from the
history list to $$HHIISSTTFFIILLEE. If the hhiissttaappppeenndd shell option is enabled
@@ -4718,7 +4718,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
plete, the edited commands are echoed and executed.
In the second form, _c_o_m_m_a_n_d is re-executed after each instance
of _p_a_t is replaced by _r_e_p. _C_o_m_m_a_n_d is intepreted the same as
of _p_a_t is replaced by _r_e_p. _C_o_m_m_a_n_d is interpreted the same as
_f_i_r_s_t above. A useful alias to use with this is ``r="fc -s"'',
so that typing ``r cc'' runs the last command beginning with
``cc'' and typing ``r'' re-executes the last command.
@@ -4937,7 +4937,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
plied. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if
supplied, have the following meanings:
--dd The first character of _d_e_l_i_m is used to terminate each
input line, rather than newline.
input line, rather than newline. If _d_e_l_i_m is the empty
string, mmaappffiillee will terminate a line when it reads a NUL
character.
--nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, all lines are
copied.
--OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default
@@ -5085,7 +5087,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
ignored.
--dd _d_e_l_i_m
The first character of _d_e_l_i_m is used to terminate the
input line, rather than newline.
input line, rather than newline. If _d_e_l_i_m is the empty
string, rreeaadd will terminate a line when it reads a NUL
character.
--ee If the standard input is coming from a terminal, rreeaaddlliinnee
(see RREEAADDLLIINNEE above) is used to obtain the line. Read-
line uses the current (or default, if line editing was
@@ -5434,7 +5438,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
UUMMNNSS.
ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple-
line command in the same history entry. This allows
easy re-editing of multi-line commands.
easy re-editing of multi-line commands. This option is
enabled by default, but only has an effect if command
history is enabled, as described above under HHIISSTTOORRYY.
ccoommppaatt3311
If set, bbaasshh changes its behavior to that of version 3.1
with respect to quoted arguments to the [[[[ conditional
@@ -5613,32 +5619,37 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
llooccaallvvaarr__iinnhheerriitt
If set, local variables inherit the value and attributes
of a variable of the same name that exists at a previous
scope before any new value is assigned. The nameref
attribute is not inherited.
llooggiinn__sshheellll
The shell sets this option if it is started as a login
shell (see IINNVVOOCCAATTIIOONN above). The value may not be
The shell sets this option if it is started as a login
shell (see IINNVVOOCCAATTIIOONN above). The value may not be
changed.
mmaaiillwwaarrnn
If set, and a file that bbaasshh is checking for mail has
been accessed since the last time it was checked, the
message ``The mail in _m_a_i_l_f_i_l_e has been read'' is dis-
If set, and a file that bbaasshh is checking for mail has
been accessed since the last time it was checked, the
message ``The mail in _m_a_i_l_f_i_l_e has been read'' is dis-
played.
nnoo__eemmppttyy__ccmmdd__ccoommpplleettiioonn
If set, and rreeaaddlliinnee is being used, bbaasshh will not
If set, and rreeaaddlliinnee is being used, bbaasshh will not
attempt to search the PPAATTHH for possible completions when
completion is attempted on an empty line.
nnooccaasseegglloobb
If set, bbaasshh matches filenames in a case-insensitive
If set, bbaasshh matches filenames in a case-insensitive
fashion when performing pathname expansion (see PPaatthhnnaammee
EExxppaannssiioonn above).
nnooccaasseemmaattcchh
If set, bbaasshh matches patterns in a case-insensitive
If set, bbaasshh matches patterns in a case-insensitive
fashion when performing matching while executing ccaassee or
[[[[ conditional commands, when performing pattern substi-
tution word expansions, or when filtering possible com-
tution word expansions, or when filtering possible com-
pletions as part of programmable completion.
nnuullllgglloobb
If set, bbaasshh allows patterns which match no files (see
PPaatthhnnaammee EExxppaannssiioonn above) to expand to a null string,
If set, bbaasshh allows patterns which match no files (see
PPaatthhnnaammee EExxppaannssiioonn above) to expand to a null string,
rather than themselves.
pprrooggccoommpp
If set, the programmable completion facilities (see PPrroo--
@@ -5646,50 +5657,50 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
enabled by default.
pprroommppttvvaarrss
If set, prompt strings undergo parameter expansion, com-
mand substitution, arithmetic expansion, and quote
removal after being expanded as described in PPRROOMMPPTTIINNGG
mand substitution, arithmetic expansion, and quote
removal after being expanded as described in PPRROOMMPPTTIINNGG
above. This option is enabled by default.
rreessttrriicctteedd__sshheellll
The shell sets this option if it is started in
The shell sets this option if it is started in
restricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL below). The value
may not be changed. This is not reset when the startup
files are executed, allowing the startup files to dis-
may not be changed. This is not reset when the startup
files are executed, allowing the startup files to dis-
cover whether or not a shell is restricted.
sshhiifftt__vveerrbboossee
If set, the sshhiifftt builtin prints an error message when
If set, the sshhiifftt builtin prints an error message when
the shift count exceeds the number of positional parame-
ters.
ssoouurrcceeppaatthh
If set, the ssoouurrccee (..) builtin uses the value of PPAATTHH to
find the directory containing the file supplied as an
find the directory containing the file supplied as an
argument. This option is enabled by default.
xxppgg__eecchhoo
If set, the eecchhoo builtin expands backslash-escape
If set, the eecchhoo builtin expands backslash-escape
sequences by default.
ssuussppeenndd [--ff]
Suspend the execution of this shell until it receives a SSIIGGCCOONNTT
Suspend the execution of this shell until it receives a SSIIGGCCOONNTT
signal. A login shell cannot be suspended; the --ff option can be
used to override this and force the suspension. The return sta-
tus is 0 unless the shell is a login shell and --ff is not sup-
tus is 0 unless the shell is a login shell and --ff is not sup-
plied, or if job control is not enabled.
tteesstt _e_x_p_r
[[ _e_x_p_r ]]
Return a status of 0 (true) or 1 (false) depending on the evalu-
ation of the conditional expression _e_x_p_r. Each operator and op-
erand must be a separate argument. Expressions are composed of
the primaries described above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS.
tteesstt does not accept any options, nor does it accept and ignore
erand must be a separate argument. Expressions are composed of
the primaries described above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS.
tteesstt does not accept any options, nor does it accept and ignore
an argument of ---- as signifying the end of options.
Expressions may be combined using the following operators,
Expressions may be combined using the following operators,
listed in decreasing order of precedence. The evaluation
depends on the number of arguments; see below. Operator prece-
depends on the number of arguments; see below. Operator prece-
dence is used when there are five or more arguments.
!! _e_x_p_r True if _e_x_p_r is false.
(( _e_x_p_r ))
Returns the value of _e_x_p_r. This may be used to override
Returns the value of _e_x_p_r. This may be used to override
the normal precedence of operators.
_e_x_p_r_1 -aa _e_x_p_r_2
True if both _e_x_p_r_1 and _e_x_p_r_2 are true.
@@ -5706,120 +5717,120 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
null.
2 arguments
If the first argument is !!, the expression is true if and
only if the second argument is null. If the first argu-
ment is one of the unary conditional operators listed
above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is
only if the second argument is null. If the first argu-
ment is one of the unary conditional operators listed
above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is
true if the unary test is true. If the first argument is
not a valid unary conditional operator, the expression is
false.
3 arguments
The following conditions are applied in the order listed.
If the second argument is one of the binary conditional
If the second argument is one of the binary conditional
operators listed above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the
result of the expression is the result of the binary test
using the first and third arguments as operands. The --aa
and --oo operators are considered binary operators when
there are three arguments. If the first argument is !!,
the value is the negation of the two-argument test using
using the first and third arguments as operands. The --aa
and --oo operators are considered binary operators when
there are three arguments. If the first argument is !!,
the value is the negation of the two-argument test using
the second and third arguments. If the first argument is
exactly (( and the third argument is exactly )), the result
is the one-argument test of the second argument. Other-
is the one-argument test of the second argument. Other-
wise, the expression is false.
4 arguments
If the first argument is !!, the result is the negation of
the three-argument expression composed of the remaining
the three-argument expression composed of the remaining
arguments. Otherwise, the expression is parsed and eval-
uated according to precedence using the rules listed
uated according to precedence using the rules listed
above.
5 or more arguments
The expression is parsed and evaluated according to
The expression is parsed and evaluated according to
precedence using the rules listed above.
When used with tteesstt or [[, the << and >> operators sort lexico-
When used with tteesstt or [[, the << and >> operators sort lexico-
graphically using ASCII ordering.
ttiimmeess Print the accumulated user and system times for the shell and
ttiimmeess Print the accumulated user and system times for the shell and
for processes run from the shell. The return status is 0.
ttrraapp [--llpp] [[_a_r_g] _s_i_g_s_p_e_c ...]
The command _a_r_g is to be read and executed when the shell
receives signal(s) _s_i_g_s_p_e_c. If _a_r_g is absent (and there is a
single _s_i_g_s_p_e_c) or --, each specified signal is reset to its
original disposition (the value it had upon entrance to the
shell). If _a_r_g is the null string the signal specified by each
_s_i_g_s_p_e_c is ignored by the shell and by the commands it invokes.
If _a_r_g is not present and --pp has been supplied, then the trap
commands associated with each _s_i_g_s_p_e_c are displayed. If no
arguments are supplied or if only --pp is given, ttrraapp prints the
list of commands associated with each signal. The --ll option
causes the shell to print a list of signal names and their cor-
responding numbers. Each _s_i_g_s_p_e_c is either a signal name
defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are
The command _a_r_g is to be read and executed when the shell
receives signal(s) _s_i_g_s_p_e_c. If _a_r_g is absent (and there is a
single _s_i_g_s_p_e_c) or --, each specified signal is reset to its
original disposition (the value it had upon entrance to the
shell). If _a_r_g is the null string the signal specified by each
_s_i_g_s_p_e_c is ignored by the shell and by the commands it invokes.
If _a_r_g is not present and --pp has been supplied, then the trap
commands associated with each _s_i_g_s_p_e_c are displayed. If no
arguments are supplied or if only --pp is given, ttrraapp prints the
list of commands associated with each signal. The --ll option
causes the shell to print a list of signal names and their cor-
responding numbers. Each _s_i_g_s_p_e_c is either a signal name
defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are
case insensitive and the SSIIGG prefix is optional.
If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_r_g is executed on exit
from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is exe-
cuted before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command,
_s_e_l_e_c_t command, every arithmetic _f_o_r command, and before the
first command executes in a shell function (see SSHHEELLLL GGRRAAMMMMAARR
above). Refer to the description of the eexxttddeebbuugg option to the
If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_r_g is executed on exit
from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is exe-
cuted before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command,
_s_e_l_e_c_t command, every arithmetic _f_o_r command, and before the
first command executes in a shell function (see SSHHEELLLL GGRRAAMMMMAARR
above). Refer to the description of the eexxttddeebbuugg option to the
sshhoopptt builtin for details of its effect on the DDEEBBUUGG trap. If a
_s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is executed each time a shell
function or a script executed with the .. or ssoouurrccee builtins fin-
ishes executing.
If a _s_i_g_s_p_e_c is EERRRR, the command _a_r_g is executed whenever a
If a _s_i_g_s_p_e_c is EERRRR, the command _a_r_g is executed whenever a
pipeline (which may consist of a single simple command), a list,
or a compound command returns a non-zero exit status, subject to
the following conditions. The EERRRR trap is not executed if the
the following conditions. The EERRRR trap is not executed if the
failed command is part of the command list immediately following
a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement,
a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement,
part of a command executed in a &&&& or |||| list except the command
following the final &&&& or ||||, any command in a pipeline but the
last, or if the command's return value is being inverted using
!!. These are the same conditions obeyed by the eerrrreexxiitt (--ee)
following the final &&&& or ||||, any command in a pipeline but the
last, or if the command's return value is being inverted using
!!. These are the same conditions obeyed by the eerrrreexxiitt (--ee)
option.
Signals ignored upon entry to the shell cannot be trapped or
reset. Trapped signals that are not being ignored are reset to
Signals ignored upon entry to the shell cannot be trapped or
reset. Trapped signals that are not being ignored are reset to
their original values in a subshell or subshell environment when
one is created. The return status is false if any _s_i_g_s_p_e_c is
one is created. The return status is false if any _s_i_g_s_p_e_c is
invalid; otherwise ttrraapp returns true.
ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...]
With no options, indicate how each _n_a_m_e would be interpreted if
With no options, indicate how each _n_a_m_e would be interpreted if
used as a command name. If the --tt option is used, ttyyppee prints a
string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or
_f_i_l_e if _n_a_m_e is an alias, shell reserved word, function,
builtin, or disk file, respectively. If the _n_a_m_e is not found,
then nothing is printed, and an exit status of false is
returned. If the --pp option is used, ttyyppee either returns the
string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or
_f_i_l_e if _n_a_m_e is an alias, shell reserved word, function,
builtin, or disk file, respectively. If the _n_a_m_e is not found,
then nothing is printed, and an exit status of false is
returned. If the --pp option is used, ttyyppee either returns the
name of the disk file that would be executed if _n_a_m_e were speci-
fied as a command name, or nothing if ``type -t name'' would not
return _f_i_l_e. The --PP option forces a PPAATTHH search for each _n_a_m_e,
return _f_i_l_e. The --PP option forces a PPAATTHH search for each _n_a_m_e,
even if ``type -t name'' would not return _f_i_l_e. If a command is
hashed, --pp and --PP print the hashed value, which is not necessar-
ily the file that appears first in PPAATTHH. If the --aa option is
used, ttyyppee prints all of the places that contain an executable
ily the file that appears first in PPAATTHH. If the --aa option is
used, ttyyppee prints all of the places that contain an executable
named _n_a_m_e. This includes aliases and functions, if and only if
the --pp option is not also used. The table of hashed commands is
not consulted when using --aa. The --ff option suppresses shell
not consulted when using --aa. The --ff option suppresses shell
function lookup, as with the ccoommmmaanndd builtin. ttyyppee returns true
if all of the arguments are found, false if any are not found.
uulliimmiitt [--HHSSaabbccddeeffiikkllmmnnppqqrrssttuuvvxxPPTT [_l_i_m_i_t]]
Provides control over the resources available to the shell and
to processes started by it, on systems that allow such control.
Provides control over the resources available to the shell and
to processes started by it, on systems that allow such control.
The --HH and --SS options specify that the hard or soft limit is set
for the given resource. A hard limit cannot be increased by a
non-root user once it is set; a soft limit may be increased up
to the value of the hard limit. If neither --HH nor --SS is speci-
for the given resource. A hard limit cannot be increased by a
non-root user once it is set; a soft limit may be increased up
to the value of the hard limit. If neither --HH nor --SS is speci-
fied, both the soft and hard limits are set. The value of _l_i_m_i_t
can be a number in the unit specified for the resource or one of
the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, which stand for the
current hard limit, the current soft limit, and no limit,
respectively. If _l_i_m_i_t is omitted, the current value of the
soft limit of the resource is printed, unless the --HH option is
current hard limit, the current soft limit, and no limit,
respectively. If _l_i_m_i_t is omitted, the current value of the
soft limit of the resource is printed, unless the --HH option is
given. When more than one resource is specified, the limit name
and unit are printed before the value. Other options are inter-
preted as follows:
@@ -5828,12 +5839,12 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--cc The maximum size of core files created
--dd The maximum size of a process's data segment
--ee The maximum scheduling priority ("nice")
--ff The maximum size of files written by the shell and its
--ff The maximum size of files written by the shell and its
children
--ii The maximum number of pending signals
--kk The maximum number of kqueues that may be allocated
--ll The maximum size that may be locked into memory
--mm The maximum resident set size (many systems do not honor
--mm The maximum resident set size (many systems do not honor
this limit)
--nn The maximum number of open file descriptors (most systems
do not allow this value to be set)
@@ -5842,53 +5853,53 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--rr The maximum real-time scheduling priority
--ss The maximum stack size
--tt The maximum amount of cpu time in seconds
--uu The maximum number of processes available to a single
--uu The maximum number of processes available to a single
user
--vv The maximum amount of virtual memory available to the
--vv The maximum amount of virtual memory available to the
shell and, on some systems, to its children
--xx The maximum number of file locks
--PP The maximum number of pseudoterminals
--TT The maximum number of threads
If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the
new value of the specified resource. If no option is given,
then --ff is assumed. Values are in 1024-byte increments, except
for --tt, which is in seconds; --pp, which is in units of 512-byte
blocks; --PP, --TT, --bb, --kk, --nn, and --uu, which are unscaled values;
If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the
new value of the specified resource. If no option is given,
then --ff is assumed. Values are in 1024-byte increments, except
for --tt, which is in seconds; --pp, which is in units of 512-byte
blocks; --PP, --TT, --bb, --kk, --nn, and --uu, which are unscaled values;
and, when in Posix mode, --cc and --ff, which are in 512-byte incre-
ments. The return status is 0 unless an invalid option or argu-
ment is supplied, or an error occurs while setting a new limit.
uummaasskk [--pp] [--SS] [_m_o_d_e]
The user file-creation mask is set to _m_o_d_e. If _m_o_d_e begins with
a digit, it is interpreted as an octal number; otherwise it is
interpreted as a symbolic mode mask similar to that accepted by
_c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is
printed. The --SS option causes the mask to be printed in sym-
bolic form; the default output is an octal number. If the --pp
a digit, it is interpreted as an octal number; otherwise it is
interpreted as a symbolic mode mask similar to that accepted by
_c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is
printed. The --SS option causes the mask to be printed in sym-
bolic form; the default output is an octal number. If the --pp
option is supplied, and _m_o_d_e is omitted, the output is in a form
that may be reused as input. The return status is 0 if the mode
was successfully changed or if no _m_o_d_e argument was supplied,
was successfully changed or if no _m_o_d_e argument was supplied,
and false otherwise.
uunnaalliiaass [-aa] [_n_a_m_e ...]
Remove each _n_a_m_e from the list of defined aliases. If --aa is
supplied, all alias definitions are removed. The return value
Remove each _n_a_m_e from the list of defined aliases. If --aa is
supplied, all alias definitions are removed. The return value
is true unless a supplied _n_a_m_e is not a defined alias.
uunnsseett [-ffvv] [-nn] [_n_a_m_e ...]
For each _n_a_m_e, remove the corresponding variable or function.
For each _n_a_m_e, remove the corresponding variable or function.
If the --vv option is given, each _n_a_m_e refers to a shell variable,
and that variable is removed. Read-only variables may not be
unset. If --ff is specified, each _n_a_m_e refers to a shell func-
tion, and the function definition is removed. If the --nn option
is supplied, and _n_a_m_e is a variable with the _n_a_m_e_r_e_f attribute,
_n_a_m_e will be unset rather than the variable it references. --nn
has no effect if the --ff option is supplied. If no options are
supplied, each _n_a_m_e refers to a variable; if there is no vari-
able by that name, any function with that name is unset. Each
unset variable or function is removed from the environment
passed to subsequent commands. If any of CCOOMMPP__WWOORRDDBBRREEAAKKSS, RRAANN--
and that variable is removed. Read-only variables may not be
unset. If --ff is specified, each _n_a_m_e refers to a shell func-
tion, and the function definition is removed. If the --nn option
is supplied, and _n_a_m_e is a variable with the _n_a_m_e_r_e_f attribute,
_n_a_m_e will be unset rather than the variable it references. --nn
has no effect if the --ff option is supplied. If no options are
supplied, each _n_a_m_e refers to a variable; if there is no vari-
able by that name, any function with that name is unset. Each
unset variable or function is removed from the environment
passed to subsequent commands. If any of CCOOMMPP__WWOORRDDBBRREEAAKKSS, RRAANN--
DDOOMM, SSEECCOONNDDSS, LLIINNEENNOO, HHIISSTTCCMMDD, FFUUNNCCNNAAMMEE, GGRROOUUPPSS, or DDIIRRSSTTAACCKK are
unset, they lose their special properties, even if they are sub-
sequently reset. The exit status is true unless a _n_a_m_e is read-
@@ -5896,23 +5907,23 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
wwaaiitt [--ffnn] [_i_d _._._.]
Wait for each specified child process and return its termination
status. Each _i_d may be a process ID or a job specification; if
a job spec is given, all processes in that job's pipeline are
status. Each _i_d may be a process ID or a job specification; if
a job spec is given, all processes in that job's pipeline are
waited for. If _i_d is not given, all currently active child pro-
cesses are waited for, and the return status is zero. If the --nn
option is supplied, wwaaiitt waits for any job to terminate and
returns its exit status. If the --ff option is supplied, and job
option is supplied, wwaaiitt waits for any job to terminate and
returns its exit status. If the --ff option is supplied, and job
control is enabled, wwaaiitt forces _i_d to terminate before returning
its status, intead of returning when it changes status. If _i_d
specifies a non-existent process or job, the return status is
127. Otherwise, the return status is the exit status of the
its status, instead of returning when it changes status. If _i_d
specifies a non-existent process or job, the return status is
127. Otherwise, the return status is the exit status of the
last process or job waited for.
RREESSTTRRIICCTTEEDD SSHHEELLLL
If bbaasshh is started with the name rrbbaasshh, or the --rr option is supplied at
invocation, the shell becomes restricted. A restricted shell is used
to set up an environment more controlled than the standard shell. It
behaves identically to bbaasshh with the exception that the following are
invocation, the shell becomes restricted. A restricted shell is used
to set up an environment more controlled than the standard shell. It
behaves identically to bbaasshh with the exception that the following are
disallowed or not performed:
+o changing directories with ccdd
@@ -5921,16 +5932,16 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o specifying command names containing //
+o specifying a filename containing a // as an argument to the ..
+o specifying a filename containing a // as an argument to the ..
builtin command
+o specifying a filename containing a slash as an argument to the
+o specifying a filename containing a slash as an argument to the
--pp option to the hhaasshh builtin command
+o importing function definitions from the shell environment at
+o importing function definitions from the shell environment at
startup
+o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
+o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
startup
+o redirecting output using the >, >|, <>, >&, &>, and >> redirect-
@@ -5939,10 +5950,10 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o using the eexxeecc builtin command to replace the shell with another
command
+o adding or deleting builtin commands with the --ff and --dd options
+o adding or deleting builtin commands with the --ff and --dd options
to the eennaabbllee builtin command
+o using the eennaabbllee builtin command to enable disabled shell
+o using the eennaabbllee builtin command to enable disabled shell
builtins
+o specifying the --pp option to the ccoommmmaanndd builtin command
@@ -5952,14 +5963,14 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed (see CCOOMM--
MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
spawned to execute the script.
SSEEEE AALLSSOO
_B_a_s_h _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, Brian Fox and Chet Ramey
_T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
_T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
_P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_-
_P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_-
_t_i_e_s, IEEE --
http://pubs.opengroup.org/onlinepubs/9699919799/
http://tiswww.case.edu/~chet/bash/POSIX -- a description of posix mode
@@ -5977,7 +5988,7 @@ FFIILLEESS
_~_/_._b_a_s_h_r_c
The individual per-interactive-shell startup file
_~_/_._b_a_s_h___l_o_g_o_u_t
The individual login shell cleanup file, executed when a login
The individual login shell cleanup file, executed when a login
shell exits
_~_/_._i_n_p_u_t_r_c
Individual _r_e_a_d_l_i_n_e initialization file
@@ -5991,14 +6002,14 @@ AAUUTTHHOORRSS
BBUUGG RREEPPOORRTTSS
If you find a bug in bbaasshh,, you should report it. But first, you should
make sure that it really is a bug, and that it appears in the latest
version of bbaasshh. The latest version is always available from
make sure that it really is a bug, and that it appears in the latest
version of bbaasshh. The latest version is always available from
_f_t_p_:_/_/_f_t_p_._g_n_u_._o_r_g_/_p_u_b_/_g_n_u_/_b_a_s_h_/.
Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
command to submit a bug report. If you have a fix, you are encouraged
to mail that as well! Suggestions and `philosophical' bug reports may
be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup
Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
command to submit a bug report. If you have a fix, you are encouraged
to mail that as well! Suggestions and `philosophical' bug reports may
be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup
ggnnuu..bbaasshh..bbuugg.
ALL bug reports should include:
@@ -6009,7 +6020,7 @@ BBUUGG RREEPPOORRTTSS
A description of the bug behaviour
A short script or `recipe' which exercises the bug
_b_a_s_h_b_u_g inserts the first three items automatically into the template
_b_a_s_h_b_u_g inserts the first three items automatically into the template
it provides for filing a bug report.
Comments and bug reports concerning this manual page should be directed
@@ -6026,10 +6037,10 @@ BBUUGGSS
Shell builtin commands and functions are not stoppable/restartable.
Compound commands and command sequences of the form `a ; b ; c' are not
handled gracefully when process suspension is attempted. When a
process is stopped, the shell immediately executes the next command in
the sequence. It suffices to place the sequence of commands between
parentheses to force it into a subshell, which may be stopped as a
handled gracefully when process suspension is attempted. When a
process is stopped, the shell immediately executes the next command in
the sequence. It suffices to place the sequence of commands between
parentheses to force it into a subshell, which may be stopped as a
unit.
Array variables may not (yet) be exported.
@@ -6038,4 +6049,4 @@ BBUUGGSS
GNU Bash 4.4 2017 March 22 BASH(1)
GNU Bash 4.4 2017 May 25 BASH(1)
+2 -1
View File
@@ -3009,7 +3009,7 @@ wait_for_return:
state */
int
wait_for_job (job, flags)
int job;
int job, flags;
{
pid_t pid;
int r, state;
@@ -3054,6 +3054,7 @@ wait_for_job (job, flags)
is responsible for translating -1 into the right return value. */
int
wait_for_any_job (flags)
int flags;
{
pid_t pid;
int i, r, waited_for;
+13 -2
View File
@@ -467,6 +467,7 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp)
if (physchars > bound) /* should rarely happen */
{
#if defined (HANDLE_MULTIBYTE)
*r = '\0'; /* need null-termination for strlen */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
new = _rl_find_prev_mbchar (ret, r - ret, MB_FIND_ANY);
else
@@ -1518,6 +1519,8 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
oldwidth = 0;
else
oldwidth = WCWIDTH (wc);
if (oldwidth < 0)
oldwidth = 1;
/* 2. how many screen positions does the first char in new consume? */
memset (&ps, 0, sizeof (mbstate_t));
@@ -1532,12 +1535,16 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
newwidth = 0;
else
newwidth = WCWIDTH (wc);
if (newwidth < 0)
newwidth = 1;
/* 3. if the new width is less than the old width, we need to keep
going in new until we have consumed at least that many screen
positions, and figure out how many bytes that will take */
while (newbytes < nmax && newwidth < oldwidth)
{
int t;
ret = mbrtowc (&wc, new+newbytes, mb_cur_max, &ps);
if (MB_INVALIDCH (ret))
{
@@ -1548,7 +1555,8 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
break;
else
{
newwidth += WCWIDTH (wc);
t = WCWIDTH (wc);
newwidth += (t >= 0) ? t : 1;
newbytes += ret;
}
}
@@ -1557,6 +1565,8 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
figure out how many bytes that will take. This is an optimization */
while (oldbytes < omax && oldwidth < newwidth)
{
int t;
ret = mbrtowc (&wc, old+oldbytes, mb_cur_max, &ps);
if (MB_INVALIDCH (ret))
{
@@ -1567,7 +1577,8 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
break;
else
{
oldwidth += WCWIDTH (wc);
t = WCWIDTH (wc);
oldwidth += (t >= 0) ? t : 1;
oldbytes += ret;
}
}
+8 -2
View File
@@ -262,7 +262,7 @@ static void
_rl_isearch_fini (_rl_search_cxt *cxt)
{
/* First put back the original state. */
strcpy (rl_line_buffer, cxt->lines[cxt->save_line]);
rl_replace_line (cxt->lines[cxt->save_line], 0);
rl_restore_prompt ();
@@ -292,6 +292,7 @@ _rl_isearch_fini (_rl_search_cxt *cxt)
rl_point = cxt->sline_index;
/* Don't worry about where to put the mark here; rl_get_previous_history
and rl_get_next_history take care of it. */
_rl_fix_point (0);
rl_clear_message ();
}
@@ -515,7 +516,7 @@ add_character:
}
return (1);
}
else if (cxt->sflags & SF_REVERSE)
else if (cxt->sflags & SF_REVERSE && cxt->sline_index > 0)
cxt->sline_index--;
else if (cxt->sline_index != cxt->sline_len)
cxt->sline_index++;
@@ -664,6 +665,11 @@ add_character:
}
else
cxt->sline_index += cxt->direction;
if (cxt->sline_index < 0)
{
cxt->sline_index = 0;
break;
}
}
if (cxt->sflags & SF_FOUND)
break;
+1 -1
View File
@@ -119,7 +119,7 @@ _rl_copy_to_kill_ring (char *text, int append)
else
{
slot = rl_kill_ring_length += 1;
rl_kill_ring = (char **)xrealloc (rl_kill_ring, slot * sizeof (char *));
rl_kill_ring = (char **)xrealloc (rl_kill_ring, (slot + 1) * sizeof (char *));
}
rl_kill_ring[--slot] = (char *)NULL;
}
+8 -1
View File
@@ -92,6 +92,11 @@ _rl_find_next_mbchar_internal (char *string, int seed, int count, int find_non_z
return seed;
point = seed + _rl_adjust_point (string, seed, &ps);
/* if _rl_adjust_point returns -1, the character or string is invalid.
treat as a byte. */
if (point == seed - 1) /* invalid */
return seed + 1;
/* if this is true, means that seed was not pointing to a byte indicating
the beginning of a multibyte character. Correct the point and consume
one char. */
@@ -265,7 +270,7 @@ _rl_compare_chars (char *buf1, int pos1, mbstate_t *ps1, char *buf2, int pos2, m
/* adjust pointed byte and find mbstate of the point of string.
adjusted point will be point <= adjusted_point, and returns
differences of the byte(adjusted_point - point).
if point is invalied (point < 0 || more than string length),
if point is invalid (point < 0 || more than string length),
it returns -1 */
int
_rl_adjust_point (char *string, int point, mbstate_t *ps)
@@ -336,6 +341,8 @@ _rl_char_value (char *buf, int ind)
l = strlen (buf);
if (ind >= l - 1)
return ((wchar_t) buf[ind]);
if (l < ind) /* Sanity check */
l = strlen (buf+ind);
memset (&ps, 0, sizeof (mbstate_t));
tmp = mbrtowc (&wc, buf + ind, l - ind, &ps);
if (MB_INVALIDCH (tmp) || MB_NULLWCH (tmp))
+1 -1
View File
@@ -193,7 +193,7 @@ rl_tilde_expand (int ignore, int key)
}
else if (start >= 0 && rl_line_buffer[start] != '~')
{
for (; !whitespace (rl_line_buffer[start]) && start >= 0; start--)
for (; start >= 0 && !whitespace (rl_line_buffer[start]); start--)
;
start++;
}
+17
View File
@@ -4284,6 +4284,16 @@ xparse_dolparen (base, string, indp, flags)
orig_ind = *indp;
ostring = string;
if (*string == 0)
{
if (flags & SX_NOALLOC)
return (char *)NULL;
ret = xmalloc (1);
ret[0] = '\0';
return ret;
}
/*itrace("xparse_dolparen: size = %d shell_input_line = `%s'", shell_input_line_size, shell_input_line);*/
sflags = SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOFREE;
if (flags & SX_NOLONGJMP)
@@ -4350,6 +4360,8 @@ xparse_dolparen (base, string, indp, flags)
#if DEBUG
if (base[*indp] != ')')
itrace("xparse_dolparen:%d: base[%d] != RPAREN (%d), base = `%s'", line_number, *indp, base[*indp], base);
if (*indp < orig_ind)
itrace("xparse_dolparen:%d: *indp (%d) < orig_ind (%d), orig_string = `%s'", line_number, *indp, orig_ind, ostring);
#endif
if (flags & SX_NOALLOC)
@@ -6614,6 +6626,8 @@ set_line_mbstate ()
shell_input_line_property = (char *)xrealloc (shell_input_line_property, shell_input_line_propsize);
}
/* XXX - use whether or not we are in a UTF-8 locale to avoid calls to
mbrlen */
memset (&prevs, '\0', sizeof (mbstate_t));
for (i = previ = 0; i < len; i++)
{
@@ -6628,6 +6642,9 @@ set_line_mbstate ()
break;
}
/* I'd love to take more advantage of UTF-8's properties in a UTF-8
locale, but mbrlen changes the mbstate_t on every call even when
presented with single-byte characters. */
mbclen = mbrlen (shell_input_line + previ, i - previ + 1, &mbs);
if (mbclen == 1 || mbclen == (size_t)-1)
{