mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 15:43:18 +02:00
commit bash-20160617 snapshot
This commit is contained in:
@@ -11270,3 +11270,26 @@ variables.c
|
||||
assignment on a nameref variable, display a warning and remove the
|
||||
nameref attribute (as bash-4.3 did). Reported by Dan Douglas
|
||||
<ormaaj@gmail.com>
|
||||
|
||||
6/14
|
||||
----
|
||||
test.c
|
||||
- posixtest: handle four-argument case where argv[1] == '(' and
|
||||
argv[4] == ')' by performing two-argument test on $2 and $3. Reported
|
||||
by Joerg Schilling <Joerg.Schilling@fokus.fraunhofer.de>
|
||||
|
||||
6/15
|
||||
----
|
||||
variables.c
|
||||
- sv_ignoreeof: make sure ignoreeof is set only if IGNOREEOF is set and
|
||||
has a value (no `local IGNOREEOF'). Reported by Grisha Levit
|
||||
<grishalevit@gmail.com>
|
||||
- sv_strict_posix: make sure posixly_correct is set only if POSIXLY_CORRECT
|
||||
is set and has a value. Reported by Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
6/16
|
||||
----
|
||||
builtins/declare.def
|
||||
- declare_internal: analogous to 6/12 change; when performing an array
|
||||
subscript assignment on a nameref, display a warning, remove the
|
||||
nameref attribute, and go on
|
||||
|
||||
@@ -1088,6 +1088,7 @@ tests/nameref14.sub f
|
||||
tests/nameref15.sub f
|
||||
tests/nameref16.sub f
|
||||
tests/nameref17.sub f
|
||||
tests/nameref18.sub f
|
||||
tests/nameref.right f
|
||||
tests/new-exp.tests f
|
||||
tests/new-exp1.sub f
|
||||
|
||||
@@ -563,6 +563,21 @@ restart_new_var_name:
|
||||
if (refvar)
|
||||
var = mkglobal ? find_global_variable (nameref_cell (refvar)) : find_variable (nameref_cell (refvar));
|
||||
}
|
||||
#if defined (ARRAY_VARS)
|
||||
/* If we have an array assignment to a nameref, remove the nameref
|
||||
attribute and go on. */
|
||||
else if (var == 0 && offset && array_subscript_assignment)
|
||||
{
|
||||
var = mkglobal ? find_global_variable_noref (name) : find_variable_noref (name);
|
||||
if (var && nameref_p (var))
|
||||
{
|
||||
internal_warning (_("%s: removing nameref attribute"), name);
|
||||
FREE (value_cell (var)); /* XXX - bash-4.3 compat */
|
||||
var_setvalue (var, (char *)NULL);
|
||||
VUNSETATTR (var, att_nameref);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* See if we are trying to set flags or value for an existing nameref
|
||||
that points to a non-existent variable: e.g.,
|
||||
|
||||
@@ -1905,6 +1905,7 @@ make_child (command, async_p)
|
||||
/* If we can't create any children, try to reap some dead ones. */
|
||||
waitchld (-1, 0);
|
||||
|
||||
errno = EAGAIN; /* restore errno */
|
||||
sys_error ("fork: retry");
|
||||
RESET_SIGTERM;
|
||||
|
||||
|
||||
@@ -823,6 +823,13 @@ posixtest ()
|
||||
value = !three_arguments ();
|
||||
break;
|
||||
}
|
||||
else if (argv[pos][0] == '(' && argv[pos][1] == '\0' && argv[argc-1][0] == ')' && argv[argc-1][1] == '\0')
|
||||
{
|
||||
advance (1);
|
||||
value = two_arguments ();
|
||||
pos = argc;
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
value = expr ();
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -17,3 +17,4 @@ A1
|
||||
A2
|
||||
B1
|
||||
B2
|
||||
HI -- 42 -- 0 42
|
||||
|
||||
@@ -18,3 +18,13 @@ echo -e 'A\nB' | while read letter; do
|
||||
done
|
||||
|
||||
rm -f $TMPDIR/outfile
|
||||
|
||||
unset -f myPipefunc
|
||||
myPipefunc()
|
||||
{
|
||||
cat | read var
|
||||
return 42
|
||||
}
|
||||
echo HI | myPipefunc
|
||||
|
||||
echo $var -- $? -- ${PIPESTATUS[@]}
|
||||
|
||||
@@ -320,6 +320,20 @@ declare -n ref="var[@]"
|
||||
./nameref15.sub: line 48: var[@]: bad array subscript
|
||||
declare -n bar="var[@]"
|
||||
./nameref15.sub: line 53: var[@]: bad array subscript
|
||||
declare -n a="b"
|
||||
declare -n b="a[1]"
|
||||
./nameref15.sub: line 61: warning: a: removing nameref attribute
|
||||
declare -a a=([1]="foo")
|
||||
declare -n b="a[1]"
|
||||
./nameref15.sub: line 66: warning: a: removing nameref attribute
|
||||
declare -a a=([1]="foo")
|
||||
declare -n b="a[1]"
|
||||
declare -n n="v"
|
||||
declare -a v=([1]="1")
|
||||
./nameref15.sub: line 82: typeset: n: not found
|
||||
declare -a v=([0]="0" [1]="1")
|
||||
declare -n n="v[1]"
|
||||
declare -a v=([0]="0")
|
||||
declare -n r1="y"
|
||||
declare -n r2="x"
|
||||
./nameref16.sub: line 12: typeset: x: not found
|
||||
@@ -372,3 +386,27 @@ declare -nr foo5
|
||||
declare -r foo5
|
||||
declare -nr foo5
|
||||
declare -r foo5
|
||||
./nameref18.sub: line 2: mapfile: `XXX[0]': not a valid identifier
|
||||
./nameref18.sub: line 3: declare: XXX[0]: not found
|
||||
./nameref18.sub: line 9: `XXX[0]': not a valid identifier
|
||||
./nameref18.sub: line 10: declare: XXX[0]: not found
|
||||
declare -n ref="XXX[0]"
|
||||
declare -a XXX=([0]="4")
|
||||
./nameref18.sub: line 24: `XXX[0]': not a valid identifier
|
||||
declare -n ref="XXX[0]"
|
||||
./nameref18.sub: line 25: declare: XXX[0]: not found
|
||||
./nameref18.sub: line 29: read: `XXX[0]': not a valid identifier
|
||||
./nameref18.sub: line 30: declare: XXX[0]: not found
|
||||
./nameref18.sub: line 35: `XXX[0]': not a valid identifier
|
||||
declare -n ref="XXX[0]"
|
||||
./nameref18.sub: line 38: `XXX[0]': not a valid identifier
|
||||
./nameref18.sub: line 38: declare: XXX[0]: not found
|
||||
declare -n ref="var[123]"
|
||||
./nameref18.sub: line 46: declare: var[123]: not found
|
||||
declare -a var=([123]="")
|
||||
declare -n ref="var[123]"
|
||||
./nameref18.sub: line 50: declare: var[123]: not found
|
||||
declare -a var=([123]="")
|
||||
declare -n ref="var[123]"
|
||||
./nameref18.sub: line 54: declare: var[123]: not found
|
||||
declare -a var=([123]="X")
|
||||
|
||||
+3
-17
@@ -115,20 +115,6 @@ declare -n v=var
|
||||
echo ${!x//c/x}
|
||||
echo ${v//c/x}
|
||||
|
||||
${THIS_SH} ./nameref1.sub
|
||||
${THIS_SH} ./nameref2.sub
|
||||
${THIS_SH} ./nameref3.sub
|
||||
${THIS_SH} ./nameref4.sub
|
||||
${THIS_SH} ./nameref5.sub
|
||||
${THIS_SH} ./nameref6.sub
|
||||
${THIS_SH} ./nameref7.sub
|
||||
${THIS_SH} ./nameref8.sub
|
||||
${THIS_SH} ./nameref9.sub
|
||||
${THIS_SH} ./nameref10.sub
|
||||
${THIS_SH} ./nameref11.sub
|
||||
${THIS_SH} ./nameref12.sub
|
||||
${THIS_SH} ./nameref13.sub
|
||||
${THIS_SH} ./nameref14.sub
|
||||
${THIS_SH} ./nameref15.sub
|
||||
${THIS_SH} ./nameref16.sub
|
||||
${THIS_SH} ./nameref17.sub
|
||||
for testfile in ./nameref[0-9].sub ./nameref[1-9][0-9].sub ; do
|
||||
${THIS_SH} "$testfile"
|
||||
done
|
||||
|
||||
@@ -51,3 +51,38 @@ typeset -n bar
|
||||
bar=var[@]
|
||||
typeset -p bar
|
||||
bar=7
|
||||
|
||||
unset a b
|
||||
unset -n a b
|
||||
|
||||
typeset -n a=b b
|
||||
b=a[1]
|
||||
typeset -p a b
|
||||
a=foo
|
||||
typeset -p a b
|
||||
|
||||
unset a
|
||||
typeset -n a=b
|
||||
declare a=foo
|
||||
typeset -p a b
|
||||
|
||||
unset n v
|
||||
unset -n n v
|
||||
|
||||
v=(0 1)
|
||||
typeset -n n=v
|
||||
unset n[0]
|
||||
typeset -p n v
|
||||
|
||||
unset -n n
|
||||
|
||||
v=(0 1)
|
||||
typeset -n n=v
|
||||
unset -n n
|
||||
typeset -p n v
|
||||
|
||||
v=(0 1)
|
||||
declare -n n=v[1]
|
||||
unset n
|
||||
declare -p n v
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
declare -n ref=XXX[0]
|
||||
mapfile ref <<< $'1\n2'
|
||||
declare -p XXX[0]
|
||||
|
||||
unset -n ref
|
||||
|
||||
declare -n ref=XXX[0]
|
||||
declare -A ref
|
||||
ref[foo]=bar
|
||||
declare -p XXX[0]
|
||||
|
||||
unset -n ref
|
||||
unset XXX
|
||||
|
||||
typeset -n ref=XXX[0]
|
||||
typeset ref=4
|
||||
|
||||
typeset -p ref XXX
|
||||
|
||||
unset -n ref
|
||||
unset XXX
|
||||
|
||||
declare -n ref=XXX[0]
|
||||
ref+=([2]=x)
|
||||
declare -p ref XXX[0]
|
||||
unset -n ref
|
||||
|
||||
declare -n ref=XXX[0]
|
||||
read -a ref <<< "A B C"
|
||||
declare -p XXX[0]
|
||||
unset -n ref
|
||||
|
||||
declare -n ref=XXX[0]
|
||||
unset ref
|
||||
ref=()
|
||||
declare -p ref
|
||||
|
||||
coproc ref { :; }; declare -p ${!ref}
|
||||
wait
|
||||
|
||||
unset -n ref
|
||||
|
||||
declare -n ref=var[123]
|
||||
unset ref
|
||||
declare ref=
|
||||
declare -p ref ${!ref} var
|
||||
|
||||
unset ref
|
||||
declare ref+=
|
||||
declare -p ref ${!ref} var
|
||||
|
||||
declare +t ref
|
||||
ref=X
|
||||
declare -p ref ${!ref} var
|
||||
+15
-13
@@ -2723,17 +2723,16 @@ bind_variable_internal (name, value, table, hflags, aflags)
|
||||
/* declare -n foo=x[2] ; foo=bar */
|
||||
if (valid_array_reference (newval, 0))
|
||||
{
|
||||
tname = array_variable_name (newval, (char **)0, (int *)0);
|
||||
if (tname && (tentry = find_variable_noref (tname)) && nameref_p (tentry))
|
||||
{
|
||||
/* nameref variables can't be arrays */
|
||||
internal_warning (_("%s: removing nameref attribute"), name_cell (tentry));
|
||||
#if 1
|
||||
FREE (value_cell (tentry)); /* XXX - bash-4.3 compat */
|
||||
var_setvalue (tentry, (char *)NULL);
|
||||
#endif
|
||||
VUNSETATTR (tentry, att_nameref);
|
||||
}
|
||||
tname = array_variable_name (newval, (char **)0, (int *)0);
|
||||
if (tname && (tentry = find_variable_noref (tname)) && nameref_p (tentry))
|
||||
{
|
||||
/* nameref variables can't be arrays */
|
||||
internal_warning (_("%s: removing nameref attribute"), name_cell (tentry));
|
||||
FREE (value_cell (tentry)); /* XXX - bash-4.3 compat */
|
||||
var_setvalue (tentry, (char *)NULL);
|
||||
VUNSETATTR (tentry, att_nameref);
|
||||
}
|
||||
free (tname);
|
||||
/* XXX - should it be aflags? */
|
||||
entry = assign_array_element (newval, make_variable_value (entry, value, 0), aflags|ASS_NAMEREF);
|
||||
if (entry == 0)
|
||||
@@ -5399,7 +5398,7 @@ sv_ignoreeof (name)
|
||||
eof_encountered = 0;
|
||||
|
||||
tmp_var = find_variable (name);
|
||||
ignoreeof = tmp_var != 0;
|
||||
ignoreeof = tmp_var && var_isset (tmp_var);
|
||||
temp = tmp_var ? value_cell (tmp_var) : (char *)NULL;
|
||||
if (temp)
|
||||
eof_encountered_limit = (*temp && all_digits (temp)) ? atoi (temp) : 10;
|
||||
@@ -5448,7 +5447,10 @@ void
|
||||
sv_strict_posix (name)
|
||||
char *name;
|
||||
{
|
||||
SET_INT_VAR (name, posixly_correct);
|
||||
SHELL_VAR *var;
|
||||
|
||||
var = find_variable (name);
|
||||
posixly_correct = var && var_isset (var);
|
||||
posix_initialize (posixly_correct);
|
||||
#if defined (READLINE)
|
||||
if (interactive_shell)
|
||||
|
||||
Reference in New Issue
Block a user