commit: 0a2371efbe94fb1b410c0afd49bb1bb640d36a9e Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Wed Feb 22 19:09:29 2017 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Wed Mar 8 07:35:26 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a2371ef
cvs.eclass: Replace unnecessary eval with bash arrays Replace the eval used to pass quoted password in with simpler and safer bash arrays. Using eval is strongly discouraged as it is error-prone and confusing. eclass/cvs.eclass | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/eclass/cvs.eclass b/eclass/cvs.eclass index 6d1adea11a4..e2121f4724f 100644 --- a/eclass/cvs.eclass +++ b/eclass/cvs.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @ECLASS: cvs.eclass @@ -352,22 +352,22 @@ cvs_fetch() { fi # Commands to run - cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login" - cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}" - cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" + cmdlogin=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_pass}" login ) + cmdupdate=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME} ) + cmdcheckout=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE} ) # Execute commands cd "${ECVS_TOP_DIR}" if [[ ${ECVS_AUTH} == "pserver" ]] ; then - einfo "Running ${cmdlogin}" - eval ${cmdlogin} || die "cvs login command failed" + einfo "Running ${cmdlogin[*]}" + "${cmdlogin[@]}" || die "cvs login command failed" if [[ ${mode} == "update" ]] ; then - einfo "Running ${cmdupdate}" - eval ${cmdupdate} || die "cvs update command failed" + einfo "Running ${cmdupdate[*]}" + "${cmdupdate[@]}" || die "cvs update command failed" elif [[ ${mode} == "checkout" ]] ; then - einfo "Running ${cmdcheckout}" - eval ${cmdcheckout} || die "cvs checkout command failed" + einfo "Running ${cmdcheckout[*]}" + "${cmdcheckout[@]}" || die "cvs checkout command failed" fi elif [[ ${ECVS_AUTH} == "ext" || ${ECVS_AUTH} == "no" ]] ; then # Hack to support SSH password authentication @@ -461,11 +461,11 @@ EOF fi if [[ ${mode} == "update" ]] ; then - einfo "Running ${cmdupdate}" - eval ${cmdupdate} || die "cvs update command failed" + einfo "Running ${cmdupdate[*]}" + "${cmdupdate[@]}" || die "cvs update command failed" elif [[ ${mode} == "checkout" ]] ; then - einfo "Running ${cmdcheckout}" - eval ${cmdcheckout} || die "cvs checkout command failed" + einfo "Running ${cmdcheckout[*]}" + "${cmdcheckout[@]}" || die "cvs checkout command failed" fi # Restore environment variable values