diff options
author | 2017-12-30 21:09:25 +0000 | |
---|---|---|
committer | 2018-01-02 22:54:55 +0000 | |
commit | b3af201832a0781a907c02976056977e2cbd8219 (patch) | |
tree | f1ed3faab86b1cd566fc96effae052fc0a3b2b2a | |
parent | Fix typo in java-vm module (diff) | |
download | eselect-java-b3af201832a0781a907c02976056977e2cbd8219.tar.gz eselect-java-b3af201832a0781a907c02976056977e2cbd8219.tar.bz2 eselect-java-b3af201832a0781a907c02976056977e2cbd8219.zip |
Fix insufficient quoting in java-vm module
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/modules/java-vm.eselect.in | 24 |
2 files changed, 13 insertions, 12 deletions
@@ -4,6 +4,7 @@ * Fix mkdir die message in java-vm module * Sort java-vm targets in version order rather than alphanumeric * Fix showing and highlighting current ecj + mvn targets (#585224) + * Fix insufficient quoting in java-vm module 0.3.0: diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in index 13da3f1..b9043e6 100644 --- a/src/modules/java-vm.eselect.in +++ b/src/modules/java-vm.eselect.in @@ -33,12 +33,12 @@ describe_show() { do_show() { if [[ ${1} == "system" ]]; then - my_show ${VM_SYSTEM} 'system-vm' + my_show "${VM_SYSTEM}" 'system-vm' elif [[ ${1} == "user" ]]; then - my_show ${VM_USER} 'user-vm' + my_show "${VM_USER}" 'user-vm' else - my_show ${VM_SYSTEM} 'system-vm' - my_show ${VM_USER} 'user-vm' + my_show "${VM_SYSTEM}" 'system-vm' + my_show "${VM_USER}" 'user-vm' fi } @@ -65,11 +65,11 @@ do_list() { if [[ -n ${targets[@]} ]] ; then local i system_name user_name - [[ -L ${VM_SYSTEM} ]] && system_name=$(sym_to_vm ${VM_SYSTEM}) - [[ -L ${VM_USER} ]] && user_name=$(sym_to_vm ${VM_USER}) + [[ -L ${VM_SYSTEM} ]] && system_name=$(sym_to_vm "${VM_SYSTEM}") + [[ -L ${VM_USER} ]] && user_name=$(sym_to_vm "${VM_USER}") for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do - local build_only=$(grep 'BUILD_ONLY' ${VM_CONFIG}/${targets[${i}]} | cut -c 13-16 ) + local build_only=$(grep 'BUILD_ONLY' "${VM_CONFIG}/${targets[${i}]}" | cut -c 13-16 ) local mark="" if [[ "${build_only}" == "TRUE" || "{build_only}" == "true" ]]; then @@ -109,14 +109,14 @@ do_set() { die -q ${usage} elif [[ ${1} == "system" ]]; then - if [[ -w $(dirname ${VM_SYSTEM}) ]]; then - my_set ${VM_SYSTEM} ${2} + if [[ -w ${VM_SYSTEM%/*} ]]; then + my_set "${VM_SYSTEM}" "${2}" else die -q "Sorry, you don't have enough permission to set system" fi elif [[ ${1} == "user" ]]; then if [[ ${UID} != 0 ]]; then - my_set ${VM_USER} ${2} + my_set "${VM_USER}" "${2}" else die -q "Sorry, you cannot set a user vm as root. Set the system vm instead" fi @@ -133,7 +133,7 @@ my_set() { elif [[ -L "${symlink}" ]] ; then set_symlink "${target}" "${symlink}" || die -q "Couldn't set a new symlink" - elif [[ -e "${symlink}" ]] ; then + elif [[ -e ${symlink} ]] ; then die -q "Target file already exists and is not a symlink: ${symlink}" else @@ -149,7 +149,7 @@ set_symlink() { fi if [[ -z ${target} ]] ; then die -q "Target \"${1}\" doesn't appear to be valid!" - elif [[ -d "${VM_BASE}/${target}" ]] ; then + elif [[ -d ${VM_BASE}/${target} ]] ; then local sym_dir=${symlink%/*} mkdir -p "${sym_dir}" || die -q "Could not create ${sym_dir}" ln -snf "${VM_BASE}/${target}" "${symlink}" |