1 |
commit: b3af201832a0781a907c02976056977e2cbd8219 |
2 |
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 30 21:09:25 2017 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 2 22:54:55 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=b3af2018 |
7 |
|
8 |
Fix insufficient quoting in java-vm module |
9 |
|
10 |
NEWS | 1 + |
11 |
src/modules/java-vm.eselect.in | 24 ++++++++++++------------ |
12 |
2 files changed, 13 insertions(+), 12 deletions(-) |
13 |
|
14 |
diff --git a/NEWS b/NEWS |
15 |
index c85ba17..8e0d519 100644 |
16 |
--- a/NEWS |
17 |
+++ b/NEWS |
18 |
@@ -4,6 +4,7 @@ |
19 |
* Fix mkdir die message in java-vm module |
20 |
* Sort java-vm targets in version order rather than alphanumeric |
21 |
* Fix showing and highlighting current ecj + mvn targets (#585224) |
22 |
+ * Fix insufficient quoting in java-vm module |
23 |
|
24 |
0.3.0: |
25 |
|
26 |
|
27 |
diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in |
28 |
index 13da3f1..b9043e6 100644 |
29 |
--- a/src/modules/java-vm.eselect.in |
30 |
+++ b/src/modules/java-vm.eselect.in |
31 |
@@ -33,12 +33,12 @@ describe_show() { |
32 |
|
33 |
do_show() { |
34 |
if [[ ${1} == "system" ]]; then |
35 |
- my_show ${VM_SYSTEM} 'system-vm' |
36 |
+ my_show "${VM_SYSTEM}" 'system-vm' |
37 |
elif [[ ${1} == "user" ]]; then |
38 |
- my_show ${VM_USER} 'user-vm' |
39 |
+ my_show "${VM_USER}" 'user-vm' |
40 |
else |
41 |
- my_show ${VM_SYSTEM} 'system-vm' |
42 |
- my_show ${VM_USER} 'user-vm' |
43 |
+ my_show "${VM_SYSTEM}" 'system-vm' |
44 |
+ my_show "${VM_USER}" 'user-vm' |
45 |
fi |
46 |
} |
47 |
|
48 |
@@ -65,11 +65,11 @@ do_list() { |
49 |
if [[ -n ${targets[@]} ]] ; then |
50 |
local i system_name user_name |
51 |
|
52 |
- [[ -L ${VM_SYSTEM} ]] && system_name=$(sym_to_vm ${VM_SYSTEM}) |
53 |
- [[ -L ${VM_USER} ]] && user_name=$(sym_to_vm ${VM_USER}) |
54 |
+ [[ -L ${VM_SYSTEM} ]] && system_name=$(sym_to_vm "${VM_SYSTEM}") |
55 |
+ [[ -L ${VM_USER} ]] && user_name=$(sym_to_vm "${VM_USER}") |
56 |
|
57 |
for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do |
58 |
- local build_only=$(grep 'BUILD_ONLY' ${VM_CONFIG}/${targets[${i}]} | cut -c 13-16 ) |
59 |
+ local build_only=$(grep 'BUILD_ONLY' "${VM_CONFIG}/${targets[${i}]}" | cut -c 13-16 ) |
60 |
local mark="" |
61 |
|
62 |
if [[ "${build_only}" == "TRUE" || "{build_only}" == "true" ]]; then |
63 |
@@ -109,14 +109,14 @@ do_set() { |
64 |
die -q ${usage} |
65 |
|
66 |
elif [[ ${1} == "system" ]]; then |
67 |
- if [[ -w $(dirname ${VM_SYSTEM}) ]]; then |
68 |
- my_set ${VM_SYSTEM} ${2} |
69 |
+ if [[ -w ${VM_SYSTEM%/*} ]]; then |
70 |
+ my_set "${VM_SYSTEM}" "${2}" |
71 |
else |
72 |
die -q "Sorry, you don't have enough permission to set system" |
73 |
fi |
74 |
elif [[ ${1} == "user" ]]; then |
75 |
if [[ ${UID} != 0 ]]; then |
76 |
- my_set ${VM_USER} ${2} |
77 |
+ my_set "${VM_USER}" "${2}" |
78 |
else |
79 |
die -q "Sorry, you cannot set a user vm as root. Set the system vm instead" |
80 |
fi |
81 |
@@ -133,7 +133,7 @@ my_set() { |
82 |
elif [[ -L "${symlink}" ]] ; then |
83 |
set_symlink "${target}" "${symlink}" || die -q "Couldn't set a new symlink" |
84 |
|
85 |
- elif [[ -e "${symlink}" ]] ; then |
86 |
+ elif [[ -e ${symlink} ]] ; then |
87 |
die -q "Target file already exists and is not a symlink: ${symlink}" |
88 |
|
89 |
else |
90 |
@@ -149,7 +149,7 @@ set_symlink() { |
91 |
fi |
92 |
if [[ -z ${target} ]] ; then |
93 |
die -q "Target \"${1}\" doesn't appear to be valid!" |
94 |
- elif [[ -d "${VM_BASE}/${target}" ]] ; then |
95 |
+ elif [[ -d ${VM_BASE}/${target} ]] ; then |
96 |
local sym_dir=${symlink%/*} |
97 |
mkdir -p "${sym_dir}" || die -q "Could not create ${sym_dir}" |
98 |
ln -snf "${VM_BASE}/${target}" "${symlink}" |