mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-06 10:12:38 +02:00
commit bash-20190215 snapshot
This commit is contained in:
+4
-1
@@ -667,6 +667,9 @@ prependå
|
||||
Ã¥
|
||||
ḅć
|
||||
ḅć
|
||||
HELLO;1 foo;2 foo;
|
||||
PASS;1 foo;2 foo;
|
||||
after: PASS
|
||||
argv[1] = </>
|
||||
argv[1] = </>
|
||||
./new-exp.tests: line 615: ABXD: parameter unset
|
||||
./new-exp.tests: line 618: ABXD: parameter unset
|
||||
|
||||
@@ -604,6 +604,9 @@ ${THIS_SH} ./new-exp10.sub
|
||||
# parameter substring replacement and removal operators with multibyte chars
|
||||
${THIS_SH} ./new-exp11.sub
|
||||
|
||||
# indirect expansion with arrays and local variables
|
||||
${THIS_SH} ./new-exp12.sub
|
||||
|
||||
# problems with stray CTLNUL in bash-4.0-alpha
|
||||
unset a
|
||||
a=/a
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# make sure indirect expansion for arrays uses the closest-scope instance
|
||||
# of the resulting variable name
|
||||
|
||||
array_1=("PASS")
|
||||
array_2=("1 foo" "2 foo")
|
||||
|
||||
unsafe_fn ()
|
||||
{
|
||||
local array_1=('HELLO')
|
||||
local a=("${!1}") b=("${!2}")
|
||||
printf '%s;' "${a[@]}" "${b[@]}"
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
safe_fn ()
|
||||
{
|
||||
local a=("${!1}") b=("${!2}")
|
||||
local array_1=('FAIL')
|
||||
printf '%s;' "${a[@]}" "${b[@]}"
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
unsafe_fn 'array_1[@]' 'array_2[@]'
|
||||
safe_fn 'array_1[@]' 'array_2[@]'
|
||||
|
||||
echo after: ${array_1[@]}
|
||||
Reference in New Issue
Block a user