commit bash-20171222 snapshot

This commit is contained in:
Chet Ramey
2018-01-02 10:52:24 -05:00
parent 32dc2bf525
commit 2e41257453
46 changed files with 838 additions and 476 deletions
+42
View File
@@ -14680,3 +14680,45 @@ array.h
variables.c
- set_pipestatus_array: use set_element_value where appropriate
12/18
-----
subst.c
- parameter_brace_find_indir: when expanding the indirect parameter
to find the eventual variable name, we don't perform word splitting.
Make sure this does the right thing for * and @. Fixes bug
reported by isabella parakiss <izaberina@gmail.com>
12/19
-----
doc/{bash.1,bashref.texi}
- indirect expansion: make sure to note that the value of the indirect
variable does not undergo word splitting as one of its expansions,
as in fix from 12/18
12/22
-----
subst.c
- parameter_brace_expand_rhs: make sure the value this function returns
when OP is `=' is quoted appropriately, as the callers expect. More
changes from Posix interp 221. Fixes report from Martijn Dekker
<martijn@inlv.org>
variables.c
- assign_hashcmd: if running in a restricted shell, make sure the
target of the hash assignment can be found via a $PATH search, to
prevent users assigning commands to the hash table they would not
ordinarily have access to. Fixes issue raised by Drew Parker
<andrew.s.parker2@gmail.com>
builtins/hash.def
- hash_builtin: if running in a restricted shell, make sure the
pathname target of `hash -p' can be found via a $PATH search, to
prevent users assigning commands to the hash table they would not
ordinarily have access to.
12/27
-----
array.c,arrayfunc.c,...
- many changes to clean up unused variables and functions. From a
report from Siteshwar Vashisht <svashisht@redhat.com>
+4
View File
@@ -1161,6 +1161,8 @@ tests/posixexp1.sub f
tests/posixexp2.sub f
tests/posixexp3.sub f
tests/posixexp4.sub f
tests/posixexp5.sub f
tests/posixexp6.sub f
tests/posixexp2.tests f
tests/posixexp2.right f
tests/posixpat.tests f
@@ -1210,6 +1212,8 @@ tests/rhs-exp.right f
tests/rhs-exp1.sub f
tests/rsh.tests f
tests/rsh.right f
tests/rsh1.sub f
tests/rsh2.sub f
tests/run-all f
tests/run-minimal f
tests/run-alias f
-1
View File
@@ -384,7 +384,6 @@ array_remove_quoted_nulls(array)
ARRAY *array;
{
ARRAY_ELEMENT *a;
char *t;
if (array == 0 || array_head(array) == 0 || array_empty(array))
return (ARRAY *)NULL;
+1 -5
View File
@@ -262,9 +262,6 @@ bind_assoc_variable (entry, name, key, value, flags)
char *value;
int flags;
{
SHELL_VAR *dentry;
char *newval;
if ((readonly_p (entry) && (flags&ASS_FORCE) == 0) || noassign_p (entry))
{
if (readonly_p (entry))
@@ -285,7 +282,7 @@ assign_array_element (name, value, flags)
{
char *sub, *vname;
int sublen;
SHELL_VAR *entry, *nv;
SHELL_VAR *entry;
vname = array_variable_name (name, (flags & ASS_NOEXPAND) != 0, &sub, &sublen);
@@ -458,7 +455,6 @@ expand_compound_array_assignment (var, value, flags)
int flags;
{
WORD_LIST *list, *nlist;
WORD_LIST *hd, *tl, *t, *n;
char *val;
int ni;
+11 -23
View File
@@ -1049,7 +1049,7 @@ bash_forward_shellword (count, key)
int count, key;
{
size_t slen;
int sindex, c, p;
int c, p;
DECLARE_MBSTATE;
if (count < 0)
@@ -1158,7 +1158,7 @@ bash_backward_shellword (count, key)
int count, key;
{
size_t slen;
int sindex, c, p;
int c, p;
DECLARE_MBSTATE;
if (count < 0)
@@ -1416,7 +1416,7 @@ attempt_shell_completion (text, start, end)
const char *text;
int start, end;
{
int in_command_position, ti, saveti, qc, dflags;
int in_command_position, ti, qc, dflags;
char **matches, *command_separator_chars;
#if defined (PROGRAMMABLE_COMPLETION)
int have_progcomps, was_assignment;
@@ -1438,7 +1438,7 @@ attempt_shell_completion (text, start, end)
appears after a character that separates commands. It cannot be a
command word if we aren't at the top-level prompt. */
ti = start - 1;
saveti = qc = -1;
qc = -1;
while ((ti > -1) && (whitespace (rl_line_buffer[ti])))
ti--;
@@ -1449,7 +1449,7 @@ attempt_shell_completion (text, start, end)
if (ti >= 0 && (rl_line_buffer[ti] == '"' || rl_line_buffer[ti] == '\''))
{
qc = rl_line_buffer[ti];
saveti = ti--;
ti--;
while (ti > -1 && (whitespace (rl_line_buffer[ti])))
ti--;
}
@@ -1799,7 +1799,7 @@ command_word_completion_function (hint_text, state)
static char *dequoted_hint = (char *)NULL;
static char *directory_part = (char *)NULL;
static char **glob_matches = (char **)NULL;
static int path_index, hint_len, dequoted_len, istate, igncase;
static int path_index, hint_len, istate, igncase;
static int mapping_over, local_index, searching_path, hint_is_dir;
static int old_glob_ignore_case, globpat;
static SHELL_VAR **varlist = (SHELL_VAR **)NULL;
@@ -1877,7 +1877,7 @@ command_word_completion_function (hint_text, state)
free (hint);
hint = dequoted_hint;
}
dequoted_len = hint_len = strlen (hint);
hint_len = strlen (hint);
if (filename_hint)
free (filename_hint);
@@ -1905,13 +1905,10 @@ command_word_completion_function (hint_text, state)
}
dequoted_hint = hint = savestring (hint_text);
dequoted_len = hint_len = strlen (hint);
hint_len = strlen (hint);
if (rl_completion_found_quote && rl_completion_quote_character == 0)
{
dequoted_hint = bash_dequote_filename (hint, 0);
dequoted_len = strlen (dequoted_hint);
}
dequoted_hint = bash_dequote_filename (hint, 0);
path = get_string_value ("PATH");
path_index = dot_in_path = 0;
@@ -2300,7 +2297,6 @@ variable_completion_function (text, state)
static char **varlist = (char **)NULL;
static int varlist_index;
static char *varname = (char *)NULL;
static int namelen;
static int first_char, first_char_loc;
if (!state)
@@ -2319,7 +2315,6 @@ variable_completion_function (text, state)
varname = savestring (text + first_char_loc);
namelen = strlen (varname);
if (varlist)
strvec_dispose (varlist);
@@ -2407,7 +2402,7 @@ bash_servicename_completion_function (text, state)
#else
static char *sname = (char *)NULL;
static struct servent *srvent;
static int snamelen, firstc;
static int snamelen;
char *value;
char **alist, *aentry;
int afound;
@@ -2415,7 +2410,6 @@ bash_servicename_completion_function (text, state)
if (state == 0)
{
FREE (sname);
firstc = *text;
sname = savestring (text);
snamelen = strlen (sname);
@@ -3145,7 +3139,6 @@ bash_filename_stat_hook (dirname)
int should_expand_dirname, return_value;
int global_nounset;
WORD_LIST *wl;
struct stat sb;
local_dirname = *dirname;
should_expand_dirname = return_value = 0;
@@ -3223,10 +3216,8 @@ bash_directory_completion_hook (dirname)
char **dirname;
{
char *local_dirname, *new_dirname, *t;
int return_value, should_expand_dirname, nextch, closer, changed;
size_t local_dirlen;
int return_value, should_expand_dirname, nextch, closer;
WORD_LIST *wl;
struct stat sb;
return_value = should_expand_dirname = nextch = closer = 0;
local_dirname = *dirname;
@@ -4090,9 +4081,6 @@ bash_execute_unix_command (count, key)
int count; /* ignored */
int key;
{
Keymap ckmap; /* current keymap */
Keymap xkmap; /* unix command executing keymap */
rl_command_func_t *func;
int type;
register int i, r;
intmax_t mi;
+2 -16
View File
@@ -385,7 +385,7 @@ mkseq (start, end, incr, type, width)
int type, width;
{
intmax_t n, prevn;
int i, j, nelem;
int i, nelem;
char **result, *t;
if (incr == 0)
@@ -496,7 +496,7 @@ expand_seqterm (text, tlen)
size_t tlen;
{
char *t, *lhs, *rhs;
int i, lhs_t, rhs_t, lhs_l, rhs_l, width;
int lhs_t, rhs_t, lhs_l, rhs_l, width;
intmax_t lhs_v, rhs_v, incr;
intmax_t tl, tr;
char **result, *ep, *oep;
@@ -745,20 +745,6 @@ comsub:
return (c);
}
/* Return 1 if ARR has any non-empty-string members. Used to short-circuit
in array_concat() below. */
static int
degenerate_array (arr)
char **arr;
{
register int i;
for (i = 0; arr[i]; i++)
if (arr[i][0] != '\0')
return 0;
return 1;
}
/* Return a new array of strings which is the result of appending each
string in ARR2 to each string in ARR1. The resultant array is
len (arr1) * len (arr2) long. For convenience, ARR1 (and its contents)
-1
View File
@@ -115,7 +115,6 @@ bind_builtin (list)
Keymap kmap, saved_keymap;
int flags, opt;
char *initfile, *map_name, *fun_name, *unbind_name, *remove_seq, *cmd_seq, *t;
rl_command_func_t *func;
if (no_line_editing)
{
+1 -2
View File
@@ -545,7 +545,7 @@ change_to_directory (newdir, nolinks, xattr)
int nolinks, xattr;
{
char *t, *tdir, *ndir;
int err, canon_failed, r, ndlen, dlen;
int err, canon_failed, r, ndlen;
tdir = (char *)NULL;
@@ -564,7 +564,6 @@ change_to_directory (newdir, nolinks, xattr)
: sh_canonpath (t, PATH_CHECKDOTDOT|PATH_CHECKEXISTS);
ndlen = strlen (newdir);
dlen = strlen (t);
/* Use the canonicalized version of NEWDIR, or, if canonicalization
failed, use the non-canonical form. */
-20
View File
@@ -60,8 +60,6 @@ $END
extern size_t confstr __P((int, char *, size_t));
#endif
static void restore_path __P((char *));
/* Run the commands mentioned in LIST without paying attention to shell
functions. */
int
@@ -69,7 +67,6 @@ command_builtin (list)
WORD_LIST *list;
{
int result, verbose, use_standard_path, opt;
char *old_path, *standard_path;
COMMAND *command;
verbose = use_standard_path = 0;
@@ -142,20 +139,3 @@ command_builtin (list)
return (result);
}
/* Restore the value of the $PATH variable after replacing it when
executing `command -p'. */
static void
restore_path (var)
char *var;
{
if (var)
{
bind_variable ("PATH", var, 0);
free (var);
}
else
unbind_variable ("PATH");
stupidly_hack_special_variables ("PATH");
}
+1 -1
View File
@@ -86,7 +86,7 @@ _evalfile (filename, flags)
size_t file_size;
sh_vmsg_func_t *errfunc;
#if defined (ARRAY_VARS)
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
struct func_array_state *fa;
# if defined (DEBUGGER)
+16 -3
View File
@@ -148,10 +148,23 @@ hash_builtin (list)
return (list_hashed_filename_targets (list, list_portably));
#if defined (RESTRICTED_SHELL)
if (restricted && pathname && strchr (pathname, '/'))
if (restricted && pathname)
{
sh_restricted (pathname);
return (EXECUTION_FAILURE);
if (strchr (pathname, '/'))
{
sh_restricted (pathname);
return (EXECUTION_FAILURE);
}
/* If we are changing the hash table in a restricted shell, make sure the
target pathname can be found using a $PATH search. */
w = find_user_command (pathname);
if (w == 0 || *w == 0 || executable_file (w) == 0)
{
sh_notfound (pathname);
free (w);
return (EXECUTION_FAILURE);
}
free (w);
}
#endif
-1
View File
@@ -420,7 +420,6 @@ wdispcolumn (i, buf, bufsize, width, height)
char *helpdoc;
wchar_t *wcstr;
size_t slen, n;
int wclen;
/* first column */
helpdoc = _(shell_builtins[i].short_doc);
+1 -1
View File
@@ -189,7 +189,7 @@ history_builtin (list)
}
if (delete_arg[0] == '-' && delete_start < 0)
{
/* the_history[history_length == 0x0, so this is correct */
/* the_history[history_length] == 0x0, so this is correct */
delete_start += history_length;
if (delete_start < history_base)
{
+1 -2
View File
@@ -244,12 +244,11 @@ int
mapfile_builtin (list)
WORD_LIST *list;
{
int opt, code, fd, clear_array, flags;
int opt, code, fd, flags;
intmax_t intval;
long lines, origin, nskip, callback_quantum;
char *array_name, *callback;
clear_array = 1;
fd = 0;
lines = origin = nskip = 0;
flags = MAPF_CLEARARRAY;
+1 -1
View File
@@ -537,7 +537,7 @@ set_var_attribute (name, attribute, undo)
int attribute, undo;
{
SHELL_VAR *var, *tv, *v, *refvar;
char *tvalue, *refname;
char *tvalue;
if (undo)
var = find_variable (name);
+4 -2
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Thu Dec 14 11:44:05 EST 2017
.\" Last Change: Tue Dec 19 09:56:59 EST 2017
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2017 December 14" "GNU Bash 4.4"
.TH BASH 1 "2017 December 19" "GNU Bash 4.4"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -2946,6 +2946,8 @@ it introduces a level of variable indirection.
expanded and that value is used in the rest of the substitution, rather
than the value of \fIparameter\fP itself.
This is known as \fIindirect expansion\fP.
The value is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
If \fIparameter\fP is a nameref, this expands to the name of the
variable referenced by \fIparameter\fP instead of performing the
complete indirect expansion.
+4 -4
View File
@@ -1830,9 +1830,6 @@ and any characters special to other expansions are preserved
in the result. It is strictly textual. Bash
does not apply any syntactic interpretation to the context of the
expansion or the text between the braces.
To avoid conflicts with parameter expansion, the string @samp{$@{}
is not considered eligible for brace expansion,
and inhibits brace expansion until the closing @samp{@}}..
A correctly-formed brace expansion must contain unquoted opening
and closing braces, and at least one unquoted comma or a valid
@@ -1842,7 +1839,8 @@ Any incorrectly formed brace expansion is left unchanged.
A @{ or @samp{,} may be quoted with a backslash to prevent its
being considered part of a brace expression.
To avoid conflicts with parameter expansion, the string @samp{$@{}
is not considered eligible for brace expansion.
is not considered eligible for brace expansion,
and inhibits brace expansion until the closing @samp{@}}..
This construct is typically used as shorthand when the common
prefix of the strings to be generated is longer than in the
@@ -1959,6 +1957,8 @@ Bash uses the value of the variable formed from the rest of
expanded and that value is used in the rest of the substitution, rather
than the value of @var{parameter} itself.
This is known as @code{indirect expansion}.
The value is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
If @var{parameter} is a nameref, this expands to the name of the
variable referenced by @var{parameter} instead of performing the
complete indirect expansion.
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2017 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Mon Nov 6 09:21:50 EST 2017
@set LASTCHANGE Tue Dec 19 09:57:23 EST 2017
@set EDITION 4.4
@set VERSION 4.4
@set UPDATED 6 November 2017
@set UPDATED-MONTH November 2017
@set UPDATED 19 December 2017
@set UPDATED-MONTH December 2017
+1 -5
View File
@@ -561,7 +561,6 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
int exec_result, user_subshell, invert, ignore_return, was_error_trap;
REDIRECT *my_undo_list, *exec_undo_list;
char *tcmd;
volatile int last_pid;
volatile int save_line_number;
#if defined (PROCESS_SUBSTITUTION)
volatile int ofifo, nfifo, osize, saved_fifo;
@@ -812,7 +811,6 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
#if defined (RECYCLES_PIDS)
last_made_pid = NO_PID;
#endif
last_pid = last_made_pid;
was_error_trap = signal_is_trapped (ERROR_TRAP) && signal_is_ignored (ERROR_TRAP) == 0;
if (ignore_return && command->value.Simple)
@@ -4533,7 +4531,7 @@ execute_builtin (builtin, words, flags, subshell)
WORD_LIST *words;
int flags, subshell;
{
int result, eval_unwind, ignexit_flag, old_e_flag;
int result, eval_unwind, ignexit_flag;
int isbltinenv, should_keep;
char *error_trap;
@@ -4669,8 +4667,6 @@ static void
maybe_restore_getopt_state (gs)
sh_getopt_state_t *gs;
{
SHELL_VAR *v;
/* If we have a local copy of OPTIND and it's at the right (current)
context, then we restore getopt's internal state. If not, we just
let it go. We know there is a local OPTIND if gs->gs_flags & 1.
+2 -4
View File
@@ -768,8 +768,6 @@ bgp_resize ()
static ps_index_t
bgp_getindex ()
{
ps_index_t psi;
if (bgpids.nalloc < js.c_childmax || bgpids.head >= bgpids.nalloc)
bgp_resize ();
@@ -3065,7 +3063,7 @@ wait_for_any_job (flags)
int flags;
{
pid_t pid;
int i, r, waited_for;
int i, r;
sigset_t set, oset;
if (jobs_list_frozen)
@@ -3092,7 +3090,7 @@ return_job:
/* At this point, we have no dead jobs in the jobs table. Wait until we
get one, even if it takes multiple pids exiting. */
for (waited_for = 0;;)
for (;;)
{
/* Make sure there is a background job to wait for */
BLOCK_CHILD (set, oset);
+1 -8
View File
@@ -4289,7 +4289,7 @@ xparse_dolparen (base, string, indp, flags)
sh_parser_state_t ps;
sh_input_line_state_t ls;
int orig_ind, nc, sflags, orig_eof_token;
char *ret, *s, *ep, *ostring;
char *ret, *ep, *ostring;
#if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
STRING_SAVER *saved_pushed_strings;
#endif
@@ -6459,8 +6459,6 @@ sh_parser_state_t *
save_parser_state (ps)
sh_parser_state_t *ps;
{
int i;
if (ps == 0)
ps = (sh_parser_state_t *)xmalloc (sizeof (sh_parser_state_t));
if (ps == 0)
@@ -6496,15 +6494,10 @@ save_parser_state (ps)
ps->need_here_doc = need_here_doc;
ps->here_doc_first_line = here_doc_first_line;
#if 0
for (i = 0; i < HEREDOC_MAX; i++)
ps->redir_stack[i] = redir_stack[i];
#else
if (need_here_doc == 0)
ps->redir_stack[0] = 0;
else
memcpy (ps->redir_stack, redir_stack, sizeof (redir_stack[0]) * HEREDOC_MAX);
#endif
ps->token = token;
ps->token_buffer_size = token_buffer_size;
+2 -3
View File
@@ -183,7 +183,7 @@ quote_string_for_globbing (pathname, qflags)
{
char *temp;
register int i, j;
int brack, cclass, collsym, equiv, c, last_was_backslash;
int cclass, collsym, equiv, c, last_was_backslash;
int savei, savej;
temp = (char *)xmalloc (2 * strlen (pathname) + 1);
@@ -194,7 +194,7 @@ quote_string_for_globbing (pathname, qflags)
return temp;
}
brack = cclass = collsym = equiv = last_was_backslash = 0;
cclass = collsym = equiv = last_was_backslash = 0;
for (i = j = 0; pathname[i]; i++)
{
/* Fix for CTLESC at the end of the string? */
@@ -225,7 +225,6 @@ quote_string_for_globbing (pathname, qflags)
}
else if ((qflags & QGLOB_REGEXP) && (i == 0 || pathname[i-1] != CTLESC) && pathname[i] == '[') /*]*/
{
brack = 1;
temp[j++] = pathname[i++]; /* open bracket */
savej = j;
savei = i;
+1 -2
View File
@@ -726,7 +726,6 @@ pcomp_filename_completion_function (text, state)
int state;
{
static char *dfn; /* dequoted filename */
int qc;
int iscompgen, iscompleting;
if (state == 0)
@@ -1616,7 +1615,7 @@ programmable_completions (cmd, word, start, end, foundp)
const char *word;
int start, end, *foundp;
{
COMPSPEC *cs, *lastcs;
COMPSPEC *lastcs;
STRINGLIST *ret;
char **rmatches, *t;
int found, retry, count;
-2
View File
@@ -1004,8 +1004,6 @@ static void
print_deferred_heredocs (cstring)
const char *cstring;
{
REDIRECT *hdtail;
/* We now print the heredoc headers in print_redirection_list */
if (cstring && cstring[0] && (cstring[0] != ';' || cstring[1]))
cprintf ("%s", cstring);
-1
View File
@@ -154,7 +154,6 @@ redirection_error (temp, error)
#endif
else if (expandable_redirection_filename (temp))
{
expandable_filename:
oflags = temp->redirectee.filename->flags;
if (posixly_correct && interactive_shell == 0)
temp->redirectee.filename->flags |= W_NOGLOB;
+32 -24
View File
@@ -1139,7 +1139,6 @@ string_extract_verbatim (string, slen, sindex, charlist, flags)
{
register int i;
#if defined (HANDLE_MULTIBYTE)
size_t clen;
wchar_t *wcharlist;
#endif
int c;
@@ -1155,7 +1154,6 @@ string_extract_verbatim (string, slen, sindex, charlist, flags)
i = *sindex;
#if defined (HANDLE_MULTIBYTE)
clen = strlen (charlist);
wcharlist = 0;
#endif
while (c = string[i])
@@ -2019,10 +2017,9 @@ skip_to_histexp (string, start, delims, flags)
char *delims;
int flags;
{
int i, pass_next, backq, dquote, si, c, oldjmp;
int i, pass_next, backq, dquote, c, oldjmp;
int histexp_comsub, histexp_backq, old_dquote;
size_t slen;
char *temp, open[3];
DECLARE_MBSTATE;
slen = strlen (string + start) + start;
@@ -4104,6 +4101,7 @@ dequote_escapes (string)
return result;
}
#if defined (INCLUDE_UNUSED)
static WORD_LIST *
list_dequote_escapes (list)
WORD_LIST *list;
@@ -4119,6 +4117,7 @@ list_dequote_escapes (list)
}
return list;
}
#endif
/* Return a new string with the quoted representation of character C.
This turns "" into QUOTED_NULL, so the W_HASQUOTEDNULL flag needs to be
@@ -4301,7 +4300,7 @@ remove_quoted_ifs (string)
char *string;
{
register size_t slen;
register int i, j, prev_i;
register int i, j;
char *ret, *send;
DECLARE_MBSTATE;
@@ -4659,7 +4658,6 @@ match_upattern (string, pat, mtype, sp, ep)
size_t len;
register char *p, *p1, *npat;
char *end;
int n1;
/* If the pattern doesn't match anywhere in the string, go ahead and
short-circuit right away. A minor optimization, saves a bunch of
@@ -4960,7 +4958,6 @@ match_pattern (string, pat, mtype, sp, ep)
size_t n;
wchar_t *wstring, *wpat;
char **indices;
size_t slen, plen, mslen, mplen;
#endif
if (string == 0 || pat == 0 || *pat == 0)
@@ -5525,7 +5522,7 @@ add_fifo_list (fd)
if (fd >= totfds)
totfds = fd + 2;
dev_fd_list = (char *)xrealloc (dev_fd_list, totfds * sizeof (dev_fd_list[0]));
dev_fd_list = (pid_t *)xrealloc (dev_fd_list, totfds * sizeof (dev_fd_list[0]));
/* XXX - might need a loop for this */
memset (dev_fd_list + ofds, '\0', (totfds - ofds) * sizeof (pid_t));
}
@@ -5921,7 +5918,7 @@ read_comsub (fd, quoted, flags, rflag)
int fd, quoted, flags;
int *rflag;
{
char *istring, buf[128], *bufp, *s;
char *istring, buf[128], *bufp;
int istring_index, c, tflag, skip_ctlesc, skip_ctlnul;
size_t istring_size;
ssize_t bufn;
@@ -6632,6 +6629,7 @@ parameter_brace_find_indir (name, var_is_special, quoted, find_nameref)
char *temp, *t;
WORD_DESC *w;
SHELL_VAR *v;
int pflags, oldex;
if (find_nameref && var_is_special == 0 && (v = find_variable_last_nameref (name, 0)) &&
nameref_p (v) && (t = nameref_cell (v)) && *t)
@@ -6640,12 +6638,23 @@ parameter_brace_find_indir (name, var_is_special, quoted, find_nameref)
/* 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);
pflags = PF_IGNUNBOUND;
/* Note that we're not going to be doing word splitting here */
if (var_is_special)
{
pflags |= PF_ASSIGNRHS; /* suppresses word splitting */
oldex = expand_no_split_dollar_star;
expand_no_split_dollar_star = 1;
}
w = parameter_brace_expand_word (name, var_is_special, quoted, pflags, 0);
if (var_is_special)
expand_no_split_dollar_star = oldex;
t = w->word;
/* Have to dequote here if necessary */
if (t)
{
temp = (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
temp = ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || var_is_special)
? dequote_string (t)
: dequote_escapes (t);
free (t);
@@ -6664,7 +6673,7 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
int var_is_special, quoted;
int *quoted_dollar_atp, *contains_dollar_at;
{
char *temp, *t;
char *t;
WORD_DESC *w;
SHELL_VAR *v;
@@ -6845,9 +6854,8 @@ parameter_brace_expand_rhs (name, value, op, quoted, pflags, qdollaratp, hasdoll
}
/* op == '=' */
t = temp ? savestring (temp) : savestring ("");
t1 = dequote_string (t);
free (t);
t1 = temp ? dequote_string (temp) : savestring ("");
free (temp);
/* bash-4.4/5.0 */
vname = name;
@@ -6884,9 +6892,13 @@ parameter_brace_expand_rhs (name, value, op, quoted, pflags, qdollaratp, hasdoll
free (vname);
/* From Posix group discussion Feb-March 2010. Issue 7 0000221 */
free (temp);
w->word = t1;
/* If we are double-quoted or if we are not going to be performing word
splitting, we want to quote the value we return appropriately, like
the other expansions this function handles. */
w->word = (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) ? quote_string (t1) : quote_escapes (t1);
free (t1);
return w;
}
@@ -7199,7 +7211,6 @@ get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
{
int vtype, want_indir;
char *temp, *vname;
WORD_DESC *wd;
SHELL_VAR *v;
arrayind_t lind;
@@ -7741,7 +7752,7 @@ parameter_brace_substring (varname, value, ind, substr, quoted, pflags, flags)
/* */
/****************************************************************/
#if 0 /* Unused */
#ifdef INCLUDE_UNUSED
static int
shouldexp_replacement (s)
char *s;
@@ -10293,7 +10304,6 @@ finished_with_string:
else
{
char *ifs_chars;
char *tstring;
ifs_chars = (quoted_dollar_at || has_dollar_at) ? ifs_value : (char *)NULL;
@@ -11010,7 +11020,6 @@ shell_expand_word_list (tlist, eflags)
{
WORD_LIST *expanded, *orig_list, *new_list, *next, *temp_list, *wcmd;
int expanded_something, has_dollar_at;
char *temp_string;
/* We do tilde expansion all the time. This is what 1003.2 says. */
new_list = (WORD_LIST *)NULL;
@@ -11020,8 +11029,6 @@ shell_expand_word_list (tlist, eflags)
for (orig_list = tlist; tlist; tlist = next)
{
temp_string = tlist->word->word;
next = tlist->next;
#if defined (ARRAY_VARS)
@@ -11034,7 +11041,8 @@ shell_expand_word_list (tlist, eflags)
if ((tlist->word->flags & (W_COMPASSIGN|W_ASSIGNARG)) == (W_COMPASSIGN|W_ASSIGNARG))
{
int t;
char opts[16], opti;
char opts[16];
int opti;
opti = 0;
if (tlist->word->flags & (W_ASSIGNASSOC|W_ASSNGLOBAL|W_ASSIGNARRAY))
+3
View File
@@ -279,6 +279,9 @@ extern void clear_fifo_list __P((void));
extern int find_procsub_child __P((pid_t));
extern void set_procsub_status __P((int, pid_t, int));
extern void wait_procsubs __P((void));
extern void reap_procsubs __P((void));
#endif
extern WORD_LIST *list_string_with_quotes __P((char *));
+159 -261
View File
@@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2013 Free Software Foundation, Inc.
# Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2013-11-29'
timestamp='2017-12-17'
# 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
@@ -15,7 +15,7 @@ timestamp='2013-11-29'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# along with this program; if not, see <https://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
@@ -24,12 +24,12 @@ timestamp='2013-11-29'
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner.
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# 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
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
# Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -39,7 +39,7 @@ Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2013 Free Software Foundation, Inc.
Copyright 1992-2017 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."
@@ -149,7 +149,7 @@ Linux|GNU|GNU/*)
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
# to ELF recently (or will in the future) and ABI.
case "${UNAME_MACHINE_ARCH}" in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
os=netbsd
;;
esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
echo "${machine}-${os}${release}${abi}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -223,6 +240,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;;
*:MidnightBSD:*:*)
echo ${UNAME_MACHINE}-unknown-midnightbsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
@@ -235,6 +259,15 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix
exit ;;
*:Redox:*:*)
echo ${UNAME_MACHINE}-unknown-redox
exit ;;
mips:OSF1:*.*)
echo mips-dec-osf1
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
@@ -251,55 +284,46 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
UNAME_MACHINE=alphaev79 ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# 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'`
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
# 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
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit ;;
@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
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 [ "$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) | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
SUN_ARCH=x86_64
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
@@ -461,13 +485,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
@@ -579,8 +603,9 @@ EOF
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
@@ -589,7 +614,7 @@ EOF
*:AIX:*:*)
echo rs6000-ibm-aix
exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
@@ -610,20 +635,20 @@ EOF
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/31?) HP_ARCH=m68000 ;;
9000/[34]??) HP_ARCH=m68k ;;
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
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
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
@@ -662,11 +687,11 @@ EOF
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
(CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
if [ ${HP_ARCH} = hppa2.0w ]
then
eval $set_cc_for_build
@@ -679,12 +704,12 @@ EOF
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
HP_ARCH=hppa2.0w
else
HP_ARCH="hppa64"
HP_ARCH=hppa64
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -724,7 +749,7 @@ EOF
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
echo hppa1.1-hp-bsd
exit ;;
9000/8??:4.3bsd:*:*)
@@ -733,7 +758,7 @@ EOF
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
echo hppa1.1-hp-osf
exit ;;
hp8??:OSF1:*:*)
@@ -789,14 +814,14 @@ EOF
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
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_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 ;;
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/ /_/'`
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:*:*)
@@ -812,10 +837,11 @@ EOF
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
UNAME_PROCESSOR=x86_64 ;;
i386)
UNAME_PROCESSOR=i586 ;;
esac
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@@ -826,13 +852,9 @@ EOF
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
@@ -848,27 +870,12 @@ EOF
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[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
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
@@ -878,7 +885,7 @@ EOF
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
@@ -901,7 +908,7 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
@@ -932,6 +939,9 @@ EOF
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
@@ -944,6 +954,9 @@ EOF
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
k1om:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
@@ -969,10 +982,13 @@ EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
or1k:Linux:*:*)
mips64el:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:*)
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
@@ -1001,6 +1017,9 @@ EOF
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
riscv32:Linux:*:* | riscv64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
@@ -1020,7 +1039,7 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1059,7 +1078,7 @@ EOF
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
i*86:*:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
@@ -1099,7 +1118,7 @@ EOF
# 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
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
@@ -1248,6 +1267,9 @@ EOF
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
SX-ACE:SUPER-UX:*:*)
echo sxace-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@@ -1261,16 +1283,23 @@ EOF
UNAME_PROCESSOR=powerpc
fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
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
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_PPC >/dev/null
then
UNAME_PROCESSOR=powerpc
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
@@ -1285,7 +1314,7 @@ EOF
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
@@ -1294,15 +1323,18 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
NEO-*:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
NSR-*:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
NSX-*:NONSTOP_KERNEL:*:*)
echo nsx-tandem-nsk${UNAME_RELEASE}
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
@@ -1316,7 +1348,7 @@ EOF
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
if test "$cputype" = 386; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
@@ -1358,7 +1390,7 @@ EOF
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
@@ -1369,171 +1401,37 @@ EOF
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
exit ;;
esac
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
echo "$0: unable to guess system type" >&2
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
case "${UNAME_MACHINE}:${UNAME_SYSTEM}" in
mips:Linux | mips64:Linux)
# If we got here on MIPS GNU/Linux, output extra information.
cat >&2 <<EOF
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
the system type. Please install a C compiler and try again.
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
;;
esac
cat >&2 <<EOF
$0: unable to guess system type
This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
This script (version $timestamp), has failed to recognize the
operating system you are using. If your script is old, overwrite *all*
copies of config.guess and config.sub with the latest versions from:
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
provide the necessary information to handle your system.
config.guess timestamp = $timestamp
@@ -1561,7 +1459,7 @@ EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'write-file-functions 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
+99 -44
View File
@@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2013 Free Software Foundation, Inc.
# Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2013-10-01'
timestamp='2017-11-23'
# 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
@@ -15,7 +15,7 @@ timestamp='2013-10-01'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# along with this program; if not, see <https://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
@@ -25,7 +25,7 @@ timestamp='2013-10-01'
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
# Please send patches to <config-patches@gnu.org>.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@@ -33,7 +33,7 @@ timestamp='2013-10-01'
# 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
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@@ -53,12 +53,11 @@ timestamp='2013-10-01'
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
Operation modes:
Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2013 Free Software Foundation, Inc.
Copyright 1992-2017 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."
@@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -230,9 +229,6 @@ case $os in
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
@@ -255,15 +251,16 @@ case $basic_machine in
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| i370 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
@@ -283,8 +280,10 @@ case $basic_machine in
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
@@ -296,14 +295,15 @@ case $basic_machine in
| nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| or1k | or32 \
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pru \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | 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[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -311,7 +311,8 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
| visium \
| wasm32 \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
@@ -325,6 +326,9 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
@@ -370,17 +374,18 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| e2k-* | 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-* \
| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
@@ -402,8 +407,10 @@ case $basic_machine in
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
@@ -415,16 +422,19 @@ case $basic_machine in
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pru-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| 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-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
@@ -432,6 +442,8 @@ case $basic_machine in
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| wasm32-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@@ -508,6 +520,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -624,10 +639,18 @@ case $basic_machine in
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
dpx2*)
basic_machine=m68k-bull
os=-sysv3
;;
e500v[12])
basic_machine=powerpc-unknown
os=$os"spe"
;;
e500v[12]-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
@@ -769,6 +792,9 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
@@ -824,6 +850,10 @@ case $basic_machine in
basic_machine=powerpc-unknown
os=-morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos)
basic_machine=i386-pc
os=-msdos
@@ -871,7 +901,7 @@ case $basic_machine in
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
next | m*-next)
basic_machine=m68k-next
case $os in
-nextstep* )
@@ -916,6 +946,9 @@ case $basic_machine in
nsr-tandem)
basic_machine=nsr-tandem
;;
nsx-tandem)
basic_machine=nsx-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
@@ -1000,7 +1033,7 @@ case $basic_machine in
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
ppcle | powerpclittle)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
@@ -1010,7 +1043,7 @@ case $basic_machine in
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
@@ -1211,6 +1244,9 @@ case $basic_machine in
basic_machine=a29k-wrs
os=-vxworks
;;
wasm32)
basic_machine=wasm32-unknown
;;
w65*)
basic_machine=w65-wdc
os=-none
@@ -1219,6 +1255,9 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
x64)
basic_machine=x86_64-pc
;;
xbox)
basic_machine=i686-pc
os=-mingw32
@@ -1326,8 +1365,8 @@ 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
@@ -1347,36 +1386,37 @@ case $os in
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# Now accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# 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* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1451,7 +1491,7 @@ case $os in
-nova*)
os=-rtmk-nova
;;
-ns2 )
-ns2)
os=-nextstep2
;;
-nsk*)
@@ -1506,8 +1546,23 @@ case $os in
-dicos*)
os=-dicos
;;
-pikeos*)
# Until real need of OS specific support for
# particular features comes up, bare metal
# configurations are quite functional.
case $basic_machine in
arm*)
os=-eabi
;;
*)
os=-elf
;;
esac
;;
-nacl*)
;;
-ios)
;;
-none)
;;
*)
@@ -1594,9 +1649,6 @@ case $basic_machine in
mips*-*)
os=-elf
;;
or1k-*)
os=-elf
;;
or32-*)
os=-coff
;;
@@ -1606,6 +1658,9 @@ case $basic_machine in
sparc-* | *-sun)
os=-sunos4.1.1
;;
pru-*)
os=-elf
;;
*-be)
os=-beos
;;
@@ -1651,7 +1706,7 @@ case $basic_machine in
m88k-omron*)
os=-luna
;;
*-next )
*-next)
os=-nextstep
;;
*-sequent)
@@ -1786,7 +1841,7 @@ echo $basic_machine$os
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'write-file-functions 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
+12
View File
@@ -0,0 +1,12 @@
#! /bin/sh
#
# update-config.sh - fetch new versions of config.guess and config.sub
# from the master GNU git tree
#
cd /usr/src/local/chet/src/bash/src/support
mv config.guess config.guess.save
mv config.sub config.sub.save
wget -v http://git.savannah.gnu.org/cgit/config.git/plain/config.guess
wget -v http://git.savannah.gnu.org/cgit/config.git/plain/config.sub
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/bash/bash-current
BUILD_DIR=/usr/local/build/chet/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+30
View File
@@ -14,3 +14,33 @@ printf '<%s>' "$a" "$b" "$c" "$d" "$e" "$f" ; echo
unset f g
f=${*,,} g=${*@Q}
printf '<%s>' "$f" "$g" ; echo
unset -v a b c d e f g
unset var
# resetting IFS here
IFS=$' \t\n'
printf '%s\n' "${*:1}"
var=${*:1}; printf '%s\n' "$var"
var="${*:1}"; printf '%s\n' "$var"
unset var
recho ${var-${*}}
recho ${var-${*:1}}
recho "${var-${*:1}}"
recho ${var-"${*:1}"}
unset var
recho ${var=${*}}
printf 'var=%s\n' "$var"
unset var
recho ${var=${*:1}}
printf 'var=%s\n' "$var"
a=${*:1}
recho "$a"
: ${b=${*:1}}
recho "$b"
+17
View File
@@ -560,3 +560,20 @@ argv[2] = <>
<12><12><12><12><12><12>
<12><12><12><12><12><12>
<12><'1''2'>
1 2
1 2
1 2
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1 2>
argv[1] = <1>
argv[2] = <2>
var=1 2
argv[1] = <1>
argv[2] = <2>
var=1 2
argv[1] = <1 2>
argv[1] = <1 2>
+175 -6
View File
@@ -63,16 +63,22 @@ argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <12>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1 2>
argv[1] = <1 2>
argv[1] = <1 2>
argv[1] = <1 2>
argv[1] = <12>
argv[1] = <12>
argv[1] = <12>
argv[1] = <12>
argv[1] = <12>
argv[1] = <12>
argv[1] = <1 2>
argv[1] = <1 2>
argv[1] = <12>
argv[1] = <12>
normal IFS
argv[1] = <abc>
argv[2] = <def>
@@ -106,5 +112,168 @@ argv[2] = <def ghi>
argv[3] = <jkl >
argv[1] = < abc def ghi jkl >
argv[1] = < abc def ghi jkl >
./posixexp.tests: line 80: unexpected EOF while looking for matching `}'
./posixexp.tests: line 81: syntax error: unexpected end of file
001: IFS = (unset): unset -v foo; set -- ${foo=$*}
soh stx etx del / soh stx etx del
002: IFS = (unset): unset -v foo; set -- ${foo="$*"}
soh stx etx del / soh stx etx del
003: IFS = (unset): unset -v foo; set -- "${foo=$*}"
soh stx etx del / soh stx etx del
004: IFS = (unset): foo=; set -- ${foo:=$*}
soh stx etx del / soh stx etx del
005: IFS = (unset): foo=; set -- ${foo:="$*"}
soh stx etx del / soh stx etx del
006: IFS = (unset): foo=; set -- "${foo:=$*}"
soh stx etx del / soh stx etx del
007: IFS = (unset): unset -v foo; set -- ${foo=$@}
soh stx etx del / soh stx etx del
008: IFS = (unset): unset -v foo; set -- ${foo="$@"}
soh stx etx del / soh stx etx del
009: IFS = (unset): unset -v foo; set -- "${foo=$@}"
soh stx etx del / soh stx etx del
010: IFS = (unset): foo=; set -- ${foo:=$@}
soh stx etx del / soh stx etx del
011: IFS = (unset): foo=; set -- ${foo:="$@"}
soh stx etx del / soh stx etx del
012: IFS = (unset): foo=; set -- "${foo:=$@}"
soh stx etx del / soh stx etx del
013: IFS = (null): unset -v foo; set -- ${foo=$*}
soh stx etx del / soh stx etx del
014: IFS = (null): unset -v foo; set -- ${foo="$*"}
soh stx etx del / soh stx etx del
015: IFS = (null): unset -v foo; set -- "${foo=$*}"
soh stx etx del / soh stx etx del
016: IFS = (null): foo=; set -- ${foo:=$*}
soh stx etx del / soh stx etx del
017: IFS = (null): foo=; set -- ${foo:="$*"}
soh stx etx del / soh stx etx del
018: IFS = (null): foo=; set -- "${foo:=$*}"
soh stx etx del / soh stx etx del
019: IFS = (null): unset -v foo; set -- ${foo=$@}
soh stx etx del / soh stx etx del
020: IFS = (null): unset -v foo; set -- ${foo="$@"}
soh stx etx del / soh stx etx del
021: IFS = (null): unset -v foo; set -- "${foo=$@}"
soh stx etx del / soh stx etx del
022: IFS = (null): foo=; set -- ${foo:=$@}
soh stx etx del / soh stx etx del
023: IFS = (null): foo=; set -- ${foo:="$@"}
soh stx etx del / soh stx etx del
024: IFS = (null): foo=; set -- "${foo:=$@}"
soh stx etx del / soh stx etx del
025: IFS = x: unset -v foo; set -- ${foo=$*}
soh stx etx del / soh stx etx del
026: IFS = x: unset -v foo; set -- ${foo="$*"}
soh stx etx del / soh stx etx del
027: IFS = x: unset -v foo; set -- "${foo=$*}"
soh stx etx del / soh stx etx del
028: IFS = x: foo=; set -- ${foo:=$*}
soh stx etx del / soh stx etx del
029: IFS = x: foo=; set -- ${foo:="$*"}
soh stx etx del / soh stx etx del
030: IFS = x: foo=; set -- "${foo:=$*}"
soh stx etx del / soh stx etx del
031: IFS = x: unset -v foo; set -- ${foo=$@}
soh stx etx del / soh stx etx del
032: IFS = x: unset -v foo; set -- ${foo="$@"}
soh stx etx del / soh stx etx del
033: IFS = x: unset -v foo; set -- "${foo=$@}"
soh stx etx del / soh stx etx del
034: IFS = x: foo=; set -- ${foo:=$@}
soh stx etx del / soh stx etx del
035: IFS = x: foo=; set -- ${foo:="$@"}
soh stx etx del / soh stx etx del
036: IFS = x: foo=; set -- "${foo:=$@}"
soh stx etx del / soh stx etx del
037: IFS = sp ht nl: unset -v foo; set -- ${foo=$*}
soh stx etx del / soh stx etx del
038: IFS = sp ht nl: unset -v foo; set -- ${foo="$*"}
soh stx etx del / soh stx etx del
039: IFS = sp ht nl: unset -v foo; set -- "${foo=$*}"
soh stx etx del / soh stx etx del
040: IFS = sp ht nl: foo=; set -- ${foo:=$*}
soh stx etx del / soh stx etx del
041: IFS = sp ht nl: foo=; set -- ${foo:="$*"}
soh stx etx del / soh stx etx del
042: IFS = sp ht nl: foo=; set -- "${foo:=$*}"
soh stx etx del / soh stx etx del
043: IFS = sp ht nl: unset -v foo; set -- ${foo=$@}
soh stx etx del / soh stx etx del
044: IFS = sp ht nl: unset -v foo; set -- ${foo="$@"}
soh stx etx del / soh stx etx del
045: IFS = sp ht nl: unset -v foo; set -- "${foo=$@}"
soh stx etx del / soh stx etx del
046: IFS = sp ht nl: foo=; set -- ${foo:=$@}
soh stx etx del / soh stx etx del
047: IFS = sp ht nl: foo=; set -- ${foo:="$@"}
soh stx etx del / soh stx etx del
048: IFS = sp ht nl: foo=; set -- "${foo:=$@}"
soh stx etx del / soh stx etx del
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
argv[1] = <a>
argv[2] = <b>
argv[1] = <a>
argv[2] = <b>
argv[1] = <a>
argv[2] = <b>
argv[1] = <a>
argv[2] = <b>
[ abc def ghi jkl / abc def ghi jkl ]
[ abc def ghi jkl ]
[ abc def ghi jkl / abc def ghi jkl / abc def ghi jkl ]
./posixexp.tests: line 82: unexpected EOF while looking for matching `}'
./posixexp.tests: line 83: syntax error: unexpected end of file
+2
View File
@@ -74,6 +74,8 @@ rm -f $TMPDIR/sh
${THIS_SH} ./posixexp3.sub
${THIS_SH} ./posixexp4.sub
${THIS_SH} ./posixexp5.sub
${THIS_SH} ./posixexp6.sub
# this will be an error
foo=bar
+17
View File
@@ -25,11 +25,28 @@ recho ${var-"$*"}
unset -v a b c d
# Posix interp 221
# there should never be any word splitting because IFS is null
recho ${a=$@}
recho "$a"
recho $a
recho ${b="$@"}
recho "$b"
recho $b
recho ${c=$*}
recho "$c"
recho $c
recho ${d="$*"}
recho "$d"
recho $d
unset -v a b c d
a=$@
recho $a
b="$@"
recho $b
c=$*
recho $c
d="$*"
recho $d
unset -v parameter a b c d
+51
View File
@@ -0,0 +1,51 @@
# test suite contribution from Martijn Dekker
defaultIFS=$IFS
set -o errexit -o noglob
(set -o pipefail) 2>/dev/null && set -o pipefail
teststring=$(printf '\1\2\3\177')
n=0
trim_od() {
od -a | sed -n '1 { s/^0*[[:blank:]]*//; s/[[:blank:]]*$//; p; }'
}
doTest() {
set -- "$teststring"
eval "$testcmd"
case ${IFS+s}${IFS:+n} in
( sn ) i=$(printf %s "$IFS" | trim_od) ;;
( s ) i='(null)' ;;
( '' ) i='(unset)' ;;
( * ) echo 'internal error!' >&2; exit 125 ;;
esac
printf '\n%03d: IFS = %s: %s\n' "$((n+=1))" "$i" "$testcmd"
printf %s "$*${foo+/}${foo-}" | trim_od
}
doAllTests() {
for testcmd in \
'unset -v foo; set -- ${foo=$*}' \
'unset -v foo; set -- ${foo="$*"}' \
'unset -v foo; set -- "${foo=$*}"' \
\
'foo=; set -- ${foo:=$*}' \
'foo=; set -- ${foo:="$*"}' \
'foo=; set -- "${foo:=$*}"' \
\
'unset -v foo; set -- ${foo=$@}' \
'unset -v foo; set -- ${foo="$@"}' \
'unset -v foo; set -- "${foo=$@}"' \
\
'foo=; set -- ${foo:=$@}' \
'foo=; set -- ${foo:="$@"}' \
'foo=; set -- "${foo:=$@}"'
do
doTest "$testcmd"
done
}
unset -v IFS; doAllTests
IFS=''; doAllTests
IFS='x'; doAllTests
IFS=$defaultIFS; doAllTests
+57
View File
@@ -0,0 +1,57 @@
var=$'\01\02\03\177'
bar=${unset:-$var}
recho "$bar"
unset -v bar
bar=${unset:-"$var"}
recho "$bar"
foo=${parameter:=$var}
recho "$foo"
recho "$parameter"
unset -v foo parameter
foo=${parameter:="$var"}
recho "$foo"
recho "$parameter"
unset -v foo parameter
foo="${parameter:=$var}"
recho "$foo"
recho "$parameter"
unset -v foo parameter
recho ${parameter:=a\ b}
unset -v parameter
recho ${parameter:="a b"}
unset -v parameter
v='a b'
recho ${parameter:=$v}
unset -v parameter
recho ${parameter:="$v"}
unset -v parameter
# unsetting IFS here
set " abc " " def ghi " "jkl "
unset -v IFS var
var=${var-$*}/${var-$*}
printf '[%s]\n' "$var"
unset -v var
: ${var=$*}
printf '[%s]\n' "$var"
unset -v var
: ${var:=$*/$*/${var-$*}}
printf '[%s]\n' "$var"
+17 -11
View File
@@ -1,13 +1,19 @@
./rsh.tests: line 9: cd: restricted
./rsh.tests: line 10: PATH: readonly variable
./rsh.tests: line 11: SHELL: readonly variable
./rsh.tests: line 12: /bin/sh: restricted: cannot specify `/' in command names
./rsh.tests: line 14: .: ./source.sub3: restricted
./rsh.tests: line 17: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 21: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 26: command: -p: restricted
./rsh.tests: line 28: set: +r: invalid option
./rsh1.sub: line 9: /bin/sh: restricted
./rsh1.sub: line 11: sh: not found
./rsh1.sub: line 12: a: command not found
./rsh2.sub: line 10: hash: /bin/sh: restricted
./rsh2.sub: line 12: hash: sh: not found
./rsh2.sub: line 13: a: command not found
./rsh.tests: line 12: cd: restricted
./rsh.tests: line 13: PATH: readonly variable
./rsh.tests: line 14: SHELL: readonly variable
./rsh.tests: line 15: /bin/sh: restricted: cannot specify `/' in command names
./rsh.tests: line 17: .: ./source.sub3: restricted
./rsh.tests: line 20: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 24: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 29: command: -p: restricted
./rsh.tests: line 31: set: +r: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
./rsh.tests: line 29: set: restricted: invalid option name
./rsh.tests: line 31: exec: restricted
./rsh.tests: line 32: set: restricted: invalid option name
./rsh.tests: line 34: exec: restricted
./rsh.tests: after exec
+3
View File
@@ -4,6 +4,9 @@
# adding builtins dynamically with enable -f
# importing function definitions from environment
${THIS_SH} ./rsh1.sub
${THIS_SH} ./rsh2.sub
set -r
cd /
+16
View File
@@ -0,0 +1,16 @@
cd ${TMPDIR:-/tmp}
cp /bin/sh .
PATH=/rbin:/usr/local/rbin
hash -p /bin/rm rm
set -r
BASH_CMDS[x]=/bin/sh
BASH_CMDS[a]="sh"
a -c 'echo hello'
rm -f sh a
exit 0
+17
View File
@@ -0,0 +1,17 @@
cd ${TMPDIR:-/tmp}
cp /bin/sh .
ln sh a
PATH=/rbin:/usr/local/rbin
hash -p /bin/rm rm
set -r
hash -p /bin/sh sh
hash -p sh a
a -c 'echo hello'
rm -f sh a
exit 0
+2 -2
View File
@@ -934,8 +934,8 @@ _run_trap_internal (sig, tag)
char *tag;
{
char *trap_command, *old_trap;
int trap_exit_value, *token_state;
volatile int save_return_catch_flag, function_code, top_level_code, old_int;
int trap_exit_value;
volatile int save_return_catch_flag, function_code, old_int;
int flags;
procenv_t save_return_catch;
WORD_LIST *save_subst_varlist;
+24 -16
View File
@@ -1696,10 +1696,25 @@ assign_hashcmd (self, value, ind, key)
char *key;
{
#if defined (RESTRICTED_SHELL)
if (restricted && strchr (value, '/'))
char *full_path;
if (restricted)
{
sh_restricted (value);
return (SHELL_VAR *)NULL;
if (strchr (value, '/'))
{
sh_restricted (value);
return (SHELL_VAR *)NULL;
}
/* If we are changing the hash table in a restricted shell, make sure the
target pathname can be found using a $PATH search. */
full_path = find_user_command (value);
if (full_path == 0 || *full_path == 0 || executable_file (full_path) == 0)
{
sh_notfound (value);
free (full_path);
return ((SHELL_VAR *)NULL);
}
free (full_path);
}
#endif
phash_insert (key, value, 0, 0);
@@ -1974,7 +1989,7 @@ find_variable_nameref (v)
SHELL_VAR *v;
{
int level, flags;
char *newname, *t;
char *newname;
SHELL_VAR *orig, *oldv;
level = 0;
@@ -2072,7 +2087,6 @@ find_nameref_at_context (v, vc)
VAR_CONTEXT *vc;
{
SHELL_VAR *nv, *nv2;
VAR_CONTEXT *nvc;
char *newname;
int level;
@@ -2534,7 +2548,7 @@ make_local_variable (name, flags)
possible variable values. */
if (was_tmpvar)
var_setvalue (new_var, savestring (old_value));
else if (localvar_inherit)
else if (localvar_inherit || (flags & MKLOC_INHERIT))
{
/* This may not make sense for nameref variables that are shadowing
variables with the same name, but we don't know that yet. */
@@ -2552,7 +2566,7 @@ make_local_variable (name, flags)
var_setvalue (new_var, (char *)NULL);
}
if (localvar_inherit)
if (localvar_inherit || (flags & MKLOC_INHERIT))
{
/* It doesn't make sense to inherit the nameref attribute */
new_var->attributes = old_var->attributes & ~att_nameref;
@@ -3020,7 +3034,6 @@ bind_variable (name, value, flags)
{
SHELL_VAR *v, *nv;
VAR_CONTEXT *vc, *nvc;
int level;
if (shell_variables == 0)
create_variable_tables ();
@@ -3098,10 +3111,6 @@ bind_global_variable (name, value, flags)
char *value;
int flags;
{
SHELL_VAR *v, *nv;
VAR_CONTEXT *vc, *nvc;
int level;
if (shell_variables == 0)
create_variable_tables ();
@@ -5749,16 +5758,15 @@ ARRAY *
save_pipestatus_array ()
{
SHELL_VAR *v;
ARRAY *a, *a2;
ARRAY *a;
v = find_variable ("PIPESTATUS");
if (v == 0 || array_p (v) == 0 || array_cell (v) == 0)
return ((ARRAY *)NULL);
a = array_cell (v);
a2 = array_copy (array_cell (v));
a = array_copy (array_cell (v));
return a2;
return a;
}
void
+3
View File
@@ -220,6 +220,9 @@ typedef struct _vlist {
#define ifsname(s) ((s)[0] == 'I' && (s)[1] == 'F' && (s)[2] == 'S' && (s)[3] == '\0')
/* Flag values for make_local_variable */
#define MKLOC_INHERIT 0x01
/* Special value for nameref with invalid value for creation or assignment */
extern SHELL_VAR nameref_invalid_value;
#define INVALID_NAMEREF_VALUE (void *)&nameref_invalid_value
+2
View File
@@ -51,9 +51,11 @@
extern char *sbrk();
#endif
#if defined (HAVE_SBRK) && defined (USING_BASH_MALLOC)
static PTR_T lbreak;
static int brkfound;
static size_t allocated;
#endif
/* **************************************************************** */
/* */