diff --git a/pkg_auto/impl/md5_cache_lib.sh b/pkg_auto/impl/md5_cache_lib.sh index 6c9466d80a..e8ac1531e4 100644 --- a/pkg_auto/impl/md5_cache_lib.sh +++ b/pkg_auto/impl/md5_cache_lib.sh @@ -26,11 +26,13 @@ function evaluate_license_group() { local -a groups_to_process=( "${license_group_name}" ) + local do_process_items while [[ ${#groups_to_process[*]} -gt 0 ]]; do local -n group_ref=${groups_to_process[-1]} unset 'groups_to_process[-1]' local -n group_items_ref=${group_ref[GROUP_ITEMS_IDX]} + do_process_items='' case ${group_ref[GROUP_TYPE_IDX]} in "${GROUP_ALL_OF}") local name=${group_ref[GROUP_USE_IDX]} @@ -50,53 +52,39 @@ function evaluate_license_group() { fi local -i flag_mode=${use_flags_map_ref["${mode}"]} if [[ mode -eq flag_mode ]]; then - local item_var_name - for item_var_name in "${group_items_ref[@]}"; do - local -n item_ref=${item_var_name} - case ${item_ref:0:1} in - 'e') - : # nothing to do here - ;; - 'g') - groups_to_process+=( "${item_ref:2}" ) - ;; - 'l') - used_licenses_ref+=( "${item_ref:2}" ) - ;; - *) - fail "item ${item_ref} is bad" - ;; - esac - unset -n item_ref - done + do_process_items=x fi + else + do_process_items=x fi unset name ;; "${GROUP_ANY_OF}") - local item_var_name - for item_var_name in "${group_items_ref[@]}"; do - local -n item_ref=${item_var_name} - case ${item_ref:0:1} in - 'e') - : # nothing to do here - ;; - 'g') - groups_to_process+=( "${item_ref:2}" ) - ;; - 'l') - used_licenses_ref+=( "${item_ref:2}" ) - ;; - *) - fail "item ${item_ref} is bad" - ;; - esac - unset -n item_ref - done + do_process_items=x ;; esac + if [[ -n ${do_process_items} ]]; then + local item_var_name + for item_var_name in "${group_items_ref[@]}"; do + local -n item_ref=${item_var_name} + case ${item_ref:0:1} in + 'e') + : # nothing to do here + ;; + 'g') + groups_to_process+=( "${item_ref:2}" ) + ;; + 'l') + used_licenses_ref+=( "${item_ref:2}" ) + ;; + *) + fail "item ${item_ref} is bad" + ;; + esac + unset -n item_ref + done + fi unset -n group_items_ref - unset -n group_ref done } diff --git a/pkg_auto/impl/pkg_auto_lib.sh b/pkg_auto/impl/pkg_auto_lib.sh index 50b0a4eb84..d0f5c17c88 100644 --- a/pkg_auto/impl/pkg_auto_lib.sh +++ b/pkg_auto/impl/pkg_auto_lib.sh @@ -2409,7 +2409,7 @@ function kvr_unset() { local name array_name pkg_map_name kv_map_name for name; do local -n reports_ref=${name} - array_name=${reports_ref[KVR_MVMS_IDX]} + array_name=${reports_ref[KVR_MAPS_IDX]} unset -n reports_ref if [[ ${array_name} = 'EMPTY_ARRAY' ]]; then continue