On Jan 16 2020, Richard Earnshaw (lists) wrote:
> diff --git a/contrib/gcc-git-customization.sh
> b/contrib/gcc-git-customization.sh
> index dae2c35bb57..1cde6fd8224 100755
> --- a/contrib/gcc-git-customization.sh
> +++ b/contrib/gcc-git-customization.sh
> @@ -11,9 +11,9 @@ ask () {
> read answer
> if [ "x$answer" = "x" ]
> then
> - eval $var=$default
> + eval $var=\"$default\"
> else
> - eval $var=$answer
> + eval $var=\"$answer\"
This still isn't the safe way to do indirect assignment. The expansion
of the rhs needs to be delayed, so that the result isn't subject to
further expansions.
Andreas.
Subject: [PATCH] gcc-git-customization.sh: avoid double expansion
---
contrib/gcc-git-customization.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh
index b7e4ce308062..26f4389bcc8a 100755
--- a/contrib/gcc-git-customization.sh
+++ b/contrib/gcc-git-customization.sh
@@ -11,9 +11,9 @@ ask () {
read answer
if [ "x$answer" = "x" ]
then
- eval $var=\"$default\"
+ eval $var=\$default
else
- eval $var=\"$answer\"
+ eval $var=\$answer
fi
}
--
2.25.0
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."