From 64c9461a9513839bae0b1e30013febc26fad1cec Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz Date: May 15 2020 08:51:13 +0000 Subject: subr/rtl.subr:rtl_set_IFS_nl(): initial implementation. subr/pkg_install.subr:pkgp_install_perms(): use rtl_set_IFS_nl(). subr/rtl_complex.subr:rtl_filter_vars(): use rtl_set_IFS_nl(). --- diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index f869ec5..ee6c783 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -3,9 +3,9 @@ # pkgp_install_perms() { - local _destdir="${1}" _fname="" _ifs_old="${IFS:- }" IFS; - IFS=" -"; for _fname in $(find "${_destdir}" -type d); do + local _destdir="${1}" _fname="" IFS; + rtl_set_IFS_nl; + for _fname in $(find "${_destdir}" -type d); do if ! rtl_fileop chmod 0755 "${_fname}"; then return 1; fi; diff --git a/subr/rtl.subr b/subr/rtl.subr index 103d6d5..b123555 100644 --- a/subr/rtl.subr +++ b/subr/rtl.subr @@ -4,6 +4,8 @@ rtl_basename() { local _fname="${1##*/}"; printf "%s" "${_fname}"; }; rtl_date() { command date "+${1:-${DEFAULT_TIMESTAMP_FMT:-"%Y/%m/%d %H:%M:%S"}}"; }; +rtl_set_IFS_nl() { IFS=" +"; }; rtl_set_var_unsafe() { [ -n "${2}" ] && eval ${1}=\"${2}\" || return 0; }; rtl_test_cmd() { command -v "${1}" >/dev/null; }; rtl_uniq() { if [ "${#}" -gt 0 ]; then printf "%s" "${*}" | sed 's/ /\n/g' | awk '!x[$0]++' | paste -s -d" "; fi; }; diff --git a/subr/rtl_complex.subr b/subr/rtl_complex.subr index 4a05551..cb7c90b 100644 --- a/subr/rtl_complex.subr +++ b/subr/rtl_complex.subr @@ -73,8 +73,9 @@ rtl_export_vars() { }; rtl_filter_vars() { - local _fn="${1}" _fnfl=0 _qchar="" _var_spec="" _vars="" _vname="" IFS=" -"; for _var_spec in $(set); do + local _fn="${1}" _fnfl=0 _qchar="" _var_spec="" _vars="" _vname="" IFS; + rtl_set_IFS_nl; + for _var_spec in $(set); do case "${_qchar}" in "\"") if [ "${_var_spec%\"}" != "${_var_spec}" ]; then _qchar="";