bash-4.3-beta overlay

This commit is contained in:
Chet Ramey
2013-08-12 19:18:42 -04:00
parent 25eee30b53
commit 1442f67c40
64 changed files with 3022 additions and 1530 deletions
+96 -8
View File
@@ -1,3 +1,91 @@
This document details the changes between this version, bash-4.3-beta, and the
previous version, bash-4.3-alpha.
1. Changes to Bash
a. Fixed a bug in the prompt directory name "trimming" code that caused
memory corruption and garbled the results.
b. Fixed a bug that caused single quotes that resulted from $'...' quoting
in the replacement portion of a double-quoted ${word/pat/rep} expansion
to be treated as quote characters.
c. Fixed a bug that caused assignment statements preceding a command word to
result in assignment statements following a declaration command to not be
expanded like assignment statements.
d. Fixed a bug with variable search order in the presence of local variables
with the same name as variables in the temporary environment supplied to
a shell function.
e. Fixed a bug that caused constructs like 1<(2) to be interpreted as process
substitutions even in an arithmetic context.
f. Fixed several cases where `invisible' variables (variables with attributes
but no values, which are technically unset) were treated incorrectly.
g. Fixed a bug that caused group commands in pipelines that were not the
last element to not run the EXIT trap.
h. Fixed a bug that caused `unset -n' to not unset a nameref variable in
certain cases.
i. Fixed the nameref circular reference checking to be less strict and only
disallow a nameref variable with the same value as its name at the global
scope.
j. Fixed a bug that caused trap handlers to be executed recursively,
corrupting internal data structures.
k. Fixed a bug that could result in bash not compiling if certain options were
not enabled.
l. Fixed a bug that caused the arithmetic expansion code to attempt variable
assignments when operator precedence prohibited them.
m. Word expansions like ${foo##bar} now understand indirect variable references.
n. Fixed a bug that caused `declare -fp name' to not display a function
definition.
o. Fixed a bug that caused asynchronous child processes to modify the stdin
file pointer when bash was using it to read a script, which modified the
parent's value as well.
2. Changes to Readline
a. Fixed a bug in vi mode that caused the arrow keys to set the saved last
vi-mode command to the wrong value.
b. Fixed a bug that caused double-quoted strings to be scanned incorrectly
when being used as the value of a readline variable assignment.
c. Fixed a bug with vi mode that prevented `.' from repeating a command
entered on a previous line (command).
d. Fixed a bug that could cause completion to core dump if it was interrupted
by a signal.
e. Readline now sends the meta-key enable string to the terminal if the
terminal has been successfully initialized.
f. Readline now calls the signal hook after resizing the terminal when it
receives a SIGWINCH.
g. Fixed a bug that could cause the history list code to perform an out-of-
bounds array reference if the history list is empty.
3. New Features in Bash
a. Shells started to run process substitutions now run any trap set on EXIT.
b. There is now a configure-time option to enable the globasciiranges option
by default.
c. The read builtin now checks its first variable argument for validity before
trying to read any input.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.3-alpha,
and the previous version, bash-4.2-release.
@@ -334,6 +422,10 @@ bbbbb. Fixed a bug that caused redirections like <&n- to leave file descriptor
ccccc. Fixed a bug that caused incorrect completion quoting when completing a
word containing a globbing character with `show-all-if-ambiguous' set.
ddddd. Fixed a bug that caused printf's %q format specifier not to quote a
tilde even if it appeared in a location where it would be subject to
tilde expansion.
2. Changes to Readline
a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode
@@ -543,18 +635,14 @@ k. New application-settable variable: rl_input_available_hook; function to be
called when readline detects there is data available on its input file
descriptor.
l. Readline calls an application-set event hook (rl_event_hook) after it gets
a signal while reading input (read returns -1/EINTR but readline does not
handle the signal immediately) to allow the application to handle or
otherwise note it.
l. Readline calls an application-set event hook (rl_signal_event_hook) after
it gets a signal while reading input (read returns -1/EINTR but readline
does not handle the signal immediately) to allow the application to handle
or otherwise note it. Not currently called for SIGHUP or SIGTERM.
m. If the user-settable variable `history-size' is set to a value less than
0, the history list size is unlimited.
n. New application-settable variable: rl_signal_event_hook; function that is
called when readline is reading terminal input and read(2) is interrupted
by a signal. Currently not called for SIGHUP or SIGTERM.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.2-release,
and the previous version, bash-4.2-rc2.
+342 -3
View File
@@ -4406,7 +4406,7 @@ execute_cmd.c
- execute_command_internal: make sure any subshell forked to run a
group command or user subshell at the end of a pipeline runs any
EXIT trap it sets. Fixes debian bash bug 698411
http://bugs.debian.org/cgi-big/bugreport.cgi?bug=698411
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698411
subst.c
- shell_expand_word_list: fix code that creates args for and calls
@@ -4725,8 +4725,6 @@ builtins/setattr.def
functions aren't changed or displayed unless the -f option is given.
Report from <gotmynick@gmail.com>
[bash-4.3-alpha frozen]
3/9
---
include/typemax.h
@@ -4748,3 +4746,344 @@ bashline.c
get inserted by `quoting' the completion. We can't kill all the
matches because show-all-if-ambiguous needs them. Bug report from
Marcel (Felix) Giannelia <info@skeena.net>
[bash-4.3-alpha frozen]
3/14
----
general.c
- trim_pathname: use memmove instead of memcpy since the source and
destination pathnames may overlap. Report and fix from Matthew
Riley <mattdr@google.com>
3/18
----
configure.ac
- socklen_t is defined as `unsigned int' if configure can't find it
3/20
----
lib/readline/complete.c
- S_ISVTX: since it's not defined on all platforms (Minix), make sure
its use is protected with #ifdef
3/21
----
doc/{bash.1,bashref.texi}
- Added mention of ${!name[@]} and ${!name[*]} expansions to get all
indices of an array. Suggested by Jonathan Leffler
<jonathan.leffler@gmail.com>
3/24
----
subst.h
- SD_IGNOREQUOTE: new define for skip_to_delim; if set, means that
single quotes (for now) will be treated as ordinary characters
subst.c
- skip_to_delim: handle SD_IGNOREQUOTE. no callers use it for now
3/25
----
support/config.{guess,sub}
- updated to versions from autoconf-2.69
3/31
----
lib/sh/shquote.c
- sh_single_quote: short-circuit quoting a single "'" instead of
creating a long string with empty single-quoted strings
parser.h
- DOLBRACE_QUOTE2: new define, like DOLBRACE_QUOTE, but need to single-
quote results of $'...' expansion because quote removal will be
done later. Right now this is only done for ${word/pat/rep}
parse.y
- parse_matched_pair: set state to DOLBRACE_QUOTE2 for pattern
substitution word expansion so we don't treat single quote specially
in the pattern or replacement string
- parse_matched_pair: if we're parsing a dollar-brace word expansion
(${...}) and we're not treating single quote specially within
double quotes, single-quote the translation of $'...' ansi-c
escaped strings. Original report and fix from Eduardo A.
Bustamante López <dualbus@gmail.com>
subst.c
- extract_dollar_brace_string: ${word/pat/rep} scanning now sets the
DOLBRACE_QUOTE2 flag instead of DOLBRACE_QUOTE so we don't treat
single quotes specially within a double-quoted string
execute_cmd.c
- fix_assignment_words: skip over assignment statements preceding a
command word before trying to figure out whether or not assignment
statements following a possible declaration command should be
treated specially. Fixes bug reported by Dan Douglas
<ormaaj@gmail.com>
4/4
---
lib/readline/readline.c
- _rl_dispatch_subseq: only call _rl_vi_set_last (and check whether
the key is a text modification command) if the key sequence length
is 1. That keeps the arrow keys from setting the last command
when called in vi command mode. Fixes bug reported by Ian A.
Watson <watson_ian_a@lilly.com>
4/6
---
lib/readline/bind.c
- rl_parse_and_bind: when parsing a double-quoted string as the value
of a variable, make sure we skip past the leading double quote.
Fix from Andreas Schwab <schwab@linux-m68k.org>
variables.c
- hash_lookup: set new local variable last_table_searched to the table
a successful lookup appears in; tested in make_local_variable to
solve the problem below
- make_local_variable: if we find a variable with the tempenv flag
set at the same `level' as variable_context', but not found in the
temporary_env (temp environment preceding the builtin), return it.
The temp environment preceding the function call has already been
merged (in execute_function) into the list of variable contexts the
function sees as shell_variables by the time this is called. Fixes
inconsistency pointed out by Dan Douglas <ormaaj@gmail.com>
subst.c
- expand_arith_string: expanded out contents of expand_string,
expand_string_internal, expand_string_if_necessary to create a
WORD_DESC and call call_expand_word_internal() on it directly.
We don't want process substitution to be performed ( 1<(2) ) should
mean something different in an arithmetic expression context.
It doesn't work to just turn on the DQUOTE flag, since that means
that things like ${x["expression"]} are not expanded correctly.
Fixes problem pointed out by Dan Douglas <ormaaj@gmail.com>
4/13
----
subst.c
- process_substitute: run the EXIT trap before exiting, as other
shells seem to. Fixes problem pointed out by Dan Douglas
<ormaaj@gmail.com>
lib/readline/readline.c
- readline_internal_setup: call rl_vi_insertion_mode to enter vi
mode instead of rl_vi_insert_mode to avoid resetting the saved last
command information. Posix says that `.' can repeat a command
that was entered on a previous line so we need to save the info.
Fixes bug reported by Ian A. Watson <watson_ian_a@lilly.com>
4/14
----
lib/readline/complete.c
- rl_completion_matches: make sure xrealloc returns something non-null
(can happen when interrupted by a signal) before trying to add
matches to match_list
subst.c
- array_remove_pattern: return NULL right away if array_variable_part
returns an invisible variable
- array_length_reference: handle array_variable_part returning an
invisible variable
- get_var_and_type: handle array_variable_part returning an invisible
variable
4/15
----
execute_cmd.c
- execute_command_internal: make sure to run the EXIT trap for group
commands anywhere in pipelines, not just at the end. From a point
raised by Andreas Schwab <schwab@linux-m68k.org>
variables.c
- bind_int_variable: make sure invisible flag is unset. Fixes problems
like "declare -ai a; : $(( a[4]=4 ));"
arrayfunc.c
- array_variable_part: return variable even if invisible flag set,
callers must handle invisible vars
4/18
----
builtins/set.def
- unset_builtin: if -n flag given, call unset_nameref instead of
unset_variable
variables.c
- find_variable_nameref: print warning message if nameref circular
reference detected, return NULL and let caller deal with it
builtins/declare.def
- declare_builtin: only disallow global references at this point if
we are at the global scope
5/16
----
configure.ac
- update release status to beta
5/23
----
trap.c
- run_pending_traps: save and restore pipeline around calls to
evalstring() in case we get a trap while running a trap. Have to
figure out the recursive running traps issue elsewhere. Fixes
bug reported by Roman Rakus <rrakus@redhat.com>
- run_pending_traps: make sure to set running_trap to the appropriate
signal value when running a trap command
- run_pending_traps: short-circuit immediately if running_trap set
when invoked. Could change this later to only skip if it would
run the same trap as currently being run (running_trap == sig + 1)
configure.ac
- add warning if bison not found
lib/readline/doc/rltech.texi
- new section with an example program illustrating the callback
interface. Suggested by Peng Yu <pengyu.ut@gmail.com>
examples/loadables/Makefile.in
- remove references to `cut' and `getconf', which were removed in
early March
5/28
----
lib/sh/pathphys.c
- sh_realpath: correct inverted two arguments to call to sh_makepath.
Report and fix from Julien Thomas <jthomas@exosec.fr>
6/7
---
execute_cmd.c
- executing_line_number: the else clauses that are conditional on
various options being defined can simply be if clauses -- they are
mutually exclusive and all have `return' in the body. Fixes bug
reported by Flavio Medeiros <flaviomotamedeiros@gmail.com>
6/25
----
lib/readline/readline.c
- readline_internal_setup: only sent the meta-key enable string to the
terminal if we've been told to use one and the terminal has been
successfully initialized (RL_ISSTATE (RL_STATE_TERMPREPPED) != 0).
Suggested by Dan Mick <dan.mick@inktank.com>
lib/readline/signals.c
- _rl_signal_handler: call any defined signal hook after calling
rl_resize_terminal when handling a SIGWINCH. We already have called
the original SIGWINCH handler but will not be resending the signal
to ourselves
6/27
----
lib/readline/doc/history.3, doc/bash.1
- fix description of the `$' modifier to note that it expands to the
last *word*, which is not always the last argument. Report from
ariyetz@gmail.com via gnu.org RT
6/29
----
lib/glob/smatch.c
- glob_asciiranges: initialize to value of GLOBASCII_DEFAULT instead
of 0 (0 if not defined)
configure.ac,config.h.in
- --enable-glob-asciiranges-default: new option, controls the value of
GLOBASCII_DEFAULT; use it to turn globasciiranges shopt option on
by default
doc/bashref.texi
- document new --enable-glob-asciiranges-default configure option
variables.c
- assign_in_env: implement += value appending semantics for assignments
preceding command names
7/4
---
expr.c
- set lasttok = NUM in all of the functions that result in a number,
even if it's a boolean, to avoid errors with constructs like
1 * x = 1, which should be an asignment error. Fixes problem
pointed out by Dan Douglas <ormaaj@gmail.com>
parse.y
- decode_prompt_string: don't bother to call strcpy if
polite_directory_format returns its argument unchanged. It's not
necessary and Mac OS X 10.9 aborts because of a supposed overlapping
string copy. Bug and fix from simon@hitzemann.org
subst.c
- parameter_brace_find_indir: new function, code from
parameter_brace_expand_indir that looks up the indirectly-referenced
variable, but does not expand it
- parameter_brace_expand_indir: call parameter_brace_find_indir to
look up indirected variable reference
- get_var_and_type: call parameter_brace_find_indir if it looks like we
are trying to manipulate an indirect variable reference like
${!b%%foo}. This makes a difference if !b references an array
variable. Bug report from Dan Douglas <ormaaj@gmail.com>
7/6
---
lib/sh/casemod.c
- sh_modcase: make sure argument passed to is_basic is <= UCHAR_MAX,
since cval can convert something to a wchar_t greater than UCHAR_MAX.
Fixes bug reported by Tomasz Tomasik <scx.mail@gmail.com>
7/8
---
lib/readline/history.c
- add_history_time: if history_length == 0, referencing history_length
- 1 will result in an array bounds error, so make history_length be
at least 1 before going on. Fixes bug reported by Geng Sheng Liu
<gsliu.tju@gmail.com>
builtins/setattr.def
- show_func_attributes: display definition (if NODEFS argument is 0) and
attributes for a particular function; used by `declare -fp name'
builtins/declare.def
- declare_internal: call show_func_attributes if -f supplied with -p.
Fixes inconsistency observed by Linda Walsh <bash@tlinx.org>
builtins/common.h
- new extern declaration for show_func_attributes
builtins/read.def
- read_builtin: check the first supplied variable name for validity
before attempting to read any input, since we know we will have to
at least use that one. Don't check any other names yet. Suggested
by jidanni@jidanni.org
7/10
----
redir.c
- do_redirection_internal: when closing a file descriptor with
r_close_this ([n]<&-) count close errors as redirection errors if
errno ends up as EIO or ENOSPC. Originally reported back in April
2012 by Andrey Zaitsev <jstcdr@gmail.com>
7/11
----
redir.c
- do_redirection_internal: before calling check_bash_input, make sure
that we don't call check_bash_input for an asynchronous process that
is replacing stdin with something else. The seek backwards affects
the parent process as well, since parents and children share the
file pointer. Fixes problem originally reported in March 2013 by
Martin Jackson <mjackson220.list@gmail.com>
7/13
----
doc/{bash.1,bashref.texi}
- slight change to add a description of `shopt -o' suggested by Bruce
Korb <bruce.korb@gmail.com>
7/19
----
lib/readline/histfile.c
- history_do_write: if close returns < 0, make sure we restore the
backup history file and return a non-zero value
- history_truncate_file: if write or close return < 0, make sure we
return a non-zero value
+342 -3
View File
@@ -4406,7 +4406,7 @@ execute_cmd.c
- execute_command_internal: make sure any subshell forked to run a
group command or user subshell at the end of a pipeline runs any
EXIT trap it sets. Fixes debian bash bug 698411
http://bugs.debian.org/cgi-big/bugreport.cgi?bug=698411
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698411
subst.c
- shell_expand_word_list: fix code that creates args for and calls
@@ -4725,8 +4725,6 @@ builtins/setattr.def
functions aren't changed or displayed unless the -f option is given.
Report from <gotmynick@gmail.com>
[bash-4.3-alpha frozen]
3/9
---
include/typemax.h
@@ -4748,3 +4746,344 @@ bashline.c
get inserted by `quoting' the completion. We can't kill all the
matches because show-all-if-ambiguous needs them. Bug report from
Marcel (Felix) Giannelia <info@skeena.net>
[bash-4.3-alpha frozen]
3/14
----
general.c
- trim_pathname: use memmove instead of memcpy since the source and
destination pathnames may overlap. Report and fix from Matthew
Riley <mattdr@google.com>
3/18
----
configure.ac
- socklen_t is defined as `unsigned int' if configure can't find it
3/20
----
lib/readline/complete.c
- S_ISVTX: since it's not defined on all platforms (Minix), make sure
its use is protected with #ifdef
3/21
----
doc/{bash.1,bashref.texi}
- Added mention of ${!name[@]} and ${!name[*]} expansions to get all
indices of an array. Suggested by Jonathan Leffler
<jonathan.leffler@gmail.com>
3/24
----
subst.h
- SD_IGNOREQUOTE: new define for skip_to_delim; if set, means that
single quotes (for now) will be treated as ordinary characters
subst.c
- skip_to_delim: handle SD_IGNOREQUOTE. no callers use it for now
3/25
----
support/config.{guess,sub}
- updated to versions from autoconf-2.69
3/31
----
lib/sh/shquote.c
- sh_single_quote: short-circuit quoting a single "'" instead of
creating a long string with empty single-quoted strings
parser.h
- DOLBRACE_QUOTE2: new define, like DOLBRACE_QUOTE, but need to single-
quote results of $'...' expansion because quote removal will be
done later. Right now this is only done for ${word/pat/rep}
parse.y
- parse_matched_pair: set state to DOLBRACE_QUOTE2 for pattern
substitution word expansion so we don't treat single quote specially
in the pattern or replacement string
- parse_matched_pair: if we're parsing a dollar-brace word expansion
(${...}) and we're not treating single quote specially within
double quotes, single-quote the translation of $'...' ansi-c
escaped strings. Original report and fix from Eduardo A.
Bustamante López <dualbus@gmail.com>
subst.c
- extract_dollar_brace_string: ${word/pat/rep} scanning now sets the
DOLBRACE_QUOTE2 flag instead of DOLBRACE_QUOTE so we don't treat
single quotes specially within a double-quoted string
execute_cmd.c
- fix_assignment_words: skip over assignment statements preceding a
command word before trying to figure out whether or not assignment
statements following a possible declaration command should be
treated specially. Fixes bug reported by Dan Douglas
<ormaaj@gmail.com>
4/4
---
lib/readline/readline.c
- _rl_dispatch_subseq: only call _rl_vi_set_last (and check whether
the key is a text modification command) if the key sequence length
is 1. That keeps the arrow keys from setting the last command
when called in vi command mode. Fixes bug reported by Ian A.
Watson <watson_ian_a@lilly.com>
4/6
---
lib/readline/bind.c
- rl_parse_and_bind: when parsing a double-quoted string as the value
of a variable, make sure we skip past the leading double quote.
Fix from Andreas Schwab <schwab@linux-m68k.org>
variables.c
- hash_lookup: set new local variable last_table_searched to the table
a successful lookup appears in; tested in make_local_variable to
solve the problem below
- make_local_variable: if we find a variable with the tempenv flag
set at the same `level' as variable_context', but not found in the
temporary_env (temp environment preceding the builtin), return it.
The temp environment preceding the function call has already been
merged (in execute_function) into the list of variable contexts the
function sees as shell_variables by the time this is called. Fixes
inconsistency pointed out by Dan Douglas <ormaaj@gmail.com>
subst.c
- expand_arith_string: expanded out contents of expand_string,
expand_string_internal, expand_string_if_necessary to create a
WORD_DESC and call call_expand_word_internal() on it directly.
We don't want process substitution to be performed ( 1<(2) ) should
mean something different in an arithmetic expression context.
It doesn't work to just turn on the DQUOTE flag, since that means
that things like ${x["expression"]} are not expanded correctly.
Fixes problem pointed out by Dan Douglas <ormaaj@gmail.com>
4/13
----
subst.c
- process_substitute: run the EXIT trap before exiting, as other
shells seem to. Fixes problem pointed out by Dan Douglas
<ormaaj@gmail.com>
lib/readline/readline.c
- readline_internal_setup: call rl_vi_insertion_mode to enter vi
mode instead of rl_vi_insert_mode to avoid resetting the saved last
command information. Posix says that `.' can repeat a command
that was entered on a previous line so we need to save the info.
Fixes bug reported by Ian A. Watson <watson_ian_a@lilly.com>
4/14
----
lib/readline/complete.c
- rl_completion_matches: make sure xrealloc returns something non-null
(can happen when interrupted by a signal) before trying to add
matches to match_list
subst.c
- array_remove_pattern: return NULL right away if array_variable_part
returns an invisible variable
- array_length_reference: handle array_variable_part returning an
invisible variable
- get_var_and_type: handle array_variable_part returning an invisible
variable
4/15
----
execute_cmd.c
- execute_command_internal: make sure to run the EXIT trap for group
commands anywhere in pipelines, not just at the end. From a point
raised by Andreas Schwab <schwab@linux-m68k.org>
variables.c
- bind_int_variable: make sure invisible flag is unset. Fixes problems
like "declare -ai a; : $(( a[4]=4 ));"
arrayfunc.c
- array_variable_part: return variable even if invisible flag set,
callers must handle invisible vars
4/18
----
builtins/set.def
- unset_builtin: if -n flag given, call unset_nameref instead of
unset_variable
variables.c
- find_variable_nameref: print warning message if nameref circular
reference detected, return NULL and let caller deal with it
builtins/declare.def
- declare_builtin: only disallow global references at this point if
we are at the global scope
5/16
----
configure.ac
- update release status to beta
5/23
----
trap.c
- run_pending_traps: save and restore pipeline around calls to
evalstring() in case we get a trap while running a trap. Have to
figure out the recursive running traps issue elsewhere. Fixes
bug reported by Roman Rakus <rrakus@redhat.com>
- run_pending_traps: make sure to set running_trap to the appropriate
signal value when running a trap command
- run_pending_traps: short-circuit immediately if running_trap set
when invoked. Could change this later to only skip if it would
run the same trap as currently being run (running_trap == sig + 1)
configure.ac
- add warning if bison not found
lib/readline/doc/rltech.texi
- new section with an example program illustrating the callback
interface. Suggested by Peng Yu <pengyu.ut@gmail.com>
examples/loadables/Makefile.in
- remove references to `cut' and `getconf', which were removed in
early March
5/28
----
lib/sh/pathphys.c
- sh_realpath: correct inverted two arguments to call to sh_makepath.
Report and fix from Julien Thomas <jthomas@exosec.fr>
6/7
---
execute_cmd.c
- executing_line_number: the else clauses that are conditional on
various options being defined can simply be if clauses -- they are
mutually exclusive and all have `return' in the body. Fixes bug
reported by Flavio Medeiros <flaviomotamedeiros@gmail.com>
6/25
----
lib/readline/readline.c
- readline_internal_setup: only sent the meta-key enable string to the
terminal if we've been told to use one and the terminal has been
successfully initialized (RL_ISSTATE (RL_STATE_TERMPREPPED) != 0).
Suggested by Dan Mick <dan.mick@inktank.com>
lib/readline/signals.c
- _rl_signal_handler: call any defined signal hook after calling
rl_resize_terminal when handling a SIGWINCH. We already have called
the original SIGWINCH handler but will not be resending the signal
to ourselves
6/27
----
lib/readline/doc/history.3, doc/bash.1
- fix description of the `$' modifier to note that it expands to the
last *word*, which is not always the last argument. Report from
ariyetz@gmail.com via gnu.org RT
6/29
----
lib/glob/smatch.c
- glob_asciiranges: initialize to value of GLOBASCII_DEFAULT instead
of 0 (0 if not defined)
configure.ac,config.h.in
- --enable-glob-asciiranges-default: new option, controls the value of
GLOBASCII_DEFAULT; use it to turn globasciiranges shopt option on
by default
doc/bashref.texi
- document new --enable-glob-asciiranges-default configure option
variables.c
- assign_in_env: implement += value appending semantics for assignments
preceding command names
7/4
---
expr.c
- set lasttok = NUM in all of the functions that result in a number,
even if it's a boolean, to avoid errors with constructs like
1 * x = 1, which should be an asignment error. Fixes problem
pointed out by Dan Douglas <ormaaj@gmail.com>
parse.y
- decode_prompt_string: don't bother to call strcpy if
polite_directory_format returns its argument unchanged. It's not
necessary and Mac OS X 10.9 aborts because of a supposed overlapping
string copy. Bug and fix from simon@hitzemann.org
subst.c
- parameter_brace_find_indir: new function, code from
parameter_brace_expand_indir that looks up the indirectly-referenced
variable, but does not expand it
- parameter_brace_expand_indir: call parameter_brace_find_indir to
look up indirected variable reference
- get_var_and_type: call parameter_brace_find_indir if it looks like we
are trying to manipulate an indirect variable reference like
${!b%%foo}. This makes a difference if !b references an array
variable. Bug report from Dan Douglas <ormaaj@gmail.com>
7/6
---
lib/sh/casemod.c
- sh_modcase: make sure argument passed to is_basic is <= UCHAR_MAX,
since cval can convert something to a wchar_t greater than UCHAR_MAX.
Fixes bug reported by Tomasz Tomasik <scx.mail@gmail.com>
7/8
---
lib/readline/history.c
- add_history_time: if history_length == 0, referencing history_length
- 1 will result in an array bounds error, so make history_length be
at least 1 before going on. Fixes bug reported by Geng Sheng Liu
<gsliu.tju@gmail.com>
builtins/setattr.def
- show_func_attributes: display definition (if NODEFS argument is 0) and
attributes for a particular function; used by `declare -fp name'
builtins/declare.def
- declare_internal: call show_func_attributes if -f supplied with -p.
Fixes inconsistency observed by Linda Walsh <bash@tlinx.org>
builtins/common.h
- new extern declaration for show_func_attributes
builtins/read.def
- read_builtin: check the first supplied variable name for validity
before attempting to read any input, since we know we will have to
at least use that one. Don't check any other names yet. Suggested
by jidanni@jidanni.org
7/10
----
redir.c
- do_redirection_internal: when closing a file descriptor with
r_close_this ([n]<&-) count close errors as redirection errors if
errno ends up as EIO or ENOSPC. Originally reported back in April
2012 by Andrey Zaitsev <jstcdr@gmail.com>
7/11
----
redir.c
- do_redirection_internal: before calling check_bash_input, make sure
that we don't call check_bash_input for an asynchronous process that
is replacing stdin with something else. The seek backwards affects
the parent process as well, since parents and children share the
file pointer. Fixes problem originally reported in March 2013 by
Martin Jackson <mjackson220.list@gmail.com>
7/13
----
doc/{bash.1,bashref.texi}
- slight change to add a description of `shopt -o' suggested by Bruce
Korb <bruce.korb@gmail.com>
7/19
----
lib/readline/histfile.c
- history_do_write: if close returns < 0, make sure we restore the
backup history file and return a non-zero value
- history_truncate_file: if write or close return < 0, make sure we
return a non-zero value
+5
View File
@@ -385,6 +385,7 @@ lib/readline/examples/fileman.c f
lib/readline/examples/manexamp.c f
lib/readline/examples/histexamp.c f
lib/readline/examples/rltest.c f
lib/readline/examples/rl-callbacktest.c f
lib/readline/examples/rl.c f
lib/readline/examples/rlcat.c f
lib/readline/examples/Inputrc f
@@ -772,6 +773,7 @@ tests/alias1.sub f
tests/alias.right f
tests/appendop.tests f
tests/appendop1.sub f
tests/appendop2.sub f
tests/appendop.right f
tests/arith-for.tests f
tests/arith-for.right f
@@ -826,6 +828,7 @@ tests/source5.sub f
tests/source6.sub f
tests/case.tests f
tests/case.right f
tests/case1.sub f
tests/casemod.tests f
tests/casemod.right f
tests/comsub.tests f
@@ -998,6 +1001,7 @@ tests/new-exp.right f
tests/nquote.tests f
tests/nquote.right f
tests/nquote1.sub f
tests/nquote2.sub f
tests/nquote1.tests f
tests/nquote1.right f
tests/nquote2.tests f
@@ -1163,6 +1167,7 @@ tests/trap2.sub f 755
tests/trap2a.sub f 755
tests/trap3.sub f
tests/trap4.sub f
tests/trap5.sub f
tests/type.tests f
tests/type.right f
tests/type1.sub f
+2
View File
@@ -108,6 +108,8 @@ gg. The brace expansion code now treats a failed sequence expansion as a
simple string and will continue to expand brace terms in the remainder
of the word.
hh. Shells started to run process substitutions now run any trap set on EXIT.
2. New Features in Readline
a. Readline is now more responsive to SIGHUP and other fatal signals when
+4
View File
@@ -929,7 +929,11 @@ array_variable_part (s, subp, lenp)
var = find_variable (t);
free (t);
#if 0
return (var == 0 || invisible_p (var)) ? (SHELL_VAR *)0 : var;
#else
return var; /* now return invisible variables; caller must handle */
#endif
}
#define INDEX_ERROR() \
+1
View File
@@ -155,6 +155,7 @@ extern int set_or_show_attributes __P((WORD_LIST *, int, int));
extern int show_all_var_attributes __P((int, int));
extern int show_var_attributes __P((SHELL_VAR *, int, int));
extern int show_name_attributes __P((char *, int));
extern int show_func_attributes __P((char *, int));
extern void set_var_attribute __P((char *, int, int));
/* Functions from pushd.def */
+6 -2
View File
@@ -264,7 +264,10 @@ declare_internal (list, local_var)
{
for (any_failed = 0; list; list = list->next)
{
pflag = show_name_attributes (list->word->word, nodefs);
if (flags_on & att_function)
pflag = show_func_attributes (list->word->word, nodefs);
else
pflag = show_name_attributes (list->word->word, nodefs);
if (pflag)
{
sh_notfound (list->word->word);
@@ -315,7 +318,8 @@ declare_internal (list, local_var)
}
else
#endif
if (STREQ (name, value))
/* disallow self references at global scope */
if (STREQ (name, value) && variable_context == 0)
{
builtin_error (_("%s: nameref variable self references not allowed"), name);
assign_error++;
+12
View File
@@ -329,6 +329,18 @@ read_builtin (list)
return (input_avail (fd) ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
#endif
/* Convenience: check early whether or not the first of possibly several
variable names is a valid identifier, and bail early if so. */
#if defined (ARRAY_VARS)
if (list && legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word) == 0)
#else
if (list && legal_identifier (list->word->word) == 0)
#endif
{
sh_invalidid (list->word->word);
return (EXECUTION_FAILURE);
}
/* If we're asked to ignore the delimiter, make sure we do. */
if (ignore_delim)
delim = -1;
+1 -1
View File
@@ -863,7 +863,7 @@ unset_builtin (list)
}
else
#endif /* ARRAY_VARS */
tem = unset_function ? unbind_func (name) : unbind_variable (name);
tem = unset_function ? unbind_func (name) : (nameref ? unbind_nameref (name) : unbind_variable (name));
/* This is what Posix.2 says: ``If neither -f nor -v
is specified, the name refers to a variable; if a variable by
+18
View File
@@ -466,6 +466,24 @@ show_name_attributes (name, nodefs)
return (1);
}
int
show_func_attributes (name, nodefs)
char *name;
int nodefs;
{
SHELL_VAR *var;
var = find_function (name);
if (var)
{
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
return (0);
}
else
return (1);
}
void
set_var_attribute (name, attribute, undo)
char *name;
+3
View File
@@ -170,6 +170,9 @@
/* Define to make the `direxpand' shopt option enabled by default. */
#undef DIRCOMPLETE_EXPAND_DEFAULT
/* Define to make the `globasciiranges' shopt option enabled by default. */
#undef GLOBASCII_DEFAULT
/* Define AFS if you are using Transarc's AFS. */
#undef AFS
Vendored
+185 -152
View File
@@ -1,14 +1,12 @@
#! /bin/sh
# From configure.ac for Bash 4.3, version 4.056.
# From configure.ac for Bash 4.3, version 4.059.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for bash 4.3-alpha.
# Generated by GNU Autoconf 2.69 for bash 4.3-beta.
#
# Report bugs to <bug-bash@gnu.org>.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
# Foundation, Inc.
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -137,6 +135,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -170,7 +193,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1"
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -215,21 +239,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
@@ -332,6 +360,14 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -453,6 +489,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -487,16 +527,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -508,28 +548,8 @@ else
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in #(
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -561,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='4.3-alpha'
PACKAGE_STRING='bash 4.3-alpha'
PACKAGE_VERSION='4.3-beta'
PACKAGE_STRING='bash 4.3-beta'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -789,6 +809,7 @@ enable_disabled_builtins
enable_dparen_arithmetic
enable_extended_glob
enable_extended_glob_default
enable_glob_asciiranges_default
enable_help_builtin
enable_history
enable_job_control
@@ -1287,8 +1308,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
$as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1374,7 +1393,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 4.3-alpha to adapt to many kinds of systems.
\`configure' configures bash 4.3-beta to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1439,7 +1458,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 4.3-alpha:";;
short | recursive ) echo "Configuration of bash 4.3-beta:";;
esac
cat <<\_ACEOF
@@ -1479,6 +1498,9 @@ Optional Features:
--enable-extended-glob-default
force extended pattern matching to be enabled by
default
--enable-glob-asciiranges-default
force bracket range expressions in pattern matching
to use the C locale by default
--enable-help-builtin include the help builtin
--enable-history turn on command history
--enable-job-control enable job control features
@@ -1628,10 +1650,10 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 4.3-alpha
generated by GNU Autoconf 2.68
bash configure 4.3-beta
generated by GNU Autoconf 2.69
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1707,7 +1729,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
@@ -2111,7 +2133,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) >= 0)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@@ -2127,7 +2150,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@@ -2153,7 +2177,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) < 0)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@@ -2169,7 +2194,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@@ -2203,7 +2229,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@@ -2332,8 +2359,8 @@ 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 4.3-alpha, which was
generated by GNU Autoconf 2.68. Invocation command line was
It was created by bash $as_me 4.3-beta, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2726,7 +2753,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=4.3
RELSTATUS=alpha
RELSTATUS=beta
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -2973,6 +3000,7 @@ opt_casemod_attrs=yes
opt_casemod_expansions=yes
opt_extglob_default=no
opt_dircomplete_expand_default=no
opt_globascii_default=no
opt_static_link=no
opt_profiling=no
@@ -2993,6 +3021,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
fi
# Check whether --enable-alias was given.
@@ -3085,6 +3114,11 @@ if test "${enable_extended_glob_default+set}" = set; then :
enableval=$enable_extended_glob_default; opt_extglob_default=$enableval
fi
# Check whether --enable-glob-asciiranges-default was given.
if test "${enable_glob_asciiranges_default+set}" = set; then :
enableval=$enable_glob_asciiranges_default; opt_globascii_default=$enableval
fi
# Check whether --enable-help-builtin was given.
if test "${enable_help_builtin+set}" = set; then :
enableval=$enable_help_builtin; opt_help=$enableval
@@ -3299,6 +3333,13 @@ fi
if test $opt_dircomplete_expand_default = yes; then
$as_echo "#define DIRCOMPLETE_EXPAND_DEFAULT 1" >>confdefs.h
fi
if test $opt_globascii_default = yes; then
$as_echo "#define GLOBASCII_DEFAULT 1" >>confdefs.h
else
$as_echo "#define GLOBASCII_DEFAULT 0" >>confdefs.h
fi
if test $opt_memscramble = yes; then
@@ -3372,7 +3413,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3412,7 +3453,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3465,7 +3506,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3506,7 +3547,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -3564,7 +3605,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3608,7 +3649,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4054,8 +4095,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -4339,7 +4379,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
{ test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@@ -4405,7 +4445,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
{ test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@@ -4612,8 +4652,8 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
# define __EXTENSIONS__ 1
$ac_includes_default
# define __EXTENSIONS__ 1
$ac_includes_default
int
main ()
{
@@ -4841,6 +4881,8 @@ _ACEOF
esac
rm -rf conftest*
fi
fi
@@ -5480,7 +5522,7 @@ case $as_dir/ in #((
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -5553,7 +5595,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5593,7 +5635,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5646,7 +5688,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5686,7 +5728,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5739,7 +5781,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_YACC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5796,6 +5838,12 @@ $as_echo "no" >&6; }
fi
case "$ac_cv_prog_YACC" in
*bison*) ;;
*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: bison not available; needed to process parse.y" >&5
$as_echo "$as_me: WARNING: bison not available; needed to process parse.y" >&2;} ;;
esac
case "$host_os" in
opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
*) MAKE_SHELL=/bin/sh ;;
@@ -5872,11 +5920,11 @@ else
int
main ()
{
/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
/* Ultrix mips cc rejects this sort of thing. */
typedef int charset[2];
const charset cs;
const charset cs = { 0, 0 };
/* SunOS 4.1.1 cc rejects this. */
char const *const *pcpcc;
char **ppc;
@@ -5893,8 +5941,9 @@ main ()
++pcpcc;
ppc = (char**) pcpcc;
pcpcc = (char const *const *) ppc;
{ /* SCO 3.2v4 cc rejects this. */
char *t;
{ /* SCO 3.2v4 cc rejects this sort of thing. */
char tx;
char *t = &tx;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
@@ -5910,10 +5959,10 @@ main ()
iptr p = 0;
++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
{ /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; };
struct s *b; b->j = 5;
struct s { int j; const int *ap[3]; } bx;
struct s *b = &bx; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
@@ -6266,7 +6315,8 @@ static int test_array [1 - 2 * !((0 < ((DBL_MAX_EXP < LDBL_MAX_EXP)
- (LDBL_MANT_DIG < DBL_MANT_DIG)))
&& (int) LDBL_EPSILON == 0
)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@@ -6322,7 +6372,8 @@ int
main ()
{
static int test_array [1 - 2 * !(((char) -1) < 0)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@@ -6540,7 +6591,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6904,23 +6955,20 @@ else
/* end confdefs.h. */
$ac_includes_default
int
find_stack_direction ()
find_stack_direction (int *addr, int depth)
{
static char *addr = 0;
auto char dummy;
if (addr == 0)
{
addr = &dummy;
return find_stack_direction ();
}
else
return (&dummy > addr) ? 1 : -1;
int dir, dummy = 0;
if (! addr)
addr = &dummy;
*addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
dir = depth ? find_stack_direction (addr, depth - 1) : 0;
return dir + dummy;
}
int
main ()
main (int argc, char **argv)
{
return find_stack_direction () < 0;
return find_stack_direction (0, argc + !argv + 20) < 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
@@ -8278,7 +8326,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_INTLBISON="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -9422,23 +9470,20 @@ else
/* end confdefs.h. */
$ac_includes_default
int
find_stack_direction ()
find_stack_direction (int *addr, int depth)
{
static char *addr = 0;
auto char dummy;
if (addr == 0)
{
addr = &dummy;
return find_stack_direction ();
}
else
return (&dummy > addr) ? 1 : -1;
int dir, dummy = 0;
if (! addr)
addr = &dummy;
*addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
dir = depth ? find_stack_direction (addr, depth - 1) : 0;
return dir + dummy;
}
int
main ()
main (int argc, char **argv)
{
return find_stack_direction () < 0;
return find_stack_direction (0, argc + !argv + 20) < 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
@@ -13380,7 +13425,7 @@ if test $bash_cv_type_socklen_t = yes; then
fi
if test $bash_cv_type_socklen_t = no; then
cat >>confdefs.h <<_ACEOF
#define socklen_t int
#define socklen_t unsigned int
_ACEOF
fi
@@ -16395,16 +16440,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -16464,28 +16509,16 @@ else
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in #(
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -16506,8 +16539,8 @@ 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 4.3-alpha, which was
generated by GNU Autoconf 2.68. Invocation command line was
This file was extended by bash $as_me 4.3-beta, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -16572,11 +16605,11 @@ _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 4.3-alpha
configured by $0, generated by GNU Autoconf 2.68,
bash config.status 4.3-beta
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -16665,7 +16698,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
+16 -3
View File
@@ -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 4.3, version 4.056])dnl
AC_REVISION([for Bash 4.3, version 4.059])dnl
define(bashvers, 4.3)
define(relstatus, alpha)
define(relstatus, beta)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
@@ -191,6 +191,7 @@ opt_casemod_attrs=yes
opt_casemod_expansions=yes
opt_extglob_default=no
opt_dircomplete_expand_default=no
opt_globascii_default=no
dnl options that affect how bash is compiled and linked
opt_static_link=no
@@ -211,6 +212,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
fi
AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
@@ -231,6 +233,7 @@ AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [a
AC_ARG_ENABLE(dparen-arithmetic, AC_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval)
AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval)
AC_ARG_ENABLE(extended-glob-default, AC_HELP_STRING([--enable-extended-glob-default], [force extended pattern matching to be enabled by default]), opt_extglob_default=$enableval)
AC_ARG_ENABLE(glob-asciiranges-default, AC_HELP_STRING([--enable-glob-asciiranges-default], [force bracket range expressions in pattern matching to use the C locale by default]), opt_globascii_default=$enableval)
AC_ARG_ENABLE(help-builtin, AC_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval)
AC_ARG_ENABLE(history, AC_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval)
AC_ARG_ENABLE(job-control, AC_HELP_STRING([--enable-job-control], [enable job control features]), opt_job_control=$enableval)
@@ -348,6 +351,11 @@ fi
if test $opt_dircomplete_expand_default = yes; then
AC_DEFINE(DIRCOMPLETE_EXPAND_DEFAULT)
fi
if test $opt_globascii_default = yes; then
AC_DEFINE(GLOBASCII_DEFAULT, 1)
else
AC_DEFINE(GLOBASCII_DEFAULT, 0)
fi
if test $opt_memscramble = yes; then
AC_DEFINE(MEMSCRAMBLE)
@@ -634,6 +642,11 @@ AC_PROG_RANLIB
AC_PROG_YACC
AC_PROG_MAKE_SET
case "$ac_cv_prog_YACC" in
*bison*) ;;
*) AC_MSG_WARN([bison not available; needed to process parse.y]) ;;
esac
case "$host_os" in
opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
*) MAKE_SHELL=/bin/sh ;;
@@ -933,7 +946,7 @@ BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
BASH_CHECK_TYPE(intmax_t, , $bash_cv_type_long_long)
BASH_CHECK_TYPE(uintmax_t, , $bash_cv_type_unsigned_long_long)
if test "$ac_cv_header_sys_socket_h" = "yes"; then
BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], int, HAVE_SOCKLEN_T)
BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], [unsigned int], HAVE_SOCKLEN_T)
fi
BASH_TYPE_RLIMIT
+34 -18
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Sun Mar 10 12:10:16 EDT 2013
.\" Last Change: Sat Jul 13 13:32:19 EDT 2013
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2013 March 10" "GNU Bash 4.3"
.TH BASH 1 "2013 July 13" "GNU Bash 4.3"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -424,8 +424,8 @@ The
.B \-\-norc
option may be used to inhibit this behavior, and the
.B \-\-rcfile
option may be used to force another file to be read, but
\fIrshd\fP does not generally invoke the shell with those options
option may be used to force another file to be read, but neither
\fIrshd\fP nor \fIsshd\fP generally invoke the shell with those options
or allow them to be specified.
.PP
If the shell is started with the effective user (group) id not equal to the
@@ -535,11 +535,11 @@ command (see
.SM
.B REDIRECTION
below).
If \fB|&\fP is used, \fIcommand\fP's standard output and standard error
are connected to
If \fB|&\fP is used, \fIcommand\fP's standard error, in addition to its
standard output, is connected to
\fIcommand2\fP's standard input through the pipe;
it is shorthand for \fB2>&1 |\fP.
This implicit redirection of the standard error is
This implicit redirection of the standard error to the standard output is
performed after any redirections specified by the command.
.PP
The return status of a pipeline is the exit status of the last
@@ -1871,8 +1871,9 @@ below.
.TP
.B BASH_COMPAT
The value is used to set the shell's compatibility level.
See the description of the \fBshopt\fB builtin below under
\fBSHELL BUILTIN COMMANDS\fP for a description of the various compatibility
See the description of the \fBshopt\fP builtin below under
\fBSHELL BUILTIN COMMANDS\fP
for a description of the various compatibility
levels and their effects.
The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
corresponding to the desired compatibility level.
@@ -2536,6 +2537,12 @@ array, and an index of \-1 references the last element.
An array variable is considered set if a subscript has been assigned a
value. The null string is a valid value.
.PP
It is possible to obtain the keys (indices) of an array as well as the values.
${\fB!\fP\fIname\fP[\fI@\fP]} and ${\fB!\fP\fIname\fP[\fI*\fP]}
expand to the indices assigned in array variable \fIname\fP.
The treatment when in double quotes is similar to the expansion of the
special parameters \fI@\fP and \fI*\fP within double quotes.
.PP
The
.B unset
builtin is used to destroy arrays. \fBunset\fP \fIname\fP[\fIsubscript\fP]
@@ -3136,8 +3143,9 @@ The
.I expression
is treated as if it were within double quotes, but a double quote
inside the parentheses is not treated specially.
All tokens in the expression undergo parameter expansion, string
expansion, command substitution, and quote removal.
All tokens in the expression undergo parameter and variable expansion,
command substitution, and quote removal.
The result is treated as the arithmetic expression to be evaluated.
Arithmetic expansions may be nested.
.PP
The evaluation is performed according to the rules listed below under
@@ -5729,7 +5737,7 @@ the first call) of each line in turn.
Any numeric argument supplied to these successive calls determines
the direction to move through the history. A negative argument switches
the direction through the history (back or forward).
The history expansion facilities are used to extract the last argument,
The history expansion facilities are used to extract the last word,
as if the "!$" history expansion had been specified.
.TP
.B shell\-expand\-line (M\-C\-e)
@@ -6665,7 +6673,8 @@ The \fIn\fRth word.
The first argument. That is, word 1.
.TP
.B $
The last argument.
The last word. This is usually the last argument, but will expand to the
zeroth word if there is only one word in the line.
.TP
.B %
The word matched by the most recent `?\fIstring\fR?' search.
@@ -7393,7 +7402,8 @@ option will display the attributes and values of each
.IR name .
When
.B \-p
is used with \fIname\fP arguments, additional options are ignored.
is used with \fIname\fP arguments, additional options,
other than \fB\-f\fP and \fB\-F\fP, are ignored.
When
.B \-p
is supplied without \fIname\fP arguments, it will display the attributes
@@ -9110,7 +9120,12 @@ is greater than
or less than zero; otherwise 0.
.TP
\fBshopt\fP [\fB\-pqsu\fP] [\fB\-o\fP] [\fIoptname\fP ...]
Toggle the values of variables controlling optional shell behavior.
Toggle the values of settings controlling optional shell behavior.
The settings can be either those listed below, or, if the
.B \-o
option is used, those available with the
.B \-o
option to the \fBset\fP builtin command.
With no options, or with the
.B \-p
option, a list of all settable options is displayed, with
@@ -9383,7 +9398,7 @@ above for a description of
This option is enabled by default.
.TP 8
.B globasciiranges
If set, range expressions used in pattern matching (see
If set, range expressions used in pattern matching bracket expressions (see
.SM
.B Pattern Matching
above) behave as if in the traditional C locale when performing
@@ -10063,7 +10078,7 @@ subsequently reset. The exit status is true unless a
is readonly.
.TP
\fBwait\fP [\fB\--n\fP] [\fIn ...\fP]
Wait for each specified process and return its termination status.
Wait for each specified child process and return its termination status.
Each
.I n
may be a process
@@ -10182,7 +10197,8 @@ script.
.TP
\fIThe Gnu History Library\fP, Brian Fox and Chet Ramey
.TP
\fIPortable Operating System Interface (POSIX) Part 2: Shell and Utilities\fP, IEEE
\fIPortable Operating System Interface (POSIX) Part 2: Shell and Utilities\fP, IEEE --
http://pubs.opengroup.org/onlinepubs/9699919799/
.TP
http://tiswww.case.edu/~chet/bash/POSIX -- a description of posix mode
.TP
+28 -11
View File
@@ -621,11 +621,11 @@ That is, each command reads the previous command's output. This
connection is performed before any redirections specified by the
command.
If @samp{|&} is used, @var{command1}'s standard output and standard error
are connected to
If @samp{|&} is used, @var{command1}'s standard error, in addition to
its standard output, is connected to
@var{command2}'s standard input through the pipe;
it is shorthand for @code{2>&1 |}.
This implicit redirection of the standard error is
This implicit redirection of the standard error to the standard output is
performed after any redirections specified by the command.
The reserved word @code{time} causes timing statistics
@@ -2216,8 +2216,9 @@ $(( @var{expression} ))
The expression is treated as if it were within double quotes, but
a double quote inside the parentheses is not treated specially.
All tokens in the expression undergo parameter expansion, command
substitution, and quote removal.
All tokens in the expression undergo parameter and variable expansion,
command substitution, and quote removal.
The result is treated as the arithmetic expression to be evaluated.
Arithmetic expansions may be nested.
The evaluation is performed according to the rules listed below
@@ -3899,8 +3900,8 @@ are given, then display the values of variables instead.
The @option{-p} option will display the attributes and values of each
@var{name}.
When @option{-p} is used with @var{name} arguments, additional options
are ignored.
When @option{-p} is used with @var{name} arguments, additional options,
other than @option{-f} and @option{-F}, are ignored.
When @option{-p} is supplied without @var{name} arguments, @code{declare}
will display the attributes and values of all variables having the
@@ -4824,7 +4825,10 @@ This builtin allows you to change additional shell optional behavior.
shopt [-pqsu] [-o] [@var{optname} @dots{}]
@end example
Toggle the values of variables controlling optional shell behavior.
Toggle the values of settings controlling optional shell behavior.
The settings can be either those listed below, or, if the
@option{-o} option is used, those available with the @option{-o}
option to the @code{set} builtin command (@pxref{The Set Builtin}).
With no options, or with the @option{-p} option, a list of all settable
options is displayed, with an indication of whether or not each is set.
The @option{-p} option causes output to be displayed in a form that
@@ -5045,7 +5049,8 @@ the ignored words are the only possible completions.
This option is enabled by default.
@item globasciiranges
If set, range expressions used in pattern matching (@pxref{Pattern Matching})
If set, range expressions used in pattern matching bracket expressions
(@pxref{Pattern Matching})
behave as if in the traditional C locale when performing
comparisons. That is, the current locale's collating sequence
is not taken into account, so
@@ -6224,8 +6229,8 @@ file exists and is readable.
It will not do this if invoked as @code{sh}.
The @option{--norc} option may be used to inhibit this behavior, and the
@option{--rcfile} option may be used to force another file to be read, but
@code{rshd} does not generally invoke the shell with those options or
allow them to be specified.
neither @code{rshd} nor @code{sshd} generally invoke the shell with those
options or allow them to be specified.
@subsubheading Invoked with unequal effective and real @sc{uid/gid}s
@@ -6813,6 +6818,12 @@ and an index of -1 refers to the last element.
An array variable is considered set if a subscript has been assigned a
value. The null string is a valid value.
It is possible to obtain the keys (indices) of an array as well as the values.
$@{!@var{name}[@@]@} and $@{!@var{name}[*]@} expand to the indices
assigned in array variable @var{name}.
The treatment when in double quotes is similar to the expansion of the
special parameters @samp{@@} and @samp{*} within double quotes.
The @code{unset} builtin is used to destroy arrays.
@code{unset @var{name}[@var{subscript}]}
destroys the array element at index @var{subscript}.
@@ -8069,6 +8080,12 @@ above under @ref{Pattern Matching}.
Set the default value of the @var{extglob} shell option described
above under @ref{The Shopt Builtin} to be enabled.
@item --enable-glob-asciirange-default
Set the default value of the @var{globasciiranges} shell option described
above under @ref{The Shopt Builtin} to be enabled.
This controls the behavior of character ranges when used in pattern matching
bracket expressions.
@item --enable-help-builtin
Include the @code{help} builtin, which displays help on shell builtins and
variables (@pxref{Bash Builtins}).
+3 -3
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2013 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sun Mar 10 12:10:36 EDT 2013
@set LASTCHANGE Sat Jul 13 13:32:05 EDT 2013
@set EDITION 4.3
@set VERSION 4.3
@set UPDATED 10 March 2013
@set UPDATED-MONTH March 2013
@set UPDATED 13 July 2013
@set UPDATED-MONTH July 2013
+1 -8
View File
@@ -85,7 +85,7 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
tty pathchk tee head mkdir rmdir printenv id whoami \
uname sync push ln unlink cut realpath getconf strftime mypid
uname sync push ln unlink realpath strftime mypid
OTHERPROG = necho hello cat
all: $(SHOBJ_STATUS)
@@ -110,9 +110,6 @@ print: print.o
necho: necho.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ necho.o $(SHOBJ_LIBS)
getconf: getconf.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ getconf.o $(SHOBJ_LIBS)
hello: hello.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ hello.o $(SHOBJ_LIBS)
@@ -179,9 +176,6 @@ ln: ln.o
unlink: unlink.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ unlink.o $(SHOBJ_LIBS)
cut: cut.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cut.o $(SHOBJ_LIBS)
realpath: realpath.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS)
@@ -229,7 +223,6 @@ tee.o: tee.c
head.o: head.c
rmdir.o: rmdir.c
necho.o: necho.c
getconf.o: getconf.c
hello.o: hello.c
cat.o: cat.c
printenv.o: printenv.c
+12 -5
View File
@@ -353,11 +353,11 @@ executing_line_number ()
return currently_executing_command->value.Cond->line;
#endif
#if defined (DPAREN_ARITHMETIC)
else if (currently_executing_command->type == cm_arith)
if (currently_executing_command->type == cm_arith)
return currently_executing_command->value.Arith->line;
#endif
#if defined (ARITH_FOR_COMMAND)
else if (currently_executing_command->type == cm_arith_for)
if (currently_executing_command->type == cm_arith_for)
return currently_executing_command->value.ArithFor->line;
#endif
@@ -607,9 +607,11 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
want to note this before execute_in_subshell modifies the
COMMAND struct. Need to keep in mind that execute_in_subshell
runs the exit trap for () subshells itself. */
/* This handles { command; } & */
s = user_subshell == 0 && command->type == cm_group && pipe_in == NO_PIPE && pipe_out == NO_PIPE && asynchronous;
/* run exit trap for : | { ...; } and : | ( ... ) */
s += user_subshell == 0 && command->type == cm_group && pipe_in != NO_PIPE && pipe_out == NO_PIPE && asynchronous == 0;
/* run exit trap for : | { ...; } and { ...; } | : */
/* run exit trap for : | ( ...; ) and ( ...; ) | : */
s += user_subshell == 0 && command->type == cm_group && (pipe_in != NO_PIPE || pipe_out != NO_PIPE) && asynchronous == 0;
last_command_exit_value = execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close);
if (s)
@@ -3754,8 +3756,13 @@ fix_assignment_words (words)
b = 0;
assoc = global = array = 0;
/* Skip over assignment statements preceding a command name */
wcmd = words;
for (w = words; w; w = w->next)
for (wcmd = words; wcmd; wcmd = wcmd->next)
if ((wcmd->word->flags & W_ASSIGNMENT) == 0)
break;
for (w = wcmd; w; w = w->next)
if (w->word->flags & W_ASSIGNMENT)
{
if (b == 0)
+13 -4
View File
@@ -94,11 +94,7 @@
/* Maximum amount of recursion allowed. This prevents a non-integer
variable such as "num=num+2" from infinitely adding to itself when
"let num=num+2" is given. */
#if 0
#define MAX_EXPR_RECURSION_LEVEL 1024
#else
#define MAX_EXPR_RECURSION_LEVEL 16
#endif
/* The Tokens. Singing "The Lion Sleeps Tonight". */
@@ -685,6 +681,7 @@ expbor ()
readtok ();
val2 = expbxor ();
val1 = val1 | val2;
lasttok = NUM;
}
return (val1);
@@ -703,6 +700,7 @@ expbxor ()
readtok ();
val2 = expband ();
val1 = val1 ^ val2;
lasttok = NUM;
}
return (val1);
@@ -721,6 +719,7 @@ expband ()
readtok ();
val2 = exp5 ();
val1 = val1 & val2;
lasttok = NUM;
}
return (val1);
@@ -743,6 +742,7 @@ exp5 ()
val1 = (val1 == val2);
else if (op == NEQ)
val1 = (val1 != val2);
lasttok = NUM;
}
return (val1);
}
@@ -771,6 +771,7 @@ exp4 ()
val1 = val1 < val2;
else /* (op == GT) */
val1 = val1 > val2;
lasttok = NUM;
}
return (val1);
}
@@ -794,6 +795,7 @@ expshift ()
val1 = val1 << val2;
else
val1 = val1 >> val2;
lasttok = NUM;
}
return (val1);
@@ -817,6 +819,7 @@ exp3 ()
val1 += val2;
else if (op == MINUS)
val1 -= val2;
lasttok = NUM;
}
return (val1);
}
@@ -868,6 +871,7 @@ exp2 ()
#else
val1 = (op == DIV) ? val1 / val2 : val1 % val2;
#endif
lasttok = NUM;
}
return (val1);
}
@@ -899,6 +903,7 @@ exppower ()
{
readtok ();
val2 = exppower (); /* exponentiation is right-associative */
lasttok = NUM;
if (val2 == 0)
return (1);
if (val2 < 0)
@@ -917,21 +922,25 @@ exp1 ()
{
readtok ();
val = !exp1 ();
lasttok = NUM;
}
else if (curtok == BNOT)
{
readtok ();
val = ~exp1 ();
lasttok = NUM;
}
else if (curtok == MINUS)
{
readtok ();
val = - exp1 ();
lasttok = NUM;
}
else if (curtok == PLUS)
{
readtok ();
val = exp1 ();
lasttok = NUM;
}
else
val = exp0 ();
+1 -1
View File
@@ -770,7 +770,7 @@ trim_pathname (name, maxlen)
*nbeg++ = '.';
nlen = nend - ntail;
memcpy (nbeg, ntail, nlen);
memmove (nbeg, ntail, nlen);
nbeg[nlen] = '\0';
return name;
+1 -1
View File
@@ -308,7 +308,7 @@ save_bash_input (fd, new_fd)
the buffered stream. Make sure the file descriptor used to save bash
input is set close-on-exec. Returns 0 on success, -1 on failure. This
works only if fd is > 0 -- if fd == 0 and bash is reading input from
fd 0, save_bash_input is used instead, to cooperate with input
fd 0, sync_buffered_stream is used instead, to cooperate with input
redirection (look at redir.c:add_undo_redirect()). */
int
check_bash_input (fd)
+10
View File
@@ -2482,6 +2482,9 @@ wait_for (pid)
waiting_for_child++;
r = waitchld (pid, 1); /* XXX */
waiting_for_child--;
#if 0
itrace("wait_for: blocking wait for %d returns %d child = %p", (int)pid, r, child);
#endif
# if defined (MUST_UNBLOCK_CHLD)
sigaction (SIGCHLD, &oact, (struct sigaction *)NULL);
sigprocmask (SIG_SETMASK, &chldset, (sigset_t *)NULL);
@@ -3218,6 +3221,10 @@ waitchld (wpid, block)
pid = WAITPID (-1, &status, waitpid_flags);
#if 0
if (wpid != -1 && block)
itrace("waitchld: blocking waitpid returns %d", pid);
#endif
/* WCONTINUED may be rejected by waitpid as invalid even when defined */
if (wcontinued && pid < 0 && errno == EINVAL)
{
@@ -3240,6 +3247,9 @@ waitchld (wpid, block)
break;
}
#if 0
itrace("waitchld: waitpid returns %d block = %d", pid, block);
#endif
/* If waitpid returns 0, there are running children. If it returns -1,
the only other error POSIX says it can return is EINTR. */
CHECK_TERMSIG;
+5 -1
View File
@@ -43,7 +43,11 @@
#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
#define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
int glob_asciirange = 0;
#ifndef GLOBASCII_DEFAULT
# define GLOBASCII_DEFAULT 0
#endif
int glob_asciirange = GLOBASCII_DEFAULT;
/* We use strcoll(3) for range comparisons in bracket expressions,
even though it can have unwanted side effects in locales
+1
View File
@@ -1330,6 +1330,7 @@ remove_trailing:
{
i = _rl_skip_to_delim (value, 1, *value);
value[i] = '\0';
value++; /* skip past the quote */
}
else
goto remove_trailing;
+6 -1
View File
@@ -167,13 +167,18 @@ _rl_print_color_indicator (char *f)
{
colored_filetype = C_DIR;
#if defined (S_ISVTX)
if ((mode & S_ISVTX) && (mode & S_IWOTH)
&& is_colored (C_STICKY_OTHER_WRITABLE))
colored_filetype = C_STICKY_OTHER_WRITABLE;
else if ((mode & S_IWOTH) != 0 && is_colored (C_OTHER_WRITABLE))
else
#endif
if ((mode & S_IWOTH) != 0 && is_colored (C_OTHER_WRITABLE))
colored_filetype = C_OTHER_WRITABLE;
#if defined (S_ISVTX)
else if ((mode & S_ISVTX) != 0 && is_colored (C_STICKY))
colored_filetype = C_STICKY;
#endif
}
else if (S_ISLNK (mode))
colored_filetype = ((linkok == 0
+5 -1
View File
@@ -2132,13 +2132,17 @@ rl_completion_matches (text, entry_function)
xfree (match_list);
match_list = 0;
match_list_size = 0;
matches = 0;
RL_CHECK_SIGNALS ();
}
if (matches + 1 == match_list_size)
if (matches + 1 >= match_list_size)
match_list = (char **)xrealloc
(match_list, ((match_list_size += 10) + 1) * sizeof (char *));
if (match_list == 0)
return (match_list);
match_list[++matches] = string;
match_list[matches + 1] = (char *)NULL;
}
+100 -5
View File
@@ -612,6 +612,7 @@ means that vi mode is active.
* Miscellaneous Functions:: Functions that don't fall into any category.
* Alternate Interface:: Using Readline in a `callback' fashion.
* A Readline Example:: An example Readline function.
* Alternate Interface Example:: An example program using the alternate interface.
@end menu
@node Function Naming
@@ -1293,8 +1294,9 @@ are functions available to make this easy.
@deftypefun void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler)
Set up the terminal for readline I/O and display the initial
expanded value of @var{prompt}. Save the value of @var{lhandler} to
use as a function to call when a complete line of input has been entered.
The function takes the text of the line as an argument.
use as a handler function to call when a complete line of input has been
entered.
The handler function receives the text of the line as an argument.
@end deftypefun
@deftypefun void rl_callback_read_char (void)
@@ -1302,14 +1304,15 @@ Whenever an application determines that keyboard input is available, it
should call @code{rl_callback_read_char()}, which will read the next
character from the current input source.
If that character completes the line, @code{rl_callback_read_char} will
invoke the @var{lhandler} function saved by @code{rl_callback_handler_install}
to process the line.
invoke the @var{lhandler} function installed by
@code{rl_callback_handler_install} to process the line.
Before calling the @var{lhandler} function, the terminal settings are
reset to the values they had before calling
@code{rl_callback_handler_install}.
If the @var{lhandler} function returns,
and the line handler remains installed,
the terminal settings are modified for Readline's use again.
@code{EOF} is indicated by calling @var{lhandler} with a
@code{EOF} is indicated by calling @var{lhandler} with a
@code{NULL} line.
@end deftypefun
@@ -1389,6 +1392,98 @@ invert_case_line (count, key)
@}
@end example
@node Alternate Interface Example
@subsection Alternate Interface Example
Here is a complete program that illustrates Readline's alternate interface.
It reads lines from the terminal and displays them, providing the
standard history and TAB completion functions.
It understands the EOF character or "exit" to exit the program.
@example
/* Standard include files. stdio.h is required. */
#include <stdlib.h>
#include <unistd.h>
/* Used for select(2) */
#include <sys/types.h>
#include <sys/select.h>
#include <stdio.h>
/* Standard readline include files. */
#include <readline/readline.h>
#include <readline/history.h>
static void cb_linehandler (char *);
int running;
const char *prompt = "rltest$ ";
/* Callback function called for each line when accept-line executed, EOF
seen, or EOF character read. This sets a flag and returns; it could
also call exit(3). */
static void
cb_linehandler (char *line)
@{
/* Can use ^D (stty eof) or `exit' to exit. */
if (line == NULL || strcmp (line, "exit") == 0)
@{
if (line == 0)
printf ("\n");
printf ("exit\n");
/* This function needs to be called to reset the terminal settings,
and calling it from the line handler keeps one extra prompt from
being displayed. */
rl_callback_handler_remove ();
running = 0;
@}
else
@{
if (*line)
add_history (line);
printf ("input line: %s\n", line);
free (line);
@}
@}
int
main (int c, char **v)
@{
fd_set fds;
int r;
/* Install the line handler. */
rl_callback_handler_install (prompt, cb_linehandler);
/* Enter a simple event loop. This waits until something is available
to read on readline's input stream (defaults to standard input) and
calls the builtin character read callback to read it. It does not
have to modify the user's terminal settings. */
running = 1;
while (running)
@{
FD_ZERO (&fds);
FD_SET (fileno (rl_instream), &fds);
r = select (FD_SETSIZE, &fds, NULL, NULL, NULL);
if (r < 0)
@{
perror ("rltest: select");
rl_callback_handler_remove ();
break;
@}
if (FD_ISSET (fileno (rl_instream), &fds))
rl_callback_read_char ();
@}
printf ("rltest: Event loop has exited\n");
return 0;
@}
@end example
@node Readline Signal Handling
@section Readline Signal Handling
+6 -6
View File
@@ -1,10 +1,10 @@
@ignore
Copyright (C) 1988-2012 Free Software Foundation, Inc.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
@end ignore
@set EDITION 6.2
@set VERSION 6.2
@set UPDATED 15 November 2012
@set UPDATED-MONTH November 2012
@set EDITION 6.3
@set VERSION 6.3
@set UPDATED 26 May 2013
@set UPDATED-MONTH May 2013
@set LASTCHANGE Thu Nov 15 21:03:04 EST 2012
@set LASTCHANGE Sat May 25 17:02:56 EDT 2013
+81
View File
@@ -0,0 +1,81 @@
/* Standard include files. stdio.h is required. */
#include <stdlib.h>
#include <unistd.h>
/* Used for select(2) */
#include <sys/types.h>
#include <sys/select.h>
#include <stdio.h>
/* Standard readline include files. */
#include <readline/readline.h>
#include <readline/history.h>
static void cb_linehandler (char *);
int running;
const char *prompt = "rltest$ ";
/* Callback function called for each line when accept-line executed, EOF
seen, or EOF character read. This sets a flag and returns; it could
also call exit(3). */
static void
cb_linehandler (char *line)
{
/* Can use ^D (stty eof) or `exit' to exit. */
if (line == NULL || strcmp (line, "exit") == 0)
{
if (line == 0)
printf ("\n");
printf ("exit\n");
/* This function needs to be called to reset the terminal settings,
and calling it from the line handler keeps one extra prompt from
being displayed. */
rl_callback_handler_remove ();
running = 0;
}
else
{
if (*line)
add_history (line);
printf ("input line: %s\n", line);
free (line);
}
}
int
main (int c, char **v)
{
fd_set fds;
int r;
/* Install the line handler. */
rl_callback_handler_install (prompt, cb_linehandler);
/* Enter a simple event loop. This waits until something is available
to read on readline's input stream (defaults to standard input) and
calls the builtin character read callback to read it. It does not
have to modify the user's terminal settings. */
running = 1;
while (running)
{
FD_ZERO (&fds);
FD_SET (fileno (rl_instream), &fds);
r = select (FD_SETSIZE, &fds, NULL, NULL, NULL);
if (r < 0)
{
perror ("rltest: select");
rl_callback_handler_remove ();
break;
}
if (FD_ISSET (fileno (rl_instream), &fds))
rl_callback_read_char ();
}
printf ("rltest: Event loop has exited\n");
return 0;
}
+6 -3
View File
@@ -411,14 +411,16 @@ history_truncate_file (fname, lines)
truncate to. */
if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
write (file, bp, chars_read - (bp - buffer));
if (write (file, bp, chars_read - (bp - buffer)) < 0)
rv = errno;
#if defined (__BEOS__)
/* BeOS ignores O_TRUNC. */
ftruncate (file, chars_read - (bp - buffer));
#endif
close (file);
if (close (file) < 0 && rv == 0)
rv = errno;
}
truncate_exit:
@@ -547,7 +549,8 @@ mmap_error:
#endif
}
close (file);
if (close (file) < 0 && rv == 0)
rv = errno;
if (rv != 0 && output && bakname)
rename (bakname, output);
+1 -1
View File
@@ -318,7 +318,7 @@ add_history_time (string)
{
HIST_ENTRY *hs;
if (string == 0)
if (string == 0 || history_length < 1)
return;
hs = the_history[history_length - 1];
FREE (hs->timestamp);
+8 -5
View File
@@ -397,8 +397,8 @@ readline_internal_setup ()
_rl_out_stream = rl_outstream;
/* Enable the meta key only for the duration of readline(), if this
terminal has one. */
if (_rl_enable_meta)
terminal has one and the terminal has been initialized */
if (_rl_enable_meta & RL_ISSTATE (RL_STATE_TERMPREPPED))
_rl_enable_meta_key ();
if (rl_startup_hook)
@@ -406,7 +406,7 @@ readline_internal_setup ()
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
rl_vi_insert_mode (1, 'i');
rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */
#endif /* VI_MODE */
/* If we're not echoing, we still want to at least print a prompt, because
@@ -469,7 +469,9 @@ readline_internal_teardown (eof)
if (rl_undo_list)
rl_free_undo_list ();
/* Disable the meta key, if this terminal has one. */
/* Disable the meta key, if this terminal has one and we were told to use it.
The check whether or not we sent the enable string is in
_rl_disable_meta_key(); the flag is set in _rl_enable_meta_key */
_rl_disable_meta_key ();
/* Restore normal cursor, if available. */
@@ -821,7 +823,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
rl_dispatching = 1;
RL_SETSTATE(RL_STATE_DISPATCHING);
(*func) (rl_numeric_arg * rl_arg_sign, key);
r = (*func) (rl_numeric_arg * rl_arg_sign, key);
RL_UNSETSTATE(RL_STATE_DISPATCHING);
rl_dispatching = 0;
@@ -957,6 +959,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
key != ANYOTHERKEY &&
rl_key_sequence_length == 1 && /* XXX */
_rl_vi_textmod_command (key))
_rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
#endif
+10 -1
View File
@@ -141,10 +141,19 @@ _rl_signal_handler (sig)
#if defined (SIGWINCH)
if (sig == SIGWINCH)
rl_resize_terminal ();
{
rl_resize_terminal ();
/* XXX - experimental for now */
/* Call a signal hook because though we called the original signal handler
in rl_sigwinch_handler below, we will not resend the signal to
ourselves. */
if (rl_signal_event_hook)
(*rl_signal_event_hook) ();
}
else
#endif
_rl_handle_signal (sig);
SIGHANDLER_RETURN;
}
+15 -2
View File
@@ -39,6 +39,7 @@
#include <shmbchar.h>
#include <shmbutil.h>
#include <chartypes.h>
#include <typemax.h>
#include <glob/strmatch.h>
@@ -68,6 +69,10 @@
extern char *substring __P((char *, int, int));
#ifndef UCHAR_MAX
# define UCHAR_MAX TYPE_MAXIMUM(unsigned char)
#endif
#if defined (HANDLE_MULTIBYTE)
static wchar_t
cval (s, i)
@@ -141,8 +146,10 @@ sh_modcase (string, pat, flags)
if (iswalnum (wc) == 0)
{
inword = 0;
#if 0
ADVANCE_CHAR (ret, end, start);
continue;
#endif
}
if (pat)
@@ -203,8 +210,11 @@ sh_modcase (string, pat, flags)
else
nop = flags;
if (MB_CUR_MAX == 1 || is_basic ((int)wc))
/* Need to check UCHAR_MAX since wc may have already been converted to a
wide character by cval() */
if (MB_CUR_MAX == 1 || (wc <= UCHAR_MAX && is_basic ((int)wc)))
{
singlebyte:
switch (nop)
{
default:
@@ -221,7 +231,10 @@ sh_modcase (string, pat, flags)
{
m = mbrtowc (&wc, string + start, end - start, &state);
if (MB_INVALIDCH (m))
wc = (wchar_t)string[start];
{
wc = (unsigned char)string[start];
goto singlebyte;
}
else if (MB_NULLWCH (m))
wc = L'\0';
switch (nop)
+1 -1
View File
@@ -269,7 +269,7 @@ sh_realpath (pathname, resolved)
wd = get_working_directory ("sh_realpath");
if (wd == 0)
return ((char *)NULL);
tdir = sh_makepath ((char *)pathname, wd, 0);
tdir = sh_makepath (wd, (char *)pathname, 0);
free (wd);
}
else
+9
View File
@@ -94,6 +94,15 @@ sh_single_quote (string)
result = (char *)xmalloc (3 + (4 * strlen (string)));
r = result;
if (string[0] == '\'' && string[1] == 0)
{
*r++ = '\\';
*r++ = '\'';
*r++ = 0;
return result;
}
*r++ = '\'';
for (s = string; s && (c = *s); s++)
+21 -5
View File
@@ -3301,6 +3301,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
treat single quotes as special when inside a double-quoted
${...}. This logic must agree with subst.c:extract_dollar_brace_string
since they share the same defines. */
/* FLAG POSIX INTERP 221 */
if (flags & P_DOLBRACE)
{
/* ${param%[%]word} */
@@ -3311,7 +3312,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
dolbrace_state = DOLBRACE_QUOTE;
/* ${param/[/]pat/rep} */
else if MBTEST(dolbrace_state == DOLBRACE_PARAM && ch == '/' && retind > 1)
dolbrace_state = DOLBRACE_QUOTE;
dolbrace_state = DOLBRACE_QUOTE2; /* XXX */
/* ${param^[^]pat} */
else if MBTEST(dolbrace_state == DOLBRACE_PARAM && ch == '^' && retind > 1)
dolbrace_state = DOLBRACE_QUOTE;
@@ -3353,7 +3354,18 @@ parse_matched_pair (qc, open, close, lenp, flags)
ttrans = ansiexpand (nestret, 0, nestlen - 1, &ttranslen);
xfree (nestret);
if ((rflags & P_DQUOTE) == 0)
/* If we're parsing a double-quoted brace expansion and we are
not in a place where single quotes are treated specially,
make sure we single-quote the results of the ansi
expansion because quote removal should remove them later */
/* FLAG POSIX INTERP 221 */
if ((shell_compatibility_level > 42) && (rflags & P_DQUOTE) && (dolbrace_state == DOLBRACE_QUOTE2) && (flags & P_DOLBRACE))
{
nestret = sh_single_quote (ttrans);
free (ttrans);
nestlen = strlen (nestret);
}
else if ((rflags & P_DQUOTE) == 0)
{
nestret = sh_single_quote (ttrans);
free (ttrans);
@@ -5344,9 +5356,13 @@ decode_prompt_string (string)
#undef ROOT_PATH
#undef DOUBLE_SLASH_ROOT
else
/* polite_directory_format is guaranteed to return a string
no longer than PATH_MAX - 1 characters. */
strcpy (t_string, polite_directory_format (t_string));
{
/* polite_directory_format is guaranteed to return a string
no longer than PATH_MAX - 1 characters. */
temp = polite_directory_format (t_string);
if (temp != t_string)
strcpy (t_string, temp);
}
temp = trim_pathname (t_string, PATH_MAX - 1);
/* If we're going to be expanding the prompt string later,
+2 -1
View File
@@ -67,6 +67,7 @@ struct dstack {
#define DOLBRACE_OP 0x02
#define DOLBRACE_WORD 0x04
#define DOLBRACE_QUOTE 0x40
#define DOLBRACE_QUOTE 0x40 /* single quote is special in double quotes */
#define DOLBRACE_QUOTE2 0x80 /* single quote is semi-special in double quotes */
#endif /* _PARSER_H_ */
BIN
View File
Binary file not shown.
+549 -719
View File
File diff suppressed because it is too large Load Diff
+10 -5
View File
@@ -873,7 +873,9 @@ do_redirection_internal (redirect, flags)
}
#if defined (BUFFERED_INPUT)
check_bash_input (redirector);
/* inhibit call to sync_buffered_stream() for async processes */
if (redirector != 0 || (subshell_environment & SUBSHELL_ASYNC) == 0)
check_bash_input (redirector);
#endif
/* Make sure there is no pending output before we change the state
@@ -1055,7 +1057,9 @@ do_redirection_internal (redirect, flags)
}
}
#if defined (BUFFERED_INPUT)
check_bash_input (redirector);
/* inhibit call to sync_buffered_stream() for async processes */
if (redirector != 0 || (subshell_environment & SUBSHELL_ASYNC) == 0)
check_bash_input (redirector);
#endif
if (redirect->rflags & REDIR_VARASSIGN)
{
@@ -1138,15 +1142,16 @@ do_redirection_internal (redirect, flags)
xtrace_fdchk (redirector);
#if defined (BUFFERED_INPUT)
check_bash_input (redirector);
/* inhibit call to sync_buffered_stream() for async processes */
if (redirector != 0 || (subshell_environment & SUBSHELL_ASYNC) == 0)
check_bash_input (redirector);
r = close_buffered_fd (redirector);
#else /* !BUFFERED_INPUT */
r = close (redirector);
#endif /* !BUFFERED_INPUT */
#if 0 /* bash-4.3 */
if (r < 0 && (flags & RX_INTERNAL) && (errno == EIO || errno == ENOSPC))
REDIRECTION_ERROR (r, errno, -1);
#endif
}
break;
+124 -29
View File
@@ -277,6 +277,7 @@ static int chk_atstar __P((char *, int, int *, int *));
static int chk_arithsub __P((const char *, int));
static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int, arrayind_t *));
static char *parameter_brace_find_indir __P((char *, int, int, int));
static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
static void parameter_brace_expand_error __P((char *, char *));
@@ -1470,7 +1471,7 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
if (c == '\'')
{
/*itrace("extract_dollar_brace_string: c == single quote flags = %d quoted = %d dolbrace_state = %d", flags, quoted, dolbrace_state);*/
if (posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
if (posixly_correct && shell_compatibility_level > 42 && dolbrace_state != DOLBRACE_QUOTE && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
ADVANCE_CHAR (string, slen, i);
else
{
@@ -1491,7 +1492,7 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
else if (dolbrace_state == DOLBRACE_PARAM && c == '#' && (i - *sindex) > 1)
dolbrace_state = DOLBRACE_QUOTE;
else if (dolbrace_state == DOLBRACE_PARAM && c == '/' && (i - *sindex) > 1)
dolbrace_state = DOLBRACE_QUOTE;
dolbrace_state = DOLBRACE_QUOTE2; /* XXX */
else if (dolbrace_state == DOLBRACE_PARAM && c == '^' && (i - *sindex) > 1)
dolbrace_state = DOLBRACE_QUOTE;
else if (dolbrace_state == DOLBRACE_PARAM && c == ',' && (i - *sindex) > 1)
@@ -3129,7 +3130,58 @@ expand_arith_string (string, quoted)
char *string;
int quoted;
{
return (expand_string_if_necessary (string, quoted, expand_string));
WORD_DESC td;
WORD_LIST *list, *tlist;
size_t slen;
int i, saw_quote;
char *ret;
DECLARE_MBSTATE;
/* Don't need string length for ADVANCE_CHAR unless multibyte chars possible. */
slen = (MB_CUR_MAX > 1) ? strlen (string) : 0;
i = saw_quote = 0;
while (string[i])
{
if (EXP_CHAR (string[i]))
break;
else if (string[i] == '\'' || string[i] == '\\' || string[i] == '"')
saw_quote = 1;
ADVANCE_CHAR (string, slen, i);
}
if (string[i])
{
/* This is expanded version of expand_string_internal as it's called by
expand_string_leave_quoted */
td.flags = W_NOPROCSUB; /* don't want process substitution */
td.word = savestring (string);
list = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL);
/* This takes care of the calls from expand_string_leave_quoted and
expand_string */
if (list)
{
tlist = word_list_split (list);
dispose_words (list);
list = tlist;
if (list)
dequote_list (list);
}
/* This comes from expand_string_if_necessary */
if (list)
{
ret = string_list (list);
dispose_words (list);
}
else
ret = (char *)NULL;
FREE (td.word);
}
else if (saw_quote && ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0))
ret = string_quote_removal (string, quoted);
else
ret = savestring (string);
return ret;
}
#if defined (COND_COMMAND)
@@ -4460,6 +4512,11 @@ array_remove_pattern (var, pattern, patspec, varname, quoted)
/* compute itype from varname here */
v = array_variable_part (varname, &ret, 0);
/* XXX */
if (v && invisible_p (var))
return ((char *)NULL);
itype = ret[0];
a = (v && array_p (v)) ? array_cell (v) : 0;
@@ -5109,6 +5166,8 @@ process_substitute (string, open_for_read_in_child)
close (open_for_read_in_child ? 0 : 1);
#endif /* !HAVE_DEV_FD */
last_command_exit_value = result;
result = run_exit_trap ();
exit (result);
/*NOTREACHED*/
}
@@ -5473,7 +5532,7 @@ array_length_reference (s)
/* If unbound variables should generate an error, report one and return
failure. */
if ((var == 0 || (assoc_p (var) == 0 && array_p (var) == 0)) && unbound_vars_is_error)
if ((var == 0 || invisible_p (var) || (assoc_p (var) == 0 && array_p (var) == 0)) && unbound_vars_is_error)
{
c = *--t;
*t = '\0';
@@ -5482,7 +5541,7 @@ array_length_reference (s)
*t = c;
return (-1);
}
else if (var == 0)
else if (var == 0 || invisible_p (var))
return 0;
/* We support a couple of expansions for variables that are not arrays.
@@ -5749,6 +5808,38 @@ expand_arrayref:
return ret;
}
static char *
parameter_brace_find_indir (name, var_is_special, quoted, find_nameref)
char *name;
int var_is_special, quoted, find_nameref;
{
char *temp, *t;
WORD_DESC *w;
SHELL_VAR *v;
if (find_nameref && var_is_special == 0 && (v = find_variable_last_nameref (name)) &&
nameref_p (v) && (t = nameref_cell (v)) && *t)
return (savestring (t));
/* If var_is_special == 0, and name is not an array reference, this does
more expansion than necessary. It should really look up the variable's
value and not try to expand it. */
w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND, 0);
t = w->word;
/* Have to dequote here if necessary */
if (t)
{
temp = (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
? dequote_string (t)
: dequote_escapes (t);
free (t);
t = temp;
}
dispose_word_desc (w);
return t;
}
/* Expand an indirect reference to a variable: ${!NAME} expands to the
value of the variable whose name is the value of NAME. */
static WORD_DESC *
@@ -5777,21 +5868,7 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
}
}
/* If var_is_special == 0, and name is not an array reference, this does
more expansion than necessary. It should really look up the variable's
value and not try to expand it. */
w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND, 0);
t = w->word;
/* Have to dequote here if necessary */
if (t)
{
temp = (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
? dequote_string (t)
: dequote_escapes (t);
free (t);
t = temp;
}
dispose_word_desc (w);
t = parameter_brace_find_indir (name, var_is_special, quoted, 0);
chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at);
if (t == 0)
@@ -6245,26 +6322,41 @@ get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
SHELL_VAR **varp;
char **valp;
{
int vtype;
char *temp;
int vtype, want_indir;
char *temp, *vname;
WORD_DESC *wd;
#if defined (ARRAY_VARS)
SHELL_VAR *v;
#endif
arrayind_t lind;
want_indir = *varname == '!' &&
(legal_variable_starter ((unsigned char)varname[1]) || DIGIT (varname[1])
|| VALID_INDIR_PARAM (varname[1]));
if (want_indir)
vname = parameter_brace_find_indir (varname+1, SPECIAL_VAR (varname, 1), quoted, 1);
else
vname = varname;
/* This sets vtype to VT_VARIABLE or VT_POSPARMS */
vtype = (varname[0] == '@' || varname[0] == '*') && varname[1] == '\0';
if (vtype == VT_POSPARMS && varname[0] == '*')
vtype = (vname[0] == '@' || vname[0] == '*') && vname[1] == '\0';
if (vtype == VT_POSPARMS && vname[0] == '*')
vtype |= VT_STARSUB;
*varp = (SHELL_VAR *)NULL;
#if defined (ARRAY_VARS)
if (valid_array_reference (varname))
if (valid_array_reference (vname))
{
v = array_variable_part (varname, &temp, (int *)0);
v = array_variable_part (vname, &temp, (int *)0);
/* If we want to signal array_value to use an already-computed index,
set LIND to that index */
lind = (ind != INTMAX_MIN && (flags & AV_USEIND)) ? ind : 0;
if (v && invisible_p (v))
{
vtype = VT_ARRAYMEMBER;
*varp = (SHELL_VAR *)NULL;
*valp = (char *)NULL;
}
if (v && (array_p (v) || assoc_p (v)))
{ /* [ */
if (ALL_ELEMENT_SUB (temp[0]) && temp[1] == ']')
@@ -6278,7 +6370,7 @@ get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
else
{
vtype = VT_ARRAYMEMBER;
*valp = array_value (varname, Q_DOUBLE_QUOTES, flags, (int *)NULL, &lind);
*valp = array_value (vname, Q_DOUBLE_QUOTES, flags, (int *)NULL, &lind);
}
*varp = v;
}
@@ -6295,10 +6387,10 @@ get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
{
vtype = VT_ARRAYMEMBER;
*varp = v;
*valp = array_value (varname, Q_DOUBLE_QUOTES, flags, (int *)NULL, &lind);
*valp = array_value (vname, Q_DOUBLE_QUOTES, flags, (int *)NULL, &lind);
}
}
else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && (assoc_p (v) || array_p (v)))
else if ((v = find_variable (vname)) && (invisible_p (v) == 0) && (assoc_p (v) || array_p (v)))
{
vtype = VT_ARRAYMEMBER;
*varp = v;
@@ -6318,6 +6410,9 @@ get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
*valp = value;
}
if (want_indir)
free (vname);
return vtype;
}
+1
View File
@@ -281,6 +281,7 @@ extern char *cond_expand_word __P((WORD_DESC *, int));
#define SD_NOQUOTEDELIM 0x04 /* don't let single or double quotes act as delimiters */
#define SD_NOSKIPCMD 0x08 /* don't skip over $(, <(, or >( command/process substitution */
#define SD_EXTGLOB 0x10 /* skip over extended globbing patterns if appropriate */
#define SD_IGNOREQUOTE 0x20 /* single and double quotes are not special */
extern int skip_to_delim __P((char *, int, char *, int));
Vendored Regular → Executable
+272 -271
View File
@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
timestamp='2008-03-12'
timestamp='2012-02-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ timestamp='2008-03-12'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -27,16 +25,16 @@ timestamp='2008-03-12'
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit build system type.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -56,8 +54,9 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008,2009 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -144,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@@ -170,7 +169,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -180,7 +179,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
fi
;;
*)
os=netbsd
os=netbsd
;;
esac
# The OS release
@@ -223,7 +222,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -269,7 +268,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit ;;
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@@ -295,7 +297,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
@@ -324,14 +326,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -375,23 +396,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
@@ -461,8 +482,8 @@ EOF
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -475,7 +496,7 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
@@ -532,7 +553,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[456])
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -575,52 +596,52 @@ EOF
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
#define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -640,7 +661,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep __LP64__ >/dev/null
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
@@ -711,22 +732,22 @@ EOF
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
@@ -750,14 +771,14 @@ EOF
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -769,13 +790,12 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
case ${UNAME_MACHINE} in
pc98)
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
@@ -784,19 +804,22 @@ EOF
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -806,6 +829,9 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -835,92 +861,13 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit ;;
ia64:Linux:*:*)
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips
#undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@@ -930,11 +877,90 @@ EOF
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -943,14 +969,17 @@ EOF
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -958,78 +987,18 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
# Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^LIBC/{
s: ::g
p
}'`"
test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit
}
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
@@ -1037,11 +1006,11 @@ EOF
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
@@ -1058,7 +1027,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1073,7 +1042,7 @@ EOF
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
@@ -1101,10 +1070,13 @@ EOF
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
exit ;;
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
@@ -1139,8 +1111,18 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1153,7 +1135,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1173,10 +1155,10 @@ EOF
echo ns32k-sni-sysv
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@@ -1202,11 +1184,11 @@ EOF
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
@@ -1246,6 +1228,16 @@ EOF
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1261,6 +1253,9 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-?:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
@@ -1306,13 +1301,13 @@ EOF
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
@@ -1327,6 +1322,12 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1349,11 +1350,11 @@ main ()
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
"4"
#else
""
""
#endif
); exit (0);
); exit (0);
#endif
#endif
Vendored Regular → Executable
+189 -75
View File
@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20098
# Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
timestamp='2008-03-26'
timestamp='2012-04-18'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -21,9 +21,7 @@ timestamp='2008-03-26'
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -32,13 +30,16 @@ timestamp='2008-03-26'
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
# diff and a properly formatted GNU ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
@@ -72,8 +73,9 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008,2009 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -120,12 +122,18 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@@ -148,10 +156,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray)
-apple | -axis | -knuth | -cray | -microblaze)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -166,10 +177,10 @@ case $os in
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
;;
-hiux*)
os=-hiuxwe2
;;
@@ -214,6 +225,12 @@ case $os in
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*)
os=-lynxos
;;
@@ -238,17 +255,23 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
| be32 | be64 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
@@ -270,29 +293,42 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 \
| ns16k | ns32k \
| open8 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -302,6 +338,21 @@ case $basic_machine in
basic_machine=mt-unknown
;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
@@ -316,24 +367,29 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -355,27 +411,32 @@ case $basic_machine in
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
@@ -397,7 +458,7 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
@@ -443,6 +504,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -459,10 +524,27 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@@ -491,7 +573,7 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
cr16)
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
@@ -530,6 +612,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
@@ -645,7 +731,6 @@ case $basic_machine in
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
@@ -703,6 +788,9 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
microblaze)
basic_machine=microblaze-xilinx
;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@@ -739,10 +827,18 @@ case $basic_machine in
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i386-pc
os=-msys
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
@@ -807,6 +903,9 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
@@ -892,9 +991,10 @@ case $basic_machine in
;;
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
@@ -988,6 +1088,9 @@ case $basic_machine in
basic_machine=i860-stratus
os=-sysv4
;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
;;
@@ -1044,20 +1147,8 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;;
tile*)
basic_machine=tile-unknown
basic_machine=$basic_machine-unknown
os=-linux-gnu
;;
tx39)
@@ -1127,6 +1218,9 @@ case $basic_machine in
xps | xps100)
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
@@ -1135,6 +1229,10 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
@@ -1173,7 +1271,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1220,9 +1318,12 @@ esac
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
@@ -1243,10 +1344,11 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1255,9 +1357,10 @@ case $os in
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1265,7 +1368,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1304,7 +1407,7 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
-os400*)
os=-os400
;;
-wince*)
@@ -1353,7 +1456,7 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
-tpf*)
os=-tpf
;;
-triton*)
@@ -1395,6 +1498,11 @@ case $os in
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-none)
;;
*)
@@ -1417,10 +1525,10 @@ else
# system, and we'll never get to this point.
case $basic_machine in
score-*)
score-*)
os=-elf
;;
spu-*)
spu-*)
os=-elf
;;
*-acorn)
@@ -1432,8 +1540,17 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
c4x-* | tic4x-*)
os=-coff
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
@@ -1453,14 +1570,11 @@ case $basic_machine in
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
m68*-cisco)
os=-aout
;;
mep-*)
mep-*)
os=-elf
;;
mips*-cisco)
@@ -1487,7 +1601,7 @@ case $basic_machine in
*-ibm)
os=-aix
;;
*-knuth)
*-knuth)
os=-mmixware
;;
*-wec)
@@ -1592,7 +1706,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
-aix*)
-cnk*|-aix*)
vendor=ibm
;;
-beos*)
+7 -2
View File
@@ -1,7 +1,7 @@
14
1 2 3 4 5 6
1 2 3 4 51 6
5
145
14
7
42
@@ -15,9 +15,14 @@
4
9
16
./appendop.tests: line 83: x: readonly variable
./appendop.tests: line 84: x: readonly variable
declare -A foo='([one]="bar" [two]="baz" [three]="quux" )'
declare -A foo='([one]="bar" [two]="baz" [0]="zero" [three]="quux" )'
declare -A foo='([four]="four" [one]="bar" [two]="baz" [0]="zero" [three]="quux" )'
declare -ai iarr='([0]="3" [1]="2" [2]="3")'
declare -ai iarr='([0]="3" [1]="2" [2]="3" [3]="4" [4]="5" [5]="6")'
25 25
7 7
14
145
145 145
+3 -1
View File
@@ -12,7 +12,8 @@ x[4]+=1
echo ${x[@]}
# trickier cases
# post-bash-4.2: bash understands += in environment assignments preceding
# command names
a+=5 printenv a
echo $a
@@ -83,3 +84,4 @@ echo $x
x+=5
${THIS_SH} ./appendop1.sub
${THIS_SH} ./appendop2.sub
+18
View File
@@ -0,0 +1,18 @@
POSIXLY_CORRECT=1
x=2
x+=5 eval printf '"$x "'
echo "$x"
unset x
typeset -i x=2
x+=5 eval printf '"$x "'
echo "$x"
a=1
a+=4
echo $a
# idiotically, ksh93 makes these two cases differ (?)
a+=5 printenv a
a+=5 eval printf '"$a "'
echo $a
+11
View File
@@ -7,3 +7,14 @@ no more clauses
1.0
./case.tests: line 29: xx: readonly variable
1.1
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
ok 9
mysterious 1
mysterious 2
+3
View File
@@ -28,3 +28,6 @@ unset x
readonly xx=1
case 1 in $((xx++)) ) echo hi1 ;; *) echo hi2; esac
echo ${xx}.$?
# tests of quote removal and pattern matching
${THIS_SH} ./case1.sub
+64
View File
@@ -0,0 +1,64 @@
x='\x'
case x in
\x) echo ok 1;;
*) echo bad 1;;
esac
case x in
$x) echo ok 2;;
*) echo bad 2;;
esac
case $x in
\x) echo bad 3;;
\\x) echo ok 3 ;;
*) echo bad 3.1 ;;
esac
case $x in
\\$x) echo ok 4 ;;
x) echo bad 4;;
$x) echo bad 4.1 ;;
*) echo bad 4.2;;
esac
case x in
\\x) echo bad 5;;
\x) echo ok 5;;
*) echo bad 5.1;;
esac
case x in
\\x) echo bad 6;;
x) echo ok 6;;
*) echo bad 6.1;;
esac
case x in
$x) echo ok 7 ;;
\\$x) echo bad 7 ;;
*) echo bad 7.1 ;;
esac
case x in
\x) echo ok 8 ;;
\\x) echo bad 8 ;;
*) echo bad 8.1 ;;
esac
case \x in
\x) echo ok 9 ;;
\\x) echo bad 9 ;;
*) echo bad 9.1 ;;
esac
case $x in
$x) echo oops 1 ;;
*) echo mysterious 1 ;;
esac
case \x in
\x) echo mysterious 2 ;;
*) echo oops 2 ;;
esac
+18
View File
@@ -38,3 +38,21 @@ argv[1] = <'A^IB'>
hello' world
hello world!
hello' world!
' | '
' | '
x | x
x | x
' | '
' | '
' | '
' | '
' | '
' | '
x | x
'
$'\''
'
'abcd'
$'\'abcd\''
'
1
+1
View File
@@ -116,3 +116,4 @@ recho "${mytab:-$'\t'}"
recho "$( args $'A\tB' )"
${THIS_SH} ./nquote1.sub
${THIS_SH} ./nquote2.sub
+29
View File
@@ -0,0 +1,29 @@
t() {
printf '%s | %s\n' "$1" "$2"
}
v="'" # v <- '
#--
t "${v/$'\''/$'\''}" "'"
t ${v/$'\''/$'\''} "'"
t "${v/$'\''/x}" "x"
t ${v/$'\''/x} "x"
t "${v/x/$'\''}" "'"
t ${v/x/$'\''} "'"
t "${v/x/$'\x5c\''}" "'"
t ${v/x/$'\x5c\''} "'"
t "${v/\'/\'}" "'"
t ${v/\'/\'} "'"
t ${v/\'/x} "x"
echo "'"
echo "$'\''"
echo $'\''
echo $'\'abcd\''
echo "$'\'abcd\''"
v=1
echo ${v/1/\'}
echo ${v/\'/2}
+1 -1
View File
@@ -146,7 +146,7 @@ fi
newtest
SQUOTE="'"
val1=$(set | sed -n 's:^SQUOTE=::p')
if [ "$val1" != "''\\'''" ]; then
if [ "$val1" != "\'" ]; then
testfail "variable quoting 1"
fi
+18
View File
@@ -85,6 +85,24 @@ outside 1
outside 2
outside 3
outside 4
sleep 2
wait $!
exit
in trap EXIT
sleep 2
wait $!
exit
in trap EXIT
works
bar
bar
foo
trap -- '' SIGINT
trap -- '' SIGUSR2
foo
bar
foo
bar
caught a child death
caught a child death
caught a child death
+2
View File
@@ -70,6 +70,8 @@ ${THIS_SH} ./trap3.sub
${THIS_SH} ./trap4.sub
${THIS_SH} ./trap5.sub
#
# show that setting a trap on SIGCHLD is not disastrous.
#
+25
View File
@@ -15,3 +15,28 @@ trap 'echo inherited exit trap' EXIT
: | ( exit; ) | : ; echo outside 4
trap - EXIT
# make sure group commands that are not at the beginning or end of pipelines
# run an EXIT trap, with and without the exit builtin
echo ignored |
{
trap 'echo "in trap EXIT">&2' EXIT
sleep 4 &
echo 'sleep 2'>&2
sleep 2
echo 'wait $!'>&2
wait $!
echo 'exit'>&2
exit
} | cat
echo ignored |
{
trap 'echo "in trap EXIT">&2' EXIT
sleep 4 &
echo 'sleep 2'>&2
sleep 2
echo 'wait $!'>&2
wait $!
echo 'exit'>&2
} | cat
+18
View File
@@ -0,0 +1,18 @@
# make sure process substitution runs the exit trap
[[ -n $(< <(trap "cat /dev/fd/0" EXIT)) ]] <<<works && echo works || echo "fail :("
read foo < <(trap "echo bar" EXIT)
echo $foo
cat <(trap "echo bar" EXIT)
trap "echo bar" EXIT #should proc subst inherit this?
cat <(echo foo ; exit 0;)
trap - 0
trap
cat <(echo foo; trap "echo bar" EXIT)
trap "echo bar" EXIT #should proc subst inherit this?
cat <(echo foo)
+15
View File
@@ -286,6 +286,9 @@ run_pending_traps ()
if (catch_flag == 0) /* simple optimization */
return;
if (running_trap > 0)
return; /* no recursive trap invocations */
catch_flag = trapped_signal_received = 0;
/* Preserve $? when running trap. */
@@ -304,6 +307,8 @@ run_pending_traps ()
BLOCK_SIGNAL (sig, set, oset);
running_trap = sig + 1;
if (sig == SIGINT)
{
run_interrupt_trap ();
@@ -324,6 +329,7 @@ run_pending_traps ()
{
/* This can happen when run_pending_traps is called while
running a SIGCHLD trap handler. */
running_trap = 0;
UNBLOCK_SIGNAL (oset);
continue; /* XXX */
}
@@ -355,11 +361,19 @@ run_pending_traps ()
}
else
{
/* XXX - should we use save_parser_state/restore_parser_state? */
token_state = save_token_state ();
save_subst_varlist = subst_assign_varlist;
subst_assign_varlist = 0;
#if defined (JOB_CONTROL)
save_pipeline (1); /* XXX only provides one save level */
#endif
evalstring (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
#if defined (JOB_CONTROL)
restore_pipeline (1);
#endif
restore_token_state (token_state);
free (token_state);
@@ -367,6 +381,7 @@ run_pending_traps ()
}
pending_traps[sig] = 0;
running_trap = 0;
UNBLOCK_SIGNAL (oset);
}
+48 -4
View File
@@ -166,6 +166,8 @@ static int export_env_size;
static int winsize_assignment; /* currently assigning to LINES or COLUMNS */
#endif
static HASH_TABLE *last_table_searched; /* hash_lookup sets this */
/* Some forward declarations. */
static void create_variable_tables __P((void));
@@ -1762,6 +1764,10 @@ hash_lookup (name, hashed_vars)
BUCKET_CONTENTS *bucket;
bucket = hash_search (name, hashed_vars, 0);
/* If we find the name in HASHED_VARS, set LAST_TABLE_SEARCHED to that
table. */
if (bucket)
last_table_searched = hashed_vars;
return (bucket ? (SHELL_VAR *)bucket->data : (SHELL_VAR *)NULL);
}
@@ -1840,17 +1846,25 @@ find_variable_nameref (v)
{
int level;
char *newname;
SHELL_VAR *orig, *oldv;
level = 0;
orig = v;
while (v && nameref_p (v))
{
level++;
if (level > NAMEREF_MAX)
return ((SHELL_VAR *)0); /* error message here? */
return ((SHELL_VAR *)0); /* error message here? */
newname = nameref_cell (v);
if (newname == 0 || *newname == '\0')
return ((SHELL_VAR *)0);
oldv = v;
v = find_variable_internal (newname, (expanding_redir == 0 && (assigning_in_environment || executing_builtin)));
if (v == orig || v == oldv)
{
internal_warning (_("%s: circular name reference"), orig->name);
return ((SHELL_VAR *)0);
}
}
return v;
}
@@ -2066,6 +2080,7 @@ find_variable (name)
{
SHELL_VAR *v;
last_table_searched = 0;
v = find_variable_internal (name, (expanding_redir == 0 && (assigning_in_environment || executing_builtin)));
if (v && nameref_p (v))
v = find_variable_nameref (v);
@@ -2186,6 +2201,21 @@ make_local_variable (name)
}
was_tmpvar = old_var && tempvar_p (old_var);
/* If we're making a local variable in a shell function, the temporary env
has already been merged into the function's variable context stack. We
can assume that a temporary var in the same context appears in the same
VAR_CONTEXT and can safely be returned without creating a new variable
(which results in duplicate names in the same VAR_CONTEXT->table */
/* We can't just test tmpvar_p because variables in the temporary env given
to a shell function appear in the function's local variable VAR_CONTEXT
but retain their tempvar attribute. We want temporary variables that are
found in temporary_env, hence the test for last_table_searched, which is
set in hash_lookup and only (so far) checked here. */
if (was_tmpvar && old_var->context == variable_context && last_table_searched != temporary_env)
{
VUNSETATTR (old_var, att_invisible);
return (old_var);
}
if (was_tmpvar)
tmp_value = value_cell (old_var);
@@ -2230,7 +2260,8 @@ make_local_variable (name)
/* If we found this variable in one of the temporary environments,
inherit its value. Watch to see if this causes problems with
things like `x=4 local x'. */
things like `x=4 local x'. XXX - see above for temporary env
variables with the same context level as variable_context */
/* XXX - we should only do this if the variable is not an array. */
if (was_tmpvar)
var_setvalue (new_var, savestring (tmp_value));
@@ -2741,6 +2772,8 @@ bind_int_variable (lhs, rhs)
if (v && isint)
VSETATTR (v, att_integer);
VUNSETATTR (v, att_invisible);
return (v);
}
@@ -2841,13 +2874,14 @@ assign_in_env (word, flags)
WORD_DESC *word;
int flags;
{
int offset;
int offset, aflags;
char *name, *temp, *value;
SHELL_VAR *var;
const char *string;
string = word->word;
aflags = 0;
offset = assignment (string, 0);
name = savestring (string);
value = (char *)NULL;
@@ -2858,7 +2892,10 @@ assign_in_env (word, flags)
/* ignore the `+' when assigning temporary environment */
if (name[offset - 1] == '+')
name[offset - 1] = '\0';
{
name[offset - 1] = '\0';
aflags |= ASS_APPEND;
}
var = find_variable (name);
if (var && (readonly_p (var) || noassign_p (var)))
@@ -2871,6 +2908,13 @@ assign_in_env (word, flags)
temp = name + offset + 1;
value = expand_assignment_string_to_string (temp, 0);
if (var && (aflags & ASS_APPEND))
{
temp = make_variable_value (var, value, aflags);
FREE (value);
value = temp;
}
}
if (temporary_env == 0)
+182 -166
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -142,7 +142,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 324 "/Users/chet/src/bash/src/parse.y"
#line 324 "/usr/homes/chet/src/bash/src/parse.y"
{
WORD_DESC *word; /* the word that we read. */
int number; /* the number that we read. */