1 |
commit: 0a2371efbe94fb1b410c0afd49bb1bb640d36a9e |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 22 19:09:29 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 8 07:35:26 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a2371ef |
7 |
|
8 |
cvs.eclass: Replace unnecessary eval with bash arrays |
9 |
|
10 |
Replace the eval used to pass quoted password in with simpler and safer |
11 |
bash arrays. Using eval is strongly discouraged as it is error-prone |
12 |
and confusing. |
13 |
|
14 |
eclass/cvs.eclass | 28 ++++++++++++++-------------- |
15 |
1 file changed, 14 insertions(+), 14 deletions(-) |
16 |
|
17 |
diff --git a/eclass/cvs.eclass b/eclass/cvs.eclass |
18 |
index 6d1adea11a4..e2121f4724f 100644 |
19 |
--- a/eclass/cvs.eclass |
20 |
+++ b/eclass/cvs.eclass |
21 |
@@ -1,4 +1,4 @@ |
22 |
-# Copyright 1999-2015 Gentoo Foundation |
23 |
+# Copyright 1999-2017 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
|
26 |
# @ECLASS: cvs.eclass |
27 |
@@ -352,22 +352,22 @@ cvs_fetch() { |
28 |
fi |
29 |
|
30 |
# Commands to run |
31 |
- cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login" |
32 |
- cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}" |
33 |
- cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" |
34 |
+ cmdlogin=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_pass}" login ) |
35 |
+ cmdupdate=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME} ) |
36 |
+ cmdcheckout=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE} ) |
37 |
|
38 |
# Execute commands |
39 |
|
40 |
cd "${ECVS_TOP_DIR}" |
41 |
if [[ ${ECVS_AUTH} == "pserver" ]] ; then |
42 |
- einfo "Running ${cmdlogin}" |
43 |
- eval ${cmdlogin} || die "cvs login command failed" |
44 |
+ einfo "Running ${cmdlogin[*]}" |
45 |
+ "${cmdlogin[@]}" || die "cvs login command failed" |
46 |
if [[ ${mode} == "update" ]] ; then |
47 |
- einfo "Running ${cmdupdate}" |
48 |
- eval ${cmdupdate} || die "cvs update command failed" |
49 |
+ einfo "Running ${cmdupdate[*]}" |
50 |
+ "${cmdupdate[@]}" || die "cvs update command failed" |
51 |
elif [[ ${mode} == "checkout" ]] ; then |
52 |
- einfo "Running ${cmdcheckout}" |
53 |
- eval ${cmdcheckout} || die "cvs checkout command failed" |
54 |
+ einfo "Running ${cmdcheckout[*]}" |
55 |
+ "${cmdcheckout[@]}" || die "cvs checkout command failed" |
56 |
fi |
57 |
elif [[ ${ECVS_AUTH} == "ext" || ${ECVS_AUTH} == "no" ]] ; then |
58 |
# Hack to support SSH password authentication |
59 |
@@ -461,11 +461,11 @@ EOF |
60 |
fi |
61 |
|
62 |
if [[ ${mode} == "update" ]] ; then |
63 |
- einfo "Running ${cmdupdate}" |
64 |
- eval ${cmdupdate} || die "cvs update command failed" |
65 |
+ einfo "Running ${cmdupdate[*]}" |
66 |
+ "${cmdupdate[@]}" || die "cvs update command failed" |
67 |
elif [[ ${mode} == "checkout" ]] ; then |
68 |
- einfo "Running ${cmdcheckout}" |
69 |
- eval ${cmdcheckout} || die "cvs checkout command failed" |
70 |
+ einfo "Running ${cmdcheckout[*]}" |
71 |
+ "${cmdcheckout[@]}" || die "cvs checkout command failed" |
72 |
fi |
73 |
|
74 |
# Restore environment variable values |