mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 19:20:16 +00:00
fix: safeguard empty array iterations for bash 3.2 compatibility
This commit is contained in:
@@ -135,9 +135,11 @@ scan_installed_apps() {
|
|||||||
) &
|
) &
|
||||||
pids+=($!)
|
pids+=($!)
|
||||||
debug_log "Waiting for ${#pids[@]} background processes: ${pids[*]}"
|
debug_log "Waiting for ${#pids[@]} background processes: ${pids[*]}"
|
||||||
|
if [[ ${#pids[@]} -gt 0 ]]; then
|
||||||
for pid in "${pids[@]}"; do
|
for pid in "${pids[@]}"; do
|
||||||
wait "$pid" 2> /dev/null || true
|
wait "$pid" 2> /dev/null || true
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
debug_log "All background processes completed"
|
debug_log "All background processes completed"
|
||||||
cat "$scan_tmp_dir"/*.txt >> "$installed_bundles" 2> /dev/null || true
|
cat "$scan_tmp_dir"/*.txt >> "$installed_bundles" 2> /dev/null || true
|
||||||
safe_remove "$scan_tmp_dir" true
|
safe_remove "$scan_tmp_dir" true
|
||||||
@@ -279,6 +281,7 @@ clean_orphaned_app_data() {
|
|||||||
for pat in "${pattern_arr[@]}"; do
|
for pat in "${pattern_arr[@]}"; do
|
||||||
file_patterns+=("$base_path/$pat")
|
file_patterns+=("$base_path/$pat")
|
||||||
done
|
done
|
||||||
|
if [[ ${#file_patterns[@]} -gt 0 ]]; then
|
||||||
for item_path in "${file_patterns[@]}"; do
|
for item_path in "${file_patterns[@]}"; do
|
||||||
local iteration_count=0
|
local iteration_count=0
|
||||||
for match in $item_path; do
|
for match in $item_path; do
|
||||||
@@ -302,6 +305,7 @@ clean_orphaned_app_data() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
stop_section_spinner
|
stop_section_spinner
|
||||||
if [[ $orphaned_count -gt 0 ]]; then
|
if [[ $orphaned_count -gt 0 ]]; then
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ is_whitelisted() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${#CURRENT_WHITELIST_PATTERNS[@]} -gt 0 ]]; then
|
||||||
for existing in "${CURRENT_WHITELIST_PATTERNS[@]}"; do
|
for existing in "${CURRENT_WHITELIST_PATTERNS[@]}"; do
|
||||||
local existing_expanded="${existing/#\~/$HOME}"
|
local existing_expanded="${existing/#\~/$HOME}"
|
||||||
# Only use exact string match to prevent glob expansion security issues
|
# Only use exact string match to prevent glob expansion security issues
|
||||||
@@ -255,6 +256,7 @@ is_whitelisted() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user