Add warnings for the use of bash arrays
Currently, we allow the use of bash arrays for some configuration settings. This is undocumented, so I want to remove the support from openrc. The first phase of this removal will be this commit which adds warnings to encourage people not to use bash arrays. X-Gentoo-Bug: 374875 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=374875
This commit is contained in:
parent
5541e5ba24
commit
e3b02abd7a
@ -48,6 +48,9 @@ _get_array()
|
|||||||
if [ -n "${BASH}" ]; then
|
if [ -n "${BASH}" ]; then
|
||||||
case "$(declare -p "$1" 2>/dev/null)" in
|
case "$(declare -p "$1" 2>/dev/null)" in
|
||||||
"declare -a "*)
|
"declare -a "*)
|
||||||
|
ewarn "You are using a bash array for $1."
|
||||||
|
ewarn "This feature will be removed in the future."
|
||||||
|
ewarn "Please see net.example for the correct format for $1."
|
||||||
eval "set -- \"\${$1[@]}\""
|
eval "set -- \"\${$1[@]}\""
|
||||||
for _a; do
|
for _a; do
|
||||||
printf "%s\n" "${_a}"
|
printf "%s\n" "${_a}"
|
||||||
@ -69,6 +72,9 @@ _flatten_array()
|
|||||||
if [ -n "${BASH}" ]; then
|
if [ -n "${BASH}" ]; then
|
||||||
case "$(declare -p "$1" 2>/dev/null)" in
|
case "$(declare -p "$1" 2>/dev/null)" in
|
||||||
"declare -a "*)
|
"declare -a "*)
|
||||||
|
ewarn "You are using a bash array for $1."
|
||||||
|
ewarn "This feature will be removed in the future."
|
||||||
|
ewarn "Please see net.example for the correct format for $1."
|
||||||
eval "set -- \"\${$1[@]}\""
|
eval "set -- \"\${$1[@]}\""
|
||||||
for x; do
|
for x; do
|
||||||
printf "'%s' " "$(printf "$x" | sed "s:':'\\\'':g")"
|
printf "'%s' " "$(printf "$x" | sed "s:':'\\\'':g")"
|
||||||
|
Loading…
Reference in New Issue
Block a user