bash-5.0-beta release

This commit is contained in:
Chet Ramey
2018-09-17 15:10:56 -04:00
parent 9a51695bed
commit 2f5dfe5a18
144 changed files with 27560 additions and 36005 deletions
+1307 -553
View File
File diff suppressed because it is too large Load Diff
+125 -4
View File
@@ -1,3 +1,124 @@
This document details the changes between this version, bash-5.0-beta, and
the previous version, bash-5.0-alpha.
1. Changes to Bash
a. Fixed a bug that allowed subshells to "inherit" enclosing loops -- this
is where POSIX says the subshell is not "enclosed" by the loop.
b. Added more UTF-8-specific versions of multibyte functions, and optimized
existing functions if the current locale uses UTF-8 encoding.
c. In POSIX mode, assignments preceding regular builtins should not persist
when the builtin completes.
d. Added additional checks to special array assignment (e.g., BASH_ALIASES)
so it can't be used to bypass validity checks performed in other places.
e. The `!!' history expansion now refers to the previous history entry as
expected, even if used on the second or subsequent line of a multi-line
history entry.
f. Fixed a bug that could cause the shell to dereference a NULL pointer if
the environment (`environ') is set to NULL.
g. Bash uses slightly better integer overflow handling for brace sequence
expansion on systems where ints are 32 bits and intmax_t is 64 bits.
h. Fixed a bug setting attributes for a variable named as an argument to
`declare' that also appears as a nameref in the temporary environment.
i. Fixed several bugs that could cause assignments to namerefs to create
variables with invalid names.
j. Fixed a bug that could result in the SIGINT handler being set incorrectly
in asynchronous subshells.
k. Fixed a bug that could cause `bash -t' to not execute the specified command.
l. Fixed several bugs that caused the shell to operate on the wrong variable
when using namerefs with the same name as a global variable in shell
functions.
m. Internal changes to how the shell handles variables with invalid names in
the initial environment and to prevent variables with invalid names from
being added to the environment instead of passing them on to children.
n. Changes to make sure that an expansion that results in a quoted null string
is reflected in the expansion, even if the word expands to nothing.
o. Changes to make sure that $* and ${array[*]} (and $@/${array[@]}) expand
the same way after the recent changes for POSIX interpretation 888.
p. Saving and restoring the positional parameters at function entry and exit
is considerably more efficient; noticeably so when there are large numbers
of positional parameters.
q. Fixed a bug that caused `lastpipe' and `pipefail' to return an incorrect
status for the pipeline if there was more than one external command in a
loop body appearing in the last pipeline element.
r. Fixed a bug that caused value conversion errors with the printf builtin's
%u and %f conversion specifications and invalid constants.
2. Changes to Readline
a. Added more UTF-8-specific versions of multibyte functions, and optimized
existing functions if the current locale uses UTF-8 encoding.
b. Fixed a problem with bracketed-paste inserting more than one character and
interacting with other readline functions.
c. Fixed a bug that caused the history library to attempt to append a history
line to a non-existent history entry.
d. If using bracketed paste mode, output a newline after the \r that is the
last character of the mode disable string to avoid overwriting output.
e. Fixes to the vi-mode `b', `B', `w', `W', `e', and `E' commands to better
handle multibyte characters.
f. Fixed a redisplay problem that caused an extra newline to be generated on
accept-line when the line length is exactly the screenwidth.
3. New Features in Bash
a. Bash no longer allows variable assignments preceding a special builtin that
changes variable attributes to propagate back to the calling environment
unless the compatibility level is 44 or lower.
b. You can set the default value for $HISTSIZE at build time in config-top.h.
c. The `complete' builtin now accepts a -I option that applies the completion
to the initial word on the line.
d. The internal bash malloc now uses mmap (if available) to satisfy requests
greater than 128K bytes, so free can use mfree to return the pages to the
kernel.
e. The shell doesn't automatically set BASH_ARGC and BASH_ARGV at startup
unless it's in debugging mode, as the documentation has always said, but
will dynamically create them if a script references them at the top level
without having enabled debugging mode.
f. The localvar_inherit option will not attempt to inherit a value from a
variable of an incompatible type (indexed vs. associative arrays, for
example).
g. The `globasciiranges' option is now enabled by default; it can be set to
off by default at configuration time.
4. New Features in Readline
a. The history expansion library now understands command and process
substitution and extended globbing and allows them to appear anywhere in a
word.
b. The history library has a new variable that allows applications to set the
initial quoting state, so quoting state can be inherited from a previous
line.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.0-alpha, and
the previous version, bash-4.4-release.
@@ -195,11 +316,11 @@ kkk. Fixed a problem with arithmetic expressions containing array references
lll. The `select' command and help builtin will use $COLUMNS before the window
size returned from the kernel as the terminal width.
mmm. `read -n 0' and `read -N 0' now try a zero-length read to attempt to
mmm. `read -n 0' and `read -N 0' now try a zero-length read in an attempt to
detect file descriptor errors.
nnn. The `read' builtin now does a better job of acting on signals that don't
interrrupt read(2).
interrupt read(2).
ooo. Fixed some cases where `printf -v' did not return failure status on a
variable assignment error.
@@ -208,7 +329,7 @@ ppp. Fixed temporary environment propagation back to the current environment
so that it doesn't happen for special builtins run by the `command'
builtin.
qqq. Fixed a bug when searhing for the end of a here-document delimiter in a
qqq. Fixed a bug when searching for the end of a here-document delimiter in a
command substitution.
rrr. Fixed a bug that could cause `cd ${DIRSTACK[0]}' to fail.
@@ -359,7 +480,7 @@ d. Added support for keyboard timeouts when an ESC character is the last
e. There are several performance improvements when in a UTF-8 locale.
f. Readline does a better job of preserving the original set of blocked =
f. Readline does a better job of preserving the original set of blocked
signals when using pselect() to wait for input.
g. Fixed a bug that caused multibyte characters in macros to be mishandled.
+20 -4
View File
@@ -396,6 +396,15 @@ above.
BASH_ARGC and BASH_ARGV is available at compatibility levels less than
or equal to 44.
61. Bash-5.0 doesn't allow a `break' or `continue' in a subshell to attempt
to break or continue loop execution inherited from the calling context.
62. Bash-5.0 doesn't allow variable assignments preceding builtins like
export and readonly to modify variables with the same name in preceding
contexts (including the global context) unless the shell is in posix
mode, since export and readonly are special builtins.
Shell Compatibility Level
=========================
@@ -451,15 +460,22 @@ compat43 set
(declare -a foo='(1 2)')
- word expansion errors are considered non-fatal errors that cause the
current command to fail, even in Posix mode
- when executing a shell function, the loop state (while/until/etc.) is
not reset, so `break' or `continue' in a shell function will break or
continue loops in the calling context. Bash-4.4 and later reset the
loop state to prevent this.
- when executing a shell function, the loop state (while/until/etc.)
is not reset, so `break' or `continue' in that function will break
or continue loops in the calling context. Bash-4.4 and later reset
the loop state to prevent this.
compat44 set
- the shell sets up the values used by BASH_ARGV and BASH_ARGC so
they can expand to the shell's positional parameters even if extended
debug mode is not enabled
- a subshell inherits loops from its parent contenxt, so `break'
or `continue' will cause the subshell to exit
- variable assignments preceding builtins like export and readonly
that set attributes continue to affect variables with the same
name in the calling environment even if the shell is not in posix
mode
-------------------------------------------------------------------------------
+613 -11699
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -248,8 +248,8 @@ and linked, rather than changing run-time features.
'--enable-largefile'
Enable support for large files
(http://www.sas.com/standards/large_file/x_open.20Mar96.html) if
the operating system requires special compiler options to build
(http://www.unix.org/version2/whatsnew/lfs20mar.html) if the
operating system requires special compiler options to build
programs which can access large files. This is enabled by default,
if the operating system provides large file support.
+14 -1
View File
@@ -453,6 +453,7 @@ lib/sh/tmpfile.c f
lib/sh/uconvert.c f
lib/sh/ufuncs.c f
lib/sh/unicode.c f
lib/sh/utf8.c f
lib/sh/vprint.c f
lib/sh/wcsdup.c f
lib/sh/wcsnwidth.c f
@@ -868,6 +869,7 @@ tests/array22.sub f
tests/array23.sub f
tests/array24.sub f
tests/array25.sub f
tests/array26.sub f
tests/array-at-star f
tests/array2.right f
tests/assoc.tests f
@@ -881,6 +883,7 @@ tests/assoc6.sub f
tests/assoc7.sub f
tests/assoc8.sub f
tests/assoc9.sub f
tests/assoc10.sub f
tests/attr.tests f
tests/attr.right f
tests/attr1.sub f
@@ -1072,6 +1075,8 @@ tests/histexp1.sub f
tests/histexp2.sub f
tests/histexp3.sub f
tests/histexp4.sub f
tests/histexp5.sub f
tests/histexp6.sub f
tests/histexp.right f
tests/history.tests f
tests/history.right f
@@ -1136,6 +1141,8 @@ tests/nameref16.sub f
tests/nameref17.sub f
tests/nameref18.sub f
tests/nameref19.sub f
tests/nameref20.sub f
tests/nameref21.sub f
tests/nameref.right f
tests/new-exp.tests f
tests/new-exp1.sub f
@@ -1179,6 +1186,7 @@ tests/posixexp3.sub f
tests/posixexp4.sub f
tests/posixexp5.sub f
tests/posixexp6.sub f
tests/posixexp7.sub f
tests/posixexp2.tests f
tests/posixexp2.right f
tests/posixpat.tests f
@@ -1199,6 +1207,7 @@ tests/procsub1.sub f
tests/quote.tests f
tests/quote.right f
tests/quote1.sub f
tests/quote2.sub f
tests/read.tests f
tests/read.right f
tests/read1.sub f
@@ -1352,7 +1361,7 @@ tests/unicode1.sub f
tests/unicode2.sub f
tests/unicode3.sub f
tests/varenv.right f
tests/varenv.sh f
tests/varenv.tests f
tests/varenv1.sub f
tests/varenv2.sub f
tests/varenv3.sub f
@@ -1365,6 +1374,10 @@ tests/varenv9.sub f
tests/varenv10.sub f
tests/varenv11.sub f
tests/varenv12.sub f
tests/varenv13.sub f
tests/varenv14.sub f
tests/varenv15.sub f
tests/varenv15.in f
tests/version f
tests/version.mini f
tests/vredir.tests f
+6 -5
View File
@@ -1,4 +1,4 @@
# Makefile for bash-5.0, version 4.25
# Makefile for bash-5.0, version 4.27
#
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
@@ -41,6 +41,7 @@ infodir = @infodir@
includedir = @includedir@
datadir = @datadir@
localedir = @localedir@
pkgconfigdir = ${libdir}/pkgconfig
loadablesdir = @loadablesdir@
headersdir = @headersdir@
@@ -230,7 +231,7 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c \
${SH_LIBSRC}/fnxform.c ${SH_LIBSRC}/unicode.c \
${SH_LIBSRC}/wcswidth.c ${SH_LIBSRC}/wcsnwidth.c \
${SH_LIBSRC}/shmbchar.c
${SH_LIBSRC}/shmbchar.c ${SH_LIBSRC}/utf8.c
SHLIB_LIB = -lsh
SHLIB_LIBNAME = libsh.a
@@ -834,7 +835,7 @@ install-headers-dirs:
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)/builtins
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)/include
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(pkgconfigdir)
install-headers: install-headers-dirs
@for hf in $(INSTALLED_HEADERS) ; do \
@@ -849,14 +850,14 @@ install-headers: install-headers-dirs
@for hf in $(CREATED_HEADERS) ; do \
${INSTALL_DATA} $(BUILD_DIR)/"$$hf" $(DESTDIR)$(headersdir)/$$hf; \
done
$(INSTALL_DATA) $(SDIR)/bash.pc $(DESTDIR)$(libdir)/pkgconfig/bash.pc
-$(INSTALL_DATA) $(SDIR)/bash.pc $(DESTDIR)$(pkgconfigdir)/bash.pc
uninstall-headers:
-( cd $(DESTDIR)$(headersdir) && $(RM) $(INSTALLED_HEADERS) )
-( cd $(DESTDIR)$(headersdir)/include && $(RM) $(INSTALLED_INCFILES) )
-( cd $(DESTDIR)$(headersdir)/builtins && $(RM) $(INSTALLED_BUILTINS_HEADERS) )
-( cd $(DESTDIR)$(headersdir) && $(RM) $(CREATED_HEADERS) )
-( $(RM) $(DESTDIR)$(libdir)/pkgconfig/bash.pc )
-( $(RM) $(DESTDIR)$(pkgconfigdir)/bash.pc )
uninstall: .made
$(RM) $(DESTDIR)$(bindir)/$(Program) $(DESTDIR)$(bindir)/bashbug
+33
View File
@@ -85,6 +85,31 @@ z. The `times' builtin now honors the current locale when printing a decimal
aa. There is a new (disabled by default, undocumented) shell option to enable
and disable sending history to syslog at runtime.
bb. Bash no longer allows variable assignments preceding a special builtin that
changes variable attributes to propagate back to the calling environment
unless the compatibility level is 44 or lower.
cc. You can set the default value for $HISTSIZE at build time in config-top.h.
dd. The `complete' builtin now accepts a -I option that applies the completion
to the initial word on the line.
ee. The internal bash malloc now uses mmap (if available) to satisfy requests
greater than 128K bytes, so free can use mfree to return the pages to the
kernel.
ff. The shell doesn't automatically set BASH_ARGC and BASH_ARGV at startup
unless it's in debugging mode, as the documentation has always said, but
will dynamically create them if a script references them at the top level
without having enabled debugging mode.
gg. The localvar_inherit option will not attempt to inherit a value from a
variable of an incompatible type (indexed vs. associative arrays, for
example).
hh. The `globasciiranges' option is now enabled by default; it can be set to
off by default at configuration time.
2. New Features in Readline
a. Non-incremental vi-mode search (`N', `n') can search for a shell pattern, as
@@ -112,6 +137,14 @@ g. There is a simple variable comparison facility available for use within an
either `on' or `off'; variable names are separated from the operator by
whitespace.
h. The history expansion library now understands command and process
substitution and extended globbing and allows them to appear anywhere in a
word.
i. The history library has a new variable that allows applications to set the
initial quoting state, so quoting state can be inherited from a previous
line.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-4.4 since
the release of bash-4.3. As always, the manual page (doc/bash.1) is
+58 -56
View File
@@ -11,212 +11,214 @@ files.
The following list is what's changed when 'POSIX mode' is in effect:
1. When a command in the hash table no longer exists, Bash will
1. Bash ensures that the 'POSIXLY_CORRECT' variable is set.
2. When a command in the hash table no longer exists, Bash will
re-search '$PATH' to find the new location. This is also available
with 'shopt -s checkhash'.
2. The message printed by the job control code and builtins when a job
3. The message printed by the job control code and builtins when a job
exits with a non-zero status is 'Done(status)'.
3. The message printed by the job control code and builtins when a job
4. The message printed by the job control code and builtins when a job
is stopped is 'Stopped(SIGNAME)', where SIGNAME is, for example,
'SIGTSTP'.
4. Alias expansion is always enabled, even in non-interactive shells.
5. Alias expansion is always enabled, even in non-interactive shells.
5. Reserved words appearing in a context where reserved words are
6. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
6. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
7. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
and '!!' to '!' are enabled, and parameter expansion is performed
on the values of 'PS1' and 'PS2' regardless of the setting of the
'promptvars' option.
7. The POSIX startup files are executed ('$ENV') rather than the
8. The POSIX startup files are executed ('$ENV') rather than the
normal Bash files.
8. Tilde expansion is only performed on assignments preceding a
9. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
9. The default history file is '~/.sh_history' (this is the default
10. The default history file is '~/.sh_history' (this is the default
value of '$HISTFILE').
10. Redirection operators do not perform filename expansion on the
11. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
11. Redirection operators do not perform word splitting on the word in
12. Redirection operators do not perform word splitting on the word in
the redirection.
12. Function names must be valid shell 'name's. That is, they may not
13. Function names must be valid shell 'name's. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
13. Function names may not be the same as one of the POSIX special
14. Function names may not be the same as one of the POSIX special
builtins.
14. POSIX special builtins are found before shell functions during
15. POSIX special builtins are found before shell functions during
command lookup.
15. When printing shell function definitions (e.g., by 'type'), Bash
16. When printing shell function definitions (e.g., by 'type'), Bash
does not print the 'function' keyword.
16. Literal tildes that appear as the first character in elements of
17. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
17. The 'time' reserved word may be used by itself as a command. When
18. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
18. When parsing and expanding a ${...} expansion that appears within
19. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
19. The parser does not recognize 'time' as a reserved word if the
20. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
20. The '!' character does not introduce history expansion within a
21. The '!' character does not introduce history expansion within a
double-quoted string, even if the 'histexpand' option is enabled.
21. If a POSIX special builtin returns an error status, a
22. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
22. A non-interactive shell exits with an error status if a variable
23. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
23. A non-interactive shell exits with an error status if a variable
24. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command.
24. A non-interactive shell exits with an error status if the
25. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
25. Non-interactive shells exit if FILENAME in '.' FILENAME is not
26. Non-interactive shells exit if FILENAME in '.' FILENAME is not
found.
26. Non-interactive shells exit if a syntax error in an arithmetic
27. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
27. Non-interactive shells exit if a parameter expansion error occurs.
28. Non-interactive shells exit if a parameter expansion error occurs.
28. Non-interactive shells exit if there is a syntax error in a script
29. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
29. Process substitution is not available.
30. Process substitution is not available.
30. While variable indirection is available, it may not be applied to
31. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
31. When expanding the '*' special parameter in a pattern context
32. When expanding the '*' special parameter in a pattern context
where the expansion is double-quoted does not treat the '$*' as if
it were double-quoted.
32. Assignment statements preceding POSIX special builtins persist in
33. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
33. Assignment statements preceding shell function calls persist in
34. Assignment statements preceding shell function calls persist in
the shell environment after the function returns, as if a POSIX
special builtin command had been executed.
34. The 'command' builtin does not prevent builtins that take
35. The 'command' builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by 'command'.
35. The 'bg' builtin uses the required format to describe each job
36. The 'bg' builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
36. The output of 'kill -l' prints all the signal names on a single
37. The output of 'kill -l' prints all the signal names on a single
line, separated by spaces, without the 'SIG' prefix.
37. The 'kill' builtin does not accept signal names with a 'SIG'
38. The 'kill' builtin does not accept signal names with a 'SIG'
prefix.
38. The 'export' and 'readonly' builtin commands display their output
39. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
39. The 'trap' builtin displays signal names without the leading
40. The 'trap' builtin displays signal names without the leading
'SIG'.
40. The 'trap' builtin doesn't check the first argument for a possible
41. 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.
41. The '.' and 'source' builtins do not search the current directory
42. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
42. Enabling POSIX mode has the effect of setting the
43. 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.
43. When the 'alias' builtin displays alias definitions, it does not
44. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
44. When the 'set' builtin is invoked without options, it does not
45. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
45. When the 'set' builtin is invoked without options, it displays
46. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
46. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
47. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to PHYSICAL mode.
47. The 'pwd' builtin verifies that the value it prints is the same as
48. 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.
48. When listing the history, the 'fc' builtin does not include an
49. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
49. The default editor used by 'fc' is 'ed'.
50. The default editor used by 'fc' is 'ed'.
50. The 'type' and 'command' builtins will not report a non-executable
51. 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'.
51. The 'vi' editing mode will invoke the 'vi' editor directly when
52. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
52. When the 'xpg_echo' option is enabled, Bash does not attempt to
53. 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.
53. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
54. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
54. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
55. 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.
55. The 'read' builtin may be interrupted by a signal for which a trap
56. 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.
56. Bash removes an exited background process's status from the list
57. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
There is other POSIX behavior that Bash does not implement by default
Vendored
+1 -1
View File
@@ -1307,7 +1307,7 @@ AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
typedef RETSIGTYPE sigfunc();
int nsigint;
volatile int nsigint;
#ifdef HAVE_POSIX_SIGNALS
sigfunc *
+38 -101
View File
@@ -406,8 +406,8 @@ int starsub, quoted;
ARRAY *a2;
ARRAY_ELEMENT *h, *p;
arrayind_t i;
char *ifs, *sifs, *t;
int slen;
char *t;
WORD_LIST *wl;
p = a ? array_head (a) : 0;
if (p == 0 || array_empty (a) || start > array_max_index(a))
@@ -432,32 +432,12 @@ int starsub, quoted;
a2 = array_slice(a, h, p);
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
array_quote(a2);
else
array_quote_escapes(a2);
if (starsub && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) {
/* ${array[*]} */
array_remove_quoted_nulls (a2);
sifs = ifs_firstchar ((int *)NULL);
t = array_to_string (a2, sifs, 0);
free (sifs);
} else if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) {
/* ${array[@]} */
sifs = ifs_firstchar (&slen);
ifs = getifs ();
if (ifs == 0 || *ifs == 0) {
if (slen < 2)
sifs = xrealloc(sifs, 2);
sifs[0] = ' ';
sifs[1] = '\0';
}
t = array_to_string (a2, sifs, 0);
free (sifs);
} else
t = array_to_string (a2, " ", 0);
wl = array_to_word_list(a2);
array_dispose(a2);
if (wl == 0)
return (char *)NULL;
t = string_list_pos_params(starsub ? '*' : '@', wl, quoted);
dispose_words(wl);
return t;
}
@@ -468,50 +448,28 @@ ARRAY *a;
char *pat, *rep;
int mflags;
{
ARRAY *a2;
ARRAY_ELEMENT *e;
char *t, *sifs, *ifs;
int slen;
char *t;
int pchar, qflags;
WORD_LIST *wl, *save;
if (a == 0 || array_head(a) == 0 || array_empty(a))
return ((char *)NULL);
a2 = array_copy(a);
for (e = element_forw(a2->head); e != a2->head; e = element_forw(e)) {
t = pat_subst(element_value(e), pat, rep, mflags);
FREE(element_value(e));
e->value = t;
wl = array_to_word_list(a);
if (wl == 0)
return (char *)NULL;
for (save = wl; wl; wl = wl->next) {
t = pat_subst (wl->word->word, pat, rep, mflags);
FREE (wl->word->word);
wl->word->word = t;
}
if (mflags & MATCH_QUOTED)
array_quote(a2);
else
array_quote_escapes(a2);
pchar = (mflags & MATCH_STARSUB) == MATCH_STARSUB ? '*' : '@';
qflags = (mflags & MATCH_QUOTED) == MATCH_QUOTED ? Q_DOUBLE_QUOTES : 0;
if (mflags & MATCH_STARSUB) {
array_remove_quoted_nulls (a2);
if ((mflags & MATCH_QUOTED) == 0 && ifs_is_null)
sifs = spacesep;
else
sifs = ifs_firstchar((int *)NULL);
t = array_to_string (a2, sifs, 0);
if (sifs != spacesep)
free(sifs);
} else if (mflags & MATCH_QUOTED) {
/* ${array[@]} */
sifs = ifs_firstchar (&slen);
ifs = getifs ();
if (ifs == 0 || *ifs == 0) {
if (slen < 2)
sifs = xrealloc (sifs, 2);
sifs[0] = ' ';
sifs[1] = '\0';
}
t = array_to_string (a2, sifs, 0);
free(sifs);
} else
t = array_to_string (a2, " ", 0);
array_dispose (a2);
t = string_list_pos_params (pchar, save, qflags);
dispose_words(save);
return t;
}
@@ -523,53 +481,32 @@ char *pat;
int modop;
int mflags;
{
ARRAY *a2;
ARRAY_ELEMENT *e;
char *t, *sifs, *ifs;
int slen;
char *t;
int pchar, qflags;
WORD_LIST *wl, *save;
if (a == 0 || array_head(a) == 0 || array_empty(a))
return ((char *)NULL);
a2 = array_copy(a);
for (e = element_forw(a2->head); e != a2->head; e = element_forw(e)) {
t = sh_modcase(element_value(e), pat, modop);
FREE(element_value(e));
e->value = t;
wl = array_to_word_list(a);
if (wl == 0)
return ((char *)NULL);
for (save = wl; wl; wl = wl->next) {
t = sh_modcase(wl->word->word, pat, modop);
FREE(wl->word->word);
wl->word->word = t;
}
if (mflags & MATCH_QUOTED)
array_quote(a2);
else
array_quote_escapes(a2);
pchar = (mflags & MATCH_STARSUB) == MATCH_STARSUB ? '*' : '@';
qflags = (mflags & MATCH_QUOTED) == MATCH_QUOTED ? Q_DOUBLE_QUOTES : 0;
if (mflags & MATCH_STARSUB) {
array_remove_quoted_nulls (a2);
if ((mflags & MATCH_QUOTED) == 0 && ifs_is_null)
sifs = spacesep;
else
sifs = ifs_firstchar((int *)NULL);
t = array_to_string (a2, sifs, 0);
if (sifs != spacesep)
free(sifs);
} else if (mflags & MATCH_QUOTED) {
/* ${array[@]} */
sifs = ifs_firstchar (&slen);
ifs = getifs ();
if (ifs == 0 || *ifs == 0) {
if (slen < 2)
sifs = xrealloc (sifs, 2);
sifs[0] = ' ';
sifs[1] = '\0';
}
t = array_to_string (a2, sifs, 0);
free(sifs);
} else
t = array_to_string (a2, " ", 0);
array_dispose (a2);
t = string_list_pos_params (pchar, save, qflags);
dispose_words(save);
return t;
}
/*
* Allocate and return a new array element with index INDEX and value
* VALUE.
+2
View File
@@ -199,6 +199,8 @@ bind_array_var_internal (entry, ind, key, value, flags)
FREE (newval);
VUNSETATTR (entry, att_invisible); /* no longer invisible */
/* check mark_modified_variables if we ever want to export array vars */
return (entry);
}
+30 -80
View File
@@ -305,54 +305,29 @@ assoc_patsub (h, pat, rep, mflags)
char *pat, *rep;
int mflags;
{
BUCKET_CONTENTS *tlist;
int i, slen;
HASH_TABLE *h2;
char *t, *sifs, *ifs;
char *t;
int pchar, qflags;
WORD_LIST *wl, *save;
if (h == 0 || assoc_empty (h))
return ((char *)NULL);
h2 = assoc_copy (h);
for (i = 0; i < h2->nbuckets; i++)
for (tlist = hash_items (i, h2); tlist; tlist = tlist->next)
{
t = pat_subst ((char *)tlist->data, pat, rep, mflags);
FREE (tlist->data);
tlist->data = t;
}
wl = assoc_to_word_list (h);
if (wl == 0)
return (char *)NULL;
if (mflags & MATCH_QUOTED)
assoc_quote (h2);
else
assoc_quote_escapes (h2);
if (mflags & MATCH_STARSUB)
for (save = wl; wl; wl = wl->next)
{
assoc_remove_quoted_nulls (h2);
sifs = ifs_firstchar ((int *)NULL);
t = assoc_to_string (h2, sifs, 0);
free (sifs);
t = pat_subst (wl->word->word, pat, rep, mflags);
FREE (wl->word->word);
wl->word->word = t;
}
else if (mflags & MATCH_QUOTED)
{
/* ${array[@]} */
sifs = ifs_firstchar (&slen);
ifs = getifs ();
if (ifs == 0 || *ifs == 0)
{
if (slen < 2)
sifs = xrealloc (sifs, 2);
sifs[0] = ' ';
sifs[1] = '\0';
}
t = assoc_to_string (h2, sifs, 0);
free(sifs);
}
else
t = assoc_to_string (h2, " ", 0);
assoc_dispose (h2);
pchar = (mflags & MATCH_STARSUB) == MATCH_STARSUB ? '*' : '@';
qflags = (mflags & MATCH_QUOTED) == MATCH_QUOTED ? Q_DOUBLE_QUOTES : 0;
t = string_list_pos_params (pchar, save, qflags);
dispose_words (save);
return t;
}
@@ -364,54 +339,29 @@ assoc_modcase (h, pat, modop, mflags)
int modop;
int mflags;
{
BUCKET_CONTENTS *tlist;
int i, slen;
HASH_TABLE *h2;
char *t, *sifs, *ifs;
char *t;
int pchar, qflags;
WORD_LIST *wl, *save;
if (h == 0 || assoc_empty (h))
return ((char *)NULL);
h2 = assoc_copy (h);
for (i = 0; i < h2->nbuckets; i++)
for (tlist = hash_items (i, h2); tlist; tlist = tlist->next)
{
t = sh_modcase ((char *)tlist->data, pat, modop);
FREE (tlist->data);
tlist->data = t;
}
wl = assoc_to_word_list (h);
if (wl == 0)
return ((char *)NULL);
if (mflags & MATCH_QUOTED)
assoc_quote (h2);
else
assoc_quote_escapes (h2);
if (mflags & MATCH_STARSUB)
for (save = wl; wl; wl = wl->next)
{
assoc_remove_quoted_nulls (h2);
sifs = ifs_firstchar ((int *)NULL);
t = assoc_to_string (h2, sifs, 0);
free (sifs);
t = sh_modcase (wl->word->word, pat, modop);
FREE (wl->word->word);
wl->word->word = t;
}
else if (mflags & MATCH_QUOTED)
{
/* ${array[@]} */
sifs = ifs_firstchar (&slen);
ifs = getifs ();
if (ifs == 0 || *ifs == 0)
{
if (slen < 2)
sifs = xrealloc (sifs, 2);
sifs[0] = ' ';
sifs[1] = '\0';
}
t = assoc_to_string (h2, sifs, 0);
free(sifs);
}
else
t = assoc_to_string (h2, " ", 0);
assoc_dispose (h2);
pchar = (mflags & MATCH_STARSUB) == MATCH_STARSUB ? '*' : '@';
qflags = (mflags & MATCH_QUOTED) == MATCH_QUOTED ? Q_DOUBLE_QUOTES : 0;
t = string_list_pos_params (pchar, save, qflags);
dispose_words (save);
return t;
}
+26 -3
View File
@@ -60,6 +60,10 @@
extern int rl_done, rl_dispatching; /* should really include readline.h */
#endif
#ifndef HISTSIZE_DEFAULT
# define HISTSIZE_DEFAULT "500"
#endif
#if !defined (errno)
extern int errno;
#endif
@@ -209,7 +213,7 @@ bash_history_inhibit_expansion (string, i)
char *string;
int i;
{
int t;
int t, si;
char hx[2];
hx[0] = history_expansion_char;
@@ -232,9 +236,20 @@ bash_history_inhibit_expansion (string, i)
return (1);
#endif
si = 0;
/* If we're supposed to be in single-quoted string, skip over the
single-quoted part and then look at what's left. */
if (history_quoting_state == '\'')
{
si = skip_to_delim (string, 0, "'", SD_NOJMP|SD_HISTEXP);
if (string[si] == 0 || si >= i)
return (1);
si++;
}
/* Make sure the history expansion should not be skipped by quoting or
command/process substitution. */
else if ((t = skip_to_histexp (string, 0, hx, SD_NOJMP|SD_HISTEXP)) > 0)
if ((t = skip_to_histexp (string, si, hx, SD_NOJMP|SD_HISTEXP)) > 0)
{
/* Skip instances of history expansion appearing on the line before
this one. */
@@ -305,7 +320,7 @@ load_history ()
Note that the history file is automatically truncated to the
size of HISTSIZE if the user does not explicitly set the size
differently. */
set_if_not ("HISTSIZE", "500");
set_if_not ("HISTSIZE", HISTSIZE_DEFAULT);
sv_histsize ("HISTSIZE");
set_if_not ("HISTFILESIZE", get_string_value ("HISTSIZE"));
@@ -545,7 +560,15 @@ pre_process_line (line, print_changes, addit)
add that line to the history if ADDIT is non-zero. */
if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
{
/* If we are expanding the second or later line of a multi-line
command, decrease history_length so references to history expansions
in these lines refer to the previous history entry and not the
current command. */
if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
history_length--;
expanded = history_expand (line, &history_value);
if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
history_length++;
if (expanded)
{
+13 -4
View File
@@ -1426,6 +1426,7 @@ attempt_shell_completion (text, start, end)
char **matches, *command_separator_chars;
#if defined (PROGRAMMABLE_COMPLETION)
int have_progcomps, was_assignment;
COMPSPEC *iw_compspec;
#endif
command_separator_chars = COMMAND_SEPARATORS;
@@ -1510,7 +1511,9 @@ attempt_shell_completion (text, start, end)
#if defined (PROGRAMMABLE_COMPLETION)
/* Attempt programmable completion. */
have_progcomps = prog_completion_enabled && (progcomp_size () > 0);
if (matches == 0 && (in_command_position == 0 || text[0] == '\0') &&
iw_compspec = progcomp_search (INITIALWORD);
if (matches == 0 &&
(in_command_position == 0 || text[0] == '\0' || (in_command_position && iw_compspec)) &&
current_prompt_string == ps1_prompt)
{
int s, e, s1, e1, os, foundcs;
@@ -1564,7 +1567,7 @@ attempt_shell_completion (text, start, end)
else if (start == end && start == s1 && e != 0 && e1 > end) /* beginning of command name, leading whitespace */
foundcs = 0;
else if (e == 0 && e == s && text[0] == '\0' && have_progcomps) /* beginning of empty line */
prog_complete_matches = programmable_completions ("_EmptycmD_", text, s, e, &foundcs);
prog_complete_matches = programmable_completions (EMPTYCMD, text, s, e, &foundcs);
else if (start == end && text[0] == '\0' && s1 > start && whitespace (rl_line_buffer[start]))
foundcs = 0; /* whitespace before command name */
else if (e > s && was_assignment == 0 && e1 == end && rl_line_buffer[e] == 0 && whitespace (rl_line_buffer[e-1]) == 0)
@@ -1589,8 +1592,8 @@ attempt_shell_completion (text, start, end)
}
else if (s >= e && n[0] == '\0' && text[0] == '\0' && start > 0)
{
foundcs = 0; /* empty command name following assignments */
in_command_position = was_assignment;
foundcs = 0; /* empty command name following optional assignments */
in_command_position += was_assignment;
}
else if (s == start && e == end && STREQ (n, text) && start > 0)
{
@@ -1599,6 +1602,12 @@ attempt_shell_completion (text, start, end)
}
else
foundcs = 0;
/* If we have defined a compspec for the initial (command) word, call
it and process the results like any other programmable completion. */
if (in_command_position && have_progcomps && foundcs == 0 && iw_compspec)
prog_complete_matches = programmable_completions (INITIALWORD, text, s, e, &foundcs);
FREE (n);
/* XXX - if we found a COMPSPEC for the command, just return whatever
the programmable completion code returns, and disable the default
+6 -4
View File
@@ -1,6 +1,6 @@
/* braces.c -- code for doing word expansion in curly braces. */
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
/* Copyright (C) 1987-2018 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -420,9 +420,9 @@ mkseq (start, end, incr, type, width)
/* Instead of a simple nelem = prevn + 1, something like:
nelem = (prevn / imaxabs(incr)) + 1;
would work */
nelem = (prevn / sh_imaxabs(incr)) + 1;
if (nelem > INT_MAX - 2) /* Don't overflow int */
if ((prevn / sh_imaxabs (incr)) > INT_MAX - 3) /* check int overflow */
return ((char **)NULL);
nelem = (prevn / sh_imaxabs(incr)) + 1;
result = strvec_mcreate (nelem + 1);
if (result == 0)
{
@@ -778,7 +778,9 @@ array_concat (arr1, arr2)
len1 = strvec_len (arr1);
len2 = strvec_len (arr2);
result = (char **)xmalloc ((1 + (len1 * len2)) * sizeof (char *));
result = (char **)malloc ((1 + (len1 * len2)) * sizeof (char *));
if (result == 0)
return (result);
len = 0;
for (i = 0; i < len1; i++)
+1 -1
View File
@@ -678,7 +678,7 @@ get_job_spec (list)
if (DIGIT (*word) && all_digits (word))
{
job = atoi (word);
return (job > js.j_jobslots ? NO_JOB : job - 1);
return ((job < 0 || job > js.j_jobslots) ? NO_JOB : job - 1);
}
jflags = 0;
+55 -19
View File
@@ -23,7 +23,7 @@ $PRODUCES complete.c
$BUILTIN complete
$DEPENDS_ON PROGRAMMABLE_COMPLETION
$FUNCTION complete_builtin
$SHORT_DOC complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]
$SHORT_DOC complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]
Specify how arguments are to be completed by Readline.
For each NAME, specify how arguments are to be completed. If no options
@@ -38,10 +38,12 @@ Options:
without any specific completion defined
-E apply the completions and actions to "empty" commands --
completion attempted on a blank line
-I apply the completions and actions to the intial (usually the
command) word
When completion is attempted, the actions are applied in the order the
uppercase-letter options are listed above. The -D option takes
precedence over -E.
uppercase-letter options are listed above. If multiple options are supplied,
the -D option takes precedence over -E, and both take precedence over -I.
Exit Status:
Returns success unless an invalid option is supplied or an error occurs.
@@ -79,6 +81,7 @@ struct _optflags {
int rflag;
int Dflag;
int Eflag;
int Iflag;
};
static int find_compact __P((char *));
@@ -195,7 +198,7 @@ build_actions (list, flagp, actp, optp)
opt_given = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "abcdefgjko:prsuvA:G:W:P:S:X:F:C:DE")) != -1)
while ((opt = internal_getopt (list, "abcdefgjko:prsuvA:G:W:P:S:X:F:C:DEI")) != -1)
{
opt_given = 1;
switch (opt)
@@ -307,6 +310,18 @@ build_actions (list, flagp, actp, optp)
builtin_usage ();
return (EX_USAGE);
}
case 'I':
if (flagp)
{
flagp->Iflag = 1;
break;
}
else
{
sh_invalidopt ("-I");
builtin_usage ();
return (EX_USAGE);
}
case 'F':
Farg = list_optarg;
break;
@@ -355,7 +370,8 @@ complete_builtin (list)
return (EXECUTION_SUCCESS);
}
opt_given = oflags.pflag = oflags.rflag = oflags.Dflag = oflags.Eflag = 0;
opt_given = oflags.pflag = oflags.rflag = 0;
oflags.Dflag = oflags.Eflag = oflags.Iflag = 0;
acts = copts = (unsigned long)0L;
Garg = Warg = Parg = Sarg = Xarg = Farg = Carg = (char *)NULL;
@@ -370,8 +386,14 @@ complete_builtin (list)
list = loptend;
wl = oflags.Dflag ? make_word_list (make_bare_word (DEFAULTCMD), (WORD_LIST *)NULL)
: (oflags.Eflag ? make_word_list (make_bare_word (EMPTYCMD), (WORD_LIST *)NULL) : 0);
if (oflags.Dflag)
wl = make_word_list (make_bare_word (DEFAULTCMD), (WORD_LIST *)NULL);
else if (oflags.Eflag)
wl = make_word_list (make_bare_word (EMPTYCMD), (WORD_LIST *)NULL);
else if (oflags.Iflag)
wl = make_word_list (make_bare_word (INITIALWORD), (WORD_LIST *)NULL);
else
wl = (WORD_LIST *)NULL;
/* -p overrides everything else */
if (oflags.pflag || (list == 0 && opt_given == 0))
@@ -564,10 +586,12 @@ print_one_completion (cmd, cs)
/* simple arguments that don't require quoting */
PRINTARG (cs->funcname, "-F");
if (STREQ (cmd, EMPTYCMD))
printf ("-E\n");
else if (STREQ (cmd, DEFAULTCMD))
if (STREQ (cmd, DEFAULTCMD))
printf ("-D\n");
else if (STREQ (cmd, EMPTYCMD))
printf ("-E\n");
else if (STREQ (cmd, INITIALWORD))
printf ("-I\n");
else
printf ("%s\n", cmd);
@@ -608,10 +632,12 @@ print_compopts (cmd, cs, full)
PRINTCOMPOPT (COPT_PLUSDIRS, "plusdirs");
}
if (STREQ (cmd, EMPTYCMD))
printf ("-E\n");
else if (STREQ (cmd, DEFAULTCMD))
if (STREQ (cmd, DEFAULTCMD))
printf ("-D\n");
else if (STREQ (cmd, EMPTYCMD))
printf ("-E\n");
else if (STREQ (cmd, INITIALWORD))
printf ("-I\n");
else
printf ("%s\n", cmd);
}
@@ -769,7 +795,7 @@ compgen_builtin (list)
$BUILTIN compopt
$DEPENDS_ON PROGRAMMABLE_COMPLETION
$FUNCTION compopt_builtin
$SHORT_DOC compopt [-o|+o option] [-DE] [name ...]
$SHORT_DOC compopt [-o|+o option] [-DEI] [name ...]
Modify or display completion options.
Modify the completion options for each NAME, or, if no NAMEs are supplied,
@@ -780,6 +806,7 @@ Options:
-o option Set completion option OPTION for each NAME
-D Change options for the "default" command completion
-E Change options for the "empty" command completion
-I Change options for completion on the initial word
Using `+o' instead of `-o' turns off the specified option.
@@ -800,15 +827,15 @@ int
compopt_builtin (list)
WORD_LIST *list;
{
int opts_on, opts_off, *opts, opt, oind, ret, Dflag, Eflag;
int opts_on, opts_off, *opts, opt, oind, ret, Dflag, Eflag, Iflag;
WORD_LIST *l, *wl;
COMPSPEC *cs;
opts_on = opts_off = Eflag = Dflag = 0;
opts_on = opts_off = Eflag = Dflag = Iflag = 0;
ret = EXECUTION_SUCCESS;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "+o:DE")) != -1)
while ((opt = internal_getopt (list, "+o:DEI")) != -1)
{
opts = (list_opttype == '-') ? &opts_on : &opts_off;
@@ -829,6 +856,9 @@ compopt_builtin (list)
case 'E':
Eflag = 1;
break;
case 'I':
Iflag = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
@@ -837,8 +867,14 @@ compopt_builtin (list)
}
list = loptend;
wl = Dflag ? make_word_list (make_bare_word (DEFAULTCMD), (WORD_LIST *)NULL)
: (Eflag ? make_word_list (make_bare_word (EMPTYCMD), (WORD_LIST *)NULL) : 0);
if (Dflag)
wl = make_word_list (make_bare_word (DEFAULTCMD), (WORD_LIST *)NULL);
else if (Eflag)
wl = make_word_list (make_bare_word (EMPTYCMD), (WORD_LIST *)NULL);
else if (Iflag)
wl = make_word_list (make_bare_word (INITIALWORD), (WORD_LIST *)NULL);
else
wl = (WORD_LIST *)NULL;
if (list == 0 && wl == 0)
{
+33 -10
View File
@@ -440,19 +440,38 @@ restart_new_var_name:
refvar = (SHELL_VAR *)NULL;
if (variable_context && mkglobal == 0 && ((flags_on & att_function) == 0))
{
char *newname;
/* check name for validity here? */
var = find_variable (name);
if (var == 0)
newname = nameref_transform_name (name, ASS_MKLOCAL);
else if ((flags_on & att_nameref) == 0 && (flags_off & att_nameref) == 0)
{
/* Ok, we're following namerefs here, so let's make sure that if
we followed one, it was at the same context (see below for
more details). */
refvar = find_variable_last_nameref (name, 1);
newname = (refvar && refvar->context != variable_context) ? name : var->name;
refvar = (SHELL_VAR *)NULL;
}
else
newname = name; /* dealing with nameref attribute */
#if defined (ARRAY_VARS)
/* Pass 1 as second argument to make_local_{assoc,array}_variable
return an existing {array,assoc} variable to be flagged as an
error below. */
if (flags_on & att_assoc)
var = make_local_assoc_variable (name);
var = make_local_assoc_variable (newname, 1);
else if ((flags_on & att_array) || making_array_special)
var = make_local_array_variable (name, making_array_special);
var = make_local_array_variable (newname, 1);
else
#endif
if (offset == 0 && (flags_on & att_nameref))
{
/* First look for refvar at current scope */
refvar = find_variable_last_nameref (name, 1);
var = find_variable (name);
/* VARIABLE_CONTEXT != 0, so we are attempting to create or modify
the attributes for a local variable at the same scope. If we've
used a reference from a previous context to resolve VAR, we
@@ -471,7 +490,8 @@ restart_new_var_name:
}
else
/* XXX - check name for validity here with valid_nameref_value */
var = make_local_variable (name, 0); /* sets att_invisible for new vars */
var = make_local_variable ((flags_on & att_nameref) ? name : newname, 0); /* sets att_invisible for new vars */
if (var == 0)
{
any_failed++;
@@ -623,14 +643,14 @@ restart_new_var_name:
}
#endif
/* See if we are trying to set flags or value for an existing nameref
that points to a non-existent variable: e.g.,
/* See if we are trying to set flags or value (or create) for an
existing nameref that points to a non-existent variable: e.g.,
declare -n foo=bar
unset foo # unsets bar
declare -i foo
foo=4+4
declare -p foo */
if (var == 0 && (flags_on || flags_off || offset))
if (var == 0 && (mkglobal || flags_on || flags_off || offset))
{
refvar = mkglobal ? find_global_variable_last_nameref (name, 0) : find_variable_last_nameref (name, 0);
if (refvar && nameref_p (refvar) == 0)
@@ -939,9 +959,12 @@ restart_new_var_name:
{
tvalue = var_isset (var) ? savestring (value_cell (var)) : savestring ("");
tv = bind_variable (var->name, tvalue, 0);
tv->attributes |= var->attributes & ~att_tempvar;
if (tv->context > 0)
VSETATTR (tv, att_propagate);
if (tv)
{
tv->attributes |= var->attributes & ~att_tempvar;
if (tv->context > 0)
VSETATTR (tv, att_propagate);
}
free (tvalue);
}
VSETATTR (var, att_propagate);
+4
View File
@@ -1198,8 +1198,10 @@ getuintmax ()
if (*ep)
{
sh_invalidnum (garglist->word->word);
#if 0
/* Same POSIX.2 conversion error requirements as getintmax(). */
ret = 0;
#endif
conversion_error = 1;
}
else if (errno == ERANGE)
@@ -1227,8 +1229,10 @@ getfloatmax ()
if (*ep)
{
sh_invalidnum (garglist->word->word);
#if 0
/* Same thing about POSIX.2 conversion error requirements. */
ret = 0;
#endif
conversion_error = 1;
}
else if (errno == ERANGE)
+1
View File
@@ -705,6 +705,7 @@ add_char:
}
else
# endif
if (locale_utf8locale == 0 || ((c & 0x80) != 0))
i += read_mbchar (fd, input_string, i, c, unbuffered_read);
}
#endif
+14 -9
View File
@@ -560,18 +560,23 @@ set_var_attribute (name, attribute, undo)
var->attributes |= tv->attributes & ~att_tempvar;
/* This avoids an error message when propagating a read-only var
later on. */
if (var->context == 0 && (attribute & att_readonly))
if (posixly_correct || shell_compatibility_level <= 44)
{
/* Don't bother to set the `propagate to the global variables
table' flag if we've just bound the variable in that table */
v = find_global_variable (tv->name);
if (v != var)
if (var->context == 0 && (attribute & att_readonly))
{
/* Don't bother to set the `propagate to the global variables
table' flag if we've just bound the variable in that
table */
v = find_global_variable (tv->name);
if (v != var)
VSETATTR (tv, att_propagate);
}
else
VSETATTR (tv, att_propagate);
if (var->context != 0)
VSETATTR (var, att_propagate);
}
else
VSETATTR (tv, att_propagate);
if (var->context != 0)
VSETATTR (var, att_propagate);
SETVARATTR (tv, attribute, undo); /* XXX */
stupidly_hack_special_variables (tv->name);
+5 -1
View File
@@ -110,6 +110,7 @@ extern int enable_hostname_completion __P((int));
#if defined (PROGRAMMABLE_COMPLETION)
extern int prog_completion_enabled;
extern int progcomp_alias;
#endif
#if defined (DEBUGGER)
@@ -219,7 +220,7 @@ static struct {
{ "lithist", &literal_history, (shopt_set_func_t *)NULL },
#endif
{ "localvar_inherit", &localvar_inherit, (shopt_set_func_t *)NULL },
#if 0
#if 0 /* bash-5.0-beta */
{ "localvar_unset", &localvar_unset, (shopt_set_func_t *)NULL },
#endif
{ "login_shell", &shopt_login_shell, set_login_shell },
@@ -232,6 +233,9 @@ static struct {
{ "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (PROGRAMMABLE_COMPLETION)
{ "progcomp", &prog_completion_enabled, (shopt_set_func_t *)NULL },
# if 0 /* bash-5.0-beta */
{ "progcomp_alias", &progcomp_alias, (shopt_set_func_t *)NULL },
# endif
#endif
{ "promptvars", &promptvars, (shopt_set_func_t *)NULL },
#if defined (RESTRICTED_SHELL)
+1 -1
View File
@@ -94,7 +94,7 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
#define W_HASQUOTEDNULL 0x040000 /* word contains a quoted null character */
#define W_DQUOTE 0x080000 /* word should be treated as if double-quoted */
#define W_NOPROCSUB 0x100000 /* don't perform process substitution */
#define W_HASCTLESC 0x200000 /* word contains literal CTLESC characters */
#define W_SAWQUOTEDNULL 0x200000 /* word contained a quoted null that was removed */
#define W_ASSIGNASSOC 0x400000 /* word looks like associative array assignment */
#define W_ASSIGNARRAY 0x800000 /* word looks like a compound indexed array assignment */
#define W_ARRAYIND 0x1000000 /* word is an array index being expanded */
+4
View File
@@ -176,3 +176,7 @@
/* Define to force the value of OLDPWD inherited from the environment to be a
directory */
#define OLDPWD_CHECK_DIRECTORY 1
/* Define to set the initial size of the history list ($HISTSIZE). This must
be a string. */
/*#define HISTSIZE_DEFAULT "500"*/
+6
View File
@@ -1028,6 +1028,9 @@
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
@@ -1167,6 +1170,9 @@
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the `mremap' function. */
#undef HAVE_MREMAP
/* Define if you have the `munmap' function. */
#undef HAVE_MUNMAP
Vendored
+35 -29
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.0, version 4.091.
# From configure.ac for Bash 5.0, version 5.002.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 5.0-alpha.
# Generated by GNU Autoconf 2.69 for bash 5.0-beta.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -581,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.0-alpha'
PACKAGE_STRING='bash 5.0-alpha'
PACKAGE_VERSION='5.0-beta'
PACKAGE_STRING='bash 5.0-beta'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1394,7 +1394,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bash 5.0-alpha to adapt to many kinds of systems.
\`configure' configures bash 5.0-beta to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1459,7 +1459,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.0-alpha:";;
short | recursive ) echo "Configuration of bash 5.0-beta:";;
esac
cat <<\_ACEOF
@@ -1655,7 +1655,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.0-alpha
bash configure 5.0-beta
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2364,7 +2364,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 5.0-alpha, which was
It was created by bash $as_me 5.0-beta, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2759,7 +2759,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=5.0
RELSTATUS=alpha
RELSTATUS=beta
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -2847,33 +2847,38 @@ opt_with_installed_readline=no
#htmldir=
case "${host_cpu}-${host_os}" in
# mostly obsolete platforms
alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
*[Cc]ray*-*) opt_bash_malloc=no ;; # Crays
*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
sparc-svr4*) opt_bash_malloc=no ;; # sparc SVR4, SVR4.2
sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
*-beos*) opt_bash_malloc=no ;; # they say it's suitable
# These need additional investigation
sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
#*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here
#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
*-mirbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
*-aix*) opt_bash_malloc=no ;; # AIX machines
*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
# Mach-derived systems have a ton of extra malloc functions and lack sbrk(2)
*-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
*-openstep*) opt_bash_malloc=no ;; # i386/Sparc/HP machines running Openstep
*-macos*) opt_bash_malloc=no ;; # Apple MacOS X
*-rhapsody*) opt_bash_malloc=no ;; # Apple Rhapsody (MacOS X)
*-darwin*) opt_bash_malloc=no ;; # Apple Darwin (MacOS X)
*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
*-qnx*) opt_bash_malloc=no ;; # QNX 4.2, QNX [67].x
*-machten4) opt_bash_malloc=no ;; # MachTen 4.x
*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
*-beos*) opt_bash_malloc=no ;; # they say it's suitable
*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
# Niche or non-mainstream-shell-user systems
*-qnx*) opt_bash_malloc=no ;; # QNX 4.2, QNX [67].x
*-nsk*) opt_bash_malloc=no ;; # HP NonStop
*-haiku*) opt_bash_malloc=no ;; # Haiku OS
# Deprecated -- bash malloc is suitable
#sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
#mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
#*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here
#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
#*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
#*-mirbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
esac
# memory scrambling on free()
@@ -2981,7 +2986,7 @@ opt_casemod_attrs=yes
opt_casemod_expansions=yes
opt_extglob_default=no
opt_dircomplete_expand_default=no
opt_globascii_default=no
opt_globascii_default=yes
opt_function_import=yes
opt_dev_fd_stat_broken=no
@@ -3004,7 +3009,7 @@ if test $opt_minimal_config = yes; then
opt_net_redirs=no opt_progcomp=no opt_separate_help=no
opt_multibyte=yes opt_cond_regexp=no opt_coproc=no
opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
opt_globascii_default=no
opt_globascii_default=yes
fi
# Check whether --enable-alias was given.
@@ -5404,7 +5409,7 @@ fi
case "$ac_cv_rl_version" in
7*|8*|9*) ;;
8*|9*) ;;
*) opt_with_installed_readline=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: installed readline library is too old to be linked with bash" >&5
$as_echo "$as_me: WARNING: installed readline library is too old to be linked with bash" >&2;}
@@ -9292,7 +9297,7 @@ fi
done
for ac_header in sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \
sys/param.h sys/socket.h sys/stat.h \
sys/mman.h sys/param.h sys/socket.h sys/stat.h \
sys/time.h sys/times.h sys/types.h sys/wait.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -11046,7 +11051,7 @@ fi
rm -f conftest.mmap conftest.txt
for ac_func in __argz_count __argz_next __argz_stringify dcgettext mempcpy \
munmap stpcpy strcspn
munmap mremap stpcpy strcspn
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -15252,7 +15257,7 @@ else
typedef RETSIGTYPE sigfunc();
int nsigint;
volatile int nsigint;
#ifdef HAVE_POSIX_SIGNALS
sigfunc *
@@ -16175,6 +16180,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
*) $as_echo "#define PGRP_PIPE 1" >>confdefs.h
;;
esac ;;
openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
*qnx[67]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
@@ -16815,7 +16821,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 5.0-alpha, which was
This file was extended by bash $as_me 5.0-beta, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16881,7 +16887,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bash config.status 5.0-alpha
bash config.status 5.0-beta
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+26 -20
View File
@@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2016 Free Software Foundation, Inc.
# Copyright (C) 1987-2018 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
@@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 5.0, version 4.091])dnl
AC_REVISION([for Bash 5.0, version 5.002])dnl
define(bashvers, 5.0)
define(relstatus, alpha)
define(relstatus, beta)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
@@ -63,33 +63,38 @@ dnl some systems should be configured without the bash malloc by default
dnl and some need a special compiler or loader
dnl look in the NOTES file for more
case "${host_cpu}-${host_os}" in
# mostly obsolete platforms
alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
*[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays
*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
sparc-svr4*) opt_bash_malloc=no ;; # sparc SVR4, SVR4.2
sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
*-beos*) opt_bash_malloc=no ;; # they say it's suitable
# These need additional investigation
sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
#*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here
#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
*-mirbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
*-aix*) opt_bash_malloc=no ;; # AIX machines
*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
# Mach-derived systems have a ton of extra malloc functions and lack sbrk(2)
*-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
*-openstep*) opt_bash_malloc=no ;; # i386/Sparc/HP machines running Openstep
*-macos*) opt_bash_malloc=no ;; # Apple MacOS X
*-rhapsody*) opt_bash_malloc=no ;; # Apple Rhapsody (MacOS X)
*-darwin*) opt_bash_malloc=no ;; # Apple Darwin (MacOS X)
*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
*-qnx*) opt_bash_malloc=no ;; # QNX 4.2, QNX [67].x
*-machten4) opt_bash_malloc=no ;; # MachTen 4.x
*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
*-beos*) opt_bash_malloc=no ;; # they say it's suitable
*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
# Niche or non-mainstream-shell-user systems
*-qnx*) opt_bash_malloc=no ;; # QNX 4.2, QNX [67].x
*-nsk*) opt_bash_malloc=no ;; # HP NonStop
*-haiku*) opt_bash_malloc=no ;; # Haiku OS
# Deprecated -- bash malloc is suitable
#sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
#mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
#*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here
#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
#*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
#*-mirbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
esac
# memory scrambling on free()
@@ -177,7 +182,7 @@ opt_casemod_attrs=yes
opt_casemod_expansions=yes
opt_extglob_default=no
opt_dircomplete_expand_default=no
opt_globascii_default=no
opt_globascii_default=yes
opt_function_import=yes
opt_dev_fd_stat_broken=no
@@ -200,7 +205,7 @@ if test $opt_minimal_config = yes; then
opt_net_redirs=no opt_progcomp=no opt_separate_help=no
opt_multibyte=yes opt_cond_regexp=no opt_coproc=no
opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
opt_globascii_default=no
opt_globascii_default=yes
fi
AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
@@ -550,7 +555,7 @@ then
RL_LIB_READLINE_VERSION
case "$ac_cv_rl_version" in
7*|8*|9*) ;;
8*|9*) ;;
*) opt_with_installed_readline=no
AC_MSG_WARN([installed readline library is too old to be linked with bash])
AC_MSG_WARN([using private bash version])
@@ -714,7 +719,7 @@ AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \
regex.h syslog.h ulimit.h)
AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \
sys/param.h sys/socket.h sys/stat.h \
sys/mman.h sys/param.h sys/socket.h sys/stat.h \
sys/time.h sys/times.h sys/types.h sys/wait.h)
AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
@@ -850,7 +855,7 @@ AC_CHECK_HEADERS([argz.h errno.h fcntl.h malloc.h stdio_ext.h])
dnl AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify dcgettext mempcpy \
munmap stpcpy strcspn])
munmap mremap stpcpy strcspn])
INTL_DEP= INTL_INC= LIBINTL_H=
if test "x$USE_INCLUDED_LIBINTL" = "xyes"; then
@@ -1111,6 +1116,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1.*|2.[[0123]]*) : ;;
*) AC_DEFINE(PGRP_PIPE) ;;
esac ;;
openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
*qnx[[67]]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
+1269 -1240
View File
File diff suppressed because it is too large Load Diff
+61 -24
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Thu Mar 15 11:30:03 EDT 2018
.\" Last Change: Tue Aug 7 12:01:07 EDT 2018
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2018 March 15" "GNU Bash 5.0"
.TH BASH 1 "2018 August 7" "GNU Bash 5.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -739,7 +739,7 @@ to be matched as a string.
An additional binary operator, \fB=~\fP, is available, with the same
precedence as \fB==\fP and \fB!=\fP.
When it is used, the string to the right of the operator is considered
an extended regular expression and matched accordingly (as in \fIregex\fP(3)).
a POSIX extended regular expression and matched accordingly (as in \fIregex\fP(3)).
The return value is 0 if the string matches
the pattern, and 1 otherwise.
If the regular expression is syntactically incorrect, the conditional
@@ -1357,7 +1357,14 @@ If
is null, the parameters are joined without intervening separators.
.TP
.B @
Expands to the positional parameters, starting from one. When the
Expands to the positional parameters, starting from one.
In contexts where word splitting is performed, this expands each
positional parameter to a separate word; if not within double
quotes, these words are subject to word splitting.
In contexts where word splitting is not performed,
this expands to a single word
with each positional parameter separated by a space.
When the
expansion occurs within double quotes, each parameter expands to a
separate word. That is, "\fB$@\fP" is equivalent to
"\fB$1\fP" "\fB$2\fP" ...
@@ -1499,7 +1506,8 @@ only when in extended debugging mode (see the description of the
option to the
.B shopt
builtin below).
Setting \fBextdebug\fP after the shell has started to execute a script
Setting \fBextdebug\fP after the shell has started to execute a script,
or referencing this variable when \fBextdebug\fP is not set,
may result in inconsistent values.
.TP
.B BASH_ARGV
@@ -1519,7 +1527,8 @@ only when in extended debugging mode
option to the
.B shopt
builtin below).
Setting \fBextdebug\fP after the shell has started to execute a script
Setting \fBextdebug\fP after the shell has started to execute a script,
or referencing this variable when \fBextdebug\fP is not set,
may result in inconsistent values.
.TP
.B BASH_ARGV0
@@ -2072,7 +2081,7 @@ line editing.
Similar to
.SM
.BR BASH_ENV ;
used when the shell is invoked in POSIX mode.
used when the shell is invoked in \fIposix mode\fP.
.TP
.B EXECIGNORE
A colon-separated list of shell patterns (see \fBPattern Matching\fP)
@@ -2277,6 +2286,11 @@ startup file, overriding the default of
.B READLINE
below).
.TP
.B INSIDE_EMACS
If this variable appears in the environment when the shell starts,
\fBbash\fP assumes that it is running inside an Emacs shell buffer
and may disable line editing, depending on the value of \fBTERM\fP.
.TP
.B LANG
Used to determine the locale category for any category not specifically
selected with a variable starting with \fBLC_\fP.
@@ -2400,6 +2414,8 @@ running, \fBbash\fP enables \fIposix mode\fP, as if the command
.if t \f(CWset -o posix\fP
.if n \fIset -o posix\fP
had been executed.
When the shell enters \fIposix mode\fP, it sets this variable if it was
not already set.
.TP
.B PROMPT_COMMAND
If set, the value is executed as a command prior to issuing each primary
@@ -2914,6 +2930,14 @@ and
.SM
.BR CDPATH ,
and the shell assigns the expanded value.
.PP
Bash also performs tilde expansion on words satisfying the conditions of
variable assignments (as described above under
.SM
.BR PARAMETERS )
when they appear as arguments to simple commands.
Bash does not do this, except for the \fIdeclaration\fP commands listed
above, when in \fIposix mode\fP.
.SS Parameter Expansion
.PP
The `\fB$\fP' character introduces parameter expansion,
@@ -2945,16 +2969,16 @@ The \fIparameter\fP is a shell parameter as described above
.PP
If the first character of \fIparameter\fP is an exclamation point (\fB!\fP),
and \fIparameter\fP is not a \fInameref\fP,
it introduces a level of variable indirection.
\fBBash\fP uses the value of the variable formed from the rest of
\fIparameter\fP as the name of the variable; this variable is then
expanded and that value is used in the rest of the substitution, rather
than the value of \fIparameter\fP itself.
it introduces a level of indirection.
\fBBash\fP uses the value formed by expanding the rest of
\fIparameter\fP as the new \fIparameter\fP; this is then
expanded and that value is used in the rest of the expansion, rather
than the expansion of the original \fIparameter\fP.
This is known as \fIindirect expansion\fP.
The value is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
If \fIparameter\fP is a nameref, this expands to the name of the
variable referenced by \fIparameter\fP instead of performing the
parameter referenced by \fIparameter\fP instead of performing the
complete indirect expansion.
The exceptions to this are the expansions of ${\fB!\fP\fIprefix\fP\fB*\fP} and
${\fB!\fP\fIname\fP[\fI@\fP]} described below.
@@ -4821,7 +4845,7 @@ subshell environment. Changes made to the subshell environment
cannot affect the shell's execution environment.
.PP
Subshells spawned to execute command substitutions inherit the value of
the \fB\-e\fP option from the parent shell. When not in \fIposix\fP mode,
the \fB\-e\fP option from the parent shell. When not in \fIposix mode\fP,
\fBbash\fP clears the \fB\-e\fP option in such subshells.
.PP
If a command is followed by a \fB&\fP and job control is not active, the
@@ -7640,12 +7664,12 @@ will be displayed.
The return value is true unless an invalid option is supplied, or no
matches were generated.
.TP
\fBcomplete\fP [\fB\-abcdefgjksuv\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-DE\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-F\fP \fIfunction\fP] [\fB\-C\fP \fIcommand\fP]
\fBcomplete\fP [\fB\-abcdefgjksuv\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-DEI\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-F\fP \fIfunction\fP] [\fB\-C\fP \fIcommand\fP]
.br
[\fB\-X\fP \fIfilterpat\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP] \fIname\fP [\fIname ...\fP]
.PD 0
.TP
\fBcomplete\fP \fB\-pr\fP [\fB\-DE\fP] [\fIname\fP ...]
\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,
@@ -7654,12 +7678,21 @@ them to be reused as input.
The \fB\-r\fP option removes a completion specification for
each \fIname\fP, or, if no \fIname\fPs are supplied, all
completion specifications.
The \fB\-D\fP option indicates that the remaining options and actions should
The \fB\-D\fP option indicates that other supplied options and actions should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The \fB\-E\fP option indicates that the remaining options and actions should
The \fB\-E\fP option indicates that other supplied options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The \fB\-I\fP option indicates that other supplied options and actions should
apply to completion on the inital non-assignment word on the line, or after
a command delimiter such as \fB;\fP or \fB|\fP, which is usually command
name completion.
If multiple options are supplied, the \fB\-D\fP option takes precedence
over \fB\-E\fP, and both take precedence over \fB\-I\fP.
If any of \fB\-D\fP, \fB\-E\fP, or \fB\-I\fP are supplied, any other
\fIname\fP arguments are ignored; these completions only apply to the case
specified by the option.
.sp 1
The process of applying these completion specifications when word completion
is attempted is described above under \fBProgrammable Completion\fP.
@@ -7855,7 +7888,7 @@ a \fIname\fP for which no specification exists, or
an error occurs adding a completion specification.
.RE
.TP
\fBcompopt\fP [\fB\-o\fP \fIoption\fP] [\fB\-DE\fP] [\fB+o\fP \fIoption\fP] [\fIname\fP]
\fBcompopt\fP [\fB\-o\fP \fIoption\fP] [\fB\-DEI\fP] [\fB+o\fP \fIoption\fP] [\fIname\fP]
Modify completion options for each \fIname\fP according to the
\fIoption\fPs, or for the
currently-executing completion if no \fIname\fPs are supplied.
@@ -7863,12 +7896,16 @@ If no \fIoption\fPs are given, display the completion options for each
\fIname\fP or the current completion.
The possible values of \fIoption\fP are those valid for the \fBcomplete\fP
builtin described above.
The \fB\-D\fP option indicates that the remaining options should
The \fB\-D\fP option indicates that other supplied options should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The \fB\-E\fP option indicates that the remaining options should
The \fB\-E\fP option indicates that other supplied options should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The \fB\-I\fP option indicates that other supplied options should
apply to completion on the inital non-assignment word on the line,
or after a command delimiter such as \fB;\fP or \fB|\fP, which is usually
command name completion.
.sp 1
The return value is true unless an invalid option is supplied, an attempt
is made to modify the options for a \fIname\fP for which no completion
@@ -9271,7 +9308,7 @@ Without options, the name and value of each shell variable are displayed
in a format that can be reused as input
for setting or resetting the currently-set variables.
Read-only variables cannot be reset.
In \fIposix\fP mode, only shell variables are listed.
In \fIposix mode\fP, only shell variables are listed.
The output is sorted according to the current locale.
When options are specified, they set or unset shell attributes.
Any arguments remaining after option processing are treated
@@ -9817,7 +9854,7 @@ interrupt; previous versions continue with the next command in the list.
.B compat41
If set,
.BR bash ,
when in \fIposix\fP mode, treats a single quote in a double-quoted
when in \fIposix mode\fP, treats a single quote in a double-quoted
parameter expansion as a special character. The single quotes must match
(an even number) and the characters between the single quotes are considered
quoted. This is the behavior of posix mode through version 4.1.
@@ -10589,7 +10626,7 @@ which is in units of 512-byte blocks;
and
.BR \-u ,
which are unscaled values;
and, when in Posix mode,
and, when in posix mode,
.B \-c
and
.BR \-f ,
+65 -25
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2018 March 15<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2018 August 7<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -965,7 +965,7 @@ to be matched as a string.
An additional binary operator, <B>=~</B>, is available, with the same
precedence as <B>==</B> and <B>!=</B>.
When it is used, the string to the right of the operator is considered
an extended regular expression and matched accordingly (as in <I>regex</I>(3)).
a POSIX extended regular expression and matched accordingly (as in <I>regex</I>(3)).
The return value is 0 if the string matches
the pattern, and 1 otherwise.
If the regular expression is syntactically incorrect, the conditional
@@ -1738,7 +1738,14 @@ is null, the parameters are joined without intervening separators.
<DT><B>@</B>
<DD>
Expands to the positional parameters, starting from one. When the
Expands to the positional parameters, starting from one.
In contexts where word splitting is performed, this expands each
positional parameter to a separate word; if not within double
quotes, these words are subject to word splitting.
In contexts where word splitting is not performed,
this expands to a single word
with each positional parameter separated by a space.
When the
expansion occurs within double quotes, each parameter expands to a
separate word. That is, &quot;<B>$@</B>&quot; is equivalent to
&quot;<B>$1</B>&quot; &quot;<B>$2</B>&quot; ...
@@ -1922,7 +1929,8 @@ option to the
<B>shopt</B>
builtin below).
Setting <B>extdebug</B> after the shell has started to execute a script
Setting <B>extdebug</B> after the shell has started to execute a script,
or referencing this variable when <B>extdebug</B> is not set,
may result in inconsistent values.
<DT><B>BASH_ARGV</B>
@@ -1947,7 +1955,8 @@ option to the
<B>shopt</B>
builtin below).
Setting <B>extdebug</B> after the shell has started to execute a script
Setting <B>extdebug</B> after the shell has started to execute a script,
or referencing this variable when <B>extdebug</B> is not set,
may result in inconsistent values.
<DT><B>BASH_ARGV0</B>
@@ -2634,7 +2643,7 @@ Similar to
<FONT SIZE=-1><B>BASH_ENV</B>;
</FONT>
used when the shell is invoked in POSIX mode.
used when the shell is invoked in <I>posix mode</I>.
<DT><B>EXECIGNORE</B>
<DD>
@@ -2887,6 +2896,12 @@ startup file, overriding the default of
</FONT>
below).
<DT><B>INSIDE_EMACS</B>
<DD>
If this variable appears in the environment when the shell starts,
<B>bash</B> assumes that it is running inside an Emacs shell buffer
and may disable line editing, depending on the value of <B>TERM</B>.
<DT><B>LANG</B>
<DD>
@@ -3043,6 +3058,8 @@ running, <B>bash</B> enables <I>posix mode</I>, as if the command
<TT>set -o posix</TT>
had been executed.
When the shell enters <I>posix mode</I>, it sets this variable if it was
not already set.
<DT><B>PROMPT_COMMAND</B>
<DD>
@@ -3698,6 +3715,16 @@ and
</FONT>
and the shell assigns the expanded value.
<P>
Bash also performs tilde expansion on words satisfying the conditions of
variable assignments (as described above under
<FONT SIZE=-1><B>PARAMETERS</B>)
</FONT>
when they appear as arguments to simple commands.
Bash does not do this, except for the <I>declaration</I> commands listed
above, when in <I>posix mode</I>.
<A NAME="lbBB">&nbsp;</A>
<H4>Parameter Expansion</H4>
@@ -3738,16 +3765,16 @@ The <I>parameter</I> is a shell parameter as described above
If the first character of <I>parameter</I> is an exclamation point (<B>!</B>),
and <I>parameter</I> is not a <I>nameref</I>,
it introduces a level of variable indirection.
<B>Bash</B> uses the value of the variable formed from the rest of
<I>parameter</I> as the name of the variable; this variable is then
expanded and that value is used in the rest of the substitution, rather
than the value of <I>parameter</I> itself.
it introduces a level of indirection.
<B>Bash</B> uses the value formed by expanding the rest of
<I>parameter</I> as the new <I>parameter</I>; this is then
expanded and that value is used in the rest of the expansion, rather
than the expansion of the original <I>parameter</I>.
This is known as <I>indirect expansion</I>.
The value is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
If <I>parameter</I> is a nameref, this expands to the name of the
variable referenced by <I>parameter</I> instead of performing the
parameter referenced by <I>parameter</I> instead of performing the
complete indirect expansion.
The exceptions to this are the expansions of ${<B>!</B><I>prefix</I><B>*</B>} and
${<B>!</B><I>name</I>[<I>@</I>]} described below.
@@ -6125,7 +6152,7 @@ cannot affect the shell's execution environment.
<P>
Subshells spawned to execute command substitutions inherit the value of
the <B>-e</B> option from the parent shell. When not in <I>posix</I> mode,
the <B>-e</B> option from the parent shell. When not in <I>posix mode</I>,
<B>bash</B> clears the <B>-e</B> option in such subshells.
<P>
@@ -9745,12 +9772,12 @@ will be displayed.
<P>
The return value is true unless an invalid option is supplied, or no
matches were generated.
<DT><B>complete</B> [<B>-abcdefgjksuv</B>] [<B>-o</B> <I>comp-option</I>] [<B>-DE</B>] [<B>-A</B> <I>action</I>] [<B>-G</B> <I>globpat</I>] [<B>-W</B> <I>wordlist</I>] [<B>-F</B> <I>function</I>] [<B>-C</B> <I>command</I>]<DD>
<DT><B>complete</B> [<B>-abcdefgjksuv</B>] [<B>-o</B> <I>comp-option</I>] [<B>-DEI</B>] [<B>-A</B> <I>action</I>] [<B>-G</B> <I>globpat</I>] [<B>-W</B> <I>wordlist</I>] [<B>-F</B> <I>function</I>] [<B>-C</B> <I>command</I>]<DD>
<BR>
[<B>-X</B> <I>filterpat</I>] [<B>-P</B> <I>prefix</I>] [<B>-S</B> <I>suffix</I>] <I>name</I> [<I>name ...</I>]
<DT><B>complete</B> <B>-pr</B> [<B>-DE</B>] [<I>name</I> ...]<DD>
<DT><B>complete</B> <B>-pr</B> [<B>-DEI</B>] [<I>name</I> ...]<DD>
Specify how arguments to each <I>name</I> should be completed.
If the <B>-p</B> option is supplied, or if no options are supplied,
@@ -9759,12 +9786,21 @@ them to be reused as input.
The <B>-r</B> option removes a completion specification for
each <I>name</I>, or, if no <I>name</I>s are supplied, all
completion specifications.
The <B>-D</B> option indicates that the remaining options and actions should
The <B>-D</B> option indicates that other supplied options and actions should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The <B>-E</B> option indicates that the remaining options and actions should
The <B>-E</B> option indicates that other supplied options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The <B>-I</B> option indicates that other supplied options and actions should
apply to completion on the inital non-assignment word on the line, or after
a command delimiter such as <B>;</B> or <B>|</B>, which is usually command
name completion.
If multiple options are supplied, the <B>-D</B> option takes precedence
over <B>-E</B>, and both take precedence over <B>-I</B>.
If any of <B>-D</B>, <B>-E</B>, or <B>-I</B> are supplied, any other
<I>name</I> arguments are ignored; these completions only apply to the case
specified by the option.
<P>
The process of applying these completion specifications when word completion
is attempted is described above under <B>Programmable Completion</B>.
@@ -9995,7 +10031,7 @@ a <I>name</I> for which no specification exists, or
an error occurs adding a completion specification.
</DL>
<DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>-DE</B>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
<DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>-DEI</B>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
Modify completion options for each <I>name</I> according to the
<I>option</I>s, or for the
currently-executing completion if no <I>name</I>s are supplied.
@@ -10003,12 +10039,16 @@ If no <I>option</I>s are given, display the completion options for each
<I>name</I> or the current completion.
The possible values of <I>option</I> are those valid for the <B>complete</B>
builtin described above.
The <B>-D</B> option indicates that the remaining options should
The <B>-D</B> option indicates that other supplied options should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The <B>-E</B> option indicates that the remaining options should
The <B>-E</B> option indicates that other supplied options should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The <B>-I</B> option indicates that other supplied options should
apply to completion on the inital non-assignment word on the line,
or after a command delimiter such as <B>;</B> or <B>|</B>, which is usually
command name completion.
<P>
The return value is true unless an invalid option is supplied, an attempt
is made to modify the options for a <I>name</I> for which no completion
@@ -11727,7 +11767,7 @@ Without options, the name and value of each shell variable are displayed
in a format that can be reused as input
for setting or resetting the currently-set variables.
Read-only variables cannot be reset.
In <I>posix</I> mode, only shell variables are listed.
In <I>posix mode</I>, only shell variables are listed.
The output is sorted according to the current locale.
When options are specified, they set or unset shell attributes.
Any arguments remaining after option processing are treated
@@ -12444,7 +12484,7 @@ interrupt; previous versions continue with the next command in the list.
If set,
<B>bash</B>,
when in <I>posix</I> mode, treats a single quote in a double-quoted
when in <I>posix mode</I>, treats a single quote in a double-quoted
parameter expansion as a special character. The single quotes must match
(an even number) and the characters between the single quotes are considered
quoted. This is the behavior of posix mode through version 4.1.
@@ -13426,7 +13466,7 @@ and
<B>-u</B>,
which are unscaled values;
and, when in Posix mode,
and, when in posix mode,
<B>-c</B>
and
@@ -13852,7 +13892,7 @@ There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash 5.0<TH ALIGN=CENTER width=33%>2018 March 15<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash 5.0<TH ALIGN=CENTER width=33%>2018 August 7<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -13958,6 +13998,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 19 March 2018 09:43:32 EDT
Time: 07 September 2018 16:15:28 EDT
</BODY>
</HTML>
+419 -359
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+3450 -3396
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+119 -51
View File
@@ -1,9 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This text is a brief description of the features that are present in
the Bash shell (version 5.0, 15 March 2018).
the Bash shell (version 5.0, 7 August 2018).
This is Edition 5.0, last updated 15 March 2018,
This is Edition 5.0, last updated 7 August 2018,
of The GNU Bash Reference Manual,
for Bash, Version 5.0.
@@ -284,10 +284,10 @@ Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previou
<h1 class="top">Bash Features</h1>
<p>This text is a brief description of the features that are present in
the Bash shell (version 5.0, 15 March 2018).
the Bash shell (version 5.0, 7 August 2018).
The Bash home page is <a href="http://www.gnu.org/software/bash/">http://www.gnu.org/software/bash/</a>.
</p>
<p>This is Edition 5.0, last updated 15 March 2018,
<p>This is Edition 5.0, last updated 7 August 2018,
of <cite>The GNU Bash Reference Manual</cite>,
for <code>Bash</code>, Version 5.0.
</p>
@@ -1297,7 +1297,9 @@ zero if no condition tested true.
<p>The syntax of the <code>case</code> command is:
</p>
<div class="example">
<pre class="example">case <var>word</var> in [ [(] <var>pattern</var> [| <var>pattern</var>]&hellip;) <var>command-list</var> ;;]&hellip; esac
<pre class="example">case <var>word</var> in
[ [(] <var>pattern</var> [| <var>pattern</var>]&hellip;) <var>command-list</var> ;;]&hellip;
esac
</pre></div>
<p><code>case</code> will selectively execute the <var>command-list</var> corresponding to
@@ -1443,14 +1445,15 @@ If the <code>nocasematch</code> shell option
is enabled, the match is performed without regard to the case
of alphabetic characters.
The return value is 0 if the string matches (&lsquo;<samp>==</samp>&rsquo;) or does not
match (&lsquo;<samp>!=</samp>&rsquo;)the pattern, and 1 otherwise.
match (&lsquo;<samp>!=</samp>&rsquo;) the pattern, and 1 otherwise.
Any part of the pattern may be quoted to force the quoted portion
to be matched as a string.
</p>
<p>An additional binary operator, &lsquo;<samp>=~</samp>&rsquo;, is available, with the same
precedence as &lsquo;<samp>==</samp>&rsquo; and &lsquo;<samp>!=</samp>&rsquo;.
When it is used, the string to the right of the operator is considered
an extended regular expression and matched accordingly (as in <i>regex</i>3)).
a <small>POSIX</small> extended regular expression and matched accordingly
(as in <i>regex</i>3)).
The return value is 0 if the string matches
the pattern, and 1 otherwise.
If the regular expression is syntactically incorrect, the conditional
@@ -1722,7 +1725,8 @@ from a file (in this case, filenames listed one per line):
<p>with a more compact syntax reminiscent of lambdas:
</p><div class="example">
<pre class="example">cat list | parallel &quot;do-something1 {} config-{} ; do-something2 &lt; {}&quot; | process-output
<pre class="example">cat list | parallel &quot;do-something1 {} config-{} ; do-something2 &lt; {}&quot; |
process-output
</pre></div>
<p>Parallel provides a built-in mechanism to remove filename extensions, which
@@ -1744,12 +1748,20 @@ written as
<p>If a command generates output, you may want to preserve the input order in
the output. For instance, the following command
</p><div class="example">
<pre class="example">{ echo foss.org.my ; echo debian.org; echo freenetproject.org; } | parallel traceroute
<pre class="example">{
echo foss.org.my ;
echo debian.org ;
echo freenetproject.org ;
} | parallel traceroute
</pre></div>
<p>will display as output the traceroute invocation that finishes first.
Adding the <samp>-k</samp> option
</p><div class="example">
<pre class="example">{ echo foss.org.my ; echo debian.org; echo freenetproject.org; } | parallel -k traceroute
<pre class="example">{
echo foss.org.my ;
echo debian.org ;
echo freenetproject.org ;
} | parallel -k traceroute
</pre></div>
<p>will ensure that the output of <code>traceroute foss.org.my</code> is displayed first.
</p>
@@ -2126,8 +2138,16 @@ separators.
<a name="index-_0040"></a>
</dt>
<dd><a name="index-_0024_0040"></a>
<p>($@) Expands to the positional parameters, starting from one. When the
expansion occurs within double quotes, each parameter expands to a
<p>($@) Expands to the positional parameters, starting from one.
In contexts where word splitting is performed, this expands each
positional parameter to a separate word; if not within double
quotes, these words are subject to word splitting.
In contexts where word splitting is not performed,
this expands to a single word
with each positional parameter separated by a space.
When the
expansion occurs within double quotes, and word splitting is performed,
each parameter expands to a
separate word. That is, <code>&quot;$@&quot;</code> is equivalent to
<code>&quot;$1&quot; &quot;$2&quot; &hellip;</code>.
If the double-quoted expansion occurs within a word, the expansion of
@@ -2446,6 +2466,12 @@ and the shell assigns the expanded value.
</p></dd>
</dl>
<p>Bash also performs tilde expansion on words satisfying the conditions of
variable assignments (see <a href="#Shell-Parameters">Shell Parameters</a>)
when they appear as arguments to simple commands.
Bash does not do this, except for the <var>declaration</var> commands listed
above, when in <small>POSIX</small> mode.
</p>
<hr>
<a name="Shell-Parameter-Expansion"></a>
<div class="header">
@@ -2480,11 +2506,11 @@ interpreted as part of its name.
</p>
<p>If the first character of <var>parameter</var> is an exclamation point (!),
and <var>parameter</var> is not a <var>nameref</var>,
it introduces a level of variable indirection.
Bash uses the value of the variable formed from the rest of
<var>parameter</var> as the name of the variable; this variable is then
expanded and that value is used in the rest of the substitution, rather
than the value of <var>parameter</var> itself.
it introduces a level of indirection.
Bash uses the value formed by expanding the rest of
<var>parameter</var> as the new <var>parameter</var>; this is then
expanded and that value is used in the rest of the expansion, rather
than the expansion of the original <var>parameter</var>.
This is known as <code>indirect expansion</code>.
The value is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
@@ -5078,8 +5104,8 @@ parent.
<dt><code>mapfile</code></dt>
<dd><a name="index-mapfile"></a>
<div class="example">
<pre class="example">mapfile [-d <var>delim</var>] [-n <var>count</var>] [-O <var>origin</var>] [-s <var>count</var>] [-t] [-u <var>fd</var>]
[-C <var>callback</var>] [-c <var>quantum</var>] [<var>array</var>]
<pre class="example">mapfile [-d <var>delim</var>] [-n <var>count</var>] [-O <var>origin</var>] [-s <var>count</var>]
[-t] [-u <var>fd</var>] [-C <var>callback</var>] [-c <var>quantum</var>] [<var>array</var>]
</pre></div>
<p>Read lines from the standard input into the indexed array variable <var>array</var>,
@@ -5309,8 +5335,8 @@ The exit status is greater than 128 if the timeout is exceeded.
<dt><code>readarray</code></dt>
<dd><a name="index-readarray"></a>
<div class="example">
<pre class="example">readarray [-d <var>delim</var>] [-n <var>count</var>] [-O <var>origin</var>] [-s <var>count</var>] [-t] [-u <var>fd</var>]
[-C <var>callback</var>] [-c <var>quantum</var>] [<var>array</var>]
<pre class="example">readarray [-d <var>delim</var>] [-n <var>count</var>] [-O <var>origin</var>] [-s <var>count</var>]
[-t] [-u <var>fd</var>] [-C <var>callback</var>] [-c <var>quantum</var>] [<var>array</var>]
</pre></div>
<p>Read lines from the standard input into the indexed array variable <var>array</var>,
@@ -6574,7 +6600,8 @@ The shell sets <code>BASH_ARGC</code> only when in extended debugging mode
(see <a href="#The-Shopt-Builtin">The Shopt Builtin</a>
for a description of the <code>extdebug</code> option to the <code>shopt</code>
builtin).
Setting <code>extdebug</code> after the shell has started to execute a script
Setting <code>extdebug</code> after the shell has started to execute a script,
or referencing this variable when <code>extdebug</code> is not set,
may result in inconsistent values.
</p>
</dd>
@@ -6590,7 +6617,8 @@ The shell sets <code>BASH_ARGV</code> only when in extended debugging mode
(see <a href="#The-Shopt-Builtin">The Shopt Builtin</a>
for a description of the <code>extdebug</code> option to the <code>shopt</code>
builtin).
Setting <code>extdebug</code> after the shell has started to execute a script
Setting <code>extdebug</code> after the shell has started to execute a script,
or referencing this variable when <code>extdebug</code> is not set,
may result in inconsistent values.
</p>
</dd>
@@ -7180,7 +7208,7 @@ as the sole input. If set, the value denotes the number
of consecutive <code>EOF</code> characters that can be read as the
first character on an input line
before the shell will exit. If the variable exists but does not
have a numeric value (or has no value) then the default is 10.
have a numeric value, or has no value, then the default is 10.
If the variable does not exist, then <code>EOF</code> signifies the end of
input to the shell. This is only in effect for interactive shells.
</p>
@@ -7192,6 +7220,14 @@ input to the shell. This is only in effect for interactive shells.
of <samp>~/.inputrc</samp>.
</p>
</dd>
<dt><code>INSIDE_EMACS</code>
<a name="index-INSIDE_005fEMACS"></a>
</dt>
<dd><p>If Bash finds this variable in the environment when the shell
starts, it assumes that the shell is running in an Emacs shell buffer
and may disable line editing depending on the value of <code>TERM</code>.
</p>
</dd>
<dt><code>LANG</code>
<a name="index-LANG"></a>
</dt>
@@ -7324,7 +7360,9 @@ as if the command
</p><div class="example">
<pre class="example"><code>set -o posix</code>
</pre></div>
<p>had been executed.
<p>had been executed.
When the shell enters <small>POSIX</small> mode, it sets this variable if it was
not already set.
</p>
</dd>
<dt><code>PPID</code>
@@ -7583,9 +7621,12 @@ Next: <a href="#Bash-Startup-Files" accesskey="n" rel="next">Bash Startup Files<
<h3 class="section">6.1 Invoking Bash</h3>
<div class="example">
<pre class="example">bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o <var>option</var>] [-O <var>shopt_option</var>] [<var>argument</var> &hellip;]
bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o <var>option</var>] [-O <var>shopt_option</var>] -c <var>string</var> [<var>argument</var> &hellip;]
bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o <var>option</var>] [-O <var>shopt_option</var>] [<var>argument</var> &hellip;]
<pre class="example">bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o <var>option</var>]
[-O <var>shopt_option</var>] [<var>argument</var> &hellip;]
bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o <var>option</var>]
[-O <var>shopt_option</var>] -c <var>string</var> [<var>argument</var> &hellip;]
bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o <var>option</var>]
[-O <var>shopt_option</var>] [<var>argument</var> &hellip;]
</pre></div>
<p>All of the single-character options used with the <code>set</code> builtin
@@ -8014,7 +8055,7 @@ when a shell with history enabled exits.
(see <a href="#Signals">Signals</a>).
</li><li> In the absence of any traps, <code>SIGINT</code> is caught and handled
((see <a href="#Signals">Signals</a>).
(see <a href="#Signals">Signals</a>).
<code>SIGINT</code> will interrupt some shell builtins.
</li><li> An interactive login shell sends a <code>SIGHUP</code> to all jobs on exit
@@ -8843,7 +8884,7 @@ shell session.
<p>After the string is decoded, it is expanded via
parameter expansion, command substitution, arithmetic
expansion, and quote removal, subject to the value of the
<code>promptvars</code> shell option (see <a href="#Bash-Builtins">Bash Builtins</a>).
<code>promptvars</code> shell option (see <a href="#The-Shopt-Builtin">The Shopt Builtin</a>).
</p>
<hr>
<a name="The-Restricted-Shell"></a>
@@ -8913,7 +8954,9 @@ startup files.
<p>The following list is what&rsquo;s changed when &lsquo;<small>POSIX</small> mode&rsquo; is in effect:
</p>
<ol>
<li> When a command in the hash table no longer exists, Bash will re-search
<li> Bash ensures that the <code>POSIXLY_CORRECT</code> variable is set.
</li><li> When a command in the hash table no longer exists, Bash will re-search
<code>$PATH</code> to find the new location. This is also available with
&lsquo;<samp>shopt -s checkhash</samp>&rsquo;.
@@ -10004,6 +10047,7 @@ The default value is &lsquo;<samp>off</samp>&rsquo;.
<p>If set to &lsquo;<samp>on</samp>&rsquo;, and <var>completion-ignore-case</var> is enabled, Readline
treats hyphens (&lsquo;<samp>-</samp>&rsquo;) and underscores (&lsquo;<samp>_</samp>&rsquo;) as equivalent when
performing case-insensitive filename matching and completion.
The default value is &lsquo;<samp>off</samp>&rsquo;.
</p>
</dd>
<dt><code>completion-prefix-display-length</code></dt>
@@ -10365,7 +10409,7 @@ Meta-Rubout: backward-kill-word
Control-o: &quot;&gt; output&quot;
</pre></div>
<p>In the above example, <kbd>C-u</kbd> is bound to the function
<p>In the example above, <kbd>C-u</kbd> is bound to the function
<code>universal-argument</code>,
<kbd>M-DEL</kbd> is bound to the function <code>backward-kill-word</code>, and
<kbd>C-o</kbd> is bound to run the macro
@@ -11068,7 +11112,7 @@ how to insert key sequences like <kbd>C-q</kbd>, for example.
sequence sent by some terminals, and such a binding is assigned by default.
It allows Readline to insert the pasted text as a single unit without treating
each character as if it had been read from the keyboard. The characters
are inserted as if each one was bound to <code>self-insert</code>) instead of
are inserted as if each one was bound to <code>self-insert</code> instead of
executing any editing commands.
</p>
</dd>
@@ -11973,10 +12017,10 @@ matches were generated.
<dt><code>complete</code></dt>
<dd><a name="index-complete"></a>
<div class="example">
<pre class="example"><code>complete [-abcdefgjksuv] [-o <var>comp-option</var>] [-DE] [-A <var>action</var>] [-G <var>globpat</var>] [-W <var>wordlist</var>]
[-F <var>function</var>] [-C <var>command</var>] [-X <var>filterpat</var>]
<pre class="example"><code>complete [-abcdefgjksuv] [-o <var>comp-option</var>] [-DEI] [-A <var>action</var>] [-G <var>globpat</var>]
[-W <var>wordlist</var>] [-F <var>function</var>] [-C <var>command</var>] [-X <var>filterpat</var>]
[-P <var>prefix</var>] [-S <var>suffix</var>] <var>name</var> [<var>name</var> &hellip;]</code>
<code>complete -pr [-DE] [<var>name</var> &hellip;]</code>
<code>complete -pr [-DEI] [<var>name</var> &hellip;]</code>
</pre></div>
<p>Specify how arguments to each <var>name</var> should be completed.
@@ -11986,16 +12030,24 @@ reused as input.
The <samp>-r</samp> option removes a completion specification for
each <var>name</var>, or, if no <var>name</var>s are supplied, all
completion specifications.
The <samp>-D</samp> option indicates that the remaining options and actions should
The <samp>-D</samp> option indicates that other supplied options and actions should
apply to the &ldquo;default&rdquo; command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The <samp>-E</samp> option indicates that the remaining options and actions should
The <samp>-E</samp> option indicates that other supplied options and actions should
apply to &ldquo;empty&rdquo; command completion; that is, completion attempted on a
blank line.
The <samp>-I</samp> option indicates that other supplied options and actions should
apply to completion on the inital non-assignment word on the line, or after a
command delimiter such as &lsquo;<samp>;</samp>&rsquo; or &lsquo;<samp>|</samp>&rsquo;, which is usually command
name completion.
If multiple options are supplied, the <samp>-D</samp> option takes precedence
over <samp>-E</samp>, and both take precedence over <samp>-I</samp>.
If any of <samp>-D</samp>, <samp>-E</samp>, or <samp>-I</samp> are supplied, any other
<var>name</var> arguments are ignored; these completions only apply to the case
specified by the option.
</p>
<p>The process of applying these completion specifications when word completion
is attempted is described above (see <a href="#Programmable-Completion">Programmable Completion</a>). The
<samp>-D</samp> option takes precedence over <samp>-E</samp>.
is attempted is described above (see <a href="#Programmable-Completion">Programmable Completion</a>).
</p>
<p>Other options, if specified, have the following meanings.
The arguments to the <samp>-G</samp>, <samp>-W</samp>, and <samp>-X</samp> options
@@ -12027,7 +12079,7 @@ no matches.
</dd>
<dt><code>filenames</code></dt>
<dd><p>Tell Readline that the compspec generates filenames, so it can perform any
filename-specific processing (like adding a slash to directory names
filename-specific processing (like adding a slash to directory names,
quoting special characters, or suppressing trailing spaces).
This option is intended to be used with shell functions specified
with <samp>-F</samp>.
@@ -12221,7 +12273,7 @@ an error occurs adding a completion specification.
<dt><code>compopt</code></dt>
<dd><a name="index-compopt"></a>
<div class="example">
<pre class="example"><code>compopt</code> [-o <var>option</var>] [-DE] [+o <var>option</var>] [<var>name</var>]
<pre class="example"><code>compopt</code> [-o <var>option</var>] [-DEI] [+o <var>option</var>] [<var>name</var>]
</pre></div>
<p>Modify completion options for each <var>name</var> according to the
<var>option</var>s, or for the currently-executing completion if no <var>name</var>s
@@ -12230,14 +12282,19 @@ If no <var>option</var>s are given, display the completion options for each
<var>name</var> or the current completion.
The possible values of <var>option</var> are those valid for the <code>complete</code>
builtin described above.
The <samp>-D</samp> option indicates that the remaining options should
The <samp>-D</samp> option indicates that other supplied options should
apply to the &ldquo;default&rdquo; command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The <samp>-E</samp> option indicates that the remaining options should
The <samp>-E</samp> option indicates that other supplied options should
apply to &ldquo;empty&rdquo; command completion; that is, completion attempted on a
blank line.
The <samp>-I</samp> option indicates that other supplied options should
apply to completion on the inital non-assignment word on the line, or after a
command delimiter such as &lsquo;<samp>;</samp>&rsquo; or &lsquo;<samp>|</samp>&rsquo;, which is usually command
name completion.
</p>
<p>The <samp>-D</samp> option takes precedence over <samp>-E</samp>.
<p>If multiple options are supplied, the <samp>-D</samp> option takes precedence
over <samp>-E</samp>, and both take precedence over <samp>-I</samp>
</p>
<p>The return value is true unless an invalid option is supplied, an attempt
is made to modify the options for a <var>name</var> for which no completion
@@ -12291,7 +12348,7 @@ _comp_cd()
local cur _skipdot _cdpath
local i j k
# Tilde expansion, with side effect of expanding tilde to full pathname
# Tilde expansion, which also expands tilde to full pathname
case &quot;$2&quot; in
\~*) eval cur=&quot;$2&quot; ;;
*) cur=$2 ;;
@@ -12626,8 +12683,8 @@ fix errors in previous commands quickly.
</p>
<p>History expansion is performed immediately after a complete line
is read, before the shell breaks it into words, and is performed
on each line individually without taking quoting on previous lines into
account.
on each line individually. Bash attempts to inform the history
expansion functions about quoting still in effect from previous lines.
</p>
<p>History expansion takes place in two parts. The first is to determine
which line from the history list should be used during substitution.
@@ -12640,8 +12697,18 @@ that Bash does, so that several words
surrounded by quotes are considered one word.
History expansions are introduced by the appearance of the
history expansion character, which is &lsquo;<samp>!</samp>&rsquo; by default.
Only &lsquo;<samp>\</samp>&rsquo; and &lsquo;<samp>'</samp>&rsquo; may be used to escape the history expansion
character, but the history expansion character is
</p>
<p>History expansion implements shell-like quoting conventions:
a backslash can be used to remove the special handling for the next character;
single quotes enclose verbatim sequences of characters, and can be used to
inhibit history expansion;
and characters enclosed within double quotes may be subject to history
expansion, since backslash can escape the history expansion character,
but single quotes may not, since they are not treated specially within
double quotes.
</p>
<p>When using the shell, only &lsquo;<samp>\</samp>&rsquo; and &lsquo;<samp>'</samp>&rsquo; may be used to escape the
history expansion character, but the history expansion character is
also treated as quoted if it immediately precedes the closing double quote
in a double-quoted string.
</p>
@@ -13285,7 +13352,7 @@ compiled and linked, rather than changing run-time features.
</p>
<dl compact="compact">
<dt><code>--enable-largefile</code></dt>
<dd><p>Enable support for <a href="http://www.sas.com/standards/large_file/x_open.20Mar96.html">large files</a> if the operating system requires special compiler options
<dd><p>Enable support for <a href="http://www.unix.org/version2/whatsnew/lfs20mar.html">large files</a> if the operating system requires special compiler options
to build programs which can access large files. This is enabled by
default, if the operating system provides large file support.
</p>
@@ -14991,6 +15058,7 @@ Next: <a href="#Function-Index" accesskey="n" rel="next">Function Index</a>, Pre
<tr><td></td><td valign="top"><a href="#index-IGNOREEOF"><code>IGNOREEOF</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Bash-Variables">Bash Variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dmeta"><code>input-meta</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Readline-Init-File-Syntax">Readline Init File Syntax</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-INPUTRC"><code>INPUTRC</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Bash-Variables">Bash Variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-INSIDE_005fEMACS"><code>INSIDE_EMACS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Bash-Variables">Bash Variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-isearch_002dterminators"><code>isearch-terminators</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Readline-Init-File-Syntax">Readline Init File Syntax</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Variable-Index_vr_letter-K">K</a></th><td></td><td></td></tr>
+419 -359
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+3972 -3859
View File
File diff suppressed because it is too large Load Diff
+64 -23
View File
@@ -876,7 +876,9 @@ zero if no condition tested true.
The syntax of the @code{case} command is:
@example
case @var{word} in [ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-list} ;;]@dots{} esac
case @var{word} in
[ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-list} ;;]@dots{}
esac
@end example
@code{case} will selectively execute the @var{command-list} corresponding to
@@ -1028,7 +1030,8 @@ to be matched as a string.
An additional binary operator, @samp{=~}, is available, with the same
precedence as @samp{==} and @samp{!=}.
When it is used, the string to the right of the operator is considered
an extended regular expression and matched accordingly (as in @i{regex}3)).
a @sc{POSIX} extended regular expression and matched accordingly
(as in @i{regex}3)).
The return value is 0 if the string matches
the pattern, and 1 otherwise.
If the regular expression is syntactically incorrect, the conditional
@@ -1283,7 +1286,8 @@ from a file (in this case, filenames listed one per line):
@noindent
with a more compact syntax reminiscent of lambdas:
@example
cat list | parallel "do-something1 @{@} config-@{@} ; do-something2 < @{@}" | process-output
cat list | parallel "do-something1 @{@} config-@{@} ; do-something2 < @{@}" |
process-output
@end example
Parallel provides a built-in mechanism to remove filename extensions, which
@@ -1306,13 +1310,21 @@ parallel "zcat @{@} | bzip2 >@{.@}.bz2 && rm @{@}" ::: *.gz
If a command generates output, you may want to preserve the input order in
the output. For instance, the following command
@example
@{ echo foss.org.my ; echo debian.org; echo freenetproject.org; @} | parallel traceroute
@{
echo foss.org.my ;
echo debian.org ;
echo freenetproject.org ;
@} | parallel traceroute
@end example
@noindent
will display as output the traceroute invocation that finishes first.
Adding the @option{-k} option
@example
@{ echo foss.org.my ; echo debian.org; echo freenetproject.org; @} | parallel -k traceroute
@{
echo foss.org.my ;
echo debian.org ;
echo freenetproject.org ;
@} | parallel -k traceroute
@end example
@noindent
will ensure that the output of @code{traceroute foss.org.my} is displayed first.
@@ -1663,8 +1675,16 @@ separators.
@item @@
@vindex $@@
($@@) Expands to the positional parameters, starting from one. When the
expansion occurs within double quotes, each parameter expands to a
($@@) Expands to the positional parameters, starting from one.
In contexts where word splitting is performed, this expands each
positional parameter to a separate word; if not within double
quotes, these words are subject to word splitting.
In contexts where word splitting is not performed,
this expands to a single word
with each positional parameter separated by a space.
When the
expansion occurs within double quotes, and word splitting is performed,
each parameter expands to a
separate word. That is, @code{"$@@"} is equivalent to
@code{"$1" "$2" @dots{}}.
If the double-quoted expansion occurs within a word, the expansion of
@@ -1926,6 +1946,12 @@ The string that would be displayed by @samp{dirs +@var{N}}
The string that would be displayed by @samp{dirs -@var{N}}
@end table
Bash also performs tilde expansion on words satisfying the conditions of
variable assignments (@pxref{Shell Parameters})
when they appear as arguments to simple commands.
Bash does not do this, except for the @var{declaration} commands listed
above, when in @sc{posix} mode.
@node Shell Parameter Expansion
@subsection Shell Parameter Expansion
@cindex parameter expansion
@@ -1954,11 +1980,11 @@ interpreted as part of its name.
If the first character of @var{parameter} is an exclamation point (!),
and @var{parameter} is not a @var{nameref},
it introduces a level of variable indirection.
Bash uses the value of the variable formed from the rest of
@var{parameter} as the name of the variable; this variable is then
expanded and that value is used in the rest of the substitution, rather
than the value of @var{parameter} itself.
it introduces a level of indirection.
Bash uses the value formed by expanding the rest of
@var{parameter} as the new @var{parameter}; this is then
expanded and that value is used in the rest of the expansion, rather
than the expansion of the original @var{parameter}.
This is known as @code{indirect expansion}.
The value is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
@@ -4353,8 +4379,8 @@ parent.
@item mapfile
@btindex mapfile
@example
mapfile [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}]
[-C @var{callback}] [-c @var{quantum}] [@var{array}]
mapfile [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}]
[-t] [-u @var{fd}] [-C @var{callback}] [-c @var{quantum}] [@var{array}]
@end example
Read lines from the standard input into the indexed array variable @var{array},
@@ -4561,8 +4587,8 @@ Read input from file descriptor @var{fd}.
@item readarray
@btindex readarray
@example
readarray [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}]
[-C @var{callback}] [-c @var{quantum}] [@var{array}]
readarray [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}]
[-t] [-u @var{fd}] [-C @var{callback}] [-c @var{quantum}] [@var{array}]
@end example
Read lines from the standard input into the indexed array variable @var{array},
@@ -5617,7 +5643,8 @@ The shell sets @code{BASH_ARGC} only when in extended debugging mode
(see @ref{The Shopt Builtin}
for a description of the @code{extdebug} option to the @code{shopt}
builtin).
Setting @code{extdebug} after the shell has started to execute a script
Setting @code{extdebug} after the shell has started to execute a script,
or referencing this variable when @code{extdebug} is not set,
may result in inconsistent values.
@item BASH_ARGV
@@ -5630,7 +5657,8 @@ The shell sets @code{BASH_ARGV} only when in extended debugging mode
(see @ref{The Shopt Builtin}
for a description of the @code{extdebug} option to the @code{shopt}
builtin).
Setting @code{extdebug} after the shell has started to execute a script
Setting @code{extdebug} after the shell has started to execute a script,
or referencing this variable when @code{extdebug} is not set,
may result in inconsistent values.
@item BASH_ARGV0
@@ -6073,6 +6101,11 @@ input to the shell. This is only in effect for interactive shells.
The name of the Readline initialization file, overriding the default
of @file{~/.inputrc}.
@item INSIDE_EMACS
If Bash finds this variable in the environment when the shell
starts, it assumes that the shell is running in an Emacs shell buffer
and may disable line editing depending on the value of @env{TERM}.
@item LANG
Used to determine the locale category for any category not specifically
selected with a variable starting with @code{LC_}.
@@ -6156,7 +6189,9 @@ as if the command
@code{set -o posix}
@end example
@noindent
had been executed.
had been executed.
When the shell enters @sc{posix} mode, it sets this variable if it was
not already set.
@item PPID
The process @sc{id} of the shell's parent process. This variable
@@ -6330,9 +6365,12 @@ This chapter describes features unique to Bash.
@section Invoking Bash
@example
bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] [@var{argument} @dots{}]
bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] -c @var{string} [@var{argument} @dots{}]
bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] [@var{argument} @dots{}]
bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @var{option}]
[-O @var{shopt_option}] [@var{argument} @dots{}]
bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @var{option}]
[-O @var{shopt_option}] -c @var{string} [@var{argument} @dots{}]
bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @var{option}]
[-O @var{shopt_option}] [@var{argument} @dots{}]
@end example
All of the single-character options used with the @code{set} builtin
@@ -7421,7 +7459,7 @@ shell session.
After the string is decoded, it is expanded via
parameter expansion, command substitution, arithmetic
expansion, and quote removal, subject to the value of the
@code{promptvars} shell option (@pxref{Bash Builtins}).
@code{promptvars} shell option (@pxref{The Shopt Builtin}).
@node The Restricted Shell
@section The Restricted Shell
@@ -7492,6 +7530,9 @@ startup files.
The following list is what's changed when `@sc{posix} mode' is in effect:
@enumerate
@item
Bash ensures that the @env{POSIXLY_CORRECT} variable is set.
@item
When a command in the hash table no longer exists, Bash will re-search
@env{$PATH} to find the new location. This is also available with
+791 -780
View File
File diff suppressed because it is too large Load Diff
+1730 -1710
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Mon Mar 19 09:43:23 2018
%%CreationDate: Fri Sep 7 15:34:15 2018
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.22 3
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Thu Mar 15 11:29:49 EDT 2018
@set LASTCHANGE Tue Aug 7 12:01:22 EDT 2018
@set EDITION 5.0
@set VERSION 5.0
@set UPDATED 15 March 2018
@set UPDATED-MONTH March 2018
@set UPDATED 7 August 2018
@set UPDATED-MONTH August 2018
+3
View File
@@ -69,6 +69,9 @@ reader_loop ()
our_indirection_level = ++indirection_level;
if (just_one_command)
reset_readahead_token ();
while (EOF_Reached == 0)
{
int code;
-7
View File
@@ -48,13 +48,6 @@
#include "builtins.h"
#include "common.h"
#define RETURN(x) \
do { \
if (sp) *sp = sec; \
if (usp) *usp = usec; \
return (x); \
} while (0)
int
sleep_builtin (list)
WORD_LIST *list;
+19 -9
View File
@@ -1522,6 +1522,11 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
/* Subshells are neither login nor interactive. */
login_shell = interactive = 0;
/* And we're no longer in a loop. See Posix interp 842 (we are not in the
"same execution environment"). */
if (shell_compatibility_level > 44)
loop_level = 0;
if (user_subshell)
{
subshell_environment = SUBSHELL_PAREN; /* XXX */
@@ -1556,13 +1561,13 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
setup_async_signals ();
asynchronous = 0;
}
else
set_sigint_handler ();
#if defined (JOB_CONTROL)
set_sigchld_handler ();
#endif /* JOB_CONTROL */
set_sigint_handler ();
/* Delete all traces that there were any jobs running. This is
only for subshells. */
without_job_control ();
@@ -1672,6 +1677,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
return_code = (return_code == EXECUTION_SUCCESS) ? EXECUTION_FAILURE
: EXECUTION_SUCCESS;
/* If we were explicitly placed in a subshell with (), we need
to do the `shell cleanup' things, such as running traps[0]. */
if (user_subshell && signal_is_trapped (0))
@@ -2432,7 +2438,7 @@ static void
lastpipe_cleanup (s)
int s;
{
unfreeze_jobs_list ();
set_jobs_list_frozen (s);
}
static int
@@ -2442,7 +2448,7 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
struct fd_bitmap *fds_to_close;
{
int prev, fildes[2], new_bitmap_size, dummyfd, ignore_return, exec_result;
int lstdin, lastpipe_flag, lastpipe_jid;
int lstdin, lastpipe_flag, lastpipe_jid, old_frozen;
COMMAND *cmd;
struct fd_bitmap *fd_bitmap;
pid_t lastpid;
@@ -2557,9 +2563,9 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
prev = NO_PIPE;
add_unwind_protect (restore_stdin, lstdin);
lastpipe_flag = 1;
freeze_jobs_list ();
old_frozen = freeze_jobs_list ();
lastpipe_jid = stop_pipeline (0, (COMMAND *)NULL); /* XXX */
add_unwind_protect (lastpipe_cleanup, lastpipe_jid);
add_unwind_protect (lastpipe_cleanup, old_frozen);
}
if (cmd)
cmd->flags |= CMD_LASTPIPE;
@@ -2605,9 +2611,9 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
else if (pipefail_opt)
exec_result = exec_result | lstdin; /* XXX */
/* otherwise we use exec_result */
#endif
unfreeze_jobs_list ();
set_jobs_list_frozen (old_frozen);
}
discard_unwind_frame ("lastpipe-exec");
@@ -4062,9 +4068,13 @@ fix_assignment_words (words)
/* If we have an assignment builtin that does not create local variables,
make sure we create global variables even if we internally call
`declare'. The CHKLOCAL flag means to set attributes or values on
an existing local variable */
an existing local variable, if there is one. */
if (b && ((b->flags & (ASSIGNMENT_BUILTIN|LOCALVAR_BUILTIN)) == ASSIGNMENT_BUILTIN))
w->word->flags |= W_ASSNGLOBAL|W_CHKLOCAL;
#if 0
else if (b && (b->flags & ASSIGNMENT_BUILTIN) && (b->flags & LOCALVAR_BUILTIN))
w->word->flags |= W_CHKLOCAL;
#endif
}
#if defined (ARRAY_VARS)
/* Note that we saw an associative array option to a builtin that takes
+9
View File
@@ -109,6 +109,7 @@ extern int return_EOF __P((void));
extern void push_token __P((int));
extern char *xparse_dolparen __P((char *, char *, int *, int));
extern void reset_parser __P((void));
extern void reset_readahead_token __P((void));
extern WORD_LIST *parse_string_to_word_list __P((char *, int, const char *));
extern int parser_in_command_position __P((void));
@@ -485,6 +486,14 @@ extern unsigned int fsleep __P((unsigned int, unsigned int));
extern int u32cconv __P((unsigned long, char *));
extern void u32reset __P((void));
/* declarations for functions defined in lib/sh/utf8.c */
extern char *utf8_mbschr __P((const char *, int));
extern int utf8_mbscmp __P((const char *, const char *));
extern char *utf8_mbsmbchar __P((const char *));
extern int utf8_mbsnlen __P((const char *, size_t, int));
extern int utf8_mblen __P((const char *, size_t));
extern size_t utf8_mbstrlen __P((const char *));
/* declarations for functions defined in lib/sh/wcsnwidth.c */
#if defined (HANDLE_MULTIBYTE)
extern int wcsnwidth __P((const wchar_t *, size_t, int));
+7
View File
@@ -110,6 +110,13 @@ extern char *strcpy __P((char *, const char *));
((TYPE_WIDTH (t) - TYPE_SIGNED (t)) * 302 / 1000 \
+ 1 + TYPE_SIGNED (t))
/* Updated version adapted from gnulib/intprops.h, not used right now.
Changes the approximation of log10(2) from 302/1000 to 146/485. */
#if 0
#define INT_STRLEN_BOUND(t) \
(INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - TYPE_SIGNED (t)) + TYPE_SIGNED(t))
#endif
/* Bound on buffer size needed to represent an integer type or expression T,
including the terminating null. */
#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+15 -2
View File
@@ -50,6 +50,10 @@ extern int locale_utf8locale; /* XXX */
#define MBLEN(s, n) ((MB_CUR_MAX > 1) ? mblen ((s), (n)) : 1)
#define MBRLEN(s, n, p) ((MB_CUR_MAX > 1) ? mbrlen ((s), (n), (p)) : 1)
#define UTF8_SINGLEBYTE(c) (((c) & 0x80) == 0)
#define UTF8_MBFIRSTCHAR(c) (((c) & 0xc0) == 0xc0)
#define UTF8_MBCHAR(c) (((c) & 0xc0) == 0x80)
#else /* !HANDLE_MULTIBYTE */
#undef MB_LEN_MAX
@@ -75,6 +79,9 @@ extern int locale_utf8locale; /* XXX */
# define wchar_t int
#endif
#define UTF8_SINGLEBYTE(c) (1)
#define UTF8_MBFIRSTCHAR(c) (0)
#endif /* !HANDLE_MULTIBYTE */
/* Declare and initialize a multibyte state. Call must be terminated
@@ -111,7 +118,7 @@ extern int locale_utf8locale; /* XXX */
if (_f) \
mblength = 1; \
else if (locale_utf8locale && (((_str)[_i] & 0x80) == 0)) \
mblength = 1; \
mblength = (_str)[_i] != 0; \
else \
{ \
state_bak = state; \
@@ -152,6 +159,8 @@ extern int locale_utf8locale; /* XXX */
_f = is_basic (*(_str)); \
if (_f) \
mblength = 1; \
else if (locale_utf8locale && ((*(_str) & 0x80) == 0)) \
mblength = *(_str) != 0; \
else \
{ \
state_bak = state; \
@@ -271,7 +280,7 @@ extern int locale_utf8locale; /* XXX */
if (_k) \
mblength = 1; \
else if (locale_utf8locale && ((*(_src) & 0x80) == 0)) \
mblength = 1; \
mblength = *(_src) != 0; \
else \
{ \
state_bak = state; \
@@ -445,6 +454,8 @@ extern int locale_utf8locale; /* XXX */
i = is_basic (*((_src) + (_si))); \
if (i) \
mblength = 1; \
else if (locale_utf8locale && (((_src)[_si] & 0x80) == 0)) \
mblength = (_src)[_si] != 0; \
else \
{ \
state_bak = state; \
@@ -483,6 +494,8 @@ extern int locale_utf8locale; /* XXX */
i = is_basic (*((_src) + (_si))); \
if (i) \
mblength = 1; \
else if (locale_utf8locale && (((_src)[_si] & 0x80) == 0)) \
mblength = (_src)[_si] != 0; \
else \
{ \
state_bak = state; \
+8 -1
View File
@@ -863,7 +863,7 @@ pshash_delindex (psi)
*bucket = ps->bucket_next; /* deleting chain head in hash table */
}
/* clear out this cell, just in case */
/* clear out this cell, in case it gets reused. */
ps->pid = NO_PID;
ps->bucket_next = ps->bucket_prev = NO_PIDSTAT;
}
@@ -4771,6 +4771,13 @@ unfreeze_jobs_list ()
jobs_list_frozen = 0;
}
void
set_jobs_list_frozen (s)
int s;
{
jobs_list_frozen = s;
}
/* Allow or disallow job control to take place. Returns the old value
of job_control. */
int
+2 -1
View File
@@ -259,7 +259,8 @@ extern int give_terminal_to __P((pid_t, int));
extern void run_sigchld_trap __P((int));
extern int freeze_jobs_list __P((void));
extern void unfreeze_jobs_list __P((void));
extern void unfreeeze_jobs_list __P((void));
extern void set_jobs_list_frozen __P((int));
extern int set_job_control __P((int));
extern void without_job_control __P((void));
extern void end_job_control __P((void));
+60 -10
View File
@@ -84,6 +84,10 @@
#include <errno.h>
#include <stdio.h>
#if defined (HAVE_MMAP)
#include <sys/mman.h>
#endif
/* Define getpagesize () if the system does not. */
#ifndef HAVE_GETPAGESIZE
# include "getpagesize.h"
@@ -111,6 +115,7 @@
# define NO_VALLOC
#endif
/* SIZEOF_LONG * 4 - 2, usable bins from 1..NBUCKETS-1 */
#define NBUCKETS 30
#define ISALLOC ((char) 0xf7) /* magic byte that implies allocation */
@@ -197,6 +202,23 @@ typedef union _malloc_guard {
#define STARTBUCK 1
/* Should we use mmap for large allocations? */
#if defined (HAVE_MMAP)
# if !defined (MAP_ANON) && defined (MAP_ANONYMOUS)
# define MAP_ANON MAP_ANONYMOUS
# endif
#endif
#if defined (HAVE_MMAP) && defined (MAP_ANON)
# define USE_MMAP
#endif
#if defined (USE_MMAP)
# define MMAP_THRESHOLD 14 /* must be >= SPLIT_MAX, COMBINE_MAX */
#else
# define MMAP_THRESHOLD (8 * SIZEOF_LONG)
#endif
/* Flags for the internal functions. */
#define MALLOC_WRAPPER 0x01 /* wrapper function */
#define MALLOC_INTERNAL 0x02 /* internal function calling another */
@@ -288,6 +310,9 @@ int malloc_flags = 0; /* future use */
int malloc_trace = 0; /* trace allocations and frees to stderr */
int malloc_register = 0; /* future use */
/* Use a variable in case we want to dynamically adapt it in the future */
int malloc_mmap_threshold = MMAP_THRESHOLD;
#ifdef MALLOC_TRACE
char _malloc_trace_buckets[NBUCKETS];
@@ -594,7 +619,7 @@ morecore (nu)
/* Try to split a larger block here, if we're within the range of sizes
to split. */
if (nu >= SPLIT_MIN)
if (nu >= SPLIT_MIN && nu <= malloc_mmap_threshold)
{
bsplit (nu);
if (nextf[nu] != 0)
@@ -603,7 +628,7 @@ morecore (nu)
/* Try to coalesce two adjacent blocks from the free list on nextf[nu - 1],
if we can, and we're within the range of the block coalescing limits. */
if (nu >= COMBINE_MIN && nu < COMBINE_MAX && busy[nu - 1] == 0 && nextf[nu - 1])
if (nu >= COMBINE_MIN && nu < COMBINE_MAX && nu <= malloc_mmap_threshold && busy[nu - 1] == 0 && nextf[nu - 1])
{
bcoalesce (nu);
if (nextf[nu] != 0)
@@ -632,6 +657,25 @@ morecore (nu)
nblks = 1;
}
#if defined (USE_MMAP)
if (nu > malloc_mmap_threshold)
{
mp = (union mhead *)mmap (0, sbrk_amt, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if ((void *)mp == MAP_FAILED)
goto morecore_done;
nextf[nu] = mp;
mp->mh_alloc = ISFREE;
mp->mh_index = nu;
CHAIN (mp) = 0;
#ifdef MALLOC_STATS
_mstats.nmmap++;
_mstats.tmmap += sbrk_amt;
#endif
goto morecore_done;
}
#endif
#ifdef MALLOC_STATS
_mstats.nsbrk++;
_mstats.tsbrk += sbrk_amt;
@@ -915,6 +959,17 @@ internal_free (mem, file, line, flags)
if (mg.i != p->mh_nbytes)
xbotch (mem, ERR_ASSERT_FAILED, _("free: start and end chunk sizes differ"), file, line);
#if defined (USE_MMAP)
if (nunits > malloc_mmap_threshold)
{
munmap (p, binsize (nunits));
#if defined (MALLOC_STATS)
_mstats.nlesscore[nunits]++;
#endif
goto free_return;
}
#endif
#if GLIBC21
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == sbrk (0)))
#else
@@ -1053,12 +1108,9 @@ internal_realloc (mem, n, file, line, flags)
/* If ok, use the same block, just marking its size as changed. */
if (RIGHT_BUCKET(nbytes, nunits) || RIGHT_BUCKET(nbytes, nunits-1))
{
#if 0
m = (char *)mem + p->mh_nbytes;
#else
/* Compensate for increment above. */
m -= 4;
#endif
*m++ = 0; *m++ = 0; *m++ = 0; *m++ = 0;
m = (char *)mem + (p->mh_nbytes = n);
@@ -1076,6 +1128,8 @@ internal_realloc (mem, n, file, line, flags)
_mstats.nrcopy++;
#endif
/* If we are using mmap and have mremap, we could use it here. */
if ((m = internal_malloc (n, file, line, MALLOC_INTERNAL|MALLOC_NOTRACE|MALLOC_NOREG)) == 0)
return 0;
FASTCOPY (mem, m, tocopy);
@@ -1120,11 +1174,7 @@ internal_memalign (alignment, size, file, line, flags)
if (((long) ptr & (alignment - 1)) == 0)
return ptr;
/* Otherwise, get address of byte in the block that has that alignment. */
#if 0
aligned = (char *) (((long) ptr + alignment - 1) & -alignment);
#else
aligned = (char *) (((long) ptr + alignment - 1) & (~alignment + 1));
#endif
/* Store a suitable indication of how to free the block,
so that free can find the true beginning of it. */
+4
View File
@@ -25,6 +25,7 @@
#ifdef MALLOC_STATS
/* This needs to change if the definition in malloc.c changes */
#ifndef NBUCKETS
# define NBUCKETS 30
#endif
@@ -77,6 +78,8 @@ struct _malstats {
int nsplit[NBUCKETS];
int tbcoalesce;
int ncoalesce[NBUCKETS];
int nmmap;
bits32_t tmmap;
};
/* Return statistics describing allocation of blocks of size BLOCKSIZE.
@@ -98,6 +101,7 @@ struct bucket_stats {
int nlesscore;
int nsplit;
int ncoalesce;
int nmmap; /* currently unused */
};
extern struct bucket_stats malloc_bucket_stats __P((int));
+9 -1
View File
@@ -36,6 +36,8 @@
extern int malloc_free_blocks __P((int));
extern int malloc_mmap_threshold;
extern struct _malstats _mstats;
extern FILE *_imalloc_fopen __P((char *, char *, char *, char *, size_t));
@@ -103,8 +105,12 @@ _print_malloc_stats (s, fp)
for (i = totused = totfree = 0; i < NBUCKETS; i++)
{
v = malloc_bucket_stats (i);
/* Show where the mmap threshold is; sizes greater than this use mmap to
allocate and munmap to free (munmap shows up as lesscore). */
if (i == malloc_mmap_threshold+1)
fprintf (fp, "--------\n");
if (v.nmal > 0)
fprintf (fp, "%8lu\t%4d\t%6d\t%5d\t%8d\t%d %5d %8d\n", (unsigned long)v.blocksize, v.nfree, v.nused, v.nmal, v.nmorecore, v.nlesscore, v.nsplit, v.ncoalesce);
fprintf (fp, "%8lu\t%4d\t%6d\t%5d\t%8d\t%8d %5d %8d\n", (unsigned long)v.blocksize, v.nfree, v.nused, v.nmal, v.nmorecore, v.nlesscore, v.nsplit, v.ncoalesce);
totfree += v.nfree * v.blocksize;
totused += v.nused * v.blocksize;
}
@@ -115,6 +121,8 @@ _print_malloc_stats (s, fp)
_mstats.nmal, _mstats.nfre, _mstats.nrealloc, _mstats.nrcopy);
fprintf (fp, "Total sbrks: %d, total bytes via sbrk: %d\n",
_mstats.nsbrk, _mstats.tsbrk);
fprintf (fp, "Total mmaps: %d, total bytes via mmap: %d\n",
_mstats.nmmap, _mstats.tmmap);
fprintf (fp, "Total blocks split: %d, total block coalesces: %d\n",
_mstats.tbsplit, _mstats.tbcoalesce);
}
+2 -1
View File
@@ -2987,7 +2987,8 @@ _rl_update_final (void)
putc (last_line[_rl_screenwidth - 1 + woff], rl_outstream);
}
_rl_vis_botlin = 0;
rl_crlf ();
if (botline_length > 0 || _rl_last_c_pos > 0)
rl_crlf ();
fflush (rl_outstream);
rl_display_fixed++;
}
+19 -3
View File
@@ -403,7 +403,7 @@ to the ``normal'' terminating characters.
Return an array of tokens parsed out of @var{string}, much as the
shell might. The tokens are split on the characters in the
@var{history_word_delimiters} variable,
and shell quoting conventions are obeyed.
and shell quoting conventions are obeyed as described below.
@end deftypefun
@deftypefun {char *} history_arg_extract (int first, int last, const char *string)
@@ -476,8 +476,24 @@ carriage return, and @samp{=}.
@end deftypevar
@deftypevar int history_quotes_inhibit_expansion
If non-zero, double-quoted words are not scanned for the history expansion
character or the history comment character. The default value is 0.
If non-zero, the history expansion code implements shell-like quoting:
single-quoted words are not scanned for the history expansion
character or the history comment character, and double-quoted words may
have history expansion performed, since single quotes are not special
within double quotes.
The default value is 0.
@end deftypevar
@deftypevar int history_quoting_state
An application may set this variable to indicate that the current line
being expanded is subject to existing quoting. If set to @samp{'}, the
history expansion function will assume that the line is single-quoted and
inhibit expansion until it reads an unquoted closing single quote; if set
to @samp{"}, history expansion will assume the line is double quoted until
it reads an unquoted closing double quote. If set to zero, the default,
the history expansion function will assume the line is not quoted and
treat quote characters within the line as described above.
This is only effective if @var{history_quotes_inhibit_expansion} is set.
@end deftypevar
@deftypevar {rl_linebuf_func_t *} history_inhibit_expansion_function
+14 -4
View File
@@ -262,8 +262,8 @@ fix errors in previous commands quickly.
@ifset BashFeatures
History expansion is performed immediately after a complete line
is read, before the shell breaks it into words, and is performed
on each line individually without taking quoting on previous lines into
account.
on each line individually. Bash attempts to inform the history
expansion functions about quoting still in effect from previous lines.
@end ifset
History expansion takes place in two parts. The first is to determine
@@ -277,9 +277,19 @@ that Bash does, so that several words
surrounded by quotes are considered one word.
History expansions are introduced by the appearance of the
history expansion character, which is @samp{!} by default.
History expansion implements shell-like quoting conventions:
a backslash can be used to remove the special handling for the next character;
single quotes enclose verbatim sequences of characters, and can be used to
inhibit history expansion;
and characters enclosed within double quotes may be subject to history
expansion, since backslash can escape the history expansion character,
but single quotes may not, since they are not treated specially within
double quotes.
@ifset BashFeatures
Only @samp{\} and @samp{'} may be used to escape the history expansion
character, but the history expansion character is
When using the shell, only @samp{\} and @samp{'} may be used to escape the
history expansion character, but the history expansion character is
also treated as quoted if it immediately precedes the closing double quote
in a double-quoted string.
@end ifset
+5 -1
View File
@@ -846,12 +846,16 @@ Return the function invoked by @var{keyseq} in keymap @var{map}.
If @var{map} is @code{NULL}, the current keymap is used. If @var{type} is
not @code{NULL}, the type of the object is returned in the @code{int} variable
it points to (one of @code{ISFUNC}, @code{ISKMAP}, or @code{ISMACR}).
It takes a "translated" key sequence and should not be used if the key sequence
can include NUL.
@end deftypefun
@deftypefun {rl_command_func_t *} rl_function_of_keyseq_len (const char *keyseq, size_t len Keymap map, int *type)
@deftypefun {rl_command_func_t *} rl_function_of_keyseq_len (const char *keyseq, size_t len, Keymap map, int *type)
Return the function invoked by @var{keyseq} of length @var{len}
in keymap @var{map}. Equivalent to @code{rl_function_of_keyseq} with the
addition of the @var{len} parameter.
It takes a "translated" key sequence and should be used if the key sequence
can include NUL.
@end deftypefun
@deftypefun {char **} rl_invoking_keyseqs (rl_command_func_t *function)
+29 -15
View File
@@ -475,6 +475,7 @@ The default value is @samp{off}.
If set to @samp{on}, and @var{completion-ignore-case} is enabled, Readline
treats hyphens (@samp{-}) and underscores (@samp{_}) as equivalent when
performing case-insensitive filename matching and completion.
The default value is @samp{off}.
@item completion-prefix-display-length
@vindex completion-prefix-display-length
@@ -802,7 +803,7 @@ Meta-Rubout: backward-kill-word
Control-o: "> output"
@end example
In the above example, @kbd{C-u} is bound to the function
In the example above, @kbd{C-u} is bound to the function
@code{universal-argument},
@kbd{M-DEL} is bound to the function @code{backward-kill-word}, and
@kbd{C-o} is bound to run the macro
@@ -1352,7 +1353,7 @@ This function is intended to be bound to the "bracketed paste" escape
sequence sent by some terminals, and such a binding is assigned by default.
It allows Readline to insert the pasted text as a single unit without treating
each character as if it had been read from the keyboard. The characters
are inserted as if each one was bound to @code{self-insert}) instead of
are inserted as if each one was bound to @code{self-insert} instead of
executing any editing commands.
@item transpose-chars (C-t)
@@ -2019,10 +2020,10 @@ matches were generated.
@item complete
@btindex complete
@example
@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-DE] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
[-F @var{function}] [-C @var{command}] [-X @var{filterpat}]
@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-DEI] [-A @var{action}] [-G @var{globpat}]
[-W @var{wordlist}] [-F @var{function}] [-C @var{command}] [-X @var{filterpat}]
[-P @var{prefix}] [-S @var{suffix}] @var{name} [@var{name} @dots{}]}
@code{complete -pr [-DE] [@var{name} @dots{}]}
@code{complete -pr [-DEI] [@var{name} @dots{}]}
@end example
Specify how arguments to each @var{name} should be completed.
@@ -2032,16 +2033,24 @@ reused as input.
The @option{-r} option removes a completion specification for
each @var{name}, or, if no @var{name}s are supplied, all
completion specifications.
The @option{-D} option indicates that the remaining options and actions should
The @option{-D} option indicates that other supplied options and actions should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The @option{-E} option indicates that the remaining options and actions should
The @option{-E} option indicates that other supplied options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options and actions should
apply to completion on the inital non-assignment word on the line, or after a
command delimiter such as @samp{;} or @samp{|}, which is usually command
name completion.
If multiple options are supplied, the @option{-D} option takes precedence
over @option{-E}, and both take precedence over @option{-I}.
If any of @option{-D}, @option{-E}, or @option{-I} are supplied, any other
@var{name} arguments are ignored; these completions only apply to the case
specified by the option.
The process of applying these completion specifications when word completion
is attempted is described above (@pxref{Programmable Completion}). The
@option{-D} option takes precedence over @option{-E}.
is attempted is described above (@pxref{Programmable Completion}).
Other options, if specified, have the following meanings.
The arguments to the @option{-G}, @option{-W}, and @option{-X} options
@@ -2071,7 +2080,7 @@ Perform directory name completion if the compspec generates no matches.
@item filenames
Tell Readline that the compspec generates filenames, so it can perform any
filename-specific processing (like adding a slash to directory names
filename-specific processing (like adding a slash to directory names,
quoting special characters, or suppressing trailing spaces).
This option is intended to be used with shell functions specified
with @option{-F}.
@@ -2226,7 +2235,7 @@ an error occurs adding a completion specification.
@item compopt
@btindex compopt
@example
@code{compopt} [-o @var{option}] [-DE] [+o @var{option}] [@var{name}]
@code{compopt} [-o @var{option}] [-DEI] [+o @var{option}] [@var{name}]
@end example
Modify completion options for each @var{name} according to the
@var{option}s, or for the currently-executing completion if no @var{name}s
@@ -2235,14 +2244,19 @@ If no @var{option}s are given, display the completion options for each
@var{name} or the current completion.
The possible values of @var{option} are those valid for the @code{complete}
builtin described above.
The @option{-D} option indicates that the remaining options should
The @option{-D} option indicates that other supplied options should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The @option{-E} option indicates that the remaining options should
The @option{-E} option indicates that other supplied options should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options should
apply to completion on the inital non-assignment word on the line, or after a
command delimiter such as @samp{;} or @samp{|}, which is usually command
name completion.
The @option{-D} option takes precedence over @option{-E}.
If multiple options are supplied, the @option{-D} option takes precedence
over @option{-E}, and both take precedence over @option{-I}
The return value is true unless an invalid option is supplied, an attempt
is made to modify the options for a @var{name} for which no completion
@@ -2289,7 +2303,7 @@ _comp_cd()
local cur _skipdot _cdpath
local i j k
# Tilde expansion, with side effect of expanding tilde to full pathname
# Tilde expansion, which also expands tilde to full pathname
case "$2" in
\~*) eval cur="$2" ;;
*) cur=$2 ;;
+6 -6
View File
@@ -1,10 +1,10 @@
@ignore
Copyright (C) 1988-2017 Free Software Foundation, Inc.
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@end ignore
@set EDITION 7.0
@set VERSION 7.0
@set UPDATED 28 December 2017
@set UPDATED-MONTH December 2017
@set EDITION 8.0
@set VERSION 8.0
@set UPDATED 6 July 2018
@set UPDATED-MONTH July 2018
@set LASTCHANGE Thu Dec 28 14:44:16 EST 2017
@set LASTCHANGE Fri Jul 6 16:25:22 MDT 2018
+58 -35
View File
@@ -1,6 +1,6 @@
/* histexpand.c -- history expansion. */
/* Copyright (C) 1989-2017 Free Software Foundation, Inc.
/* Copyright (C) 1989-2018 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
@@ -107,6 +107,8 @@ char *history_word_delimiters = HISTORY_WORD_DELIMITERS;
particular history expansion should be performed. */
rl_linebuf_func_t *history_inhibit_expansion_function;
int history_quoting_state = 0;
/* **************************************************************** */
/* */
/* History Expansion */
@@ -961,7 +963,22 @@ history_expand (char *hstring, char **output)
/* `!' followed by one of the characters in history_no_expand_chars
is NOT an expansion. */
for (i = dquote = squote = 0; string[i]; i++)
dquote = history_quoting_state == '"';
squote = history_quoting_state == '\'';
/* If the calling application tells us we are already reading a
single-quoted string, consume the rest of the string right now
and then go on. */
i = 0;
if (squote && history_quotes_inhibit_expansion)
{
hist_string_extract_single_quoted (string, &i, 0);
squote = 0;
if (string[i])
i++;
}
for ( ; string[i]; i++)
{
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
@@ -1049,7 +1066,29 @@ history_expand (char *hstring, char **output)
}
/* Extract and perform the substitution. */
for (passc = dquote = squote = i = j = 0; i < l; i++)
dquote = history_quoting_state == '"';
squote = history_quoting_state == '\'';
/* If the calling application tells us we are already reading a
single-quoted string, consume the rest of the string right now
and then go on. */
i = j = 0;
if (squote && history_quotes_inhibit_expansion)
{
int c;
hist_string_extract_single_quoted (string, &i, 0);
squote = 0;
for (c = 0; c < i; c++)
ADD_CHAR (string[c]);
if (string[i])
{
ADD_CHAR (string[i]);
i++;
}
}
for (passc = 0; i < l; i++)
{
int qc, tchar = string[i];
@@ -1429,11 +1468,11 @@ history_tokenize_word (const char *string, int ind)
}
}
if (member (string[i], "<>;&|$"))
if (member (string[i], "<>;&|"))
{
int peek = string[i + 1];
if (peek == string[i] && peek != '$')
if (peek == string[i])
{
if (peek == '<' && string[i + 2] == '-')
i++;
@@ -1456,9 +1495,8 @@ history_tokenize_word (const char *string, int ind)
i += 2;
return i;
}
/* XXX - separated out for later -- bash-4.2 */
else if ((peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */
(peek == '(' && string[i] == '$')) /*)*/
/* XXX - process substitution -- separated out for later -- bash-4.2 */
else if (peek == '(' && (string[i] == '>' || string[i] == '<')) /*)*/
{
i += 2;
delimopen = '(';
@@ -1466,34 +1504,9 @@ history_tokenize_word (const char *string, int ind)
nestdelim = 1;
goto get_word;
}
#if 0
else if (peek == '\'' && string[i] == '$')
{
i += 2; /* XXX */
return i;
}
#endif
if (string[i] != '$')
{
i++;
return i;
}
}
/* same code also used for $(...)/<(...)/>(...) above */
if (member (string[i], "!@?+*"))
{
int peek = string[i + 1];
if (peek == '(') /*)*/
{
/* Shell extended globbing patterns */
i += 2;
delimopen = '(';
delimiter = ')'; /* XXX - not perfect */
nestdelim = 1;
}
i++;
return i;
}
get_word:
@@ -1538,6 +1551,16 @@ get_word:
continue;
}
/* Command and process substitution; shell extended globbing patterns */
if (nestdelim == 0 && delimiter == 0 && member (string[i], "<>$!@?+*") && string[i+1] == '(') /*)*/
{
i += 2;
delimopen = '(';
delimiter = ')';
nestdelim = 1;
continue;
}
if (delimiter == 0 && (member (string[i], history_word_delimiters)))
break;
+2 -2
View File
@@ -1,6 +1,6 @@
/* histfile.c - functions to manipulate the history file. */
/* Copyright (C) 1989-2017 Free Software Foundation, Inc.
/* Copyright (C) 1989-2018 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
@@ -396,7 +396,7 @@ read_history_range (const char *filename, int from, int to)
{
if (HIST_TIMESTAMP_START(line_start) == 0)
{
if (last_ts == NULL && history_multiline_entries)
if (last_ts == NULL && history_length > 0 && history_multiline_entries)
_hs_append_history_line (history_length - 1, line_start);
else
add_history (line_start);
+2
View File
@@ -261,7 +261,9 @@ extern char *history_word_delimiters;
extern char history_comment_char;
extern char *history_no_expand_chars;
extern char *history_search_delimiter_chars;
extern int history_quotes_inhibit_expansion;
extern int history_quoting_state;
extern int history_write_timestamps;
+4 -4
View File
@@ -322,7 +322,7 @@ rl_unix_word_rubout (int count, int key)
rl_point--;
while (rl_point && (whitespace (rl_line_buffer[rl_point - 1]) == 0))
rl_point--;
rl_point--; /* XXX - multibyte? */
}
rl_kill_text (orig_point, rl_point);
@@ -359,7 +359,7 @@ rl_unix_filename_rubout (int count, int key)
while (rl_point && (whitespace (c) == 0) && c != '/')
{
rl_point--;
rl_point--; /* XXX - multibyte? */
c = rl_line_buffer[rl_point - 1];
}
}
@@ -677,7 +677,7 @@ rl_bracketed_paste_begin (int count, int key)
size_t len, cap;
char *buf;
retval = 1;
retval = 0;
len = 0;
buf = xmalloc (cap = 64);
@@ -708,7 +708,7 @@ rl_bracketed_paste_begin (int count, int key)
if (len == cap)
buf = xrealloc (buf, cap + 1);
buf[len] = '\0';
retval = rl_insert_text (buf);
retval = rl_insert_text (buf) == len ? 0 : 1;
}
xfree (buf);
+59 -3
View File
@@ -75,6 +75,57 @@ int _rl_utf8locale = 0;
#if defined(HANDLE_MULTIBYTE)
/* **************************************************************** */
/* */
/* UTF-8 specific Character Utility Functions */
/* */
/* **************************************************************** */
/* Return the length in bytes of the possibly-multibyte character beginning
at S. Encoding is UTF-8. */
static int
_rl_utf8_mblen (const char *s, size_t n)
{
unsigned char c, c1;
if (s == 0)
return (0); /* no shift states */
if (n <= 0)
return (-1);
c = (unsigned char)*s;
if (c < 0x80)
return (c != 0);
if (c >= 0xc2)
{
c1 = (unsigned char)s[1];
if (c < 0xe0)
{
if (n >= 2 && (s[1] ^ 0x80) < 0x40)
return 2;
}
else if (c < 0xf0)
{
if (n >= 3
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (c >= 0xe1 || c1 >= 0xa0)
&& (c != 0xed || c1 < 0xa0))
return 3;
}
else if (c < 0xf8)
{
if (n >= 4
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || c1 >= 0x90)
&& (c < 0xf4 || (c == 0xf4 && c1 < 0x90)))
return 4;
}
}
/* invalid or incomplete multibyte character */
return -1;
}
static int
_rl_find_next_mbchar_internal (char *string, int seed, int count, int find_non_zero)
{
@@ -228,11 +279,16 @@ _rl_get_char_len (char *src, mbstate_t *ps)
/* Look at no more than MB_CUR_MAX characters */
l = (size_t)strlen (src);
mb_cur_max = MB_CUR_MAX;
tmp = mbrlen((const char *)src, (l < mb_cur_max) ? l : mb_cur_max, ps);
if (_rl_utf8locale && l > 0 && UTF8_SINGLEBYTE(*src))
tmp = (*src != 0) ? 1 : 0;
else
{
mb_cur_max = MB_CUR_MAX;
tmp = mbrlen((const char *)src, (l < mb_cur_max) ? l : mb_cur_max, ps);
}
if (tmp == (size_t)(-2))
{
/* shorted to compose multibyte char */
/* too short to compose multibyte char */
if (ps)
memset (ps, 0, sizeof(mbstate_t));
return -2;
+7 -6
View File
@@ -214,6 +214,9 @@ int _rl_eof_char = CTRL ('D');
/* Non-zero makes this the next keystroke to read. */
int rl_pending_input = 0;
/* If non-zero when readline_internal returns, it means we found EOF */
int _rl_eof_found = 0;
/* Pointer to a useful terminal name. */
const char *rl_terminal_name = (const char *)NULL;
@@ -222,7 +225,7 @@ int _rl_horizontal_scroll_mode = 0;
/* Non-zero means to display an asterisk at the starts of history lines
which have been modified. */
int _rl_mark_modified_lines = 0;
int _rl_mark_modified_lines = 0;
/* The style of `bell' notification preferred. This can be set to NO_BELL,
AUDIBLE_BELL, or VISIBLE_BELL. */
@@ -664,11 +667,9 @@ readline_internal_charloop (void)
static char *
readline_internal (void)
{
int eof;
readline_internal_setup ();
eof = readline_internal_charloop ();
return (readline_internal_teardown (eof));
_rl_eof_found = readline_internal_charloop ();
return (readline_internal_teardown (_rl_eof_found));
}
void
@@ -1055,7 +1056,7 @@ _rl_subseq_result (int r, Keymap map, int key, int got_subseq)
/* We probably shadowed a keymap, so keep going. */
r = _rl_dispatch (ANYOTHERKEY, m);
}
else if (r && map[ANYOTHERKEY].function)
else if (r < 0 && map[ANYOTHERKEY].function)
{
/* We didn't match (r is probably -1), so return something to
tell the caller that it should try ANYOTHERKEY for an
+2 -2
View File
@@ -39,8 +39,8 @@ extern "C" {
#endif
/* Hex-encoded Readline version number. */
#define RL_READLINE_VERSION 0x0700 /* Readline 7.0 */
#define RL_VERSION_MAJOR 7
#define RL_READLINE_VERSION 0x0800 /* Readline 8.0 */
#define RL_VERSION_MAJOR 8
#define RL_VERSION_MINOR 0
/* Readline data structures. */
+2
View File
@@ -173,6 +173,8 @@ _rl_wcwidth (wc)
#endif
#define UTF8_SINGLEBYTE(c) (((c) & 0x80) == 0)
#define UTF8_MBFIRSTCHAR(c) (((c) & 0xc0) == 0xc0)
#define UTF8_MBCHAR(c) (((c) & 0xc0) == 0x80)
#else /* !HANDLE_MULTIBYTE */
+2
View File
@@ -382,6 +382,7 @@ extern void _rl_set_cursor PARAMS((int, int));
extern void _rl_fix_point PARAMS((int));
extern int _rl_replace_text PARAMS((const char *, int, int));
extern int _rl_forward_char_internal PARAMS((int));
extern int _rl_backward_char_internal PARAMS((int));
extern int _rl_insert_char PARAMS((int, int));
extern int _rl_overwrite_char PARAMS((int, int));
extern int _rl_overwrite_rubout PARAMS((int, int));
@@ -511,6 +512,7 @@ extern FILE *_rl_in_stream;
extern FILE *_rl_out_stream;
extern int _rl_last_command_was_kill;
extern int _rl_eof_char;
extern int _rl_eof_found;
extern procenv_t _rl_top_level;
extern _rl_keyseq_cxt *_rl_kscxt;
extern int _rl_keyseq_timeout;
+5 -1
View File
@@ -691,7 +691,11 @@ rl_deprep_terminal (void)
tty = rl_instream ? fileno (rl_instream) : fileno (stdin);
if (terminal_prepped & TPX_BRACKPASTE)
fprintf (rl_outstream, BRACK_PASTE_FINI);
{
fprintf (rl_outstream, BRACK_PASTE_FINI);
if (_rl_eof_found)
fprintf (rl_outstream, "\n");
}
if (_rl_enable_keypad)
_rl_control_keypad (0);
+30 -3
View File
@@ -297,13 +297,40 @@ _rl_forward_char_internal (int count)
#endif
if (rl_end < 0)
rl_end = 0;
rl_end = 0;
#else
point = rl_point + count;
if (point > rl_end)
point = rl_end;
#endif
if (point > rl_end)
point = rl_end;
return (point);
}
int
_rl_backward_char_internal (int count)
{
int point;
point = rl_point;
#if defined (HANDLE_MULTIBYTE)
if (count > 0)
{
while (count > 0 && point > 0)
{
point = _rl_find_prev_mbchar (rl_line_buffer, point, MB_FIND_NONZERO);
count--;
}
if (count > 0)
return 0; /* XXX - rl_ding() here? */
}
#else
if (count > 0)
point -= count;
#endif
if (point < 0)
point = 0;
return (point);
}
+168 -74
View File
@@ -1,7 +1,7 @@
/* vi_mode.c -- A vi emulation mode for Bash.
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
/* Copyright (C) 1987-2018 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@@ -63,6 +63,19 @@
#define member(c, s) ((c) ? (char *)strchr ((s), (c)) != (char *)NULL : 0)
#endif
/* Increment START to the next character in RL_LINE_BUFFER, handling multibyte chars */
#if defined (HANDLE_MULTIBYTE)
#define INCREMENT_POS(start) \
do { \
if (MB_CUR_MAX == 1 || rl_byte_oriented) \
start++; \
else \
start = _rl_find_next_mbchar (rl_line_buffer, start, 1, MB_FIND_ANY); \
} while (0)
#else /* !HANDLE_MULTIBYTE */
#define INCREMENT_POS(start) (start)++
#endif /* !HANDLE_MULTIBYTE */
/* This is global so other parts of the code can check whether the last
command was a text modification command. */
int _rl_vi_last_command = 'i'; /* default `.' puts you in insert mode */
@@ -118,7 +131,7 @@ static void _rl_vi_save_insert PARAMS((UNDO_LIST *));
static void vi_save_insert_buffer PARAMS ((int, int));
static void _rl_vi_backup PARAMS((void));
static inline void _rl_vi_backup PARAMS((void));
static int _rl_vi_arg_dispatch PARAMS((int));
static int rl_digit_loop1 PARAMS((void));
@@ -126,6 +139,9 @@ static int rl_digit_loop1 PARAMS((void));
static int _rl_vi_set_mark PARAMS((void));
static int _rl_vi_goto_mark PARAMS((void));
static inline int _rl_vi_advance_point PARAMS((void));
static inline int _rl_vi_backup_point PARAMS((void));
static void _rl_vi_append_forward PARAMS((int));
static int _rl_vi_callback_getchar PARAMS((char *, int));
@@ -383,7 +399,7 @@ rl_vi_complete (int ignore, int key)
{
if (!whitespace (rl_line_buffer[rl_point + 1]))
rl_vi_end_word (1, 'E');
rl_point++;
_rl_vi_advance_point ();
}
if (key == '*')
@@ -451,6 +467,69 @@ rl_vi_next_word (int count, int key)
return (0);
}
static inline int
_rl_vi_advance_point (void)
{
int point;
point = rl_point;
if (rl_point < rl_end)
#if defined (HANDLE_MULTIBYTE)
{
if (MB_CUR_MAX == 1 || rl_byte_oriented)
rl_point++;
else
{
point = rl_point;
rl_point = _rl_forward_char_internal (1);
if (point == rl_point || rl_point > rl_end)
rl_point = rl_end;
}
}
#else
rl_point++;
#endif
return point;
}
/* Move the cursor back one character. */
static inline void
_rl_vi_backup (void)
{
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
else
rl_point--;
}
/* Move the point back one character, returning the starting value and not
doing anything at the beginning of the line */
static inline int
_rl_vi_backup_point (void)
{
int point;
point = rl_point;
if (rl_point > 0)
#if defined (HANDLE_MULTIBYTE)
{
if (MB_CUR_MAX == 1 || rl_byte_oriented)
rl_point--;
else
{
point = rl_point;
rl_point = _rl_backward_char_internal (1);
if (rl_point < 0)
rl_point = 0; /* XXX - not really necessary */
}
}
#else
rl_point--;
#endif
return point;
}
/* Move to the end of the ?next? word. */
int
rl_vi_end_word (int count, int key)
@@ -476,11 +555,11 @@ rl_vi_fWord (int count, int ignore)
{
/* Skip until whitespace. */
while (!whitespace (rl_line_buffer[rl_point]) && rl_point < rl_end)
rl_point++;
_rl_vi_advance_point ();
/* Now skip whitespace. */
while (whitespace (rl_line_buffer[rl_point]) && rl_point < rl_end)
rl_point++;
_rl_vi_advance_point ();
}
return (0);
}
@@ -497,12 +576,18 @@ rl_vi_bWord (int count, int ignore)
rl_point--;
while (rl_point > 0 && whitespace (rl_line_buffer[rl_point]))
rl_point--;
_rl_vi_backup_point ();
if (rl_point > 0)
{
while (--rl_point >= 0 && !whitespace (rl_line_buffer[rl_point]));
rl_point++;
do
_rl_vi_backup_point ();
while (rl_point > 0 && !whitespace (rl_line_buffer[rl_point]));
if (rl_point > 0) /* hit whitespace */
rl_point++;
if (rl_point < 0)
rl_point = 0;
}
}
return (0);
@@ -511,28 +596,32 @@ rl_vi_bWord (int count, int ignore)
int
rl_vi_eWord (int count, int ignore)
{
int opoint;
while (count-- && rl_point < (rl_end - 1))
{
if (!whitespace (rl_line_buffer[rl_point]))
rl_point++;
if (whitespace (rl_line_buffer[rl_point]) == 0)
_rl_vi_advance_point ();
/* Move to the next non-whitespace character (to the start of the
next word). */
while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point]))
rl_point++;
_rl_vi_advance_point ();
if (rl_point && rl_point < rl_end)
{
opoint = rl_point;
/* Skip whitespace. */
while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point]))
rl_point++;
opoint = _rl_vi_advance_point (); /* XXX - why? */
/* Skip until whitespace. */
while (rl_point < rl_end && !whitespace (rl_line_buffer[rl_point]))
rl_point++;
opoint = _rl_vi_advance_point ();
/* Move back to the last character of the word. */
rl_point--;
rl_point = opoint;
}
}
return (0);
@@ -541,24 +630,28 @@ rl_vi_eWord (int count, int ignore)
int
rl_vi_fword (int count, int ignore)
{
int opoint;
while (count-- && rl_point < (rl_end - 1))
{
/* Move to white space (really non-identifer). */
if (_rl_isident (rl_line_buffer[rl_point]))
{
while (_rl_isident (rl_line_buffer[rl_point]) && rl_point < rl_end)
rl_point++;
_rl_vi_advance_point ();
}
else /* if (!whitespace (rl_line_buffer[rl_point])) */
{
while (!_rl_isident (rl_line_buffer[rl_point]) &&
!whitespace (rl_line_buffer[rl_point]) && rl_point < rl_end)
rl_point++;
_rl_vi_advance_point ();
}
opoint = rl_point;
/* Move past whitespace. */
while (whitespace (rl_line_buffer[rl_point]) && rl_point < rl_end)
rl_point++;
opoint = _rl_vi_advance_point ();
}
return (0);
}
@@ -566,9 +659,11 @@ rl_vi_fword (int count, int ignore)
int
rl_vi_bword (int count, int ignore)
{
int opoint;
while (count-- && rl_point > 0)
{
int last_is_ident;
int prev_is_ident, cur_is_ident;
/* If we are at the start of a word, move back to whitespace
so we will go back to the start of the previous word. */
@@ -581,22 +676,35 @@ rl_vi_bword (int count, int ignore)
back so we don't get messed up by the rl_point++ down there in
the while loop. Without this code, words like `l;' screw up the
function. */
last_is_ident = _rl_isident (rl_line_buffer[rl_point - 1]);
if ((_rl_isident (rl_line_buffer[rl_point]) && !last_is_ident) ||
(!_rl_isident (rl_line_buffer[rl_point]) && last_is_ident))
rl_point--;
cur_is_ident = _rl_isident (rl_line_buffer[rl_point]);
opoint = _rl_vi_backup_point ();
prev_is_ident = _rl_isident (rl_line_buffer[rl_point]);
if ((cur_is_ident && !prev_is_ident) || (!cur_is_ident && prev_is_ident))
; /* leave point alone, we backed it up one character */
else
rl_point = opoint;
while (rl_point > 0 && whitespace (rl_line_buffer[rl_point]))
rl_point--;
_rl_vi_backup_point ();
if (rl_point > 0)
{
opoint = rl_point;
if (_rl_isident (rl_line_buffer[rl_point]))
while (--rl_point >= 0 && _rl_isident (rl_line_buffer[rl_point]));
do
opoint = _rl_vi_backup_point ();
while (rl_point > 0 && _rl_isident (rl_line_buffer[rl_point]));
else
while (--rl_point >= 0 && !_rl_isident (rl_line_buffer[rl_point]) &&
do
opoint = _rl_vi_backup_point ();
while (rl_point > 0 && !_rl_isident (rl_line_buffer[rl_point]) &&
!whitespace (rl_line_buffer[rl_point]));
rl_point++;
if (rl_point > 0)
rl_point = opoint;
if (rl_point < 0)
rl_point = 0;
}
}
return (0);
@@ -605,23 +713,34 @@ rl_vi_bword (int count, int ignore)
int
rl_vi_eword (int count, int ignore)
{
while (count-- && rl_point < rl_end - 1)
int opoint;
while (count-- && rl_point < (rl_end - 1))
{
if (!whitespace (rl_line_buffer[rl_point]))
rl_point++;
if (whitespace (rl_line_buffer[rl_point]) == 0)
_rl_vi_advance_point ();
while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point]))
rl_point++;
_rl_vi_advance_point ();
opoint = rl_point;
if (rl_point < rl_end)
{
if (_rl_isident (rl_line_buffer[rl_point]))
while (++rl_point < rl_end && _rl_isident (rl_line_buffer[rl_point]));
do
{
opoint = _rl_vi_advance_point ();
}
while (rl_point < rl_end && _rl_isident (rl_line_buffer[rl_point]));
else
while (++rl_point < rl_end && !_rl_isident (rl_line_buffer[rl_point])
do
{
opoint = _rl_vi_advance_point ();
}
while (rl_point < rl_end && !_rl_isident (rl_line_buffer[rl_point])
&& !whitespace (rl_line_buffer[rl_point]));
}
rl_point--;
rl_point = opoint;
}
return (0);
}
@@ -637,20 +756,7 @@ rl_vi_insert_beg (int count, int key)
static void
_rl_vi_append_forward (int key)
{
int point;
if (rl_point < rl_end)
{
if (MB_CUR_MAX == 1 || rl_byte_oriented)
rl_point++;
else
{
point = rl_point;
rl_point = _rl_forward_char_internal (1);
if (point == rl_point)
rl_point = rl_end;
}
}
_rl_vi_advance_point ();
}
int
@@ -859,7 +965,7 @@ _rl_vi_change_mbchar_case (int count)
rl_begin_undo_group ();
rl_vi_delete (1, 0);
if (rl_point < p) /* Did we retreat at EOL? */
rl_point++; /* XXX - should we advance more than 1 for mbchar? */
_rl_vi_advance_point ();
rl_insert_text (mb);
rl_end_undo_group ();
rl_vi_check ();
@@ -931,27 +1037,12 @@ rl_vi_put (int count, int key)
return (0);
}
/* Move the cursor back one character. */
static void
_rl_vi_backup (void)
{
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
else
rl_point--;
}
/* Move the cursor back one character if you're at the end of the line */
int
rl_vi_check (void)
{
if (rl_point && rl_point == rl_end)
{
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
else
rl_point--;
}
_rl_vi_backup ();
return (0);
}
@@ -962,7 +1053,10 @@ rl_vi_column (int count, int key)
if (count > rl_end)
rl_end_of_line (1, key);
else
rl_point = count - 1;
{
rl_point = 0;
rl_point = _rl_forward_char_internal (count - 1);
}
return (0);
}
@@ -1113,7 +1207,7 @@ _rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m)
non-whitespace character, move back one (presumably to whitespace). */
if ((_rl_to_upper (c) == 'W') && rl_point < rl_end && rl_point > rl_mark &&
!whitespace (rl_line_buffer[rl_point]))
rl_point--;
rl_point--; /* XXX */
/* If cw or cW, back up to the end of a word, so the behaviour of ce
or cE is the actual result. Brute-force, no subtlety. */
@@ -1126,14 +1220,14 @@ _rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m)
/* Posix.2 says that if cw or cW moves the cursor towards the end of
the line, the character under the cursor should be deleted. */
if (rl_point == rl_mark)
rl_point++;
_rl_vi_advance_point ();
else
{
/* Move past the end of the word so that the kill doesn't
remove the last letter of the previous word. Only do this
if we are not at the end of the line. */
if (rl_point >= 0 && rl_point < (rl_end - 1) && !whitespace (rl_line_buffer[rl_point]))
rl_point++;
_rl_vi_advance_point ();
}
}
@@ -1271,7 +1365,7 @@ vi_delete_dispatch (_rl_vimotion_cxt *m)
mark. */
if (((strchr (" l|h^0bBFT`", m->motion) == 0) && (rl_point >= m->start)) &&
(rl_mark < rl_end))
rl_mark++;
INCREMENT_POS (rl_mark);
rl_kill_text (rl_point, rl_mark);
return (0);
@@ -1334,7 +1428,7 @@ vi_change_dispatch (_rl_vimotion_cxt *m)
and already leave the mark at the correct location. */
if (((strchr (" l|hwW^0bBFT`", m->motion) == 0) && (rl_point >= m->start)) &&
(rl_mark < rl_end))
rl_mark++;
INCREMENT_POS (rl_mark);
/* The cursor never moves with c[wW]. */
if ((_rl_to_upper (m->motion) == 'W') && rl_point < m->start)
@@ -1421,7 +1515,7 @@ vi_yank_dispatch (_rl_vimotion_cxt *m)
mark. */
if (((strchr (" l|h^0%bBFT`", m->motion) == 0) && (rl_point >= m->start)) &&
(rl_mark < rl_end))
rl_mark++;
INCREMENT_POS (rl_mark);
rl_begin_undo_group ();
rl_kill_text (rl_point, rl_mark);
@@ -1611,8 +1705,8 @@ rl_vi_unix_word_rubout (int count, int key)
while (rl_point && vi_unix_word_boundary (rl_line_buffer[rl_point - 1]))
rl_point--;
else if (rl_point > 0 && vi_unix_word_boundary (rl_line_buffer[rl_point]) == 0)
while (rl_point && (vi_unix_word_boundary (rl_line_buffer[rl_point - 1]) == 0))
rl_point--;
while (rl_point > 0 && (vi_unix_word_boundary (rl_line_buffer[rl_point - 1]) == 0))
_rl_vi_backup_point ();
}
rl_kill_text (orig_point, rl_point);
@@ -2100,7 +2194,7 @@ rl_vi_possible_completions (void)
{
while (rl_point < rl_end && rl_line_buffer[rl_point] != ' ' &&
rl_line_buffer[rl_point] != ';')
rl_point++;
_rl_vi_advance_point ();
}
else if (rl_line_buffer[rl_point - 1] == ';')
{
+9 -2
View File
@@ -92,7 +92,8 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
mktime.c strftime.c mbschr.c zcatfd.c zmapfd.c winsize.c eaccess.c \
wcsdup.c fpurge.c zgetline.c mbscmp.c uconvert.c ufuncs.c \
casemod.c dprintf.c input_avail.c mbscasecmp.c fnxform.c \
strchrnul.c unicode.c wcswidth.c wcsnwidth.c shmbchar.c strdup.c
strchrnul.c unicode.c wcswidth.c wcsnwidth.c shmbchar.c strdup.c \
utf8.c
# The header files for this library.
HSOURCES =
@@ -107,7 +108,7 @@ OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.o \
fmtullong.o fmtumax.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
fpurge.o zgetline.o mbscmp.o uconvert.o ufuncs.o casemod.o \
input_avail.o mbscasecmp.o fnxform.o unicode.o shmbchar.o \
wcsnwidth.o ${LIBOBJS}
utf8.o wcsnwidth.o ${LIBOBJS}
SUPPORT = Makefile
@@ -200,6 +201,7 @@ tmpfile.o: tmpfile.c
uconvert.o: uconvert.c
ufuncs.o: ufuncs.c
unicode.o: unicode.c
utf8.o: utf8.c
vprint.o: vprint.c
wcsdup.o: wcsdup.c
wcsnwidth.o: wcsnwidth.c
@@ -277,6 +279,7 @@ tmpfile.o: ${BUILD_DIR}/config.h
uconvert.o: ${BUILD_DIR}/config.h
ufuncs.o: ${BUILD_DIR}/config.h
unicode.o: ${BUILD_DIR}/config.h
utf8.o: ${BUILD_DIR}/config.h
vprint.o: ${BUILD_DIR}/config.h
wcsdup.o: ${BUILD_DIR}/config.h
wcsnwidth.o: ${BUILD_DIR}/config.h
@@ -612,6 +615,10 @@ unicode.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
unicode.o: ${BASHINCDIR}/stdc.h
unicode.o: ${topdir}/xmalloc.h
utf8.o: ${topdir}/bashansi.h
utf8.o: ${BASHINCDIR}/ansi_stdlib.h
utf8.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
winsize.o: ${BASHINCDIR}/stdc.h
winsize.o: ${topdir}/xmalloc.h
winsize.o: ${topdir}/bashtypes.h
+1 -1
View File
@@ -69,7 +69,7 @@ getenv (name)
if (var && exported_p (var))
return (value_cell (var));
}
else
else if (environ)
{
register int i, len;
+1 -7
View File
@@ -32,13 +32,7 @@ extern int locale_utf8locale;
#undef mbschr
static inline char *
utf8_mbschr (s, c)
const char *s;
int c;
{
return strchr (s, c); /* for now */
}
extern char *utf8_mbschr (const char *, int); /* XXX */
/* In some locales, the non-first byte of some multibyte characters have
the same value as some ascii character. Faced with these strings, a
+5 -1
View File
@@ -1,6 +1,6 @@
/* mbscmp - multibyte string comparison. */
/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -26,6 +26,10 @@
#include <stddef.h>
#include <string.h>
extern int locale_utf8locale;
extern int utf8_mbscmp (const char *, const char *);
/* Compare MBS1 and MBS2. */
int
mbscmp (mbs1, mbs2)
+3 -124
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2001, 2006, 2009, 2010, 2012, 2015 Free Software Foundation, Inc.
/* Copyright (C) 2001, 2006, 2009, 2010, 2012, 2015-2018 Free Software Foundation, Inc.
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
@@ -45,102 +45,9 @@ const unsigned int is_basic_table [UCHAR_MAX / 32 + 1] =
extern int locale_utf8locale;
/* We can optimize this if we know the locale is UTF-8, but needs to handle
malformed byte sequences. */
static inline size_t
utf8_mbstrlen(s)
const char *s;
{
size_t num = 0;
register unsigned char c;
extern char *utf8_mbsmbchar (const char *);
extern int utf8_mblen (const char *, size_t);
while ((c = *s++))
/* bytes 0xc0 through 0xff are first byte of multi-byte sequence */
if ((c & 0xc0) != 0x80) /* skip continuation bytes */
++num;
return (num);
}
/* Adapted from GNU libutf8 */
static inline int
utf8_mblen (s, n)
const char *s;
int n;
{
unsigned char c;
if (s == 0)
return 0;
else if (n == 0)
return -1;
c = (unsigned char) *s;
if (c < 0x80)
return (c != 0);
else if (c < 0xc0)
goto return_error;
else
{
const char *start = s;
size_t count;
int check_unsafe;
if (c < 0xe0)
{
count = 1;
if (c < 0xc2)
goto return_error;
check_unsafe = 0;
}
else if (c < 0xf0)
{
count = 2;
check_unsafe = (c == 0xe0);
}
#if SIZEOF_WCHAR_T == 4
else if (c < 0xf8)
{
count = 3;
check_unsafe = (c == 0xe0);
}
else if (c < 0xfc)
{
count = 4;
check_unsafe = (c == 0xf8);
}
else if (c < 0xfe)
{
count = 5;
check_unsafe = (c == 0xfc);
}
#endif
else
goto return_error;
if (n <= count)
return -1;
s++;
c = (unsigned char) *s++ ^ 0x80;
if (c >= 0x40)
goto return_error;
if (--count > 0)
{
if (check_unsafe && ((c >> (6 - count)) == 0))
goto return_error;
do
{
c = (unsigned char) *s++ ^ 0x80;
if (c >= 0x40)
goto return_error;
}
while (--count > 0);
}
return s - start;
}
return_error:
errno = EILSEQ;
return -1;
}
/* Count the number of characters in S, counting multi-byte characters as a
single character. */
size_t
@@ -170,18 +77,6 @@ mbstrlen (s)
return nc;
}
static inline char *
utf8_mbsmbchar (str)
const char *str;
{
register char *s;
for (s = (char *)str; *s; s++)
if ((*s & 0xc0) == 0x80)
return s;
return (0);
}
/* Return pointer to first multibyte char in S, or NULL if none. */
/* XXX - if we know that the locale is UTF-8, we can just check whether or
not any byte has the eighth bit turned on */
@@ -219,22 +114,6 @@ mbsmbchar (s)
return 0;
}
static inline int
utf_mbsnlen(src, srclen, maxlen)
const char *src;
size_t srclen;
int maxlen;
{
register int sind, count;
for (sind = count = 0; src[sind] && sind <= maxlen; sind++)
{
if ((src[sind] & 0xc0) != 0x80)
count++;
}
return (count);
}
int
sh_mbsnlen(src, srclen, maxlen)
const char *src;
+2
View File
@@ -142,9 +142,11 @@ extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int));
302 / 1000 is log10 (2) rounded up;
add one for integer division truncation;
add one more for a minus sign if t is signed. */
#ifndef INT_STRLEN_BOUND
#define INT_STRLEN_BOUND(t) \
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
+ 1 + TYPE_SIGNED (t))
#endif
/* conversion flags */
#define PF_ALTFORM 0x00001 /* # */
+147
View File
@@ -0,0 +1,147 @@
/* utf8.c - UTF-8 character handling functions */
/* Copyright (C) 2018 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include "bashansi.h"
#include "shmbutil.h"
extern int locale_mb_cur_max;
extern int locale_utf8locale;
#if defined (HANDLE_MULTIBYTE)
char *
utf8_mbschr (s, c)
const char *s;
int c;
{
return strchr (s, c); /* for now */
}
int
utf8_mbscmp (s1, s2)
const char *s1, *s2;
{
/* Use the fact that the UTF-8 encoding preserves lexicographic order. */
return strcmp (s1, s2);
}
char *
utf8_mbsmbchar (str)
const char *str;
{
register char *s;
for (s = (char *)str; *s; s++)
if ((*s & 0xc0) == 0x80)
return s;
return (0);
}
int
utf8_mbsnlen(src, srclen, maxlen)
const char *src;
size_t srclen;
int maxlen;
{
register int sind, count;
for (sind = count = 0; src[sind] && sind <= maxlen; sind++)
{
if ((src[sind] & 0xc0) != 0x80)
count++;
}
return (count);
}
/* Adapted from GNU gnulib */
int
utf8_mblen (s, n)
const char *s;
size_t n;
{
unsigned char c, c1;
if (s == 0)
return (0); /* no shift states */
if (n <= 0)
return (-1);
c = (unsigned char)*s;
if (c < 0x80)
return (c != 0);
if (c >= 0xc2)
{
c1 = (unsigned char)s[1];
if (c < 0xe0)
{
if (n >= 2 && (s[1] ^ 0x80) < 0x40)
return 2;
}
else if (c < 0xf0)
{
if (n >= 3
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (c >= 0xe1 || c1 >= 0xa0)
&& (c != 0xed || c1 < 0xa0))
return 3;
}
else if (c < 0xf8)
{
if (n >= 4
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || c1 >= 0x90)
&& (c < 0xf4 || (c == 0xf4 && c1 < 0x90)))
return 4;
}
}
/* invalid or incomplete multibyte character */
return -1;
}
/* We can optimize this if we know the locale is UTF-8, but needs to handle
malformed byte sequences. */
size_t
utf8_mbstrlen(s)
const char *s;
{
size_t clen, nc;
int mb_cur_max;
nc = 0;
mb_cur_max = MB_CUR_MAX;
while (*s && (clen = (size_t)utf8_mblen(s, mb_cur_max)) != 0)
{
if (MB_INVALIDCH(clen))
clen = 1; /* assume single byte */
s += clen;
nc++;
}
return nc;
}
#endif
+1 -1
View File
@@ -43,7 +43,7 @@
extern int errno;
#endif
int locale_utf8locale; /* set but unused for now */
int locale_utf8locale;
int locale_mb_cur_max; /* value of MB_CUR_MAX for current locale (LC_CTYPE) */
int locale_shiftstates;
+6
View File
@@ -1037,6 +1037,12 @@ unfreeze_jobs_list ()
{
}
void
set_jobs_list_frozen (s)
int s;
{
}
int
count_all_jobs ()
{
+13 -5
View File
@@ -2414,20 +2414,21 @@ shell_getc (remove_quoted_newline)
{
char *expansions;
# if defined (BANG_HISTORY)
int old_hist;
/* If the current delimiter is a single quote, we should not be
performing history expansion, even if we're on a different
line from the original single quote. */
old_hist = history_expansion_inhibited;
if (current_delimiter (dstack) == '\'')
history_expansion_inhibited = 1;
history_quoting_state = '\'';
else if (current_delimiter (dstack) == '"')
history_quoting_state = '"';
else
history_quoting_state = 0;
# endif
/* Calling with a third argument of 1 allows remember_on_history to
determine whether or not the line is saved to the history list */
expansions = pre_process_line (shell_input_line, 1, 1);
# if defined (BANG_HISTORY)
history_expansion_inhibited = old_hist;
history_quoting_state = 0;
# endif
if (expansions != shell_input_line)
{
@@ -3167,6 +3168,13 @@ reset_parser ()
token_to_read = '\n';
}
void
reset_readahead_token ()
{
if (token_to_read == '\n')
token_to_read = 0;
}
/* Read the next token. Command can be READ (normal operation) or
RESET (to normalize state). */
static int
+1 -1
View File
@@ -148,7 +148,7 @@ extern int yydebug;
union YYSTYPE
{
#line 328 "/usr/homes/chet/src/bash/src/parse.y" /* yacc.c:1909 */
#line 328 "./parse.y" /* yacc.c:1909 */
WORD_DESC *word; /* the word that we read. */
int number; /* the number that we read. */
+2 -2
View File
@@ -151,7 +151,7 @@ static int progcomp_debug = 0;
int prog_completion_enabled = 1;
#ifdef ALIAS
#ifdef ALIAS /* bash-5.0-beta */
int progcomp_alias = 0; /* unavailable to user code for now */
#endif
@@ -1688,7 +1688,7 @@ programmable_completions (cmd, word, start, end, foundp)
/* Find the first word of the alias value and use that as OCMD. We
don't check the alias value to see whether it begins with a valid
command name, so this can be fooled. */
ind = skip_to_delim (ntxt, 0, "()<>;&| \t\n", SD_NOJMP|SD_COMPLETE); /*)*/
ind = skip_to_delim (ntxt, 0, "()<>;&| \t\n", SD_NOJMP|SD_COMPLETE);
if (ind > 0)
ncmd = substring (ntxt, 0, ind);
else
+1
View File
@@ -107,6 +107,7 @@ typedef struct _list_of_items {
#define EMPTYCMD "_EmptycmD_"
#define DEFAULTCMD "_DefaultCmD_"
#define INITIALWORD "_InitialWorD_"
extern HASH_TABLE *prog_completes;
+1 -1
View File
@@ -277,7 +277,7 @@ mostlyclean:
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo
rm -f Makefile Makefile.in POTFILES *.mo stamp-po
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
+144 -138
View File
@@ -8,10 +8,11 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-27 14:15-0400\n"
"POT-Creation-Date: 2018-09-07 16:16-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -21,52 +22,52 @@ msgstr ""
msgid "bad array subscript"
msgstr ""
#: arrayfunc.c:373 builtins/declare.def:618 variables.c:2188 variables.c:2214
#: variables.c:2922
#: arrayfunc.c:375 builtins/declare.def:638 variables.c:2230 variables.c:2256
#: variables.c:3072
#, c-format
msgid "%s: removing nameref attribute"
msgstr ""
#: arrayfunc.c:398 builtins/declare.def:831
#: arrayfunc.c:400 builtins/declare.def:851
#, c-format
msgid "%s: cannot convert indexed to associative array"
msgstr ""
#: arrayfunc.c:582
#: arrayfunc.c:584
#, c-format
msgid "%s: invalid associative array key"
msgstr ""
#: arrayfunc.c:584
#: arrayfunc.c:586
#, c-format
msgid "%s: cannot assign to non-numeric index"
msgstr ""
#: arrayfunc.c:629
#: arrayfunc.c:631
#, c-format
msgid "%s: %s: must use subscript when assigning associative array"
msgstr ""
#: bashhist.c:436
#: bashhist.c:451
#, c-format
msgid "%s: cannot create: %s"
msgstr ""
#: bashline.c:4111
#: bashline.c:4120
msgid "bash_execute_unix_command: cannot find keymap for command"
msgstr ""
#: bashline.c:4221
#: bashline.c:4230
#, c-format
msgid "%s: first non-whitespace character is not `\"'"
msgstr ""
#: bashline.c:4250
#: bashline.c:4259
#, c-format
msgid "no closing `%c' in %s"
msgstr ""
#: bashline.c:4284
#: bashline.c:4293
#, c-format
msgid "%s: missing colon separator"
msgstr ""
@@ -86,7 +87,7 @@ msgstr ""
msgid "brace expansion: failed to allocate memory for `%s'"
msgstr ""
#: builtins/alias.def:131
#: builtins/alias.def:131 variables.c:1818
#, c-format
msgid "`%s': invalid alias name"
msgstr ""
@@ -144,7 +145,7 @@ msgstr ""
msgid "HOME not set"
msgstr ""
#: builtins/cd.def:327 builtins/common.c:161 test.c:889
#: builtins/cd.def:327 builtins/common.c:161 test.c:891
msgid "too many arguments"
msgstr ""
@@ -196,7 +197,7 @@ msgstr ""
msgid "%s: invalid option name"
msgstr ""
#: builtins/common.c:230 execute_cmd.c:2342 general.c:294 general.c:299
#: builtins/common.c:230 execute_cmd.c:2358 general.c:294 general.c:299
#, c-format
msgid "`%s': not a valid identifier"
msgstr ""
@@ -299,26 +300,26 @@ msgstr ""
msgid "help not available in this version"
msgstr ""
#: builtins/complete.def:278
#: builtins/complete.def:281
#, c-format
msgid "%s: invalid action name"
msgstr ""
#: builtins/complete.def:452 builtins/complete.def:653
#: builtins/complete.def:874
#: builtins/complete.def:474 builtins/complete.def:679
#: builtins/complete.def:910
#, c-format
msgid "%s: no completion specification"
msgstr ""
#: builtins/complete.def:707
#: builtins/complete.def:733
msgid "warning: -F option may not work as you expect"
msgstr ""
#: builtins/complete.def:709
#: builtins/complete.def:735
msgid "warning: -C option may not work as you expect"
msgstr ""
#: builtins/complete.def:847
#: builtins/complete.def:883
msgid "not currently executing completion function"
msgstr ""
@@ -326,47 +327,47 @@ msgstr ""
msgid "can only be used in a function"
msgstr ""
#: builtins/declare.def:369 builtins/declare.def:736
#: builtins/declare.def:369 builtins/declare.def:756
#, c-format
msgid "%s: reference variable cannot be an array"
msgstr ""
#: builtins/declare.def:380 variables.c:3161
#: builtins/declare.def:380 variables.c:3322
#, c-format
msgid "%s: nameref variable self references not allowed"
msgstr ""
#: builtins/declare.def:385 variables.c:2018 variables.c:3083 variables.c:3095
#: variables.c:3158
#: builtins/declare.def:385 variables.c:2060 variables.c:3233 variables.c:3245
#: variables.c:3319
#, c-format
msgid "%s: circular name reference"
msgstr ""
#: builtins/declare.def:390 builtins/declare.def:742 builtins/declare.def:753
#: builtins/declare.def:390 builtins/declare.def:762 builtins/declare.def:773
#, c-format
msgid "`%s': invalid variable name for name reference"
msgstr ""
#: builtins/declare.def:500
#: builtins/declare.def:520
msgid "cannot use `-f' to make functions"
msgstr ""
#: builtins/declare.def:512 execute_cmd.c:5797
#: builtins/declare.def:532 execute_cmd.c:5823
#, c-format
msgid "%s: readonly function"
msgstr ""
#: builtins/declare.def:804
#: builtins/declare.def:824
#, c-format
msgid "%s: quoted compound array assignment deprecated"
msgstr ""
#: builtins/declare.def:818
#: builtins/declare.def:838
#, c-format
msgid "%s: cannot destroy array variables in this way"
msgstr ""
#: builtins/declare.def:825 builtins/read.def:784
#: builtins/declare.def:845 builtins/read.def:785
#, c-format
msgid "%s: cannot convert associative to indexed array"
msgstr ""
@@ -400,7 +401,7 @@ msgstr ""
msgid "%s: cannot delete: %s"
msgstr ""
#: builtins/evalfile.c:138 builtins/hash.def:184 execute_cmd.c:5629
#: builtins/evalfile.c:138 builtins/hash.def:184 execute_cmd.c:5655
#, c-format
msgid "%s: is a directory"
msgstr ""
@@ -728,7 +729,7 @@ msgstr ""
msgid "%s: invalid timeout specification"
msgstr ""
#: builtins/read.def:729
#: builtins/read.def:730
#, c-format
msgid "read error: %d: %s"
msgstr ""
@@ -746,7 +747,7 @@ msgstr ""
msgid "%s: cannot unset"
msgstr ""
#: builtins/set.def:902 variables.c:3597
#: builtins/set.def:902 variables.c:3764
#, c-format
msgid "%s: cannot unset: readonly %s"
msgstr ""
@@ -770,11 +771,11 @@ msgstr ""
msgid "shift count"
msgstr ""
#: builtins/shopt.def:301
#: builtins/shopt.def:312
msgid "cannot set and unset shell options simultaneously"
msgstr ""
#: builtins/shopt.def:403
#: builtins/shopt.def:422
#, c-format
msgid "%s: invalid shell option name"
msgstr ""
@@ -910,7 +911,7 @@ msgstr ""
msgid "%s: unbound variable"
msgstr ""
#: eval.c:242
#: eval.c:245
#, c-format
msgid "\atimed out waiting for input: auto-logout\n"
msgstr ""
@@ -920,66 +921,66 @@ msgstr ""
msgid "cannot redirect standard input from /dev/null: %s"
msgstr ""
#: execute_cmd.c:1294
#: execute_cmd.c:1304
#, c-format
msgid "TIMEFORMAT: `%c': invalid format character"
msgstr ""
#: execute_cmd.c:2330
#: execute_cmd.c:2346
#, c-format
msgid "execute_coproc: coproc [%d:%s] still exists"
msgstr ""
#: execute_cmd.c:2456
#: execute_cmd.c:2472
msgid "pipe error"
msgstr ""
#: execute_cmd.c:4624
#: execute_cmd.c:4644
#, c-format
msgid "eval: maximum eval nesting level exceeded (%d)"
msgstr ""
#: execute_cmd.c:4636
#: execute_cmd.c:4656
#, c-format
msgid "%s: maximum source nesting level exceeded (%d)"
msgstr ""
#: execute_cmd.c:4742
#: execute_cmd.c:4762
#, c-format
msgid "%s: maximum function nesting level exceeded (%d)"
msgstr ""
#: execute_cmd.c:5285
#: execute_cmd.c:5311
#, c-format
msgid "%s: restricted: cannot specify `/' in command names"
msgstr ""
#: execute_cmd.c:5383
#: execute_cmd.c:5409
#, c-format
msgid "%s: command not found"
msgstr ""
#: execute_cmd.c:5627
#: execute_cmd.c:5653
#, c-format
msgid "%s: %s"
msgstr ""
#: execute_cmd.c:5665
#: execute_cmd.c:5691
#, c-format
msgid "%s: %s: bad interpreter"
msgstr ""
#: execute_cmd.c:5702
#: execute_cmd.c:5728
#, c-format
msgid "%s: cannot execute binary file: %s"
msgstr ""
#: execute_cmd.c:5788
#: execute_cmd.c:5814
#, c-format
msgid "`%s': is a special builtin"
msgstr ""
#: execute_cmd.c:5840
#: execute_cmd.c:5866
#, c-format
msgid "cannot duplicate fd %d to fd %d"
msgstr ""
@@ -1058,7 +1059,7 @@ msgstr ""
msgid "getcwd: cannot access parent directories"
msgstr ""
#: input.c:99 subst.c:5858
#: input.c:99 subst.c:5867
#, c-format
msgid "cannot reset nodelay mode for fd %d"
msgstr ""
@@ -1222,51 +1223,51 @@ msgstr ""
msgid "no job control in this shell"
msgstr ""
#: lib/malloc/malloc.c:306
#: lib/malloc/malloc.c:331
#, c-format
msgid "malloc: failed assertion: %s\n"
msgstr ""
#: lib/malloc/malloc.c:322
#: lib/malloc/malloc.c:347
#, c-format
msgid ""
"\r\n"
"malloc: %s:%d: assertion botched\r\n"
msgstr ""
#: lib/malloc/malloc.c:323
#: lib/malloc/malloc.c:348
msgid "unknown"
msgstr ""
#: lib/malloc/malloc.c:811
#: lib/malloc/malloc.c:855
msgid "malloc: block on free list clobbered"
msgstr ""
#: lib/malloc/malloc.c:888
#: lib/malloc/malloc.c:932
msgid "free: called with already freed block argument"
msgstr ""
#: lib/malloc/malloc.c:891
#: lib/malloc/malloc.c:935
msgid "free: called with unallocated block argument"
msgstr ""
#: lib/malloc/malloc.c:910
#: lib/malloc/malloc.c:954
msgid "free: underflow detected; mh_nbytes out of range"
msgstr ""
#: lib/malloc/malloc.c:916
#: lib/malloc/malloc.c:960
msgid "free: start and end chunk sizes differ"
msgstr ""
#: lib/malloc/malloc.c:1015
#: lib/malloc/malloc.c:1070
msgid "realloc: called with unallocated block argument"
msgstr ""
#: lib/malloc/malloc.c:1030
#: lib/malloc/malloc.c:1085
msgid "realloc: underflow detected; mh_nbytes out of range"
msgstr ""
#: lib/malloc/malloc.c:1036
#: lib/malloc/malloc.c:1091
msgid "realloc: start and end chunk sizes differ"
msgstr ""
@@ -1376,103 +1377,103 @@ msgid ""
"truncated"
msgstr ""
#: parse.y:2772
#: parse.y:2773
msgid "maximum here-document count exceeded"
msgstr ""
#: parse.y:3511 parse.y:3881
#: parse.y:3519 parse.y:3889
#, c-format
msgid "unexpected EOF while looking for matching `%c'"
msgstr ""
#: parse.y:4581
#: parse.y:4589
msgid "unexpected EOF while looking for `]]'"
msgstr ""
#: parse.y:4586
#: parse.y:4594
#, c-format
msgid "syntax error in conditional expression: unexpected token `%s'"
msgstr ""
#: parse.y:4590
#: parse.y:4598
msgid "syntax error in conditional expression"
msgstr ""
#: parse.y:4668
#: parse.y:4676
#, c-format
msgid "unexpected token `%s', expected `)'"
msgstr ""
#: parse.y:4672
#: parse.y:4680
msgid "expected `)'"
msgstr ""
#: parse.y:4700
#: parse.y:4708
#, c-format
msgid "unexpected argument `%s' to conditional unary operator"
msgstr ""
#: parse.y:4704
#: parse.y:4712
msgid "unexpected argument to conditional unary operator"
msgstr ""
#: parse.y:4750
#: parse.y:4758
#, c-format
msgid "unexpected token `%s', conditional binary operator expected"
msgstr ""
#: parse.y:4754
#: parse.y:4762
msgid "conditional binary operator expected"
msgstr ""
#: parse.y:4776
#: parse.y:4784
#, c-format
msgid "unexpected argument `%s' to conditional binary operator"
msgstr ""
#: parse.y:4780
#: parse.y:4788
msgid "unexpected argument to conditional binary operator"
msgstr ""
#: parse.y:4791
#: parse.y:4799
#, c-format
msgid "unexpected token `%c' in conditional command"
msgstr ""
#: parse.y:4794
#: parse.y:4802
#, c-format
msgid "unexpected token `%s' in conditional command"
msgstr ""
#: parse.y:4798
#: parse.y:4806
#, c-format
msgid "unexpected token %d in conditional command"
msgstr ""
#: parse.y:6220
#: parse.y:6228
#, c-format
msgid "syntax error near unexpected token `%s'"
msgstr ""
#: parse.y:6238
#: parse.y:6246
#, c-format
msgid "syntax error near `%s'"
msgstr ""
#: parse.y:6248
#: parse.y:6256
msgid "syntax error: unexpected end of file"
msgstr ""
#: parse.y:6248
#: parse.y:6256
msgid "syntax error"
msgstr ""
#: parse.y:6310
#: parse.y:6318
#, c-format
msgid "Use \"%s\" to leave the shell.\n"
msgstr ""
#: parse.y:6472
#: parse.y:6480
msgid "unexpected EOF while looking for matching `)'"
msgstr ""
@@ -1548,7 +1549,7 @@ msgstr ""
msgid "/dev/(tcp|udp)/host/port not supported without networking"
msgstr ""
#: redir.c:870 redir.c:985 redir.c:1046 redir.c:1211
#: redir.c:870 redir.c:985 redir.c:1046 redir.c:1214
msgid "redirection error: cannot duplicate fd"
msgstr ""
@@ -1646,7 +1647,7 @@ msgstr ""
msgid "General help using GNU software: <http://www.gnu.org/gethelp/>\n"
msgstr ""
#: sig.c:695
#: sig.c:727
#, c-format
msgid "sigprocmask: %d: invalid operation"
msgstr ""
@@ -1820,107 +1821,107 @@ msgstr ""
msgid "Unknown Signal #%d"
msgstr ""
#: subst.c:1450 subst.c:1641
#: subst.c:1453 subst.c:1644
#, c-format
msgid "bad substitution: no closing `%s' in %s"
msgstr ""
#: subst.c:3209
#: subst.c:3216
#, c-format
msgid "%s: cannot assign list to array member"
msgstr ""
#: subst.c:5734 subst.c:5750
#: subst.c:5743 subst.c:5759
msgid "cannot make pipe for process substitution"
msgstr ""
#: subst.c:5796
#: subst.c:5805
msgid "cannot make child for process substitution"
msgstr ""
#: subst.c:5848
#: subst.c:5857
#, c-format
msgid "cannot open named pipe %s for reading"
msgstr ""
#: subst.c:5850
#: subst.c:5859
#, c-format
msgid "cannot open named pipe %s for writing"
msgstr ""
#: subst.c:5873
#: subst.c:5882
#, c-format
msgid "cannot duplicate named pipe %s as fd %d"
msgstr ""
#: subst.c:5990
#: subst.c:5999
msgid "command substitution: ignored null byte in input"
msgstr ""
#: subst.c:6121
#: subst.c:6127
msgid "cannot make pipe for command substitution"
msgstr ""
#: subst.c:6164
#: subst.c:6170
msgid "cannot make child for command substitution"
msgstr ""
#: subst.c:6190
#: subst.c:6196
msgid "command_substitute: cannot duplicate pipe as fd 1"
msgstr ""
#: subst.c:6641 subst.c:9483
#: subst.c:6647 subst.c:9515
#, c-format
msgid "%s: invalid variable name for name reference"
msgstr ""
#: subst.c:6737 subst.c:6755 subst.c:6903
#: subst.c:6743 subst.c:6761 subst.c:6915
#, c-format
msgid "%s: invalid indirect expansion"
msgstr ""
#: subst.c:6771 subst.c:6910
#: subst.c:6777 subst.c:6922
#, c-format
msgid "%s: invalid variable name"
msgstr ""
#: subst.c:6962
#: subst.c:6974
#, c-format
msgid "%s: parameter not set"
msgstr ""
#: subst.c:6964
#: subst.c:6976
#, c-format
msgid "%s: parameter null or not set"
msgstr ""
#: subst.c:7201 subst.c:7216
#: subst.c:7213 subst.c:7228
#, c-format
msgid "%s: substring expression < 0"
msgstr ""
#: subst.c:8839 subst.c:8860
#: subst.c:8871 subst.c:8892
#, c-format
msgid "%s: bad substitution"
msgstr ""
#: subst.c:8948
#: subst.c:8980
#, c-format
msgid "$%s: cannot assign in this way"
msgstr ""
#: subst.c:9346
#: subst.c:9378
msgid ""
"future versions of the shell will force evaluation as an arithmetic "
"substitution"
msgstr ""
#: subst.c:9903
#: subst.c:9937
#, c-format
msgid "bad substitution: no closing \"`\" in %s"
msgstr ""
#: subst.c:10907
#: subst.c:10965
#, c-format
msgid "no match: %s"
msgstr ""
@@ -1943,17 +1944,17 @@ msgstr ""
msgid "`)' expected, found %s"
msgstr ""
#: test.c:282 test.c:748 test.c:751
#: test.c:282 test.c:750 test.c:753
#, c-format
msgid "%s: unary operator expected"
msgstr ""
#: test.c:469 test.c:791
#: test.c:469 test.c:793
#, c-format
msgid "%s: binary operator expected"
msgstr ""
#: test.c:873
#: test.c:875
msgid "missing `]'"
msgstr ""
@@ -1977,78 +1978,78 @@ msgstr ""
msgid "trap_handler: bad signal %d"
msgstr ""
#: variables.c:399
#: variables.c:408
#, c-format
msgid "error importing function definition for `%s'"
msgstr ""
#: variables.c:801
#: variables.c:817
#, c-format
msgid "shell level (%d) too high, resetting to 1"
msgstr ""
#: variables.c:2512
#: variables.c:2620
msgid "make_local_variable: no function context at current scope"
msgstr ""
#: variables.c:2531
#: variables.c:2639
#, c-format
msgid "%s: variable may not be assigned value"
msgstr ""
#: variables.c:3246
#: variables.c:3407
#, c-format
msgid "%s: assigning integer to name reference"
msgstr ""
#: variables.c:4149
#: variables.c:4316
msgid "all_local_variables: no function context at current scope"
msgstr ""
#: variables.c:4437
#: variables.c:4652
#, c-format
msgid "%s has null exportstr"
msgstr ""
#: variables.c:4442 variables.c:4451
#: variables.c:4657 variables.c:4666
#, c-format
msgid "invalid character %d in exportstr for %s"
msgstr ""
#: variables.c:4457
#: variables.c:4672
#, c-format
msgid "no `=' in exportstr for %s"
msgstr ""
#: variables.c:4911
#: variables.c:5167
msgid "pop_var_context: head of shell_variables not a function context"
msgstr ""
#: variables.c:4924
#: variables.c:5180
msgid "pop_var_context: no global_variables context"
msgstr ""
#: variables.c:4999
#: variables.c:5260
msgid "pop_scope: head of shell_variables not a temporary environment scope"
msgstr ""
#: variables.c:5862
#: variables.c:6196
#, c-format
msgid "%s: %s: cannot open as FILE"
msgstr ""
#: variables.c:5867
#: variables.c:6201
#, c-format
msgid "%s: %s: invalid value for trace file descriptor"
msgstr ""
#: variables.c:5912
#: variables.c:6246
#, c-format
msgid "%s: %s: compatibility value out of range"
msgstr ""
#: version.c:46 version2.c:46
msgid "Copyright (C) 2016 Free Software Foundation, Inc."
msgid "Copyright (C) 2018 Free Software Foundation, Inc."
msgstr ""
#: version.c:47 version2.c:47
@@ -2378,7 +2379,7 @@ msgstr ""
#: builtins.c:231
msgid ""
"complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] [-G globpat] [-"
"complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-"
"W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S "
"suffix] [name ...]"
msgstr ""
@@ -2390,7 +2391,7 @@ msgid ""
msgstr ""
#: builtins.c:239
msgid "compopt [-o|+o option] [-DE] [name ...]"
msgid "compopt [-o|+o option] [-DEI] [name ...]"
msgstr ""
#: builtins.c:242
@@ -2510,7 +2511,7 @@ msgid ""
" \n"
" Exit Status:\n"
" Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is\n"
" not a shell builtin.."
" not a shell builtin."
msgstr ""
#: builtins.c:369
@@ -4031,8 +4032,8 @@ msgid ""
"successive\n"
" argument.\n"
" \n"
" In addition to the standard format specifications described in printf"
"(1),\n"
" In addition to the standard format specifications described in "
"printf(1),\n"
" printf interprets:\n"
" \n"
" %b\texpand backslash escape sequences in the corresponding argument\n"
@@ -4071,16 +4072,20 @@ msgid ""
" \t\twithout any specific completion defined\n"
" -E\tapply the completions and actions to \"empty\" commands --\n"
" \t\tcompletion attempted on a blank line\n"
" -I\tapply the completions and actions to the intial (usually the\n"
" \t\tcommand) word\n"
" \n"
" When completion is attempted, the actions are applied in the order the\n"
" uppercase-letter options are listed above. The -D option takes\n"
" precedence over -E.\n"
" uppercase-letter options are listed above. If multiple options are "
"supplied,\n"
" the -D option takes precedence over -E, and both take precedence over -"
"I.\n"
" \n"
" Exit Status:\n"
" Returns success unless an invalid option is supplied or an error occurs."
msgstr ""
#: builtins.c:1985
#: builtins.c:1987
msgid ""
"Display possible completions depending on the options.\n"
" \n"
@@ -4093,7 +4098,7 @@ msgid ""
" Returns success unless an invalid option is supplied or an error occurs."
msgstr ""
#: builtins.c:2000
#: builtins.c:2002
msgid ""
"Modify or display completion options.\n"
" \n"
@@ -4108,6 +4113,7 @@ msgid ""
" \t-o option\tSet completion option OPTION for each NAME\n"
" \t-D\t\tChange options for the \"default\" command completion\n"
" \t-E\t\tChange options for the \"empty\" command completion\n"
" \t-I\t\tChange options for completion on the initial word\n"
" \n"
" Using `+o' instead of `-o' turns off the specified option.\n"
" \n"
@@ -4124,7 +4130,7 @@ msgid ""
" have a completion specification defined."
msgstr ""
#: builtins.c:2030
#: builtins.c:2033
msgid ""
"Read lines from the standard input into an indexed array variable.\n"
" \n"
@@ -4166,7 +4172,7 @@ msgid ""
" not an indexed array."
msgstr ""
#: builtins.c:2066
#: builtins.c:2069
msgid ""
"Read lines from a file into an array variable.\n"
" \n"
+577 -790
View File
File diff suppressed because it is too large Load Diff
+1287 -1558
View File
File diff suppressed because it is too large Load Diff
+650 -936
View File
File diff suppressed because it is too large Load Diff
+2306 -1188
View File
File diff suppressed because it is too large Load Diff
+775 -1177
View File
File diff suppressed because it is too large Load Diff
+986 -1622
View File
File diff suppressed because it is too large Load Diff
+1798 -1697
View File
File diff suppressed because it is too large Load Diff
+630 -853
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -363,7 +363,7 @@ main (argc, argv, env)
#endif /* !NO_MAIN_ENV_ARG */
{
register int i;
int code, old_errexit_flag;
int code, old_errexit_flag, old_onecmd;
#if defined (RESTRICTED_SHELL)
int saverst;
#endif
@@ -1012,7 +1012,7 @@ sh_exit (s)
int s;
{
#if defined (MALLOC_DEBUG) && defined (USING_BASH_MALLOC)
if (malloc_trace_at_exit)
if (malloc_trace_at_exit && (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB)) == 0)
trace_malloc_stats (get_name_for_error (), (char *)NULL);
/* mlocation_write_table (); */
#endif
-1
View File
@@ -268,7 +268,6 @@ initialize_terminating_signals ()
sigaction (XSIG (i), &oact, (struct sigaction *)NULL);
#endif /* SIGPROF && !_MINIX */
}
#else /* !HAVE_POSIX_SIGNALS */
for (i = 0; i < TERMSIGS_LENGTH; i++)
+108 -50
View File
@@ -387,10 +387,10 @@ dump_word_flags (flags)
f &= ~W_ASSIGNARRAY;
fprintf (stderr, "W_ASSIGNARRAY%s", f ? "|" : "");
}
if (f & W_HASCTLESC)
if (f & W_SAWQUOTEDNULL)
{
f &= ~W_HASCTLESC;
fprintf (stderr, "W_HASCTLESC%s", f ? "|" : "");
f &= ~W_SAWQUOTEDNULL;
fprintf (stderr, "W_SAWQUOTEDNULL%s", f ? "|" : "");
}
if (f & W_NOPROCSUB)
{
@@ -1178,7 +1178,10 @@ string_extract_verbatim (string, slen, sindex, charlist, flags)
}
#if defined (HANDLE_MULTIBYTE)
mblength = MBLEN (string + i, slen - i);
if (locale_utf8locale && slen > i && UTF8_SINGLEBYTE (string[i]))
mblength = (string[i] != 0) ? 1 : 0;
else
mblength = MBLEN (string + i, slen - i);
if (mblength > 1)
{
wchar_t wc;
@@ -3059,6 +3062,7 @@ do_compound_assignment (name, value, flags)
SHELL_VAR *v;
int mklocal, mkassoc, mkglobal, chklocal;
WORD_LIST *list;
char *newname; /* used for local nameref references */
mklocal = flags & ASS_MKLOCAL;
mkassoc = flags & ASS_MKASSOC;
@@ -3067,7 +3071,8 @@ do_compound_assignment (name, value, flags)
if (mklocal && variable_context)
{
v = find_variable (name);
v = find_variable (name); /* follows namerefs */
newname = (v == 0) ? nameref_transform_name (name, flags) : v->name;
if (v && ((readonly_p (v) && (flags & ASS_FORCE) == 0) || noassign_p (v)))
{
if (readonly_p (v))
@@ -3076,9 +3081,9 @@ do_compound_assignment (name, value, flags)
}
list = expand_compound_array_assignment (v, value, flags);
if (mkassoc)
v = make_local_assoc_variable (name);
v = make_local_assoc_variable (newname, 0);
else if (v == 0 || (array_p (v) == 0 && assoc_p (v) == 0) || v->context != variable_context)
v = make_local_array_variable (name, 0);
v = make_local_array_variable (newname, 0);
if (v)
assign_compound_array_list (v, list, flags);
if (list)
@@ -3099,13 +3104,15 @@ do_compound_assignment (name, value, flags)
err_readonly (name);
return (v); /* XXX */
}
/* sanity check */
newname = (v == 0) ? nameref_transform_name (name, flags) : name;
list = expand_compound_array_assignment (v, value, flags);
if (v == 0 && mkassoc)
v = make_new_assoc_variable (name);
v = make_new_assoc_variable (newname);
else if (v && mkassoc && assoc_p (v) == 0)
v = convert_var_to_assoc (v);
else if (v == 0)
v = make_new_array_variable (name);
v = make_new_array_variable (newname);
else if (v && mkassoc == 0 && array_p (v) == 0)
v = convert_var_to_array (v);
if (v)
@@ -3896,15 +3903,17 @@ expand_string_for_pat (string, quoted, dollar_at_p, expanded_p)
{
WORD_DESC td;
WORD_LIST *tresult;
int oexp;
if (string == 0 || *string == '\0')
return (WORD_LIST *)NULL;
oexp = expand_no_split_dollar_star;
expand_no_split_dollar_star = 1;
td.flags = W_NOSPLIT2; /* no splitting, remove "" and '' */
td.word = string;
tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, expanded_p);
expand_no_split_dollar_star = 0;
expand_no_split_dollar_star = oexp;
return (tresult);
}
@@ -6006,10 +6015,7 @@ read_comsub (fd, quoted, flags, rflag)
from the rest of the word expansions (word splitting and globbing.)
This is essentially quote_escapes inline. */
else if (skip_ctlesc == 0 && c == CTLESC)
{
tflag |= W_HASCTLESC;
istring[istring_index++] = CTLESC;
}
istring[istring_index++] = CTLESC;
else if ((skip_ctlnul == 0 && c == CTLNUL) || (c == ' ' && (ifs_value && *ifs_value == 0)))
istring[istring_index++] = CTLESC;
@@ -6840,8 +6846,14 @@ parameter_brace_expand_rhs (name, value, op, quoted, pflags, qdollaratp, hasdoll
temp = string_list_internal (l, " ");
w->flags |= W_SPLITSPACE;
}
else if (l_hasdollat || l->next)
temp = string_list_dollar_star (l, quoted, 0);
else
temp = (l_hasdollat || l->next) ? string_list_dollar_star (l, quoted, 0) : string_list (l);
{
temp = string_list (l);
if (temp && (QUOTED_NULL (temp) == 0) && (l->word->flags & W_SAWQUOTEDNULL))
w->flags |= W_SAWQUOTEDNULL; /* XXX */
}
/* If we have a quoted null result (QUOTED_NULL(temp)) and the word is
a quoted null (l->next == 0 && QUOTED_NULL(l->word->word)), the
@@ -7310,9 +7322,9 @@ get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
vtype = VT_VARIABLE;
*varp = v;
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
*valp = dequote_string (value);
*valp = value ? dequote_string (value) : savestring ("");
else
*valp = dequote_escapes (value);
*valp = value ? dequote_escapes (value) : (char *)NULL;
}
else
{
@@ -7696,7 +7708,7 @@ parameter_brace_substring (varname, value, ind, substr, quoted, pflags, flags)
int quoted, pflags, flags;
{
intmax_t e1, e2;
int vtype, r, starsub, qflags;
int vtype, r, starsub;
char *temp, *val, *tt, *oname;
SHELL_VAR *v;
@@ -7745,9 +7757,23 @@ parameter_brace_substring (varname, value, ind, substr, quoted, pflags, flags)
FREE (tt);
break;
case VT_POSPARMS:
qflags = quoted;
tt = pos_params (varname, e1, e2, qflags);
/* string_list_dollar_at will quote the list if ifs_is_null != 0 */
case VT_ARRAYVAR:
if (vtype == VT_POSPARMS)
tt = pos_params (varname, e1, e2, quoted);
#if defined (ARRAY_VARS)
/* assoc_subrange and array_subrange both call string_list_pos_params,
so we can treat this case just like VT_POSPARAMS. */
else if (assoc_p (v))
/* we convert to list and take first e2 elements starting at e1th
element -- officially undefined for now */
tt = assoc_subrange (assoc_cell (v), e1, e2, starsub, quoted);
else
/* We want E2 to be the number of elements desired (arrays can be
sparse, so verify_substring_values just returns the numbers
specified and we rely on array_subrange to understand how to
deal with them). */
tt = array_subrange (array_cell (v), e1, e2, starsub, quoted);
#endif
/* We want to leave this alone in every case where pos_params/
string_list_pos_params quotes the list members */
if (tt && quoted == 0 && ifs_is_null)
@@ -7762,21 +7788,7 @@ parameter_brace_substring (varname, value, ind, substr, quoted, pflags, flags)
else
temp = tt;
break;
#if defined (ARRAY_VARS)
case VT_ARRAYVAR:
if (assoc_p (v))
/* we convert to list and take first e2 elements starting at e1th
element -- officially undefined for now */
temp = assoc_subrange (assoc_cell (v), e1, e2, starsub, quoted);
else
/* We want E2 to be the number of elements desired (arrays can be sparse,
so verify_substring_values just returns the numbers specified and we
rely on array_subrange to understand how to deal with them). */
temp = array_subrange (array_cell (v), e1, e2, starsub, quoted);
/* array_subrange now calls array_quote_escapes as appropriate, so the
caller no longer needs to. */
break;
#endif
default:
temp = (char *)NULL;
}
@@ -7817,7 +7829,7 @@ pat_subst (string, pat, rep, mflags)
int rptr, mtype, rxpand, mlen;
size_t rsize, l, replen, rslen;
if (string == 0)
if (string == 0)
return (savestring (""));
mtype = mflags & MATCH_TYPEMASK;
@@ -7968,7 +7980,7 @@ pos_params_pat_subst (string, pat, rep, mflags)
qflags = (mflags & MATCH_QUOTED) == MATCH_QUOTED ? Q_DOUBLE_QUOTES : 0;
/* If we are expanding in a context where word splitting will not be
performed, treat as quoted. This changes how $* will be expanded. */
performed, treat as quoted. This changes how $* will be expanded. */
if (pchar == '*' && (mflags & MATCH_ASSIGNRHS) && expand_no_split_dollar_star && ifs_is_null)
qflags |= Q_DOUBLE_QUOTES; /* Posix interp 888 */
@@ -8135,11 +8147,22 @@ parameter_brace_patsub (varname, value, ind, patsub, quoted, pflags, flags)
if ((mflags & MATCH_STARSUB) && (mflags & MATCH_ASSIGNRHS) && ifs_is_null)
mflags |= MATCH_QUOTED; /* Posix interp 888 */
temp = assoc_p (v) ? assoc_patsub (assoc_cell (v), p, rep, mflags)
: array_patsub (array_cell (v), p, rep, mflags);
/* Don't call quote_escapes anymore; array_patsub calls
array_quote_escapes as appropriate before adding the
space separators; ditto for assoc_patsub. */
/* these eventually call string_list_pos_params */
if (assoc_p (v))
temp = assoc_patsub (assoc_cell (v), p, rep, mflags);
else
temp = array_patsub (array_cell (v), p, rep, mflags);
if (temp && quoted == 0 && ifs_is_null)
{
/* Posix interp 888 */
}
else if (temp && (mflags & MATCH_QUOTED) == 0)
{
tt = quote_escapes (temp);
free (temp);
temp = tt;
}
break;
#endif
}
@@ -8286,7 +8309,7 @@ parameter_brace_casemod (varname, value, ind, modspec, patspec, quoted, pflags,
{
/* Posix interp 888 */
}
else if (temp && (mflags & MATCH_QUOTED) == 0)
else if (temp && (mflags & MATCH_QUOTED) == 0)
{
tt = quote_escapes (temp);
free (temp);
@@ -8304,9 +8327,18 @@ parameter_brace_casemod (varname, value, ind, modspec, patspec, quoted, pflags,
temp = assoc_p (v) ? assoc_modcase (assoc_cell (v), pat, modop, mflags)
: array_modcase (array_cell (v), pat, modop, mflags);
/* Don't call quote_escapes; array_modcase calls array_quote_escapes
as appropriate before adding the space separators; ditto for
assoc_modcase. */
if (temp && quoted == 0 && ifs_is_null)
{
/* Posix interp 888 */
}
else if (temp && (mflags & MATCH_QUOTED) == 0)
{
tt = quote_escapes (temp);
free (temp);
temp = tt;
}
break;
#endif
}
@@ -9870,6 +9902,8 @@ add_string:
if (tword && (tword->flags & W_HASQUOTEDNULL))
had_quoted_null = 1; /* note for later */
if (tword && (tword->flags & W_SAWQUOTEDNULL))
had_quoted_null = 1; /* XXX */
temp = tword ? tword->word : (char *)NULL;
dispose_word_desc (tword);
@@ -10146,6 +10180,9 @@ add_twochars:
else
temp = (char *)NULL;
if (temp == 0 && quoted_state == PARTIALLY_QUOTED)
had_quoted_null = 1; /* note for later */
/* We do not want to add quoted nulls to strings that are only
partially quoted; we can throw them away. The exception to
this is when we are going to be performing word splitting,
@@ -10416,6 +10453,8 @@ finished_with_string:
tword->word = istring;
if (had_quoted_null && QUOTED_NULL (istring))
tword->flags |= W_HASQUOTEDNULL; /* XXX */
else if (had_quoted_null)
tword->flags |= W_SAWQUOTEDNULL; /* XXX */
if (tword->word != istring)
free (istring);
istring = 0; /* avoid later free() */
@@ -10596,9 +10635,14 @@ setifs (v)
}
else
{
size_t ifs_len;
ifs_len = strnlen (ifs_value, MB_CUR_MAX);
ifs_firstc_len = MBLEN (ifs_value, ifs_len);
if (locale_utf8locale && UTF8_SINGLEBYTE (*ifs_value))
ifs_firstc_len = (*ifs_value != 0) ? 1 : 0;
else
{
size_t ifs_len;
ifs_len = strnlen (ifs_value, MB_CUR_MAX);
ifs_firstc_len = MBLEN (ifs_value, ifs_len);
}
if (ifs_firstc_len == 1 || ifs_firstc_len == 0 || MB_INVALIDCH (ifs_firstc_len))
{
ifs_firstc[0] = ifs_value[0];
@@ -10649,10 +10693,24 @@ word_list_split (list)
WORD_LIST *list;
{
WORD_LIST *result, *t, *tresult, *e;
WORD_DESC *w;
for (t = list, result = (WORD_LIST *)NULL; t; t = t->next)
{
tresult = word_split (t->word, ifs_value);
/* POSIX 2.6: "If the complete expansion appropriate for a word results
in an empty field, that empty field shall be deleted from the list
of fields that form the completely expanded command, unless the
original word contained single-quote or double-quote characters."
This is where we handle these words that contain quoted null strings
and other characters that expand to nothing after word splitting. */
if (tresult == 0 && t->word && (t->word->flags & W_SAWQUOTEDNULL)) /* XXX */
{
w = alloc_word_desc ();
w->word = (char *)xmalloc (1);
w->word[0] = '\0';
tresult = make_word_list (w, (WORD_LIST *)NULL);
}
if (result == 0)
result = e = tresult;
else
+4 -3
View File
@@ -4,11 +4,12 @@
# documentation support: man2html
# testing support: printenv recho zecho xcase
#
# bashbug lives here but is created by the top-level makefile
# bashbug.sh lives here (created by configure), but bashbug is created by
# the top-level makefile
#
# Currently only man2html is built
#
# Copyright (C) 1998-2009 Free Software Foundation, Inc.
# Copyright (C) 1998-2018 Free Software Foundation, Inc.
# 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
@@ -82,6 +83,6 @@ clean:
$(RM) man2html$(EXEEXT) $(OBJ1)
distclean maintainer-clean mostlyclean: clean
$(RM) bash.pc
$(RM) bash.pc bashbug.sh
man2html.o: man2html.c

Some files were not shown because too many files have changed in this diff Show More