mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-30 00:49:57 +02:00
commit bash-20170224 snapshot
This commit is contained in:
@@ -13223,3 +13223,89 @@ subst.c
|
||||
- expand_string_for_rhs: make sure to set expand_no_split_dollar_star
|
||||
if `op' is `=', since we are supposed to preserve the assignment
|
||||
statement expansion semantics on the RHS of ${param=word}
|
||||
|
||||
jobs.c
|
||||
- bgp_delindex: make sure to set ps->pid to NO_PID so we more
|
||||
effectively remove it from the hash table. It shouldn't matter as
|
||||
long as nothing in pidstat_table points to it, but
|
||||
- bgp_delete,bgp_search: generalize previous collision detection to
|
||||
loop detection: abort search if we are going to go back to the
|
||||
first index we tried
|
||||
|
||||
2/21
|
||||
----
|
||||
lib/readline/vi_mode.c
|
||||
- rl_vi_bword: if we're trying to move backward to non-whitespace
|
||||
in a line that begins with whitespace, make sure we don't move
|
||||
point to 0 and test memory locations before the start of the
|
||||
buffer. Report and fix from Jason Hood <jadoxa@yahoo.com.au>
|
||||
|
||||
lib/readline/display.c
|
||||
- expand_prompt: if _rl_screenwith == 0, call rl_reset_screen_size to
|
||||
initialize it. If it's still 0 after that, guess that the screen
|
||||
width is 80 and use that to guess how many screen lines the prompt
|
||||
consumes
|
||||
|
||||
lib/readline/readline.c
|
||||
- readline_internal_setup: if in emacs editing mode, and we are
|
||||
showing the editing mode in the prompt, call _rl_reset_prompt() to
|
||||
make sure that the updated setting of _rl_show_mode_in_prompt
|
||||
(presumably set in an inputrc file) is reflected in the redisplay
|
||||
performed by rl_callback_newline via readline_internal_setup.
|
||||
Fix from Jason Hood <jadoxa@yahoo.com.au>
|
||||
|
||||
2/22
|
||||
----
|
||||
builtins/complete.def
|
||||
- print_one_completion,print_compopts: make sure to display the
|
||||
`nosort' and `noquote' options if they've been set for a particular
|
||||
compspec. Fix from Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
builtins/read.def
|
||||
- read_builtin: if -e is supplied, read needs to free rlbuf before
|
||||
returning, since it uses discard_unwind_frame at that point. Bug
|
||||
and fix from ZhangXiao <xiao.zhang@windriver.com>
|
||||
|
||||
execute_cmd.c
|
||||
- execute_for_command: when using a nameref as the for loop control
|
||||
variable, make sure we check for readonly namerefs and make sure
|
||||
that we force bind_variable to enforce restrictions on nameref
|
||||
assignments. Fix from Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
2/23
|
||||
----
|
||||
general.c
|
||||
- make_absolute: convert deprecated cygwin_conv_to_full_posix_path
|
||||
to cygwin_conv_path (CCP_WIN_A_TO_POSIX, ...)
|
||||
|
||||
{shell,variables}.c,config-top.h
|
||||
- modify change from 2/17: rename STATIC_PATH_VALUE to RBASH_STATIC_PATH_VALUE;
|
||||
don't use it in shell_initialize; set PATH to it just before
|
||||
imposing restricted shell restrictions
|
||||
|
||||
2/24
|
||||
----
|
||||
subst.c
|
||||
- expand_string_for_rhs: revert change from 2/19 concerning setting
|
||||
expand_no_split_dollar_star so we are consistent with the Posix
|
||||
examples. This anticipates Martijn Dekker initiating an austin
|
||||
group discussion about this case
|
||||
|
||||
2/25
|
||||
----
|
||||
pcomplete.c
|
||||
- gen_shell_function_matches: if COMPREPLY is an associative array,
|
||||
don't coerce it to an indexed array, which will fail to produce any
|
||||
matches anyway. Report from Grisha Levit <grishalevit@gmail.com>
|
||||
- bind_comp_words: if COMP_WORDS exists as a nameref variable, ignore
|
||||
the nameref attribute. Report from Grisha Levit
|
||||
<grishalevit@gmail.com>
|
||||
|
||||
subst.c
|
||||
- parameter_brace_expand: if expand_no_split_dollar_star is set, make
|
||||
sure chk_atstar treats ${var[*]} as quoted by passing Q_DOUBLE_QUOTES
|
||||
as the second argument. Fixes differing treatment of $* and ${v[*]}
|
||||
reported by Grisha Levit <grishalevit@gmail.com>, because otherwise
|
||||
*contains_dollar_at gets set to 1 and the word is inappropriately
|
||||
split
|
||||
|
||||
|
||||
@@ -855,6 +855,7 @@ tests/array20.sub f
|
||||
tests/array21.sub f
|
||||
tests/array22.sub f
|
||||
tests/array23.sub f
|
||||
tests/array24.sub f
|
||||
tests/array-at-star f
|
||||
tests/array2.right f
|
||||
tests/assoc.tests f
|
||||
|
||||
@@ -515,6 +515,8 @@ print_one_completion (cmd, cs)
|
||||
PRINTCOMPOPT (COPT_DEFAULT, "default");
|
||||
PRINTCOMPOPT (COPT_DIRNAMES, "dirnames");
|
||||
PRINTCOMPOPT (COPT_FILENAMES, "filenames");
|
||||
PRINTCOMPOPT (COPT_NOQUOTE, "noquote");
|
||||
PRINTCOMPOPT (COPT_NOSORT, "nosort");
|
||||
PRINTCOMPOPT (COPT_NOSPACE, "nospace");
|
||||
PRINTCOMPOPT (COPT_PLUSDIRS, "plusdirs");
|
||||
|
||||
@@ -589,6 +591,8 @@ print_compopts (cmd, cs, full)
|
||||
XPRINTCOMPOPT (COPT_DEFAULT, "default");
|
||||
XPRINTCOMPOPT (COPT_DIRNAMES, "dirnames");
|
||||
XPRINTCOMPOPT (COPT_FILENAMES, "filenames");
|
||||
XPRINTCOMPOPT (COPT_NOQUOTE, "noquote");
|
||||
XPRINTCOMPOPT (COPT_NOSORT, "nosort");
|
||||
XPRINTCOMPOPT (COPT_NOSPACE, "nospace");
|
||||
XPRINTCOMPOPT (COPT_PLUSDIRS, "plusdirs");
|
||||
}
|
||||
@@ -598,6 +602,8 @@ print_compopts (cmd, cs, full)
|
||||
PRINTCOMPOPT (COPT_DEFAULT, "default");
|
||||
PRINTCOMPOPT (COPT_DIRNAMES, "dirnames");
|
||||
PRINTCOMPOPT (COPT_FILENAMES, "filenames");
|
||||
PRINTCOMPOPT (COPT_NOQUOTE, "noquote");
|
||||
PRINTCOMPOPT (COPT_NOSORT, "nosort");
|
||||
PRINTCOMPOPT (COPT_NOSPACE, "nospace");
|
||||
PRINTCOMPOPT (COPT_PLUSDIRS, "plusdirs");
|
||||
}
|
||||
|
||||
@@ -684,6 +684,11 @@ add_char:
|
||||
input_string[i] = '\0';
|
||||
CHECK_ALRM;
|
||||
|
||||
#if defined (READLINE)
|
||||
if (edit)
|
||||
free (rlbuf);
|
||||
#endif
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
t_errno = errno;
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ Wait for job completion and return exit status.
|
||||
Waits for each process identified by an ID, which may be a process ID or a
|
||||
job specification, and reports its termination status. If ID is not
|
||||
given, waits for all currently active child processes, and the return
|
||||
status is zero. If ID is a a job specification, waits for all processes
|
||||
status is zero. If ID is a job specification, waits for all processes
|
||||
in that job's pipeline.
|
||||
|
||||
If the -n option is supplied, waits for the next job to terminate and
|
||||
|
||||
+3
-3
@@ -66,9 +66,9 @@
|
||||
"/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:."
|
||||
#endif
|
||||
|
||||
/* If you want to unconditionally set a value for PATH in every shell, set
|
||||
this. You could use this for a restricted shell, for example. */
|
||||
/* #define STATIC_PATH_VALUE "/rbin:/usr/rbin" */
|
||||
/* If you want to unconditionally set a value for PATH in every restricted
|
||||
shell, set this. */
|
||||
/* #define RBASH_STATIC_PATH_VALUE "/rbin:/usr/rbin" */
|
||||
|
||||
/* The value for PATH when invoking `command -p'. This is only used when
|
||||
the Posix.2 confstr () function, or CS_PATH define are not present. */
|
||||
|
||||
+4
-2
@@ -1,6 +1,6 @@
|
||||
/* execute_cmd.c -- Execute a COMMAND structure. */
|
||||
|
||||
/* Copyright (C) 1987-2016 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -2802,8 +2802,10 @@ execute_for_command (for_command)
|
||||
sh_invalidid (list->word->word);
|
||||
v = 0;
|
||||
}
|
||||
else if (readonly_p (v))
|
||||
err_readonly (name_cell (v));
|
||||
else
|
||||
v = bind_variable_value (v, list->word->word, 0);
|
||||
v = bind_variable_value (v, list->word->word, ASS_NAMEREF);
|
||||
}
|
||||
else
|
||||
v = bind_variable (identifier, list->word->word, 0);
|
||||
|
||||
@@ -57,6 +57,10 @@
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <sys/cygwin.h>
|
||||
#endif
|
||||
|
||||
static char *bash_special_tilde_expansions __P((char *));
|
||||
static int unquoted_tilde_word __P((const char *));
|
||||
static void initialize_group_array __P((void));
|
||||
@@ -724,7 +728,8 @@ make_absolute (string, dot_path)
|
||||
{
|
||||
char pathbuf[PATH_MAX + 1];
|
||||
|
||||
cygwin_conv_to_full_posix_path (string, pathbuf);
|
||||
/* WAS cygwin_conv_to_full_posix_path (string, pathbuf); */
|
||||
cygwin_conv_path (CCP_WIN_A_TO_POSIX, string, pathbuf, PATH_MAX);
|
||||
result = savestring (pathbuf);
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -795,8 +795,11 @@ bgp_add (pid, status)
|
||||
ps_index_t *bucket, psi;
|
||||
struct pidstat *ps;
|
||||
|
||||
bucket = pshash_getbucket (pid);
|
||||
psi = bgp_getindex ();
|
||||
/* bucket == existing chain of pids hashing to same value
|
||||
psi = where were going to put this pid/status */
|
||||
|
||||
bucket = pshash_getbucket (pid); /* index into pidstat_table */
|
||||
psi = bgp_getindex (); /* bgpids.head, index into storage */
|
||||
|
||||
/* XXX - what if psi == *bucket? */
|
||||
if (psi == *bucket)
|
||||
@@ -835,36 +838,44 @@ pshash_delindex (psi)
|
||||
ps_index_t psi;
|
||||
{
|
||||
struct pidstat *ps;
|
||||
ps_index_t *bucket;
|
||||
|
||||
ps = &bgpids.storage[psi];
|
||||
if (ps->pid == NO_PID)
|
||||
return;
|
||||
|
||||
if (ps->bucket_next != NO_PID)
|
||||
if (ps->bucket_next != NO_PIDSTAT)
|
||||
bgpids.storage[ps->bucket_next].bucket_prev = ps->bucket_prev;
|
||||
if (ps->bucket_prev != NO_PID)
|
||||
if (ps->bucket_prev != NO_PIDSTAT)
|
||||
bgpids.storage[ps->bucket_prev].bucket_next = ps->bucket_next;
|
||||
else
|
||||
*(pshash_getbucket (ps->pid)) = ps->bucket_next;
|
||||
{
|
||||
bucket = pshash_getbucket (ps->pid);
|
||||
*bucket = ps->bucket_next; /* deleting chain head in hash table */
|
||||
}
|
||||
|
||||
/* clear out this cell, just in case */
|
||||
ps->pid = NO_PID;
|
||||
ps->bucket_next = ps->bucket_prev = NO_PIDSTAT;
|
||||
}
|
||||
|
||||
static int
|
||||
bgp_delete (pid)
|
||||
pid_t pid;
|
||||
{
|
||||
ps_index_t psi;
|
||||
ps_index_t psi, orig_psi;
|
||||
|
||||
if (bgpids.storage == 0 || bgpids.nalloc == 0 || bgpids.npid == 0)
|
||||
return 0;
|
||||
|
||||
/* Search chain using hash to find bucket in pidstat_table */
|
||||
for (psi = *(pshash_getbucket (pid)); psi != NO_PIDSTAT; psi = bgpids.storage[psi].bucket_next)
|
||||
for (orig_psi = psi = *(pshash_getbucket (pid)); psi != NO_PIDSTAT; psi = bgpids.storage[psi].bucket_next)
|
||||
{
|
||||
if (bgpids.storage[psi].pid == pid)
|
||||
break;
|
||||
if (psi == bgpids.storage[psi].bucket_next) /* catch reported bug */
|
||||
if (orig_psi == bgpids.storage[psi].bucket_next) /* catch reported bug */
|
||||
{
|
||||
internal_warning ("bgp_delete: BUG: psi (%d) == storage[psi].bucket_next", psi);
|
||||
internal_warning ("bgp_delete: LOOP: psi (%d) == storage[psi].bucket_next", psi);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -905,15 +916,22 @@ static int
|
||||
bgp_search (pid)
|
||||
pid_t pid;
|
||||
{
|
||||
ps_index_t psi;
|
||||
ps_index_t psi, orig_psi;
|
||||
|
||||
if (bgpids.storage == 0 || bgpids.nalloc == 0 || bgpids.npid == 0)
|
||||
return -1;
|
||||
|
||||
/* Search chain using hash to find bucket in pidstat_table */
|
||||
for (psi = *(pshash_getbucket (pid)); psi != NO_PIDSTAT; psi = bgpids.storage[psi].bucket_next)
|
||||
if (bgpids.storage[psi].pid == pid)
|
||||
return (bgpids.storage[psi].status);
|
||||
for (orig_psi = psi = *(pshash_getbucket (pid)); psi != NO_PIDSTAT; psi = bgpids.storage[psi].bucket_next)
|
||||
{
|
||||
if (bgpids.storage[psi].pid == pid)
|
||||
return (bgpids.storage[psi].status);
|
||||
if (orig_psi == bgpids.storage[psi].bucket_next) /* catch reported bug */
|
||||
{
|
||||
internal_warning ("bgp_search: LOOP: psi (%d) == storage[psi].bucket_next", psi);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ int rl_persistent_signal_handlers = 0;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Callback Readline Functions */
|
||||
/* Callback Readline Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
|
||||
@@ -991,7 +991,6 @@ print_filename (to_print, full_pathname, prefix_bytes)
|
||||
slen--;
|
||||
else
|
||||
new_full_pathname[slen] = '/';
|
||||
new_full_pathname[slen] = '/';
|
||||
strcpy (new_full_pathname + slen + 1, to_print);
|
||||
|
||||
#if defined (VISIBLE_STATS)
|
||||
|
||||
@@ -307,6 +307,8 @@ prompt_modestr (lenp)
|
||||
|
||||
static int *local_prompt_newlines;
|
||||
|
||||
#define APPROX_DIV(n, d) (((n) < (d)) ? 1 : ((n) / (d)) + 1)
|
||||
|
||||
static char *
|
||||
expand_prompt (pmt, flags, lp, lip, niflp, vlp)
|
||||
char *pmt;
|
||||
@@ -349,7 +351,10 @@ expand_prompt (pmt, flags, lp, lip, niflp, vlp)
|
||||
l = strlen (nprompt); /* XXX */
|
||||
r = ret = (char *)xmalloc (l + 1);
|
||||
|
||||
newlines_guess = (l / _rl_screenwidth) + 1;
|
||||
if (_rl_screenwidth == 0)
|
||||
_rl_get_screen_size (0, 0); /* avoid division by zero */
|
||||
|
||||
newlines_guess = (_rl_screenwidth > 0) ? APPROX_DIV(l, _rl_screenwidth) : APPROX_DIV(l, 80);
|
||||
local_prompt_newlines = (int *) xrealloc (local_prompt_newlines, sizeof (int) * (newlines_guess + 1));
|
||||
local_prompt_newlines[newlines = 0] = 0;
|
||||
for (rl = 1; rl <= newlines_guess; rl++)
|
||||
@@ -2629,7 +2634,8 @@ _rl_erase_at_end_of_line (l)
|
||||
}
|
||||
|
||||
/* Clear to the end of the line. COUNT is the minimum
|
||||
number of character spaces to clear, */
|
||||
number of character spaces to clear, but we use a terminal escape
|
||||
sequence if available. */
|
||||
void
|
||||
_rl_clear_to_eol (count)
|
||||
int count;
|
||||
@@ -2652,7 +2658,7 @@ space_to_eol (count)
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
putc (' ', rl_outstream);
|
||||
putc (' ', rl_outstream);
|
||||
|
||||
_rl_last_c_pos += count;
|
||||
}
|
||||
|
||||
+1
-1
@@ -740,7 +740,7 @@ rl_bracketed_paste_begin (count, key)
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/* A special paste command for Windows users.. */
|
||||
/* A special paste command for Windows users. */
|
||||
#if defined (_WIN32)
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
@@ -419,7 +419,10 @@ readline_internal_setup ()
|
||||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode == vi_mode)
|
||||
rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */
|
||||
else
|
||||
#endif /* VI_MODE */
|
||||
if (_rl_show_mode_in_prompt)
|
||||
_rl_reset_prompt ();
|
||||
|
||||
/* If we're not echoing, we still want to at least print a prompt, because
|
||||
rl_redisplay will not do it for us. If the calling application has a
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
/* The next-to-last-ditch effort file name for a user-specific init file. */
|
||||
#define DEFAULT_INPUTRC "~/.inputrc"
|
||||
|
||||
/* The ultimate last-ditch filenname for an init file -- system-wide. */
|
||||
/* The ultimate last-ditch filename for an init file -- system-wide. */
|
||||
#define SYS_INPUTRC "/etc/inputrc"
|
||||
|
||||
/* If defined, expand tabs to spaces. */
|
||||
|
||||
@@ -594,7 +594,8 @@ rl_vi_bword (count, ignore)
|
||||
so we will go back to the start of the previous word. */
|
||||
if (!whitespace (rl_line_buffer[rl_point]) &&
|
||||
whitespace (rl_line_buffer[rl_point - 1]))
|
||||
rl_point--;
|
||||
if (--rl_point == 0)
|
||||
break;
|
||||
|
||||
/* If this character and the previous character are `opposite', move
|
||||
back so we don't get messed up by the rl_point++ down there in
|
||||
|
||||
+7
-3
@@ -952,11 +952,15 @@ bind_comp_words (lwords)
|
||||
{
|
||||
SHELL_VAR *v;
|
||||
|
||||
v = find_variable ("COMP_WORDS");
|
||||
v = find_variable_noref ("COMP_WORDS");
|
||||
if (v == 0)
|
||||
v = make_new_array_variable ("COMP_WORDS");
|
||||
if (nameref_p (v))
|
||||
VUNSETATTR (v, att_nameref);
|
||||
#if 0
|
||||
if (readonly_p (v))
|
||||
VUNSETATTR (v, att_readonly);
|
||||
#endif
|
||||
if (array_p (v) == 0)
|
||||
v = convert_var_to_array (v);
|
||||
v = assign_array_var_from_word_list (v, lwords, 0);
|
||||
@@ -1163,13 +1167,13 @@ gen_shell_function_matches (cs, cmd, text, line, ind, lwords, nw, cw, foundp)
|
||||
v = find_variable ("COMPREPLY");
|
||||
if (v == 0)
|
||||
return ((STRINGLIST *)NULL);
|
||||
if (array_p (v) == 0)
|
||||
if (array_p (v) == 0 && assoc_p (v) == 0)
|
||||
v = convert_var_to_array (v);
|
||||
|
||||
VUNSETATTR (v, att_invisible);
|
||||
|
||||
a = array_cell (v);
|
||||
if (found == 0 || (found & PCOMP_RETRYFAIL) || a == 0 || array_empty (a))
|
||||
if (found == 0 || (found & PCOMP_RETRYFAIL) || a == 0 || array_p (v) == 0 || array_empty (a))
|
||||
sl = (STRINGLIST *)NULL;
|
||||
else
|
||||
{
|
||||
|
||||
+2
-3
@@ -1,6 +1,6 @@
|
||||
/* print_command -- A way to make readable commands from a command tree. */
|
||||
|
||||
/* Copyright (C) 1989-2011 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1989-2017 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -1417,8 +1417,7 @@ named_function_string (name, command, flags)
|
||||
}
|
||||
#else
|
||||
if (result[2] == '\n') /* XXX -- experimental */
|
||||
memmove (result + 2, result + 3, strlen (result) - 2);
|
||||
|
||||
memmove (result + 2, result + 3, strlen (result) - 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1238,7 +1238,10 @@ maybe_make_restricted (name)
|
||||
temp++;
|
||||
if (restricted || (STREQ (temp, RESTRICTED_SHELL_NAME)))
|
||||
{
|
||||
#if defined (RBASH_STATIC_PATH_VALUE)
|
||||
temp_var = bind_variable ("PATH", RBASH_STATIC_PATH_VALUE, 0);
|
||||
stupidly_hack_special_variables ("PATH"); /* clear hash table */
|
||||
#endif
|
||||
set_var_read_only ("PATH");
|
||||
set_var_read_only ("SHELL");
|
||||
set_var_read_only ("ENV");
|
||||
|
||||
@@ -3842,7 +3842,11 @@ expand_string_for_rhs (string, quoted, op, dollar_at_p, expanded_p)
|
||||
1. This may need additional changes depending on whether or not this is
|
||||
on the RHS of an assignment statement. */
|
||||
/* The updated treatment of $* is the result of Posix interp 888 */
|
||||
#if 0
|
||||
expand_no_split_dollar_star = (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || op == '=' || ifs_is_null == 0;
|
||||
#else
|
||||
expand_no_split_dollar_star = 1;
|
||||
#endif
|
||||
td.flags = W_NOSPLIT2; /* no splitting, remove "" and '' */
|
||||
td.word = string;
|
||||
tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, expanded_p);
|
||||
@@ -6640,9 +6644,9 @@ parameter_brace_expand_word (name, var_is_special, quoted, pflags, indp)
|
||||
else if (valid_array_reference (name, 0))
|
||||
{
|
||||
expand_arrayref:
|
||||
var = array_variable_part (name, 0, &tt, (int *)0);
|
||||
if (pflags & PF_ASSIGNRHS)
|
||||
{
|
||||
var = array_variable_part (name, 0, &tt, (int *)0);
|
||||
{ /* [ */
|
||||
if (ALL_ELEMENT_SUB (tt[0]) && tt[1] == ']')
|
||||
{
|
||||
/* Only treat as double quoted if array variable */
|
||||
@@ -6654,7 +6658,9 @@ expand_arrayref:
|
||||
}
|
||||
else
|
||||
temp = array_value (name, quoted, 0, &atype, &ind);
|
||||
}
|
||||
} /* [ */
|
||||
else if (tt[0] == '*' && tt[1] == ']' && expand_no_split_dollar_star && ifs_is_null)
|
||||
temp = array_value (name, Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT, 0, &atype, &ind);
|
||||
else
|
||||
temp = array_value (name, quoted, 0, &atype, &ind);
|
||||
if (atype == 0 && temp)
|
||||
@@ -8403,13 +8409,18 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
qflags = quoted;
|
||||
/* If in a context where word splitting will not take place, treat as
|
||||
if double-quoted. Has effects with $* and ${array[*]} */
|
||||
|
||||
if (pflags & PF_ASSIGNRHS)
|
||||
qflags |= Q_DOUBLE_QUOTES;
|
||||
chk_atstar (name, qflags, quoted_dollar_atp, contains_dollar_at);
|
||||
/* We duplicate a little code here */
|
||||
t = mbschr (name, '[');
|
||||
if (t && ALL_ELEMENT_SUB (t[1]) && t[2] == ']')
|
||||
all_element_arrayref = 1;
|
||||
{
|
||||
all_element_arrayref = 1;
|
||||
if (expand_no_split_dollar_star && t[1] == '*') /* XXX */
|
||||
qflags |= Q_DOUBLE_QUOTES;
|
||||
}
|
||||
chk_atstar (name, qflags, quoted_dollar_atp, contains_dollar_at);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -530,3 +530,42 @@ foo
|
||||
6
|
||||
./array23.sub: line 21: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
|
||||
./array23.sub: line 22: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
|
||||
IFS=: ${var-$*}
|
||||
abc
|
||||
def ghi
|
||||
jkl
|
||||
abc
|
||||
def ghi
|
||||
jkl
|
||||
----
|
||||
IFS=: ${var=$*}
|
||||
abc
|
||||
def ghi
|
||||
jkl
|
||||
var=abc:def ghi:jkl
|
||||
abc
|
||||
def ghi
|
||||
jkl
|
||||
var=abc:def ghi:jkl
|
||||
----
|
||||
IFS=: ${var+$*}
|
||||
abc
|
||||
def ghi
|
||||
jkl
|
||||
abc
|
||||
def ghi
|
||||
jkl
|
||||
----
|
||||
IFS= ${var-$*}
|
||||
abcdef ghijkl
|
||||
abcdef ghijkl
|
||||
----
|
||||
IFS= ${var=$*}
|
||||
abcdef ghijkl
|
||||
var=abcdef ghijkl
|
||||
abcdef ghijkl
|
||||
var=abcdef ghijkl
|
||||
----
|
||||
IFS= ${var+$*}
|
||||
abcdef ghijkl
|
||||
abcdef ghijkl
|
||||
|
||||
@@ -399,3 +399,4 @@ ${THIS_SH} ./array20.sub
|
||||
${THIS_SH} ./array21.sub
|
||||
${THIS_SH} ./array22.sub
|
||||
${THIS_SH} ./array23.sub
|
||||
${THIS_SH} ./array24.sub
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
set -- "abc" "def ghi" "jkl"
|
||||
A=("$@")
|
||||
|
||||
IFS=':'
|
||||
|
||||
echo 'IFS=: ${var-$*}'
|
||||
unset var; printf '%s\n' ${var-$*}
|
||||
printf '%s\n' ${var-${A[*]}}
|
||||
|
||||
echo "----"
|
||||
echo 'IFS=: ${var=$*}'
|
||||
|
||||
unset var; printf '%s\n' ${var=$*}
|
||||
printf 'var=%s\n' "$var"
|
||||
|
||||
unset var; printf '%s\n' ${var=${A[*]}}
|
||||
printf 'var=%s\n' "$var"
|
||||
|
||||
echo "----"
|
||||
echo 'IFS=: ${var+$*}'
|
||||
|
||||
printf '%s\n' ${var+$*}
|
||||
printf '%s\n' ${var+${A[*]}}
|
||||
|
||||
echo "----"
|
||||
echo 'IFS= ${var-$*}'
|
||||
|
||||
IFS=''
|
||||
unset var; printf '%s\n' ${var-$*}
|
||||
unset var; printf '%s\n' ${var-${A[*]}}
|
||||
|
||||
echo "----"
|
||||
echo 'IFS= ${var=$*}'
|
||||
|
||||
unset var
|
||||
printf '%s\n' ${var=$*}
|
||||
printf 'var=%s\n' "$var"
|
||||
|
||||
unset var
|
||||
printf '%s\n' ${var=${A[*]}}
|
||||
printf 'var=%s\n' "$var"
|
||||
|
||||
echo "----"
|
||||
echo 'IFS= ${var+$*}'
|
||||
|
||||
printf '%s\n' ${var+$*}
|
||||
printf '%s\n' ${var+${A[*]}}
|
||||
+4
-8
@@ -179,7 +179,7 @@ a b
|
||||
<a><b><c><d>
|
||||
<a><b><c><d>
|
||||
<a><b><c d>
|
||||
<a><b><c d>
|
||||
<abc d>
|
||||
<a><b>
|
||||
<a:b>
|
||||
<a><b>
|
||||
@@ -480,10 +480,8 @@ argv[2] = <b>
|
||||
argv[3] = <c>
|
||||
argv[4] = <d>
|
||||
argv[1] = <a b c d>
|
||||
<3>
|
||||
<abc>
|
||||
<def ghi>
|
||||
<jkl>
|
||||
<1>
|
||||
<abcdef ghijkl>
|
||||
<3>
|
||||
<abc>
|
||||
<def ghi>
|
||||
@@ -491,9 +489,7 @@ argv[1] = <a b c d>
|
||||
<abc>
|
||||
<def ghi>
|
||||
<jkl>
|
||||
<abc>
|
||||
<def ghi>
|
||||
<jkl>
|
||||
<abcdef ghijkl>
|
||||
<abcdef ghijkl>
|
||||
<abc>
|
||||
<def ghi>
|
||||
|
||||
+1
-5
@@ -210,13 +210,11 @@ argv[1] = <correct>
|
||||
argv[2] = <a>
|
||||
argv[1] = <correct>
|
||||
argv[2] = <a>
|
||||
./exp7.sub: line 5: INFORM: dequote_string: string with bare CTLESC
|
||||
argv[1] = <^A>
|
||||
argv[1] = <3>
|
||||
argv[2] = <^C>
|
||||
argv[3] = <^C>
|
||||
argv[4] = <^C>
|
||||
./exp7.sub: line 10: INFORM: dequote_string: string with bare CTLESC
|
||||
argv[1] = <^A>
|
||||
argv[1] = <x^Ay^?z>
|
||||
argv[1] = <x^Ay^?z>
|
||||
@@ -293,9 +291,7 @@ var=abc:def ghi:jkl
|
||||
abcdef ghijkl
|
||||
abcdef ghijkl
|
||||
abcdef ghijkl
|
||||
abc
|
||||
def ghi
|
||||
jkl
|
||||
abcdef ghijkl
|
||||
abcdef ghijkl
|
||||
abcdef ghijkl
|
||||
abcdef ghijkl
|
||||
|
||||
@@ -451,11 +451,7 @@ initialize_shell_variables (env, privmode)
|
||||
|
||||
/* Now make our own defaults in case the vars that we think are
|
||||
important are missing. */
|
||||
#if defined (STATIC_PATH_VALUE)
|
||||
temp_var = bind_variable ("PATH", STATIC_PATH_VALUE, 0);
|
||||
#else
|
||||
temp_var = set_if_not ("PATH", DEFAULT_PATH_VALUE);
|
||||
#endif
|
||||
temp_var = set_if_not ("TERM", "dumb");
|
||||
|
||||
#if defined (__QNX__)
|
||||
|
||||
Reference in New Issue
Block a user