@@ -300,11 +300,16 @@ EVENTS
300300 # default toggle: owner filters NOT applied
301301 monitor_scan_owner_filters=" 0"
302302 if [ " ${monitor_scan_owner_filters:- 0} " = " 1" ]; then
303- _owner_filter_args=(" ${ignore_root[@]} " " ${ignore_user[@]} " " ${ignore_group[@]} " )
303+ _owner_filter_args=(
304+ ${ignore_root+" ${ignore_root[@]} " }
305+ ${ignore_user+" ${ignore_user[@]} " }
306+ ${ignore_group+" ${ignore_group[@]} " }
307+ )
304308 fi
309+ # ${arr+"${arr[@]}"} — Bash 4.2-safe empty-array expansion under set -u (centos7)
305310 run find " $tmpfile " -maxdepth 0 -type f \
306311 -size +" ${scan_min_filesize} c" \
307- " ${_owner_filter_args[@]} "
312+ ${_owner_filter_args+ " ${_owner_filter_args[@]} " }
308313 [ " $status " -eq 0 ]
309314 [ " $output " = " $tmpfile " ]
310315 rm -rf " $tmpdir "
@@ -325,11 +330,16 @@ EVENTS
325330 # default toggle off — ignore_root/ignore_user suppressed in monitor
326331 monitor_scan_owner_filters=" 0"
327332 if [ " ${monitor_scan_owner_filters:- 0} " = " 1" ]; then
328- _owner_filter_args=(" ${ignore_root[@]} " " ${ignore_user[@]} " " ${ignore_group[@]} " )
333+ _owner_filter_args=(
334+ ${ignore_root+" ${ignore_root[@]} " }
335+ ${ignore_user+" ${ignore_user[@]} " }
336+ ${ignore_group+" ${ignore_group[@]} " }
337+ )
329338 fi
339+ # ${arr+"${arr[@]}"} — Bash 4.2-safe empty-array expansion under set -u (centos7)
330340 run find " $tmpfile " -maxdepth 0 -type f \
331341 -size +" ${scan_min_filesize} c" \
332- " ${_owner_filter_args[@]} "
342+ ${_owner_filter_args+ " ${_owner_filter_args[@]} " }
333343 [ " $status " -eq 0 ]
334344 [ " $output " = " $tmpfile " ]
335345 rm -rf " $tmpdir "
@@ -349,11 +359,16 @@ EVENTS
349359 # opt-in toggle: owner filters ARE applied (rc3 behavior)
350360 monitor_scan_owner_filters=" 1"
351361 if [ " ${monitor_scan_owner_filters:- 0} " = " 1" ]; then
352- _owner_filter_args=(" ${ignore_root[@]} " " ${ignore_user[@]} " " ${ignore_group[@]} " )
362+ _owner_filter_args=(
363+ ${ignore_root+" ${ignore_root[@]} " }
364+ ${ignore_user+" ${ignore_user[@]} " }
365+ ${ignore_group+" ${ignore_group[@]} " }
366+ )
353367 fi
368+ # ${arr+"${arr[@]}"} — Bash 4.2-safe empty-array expansion under set -u (centos7)
354369 run find " $tmpfile " -maxdepth 0 -type f \
355370 -size +" ${scan_min_filesize} c" \
356- " ${_owner_filter_args[@]} "
371+ ${_owner_filter_args+ " ${_owner_filter_args[@]} " }
357372 # root-owned file excluded by ignore_root=(-not -uid 0 -not -gid 0)
358373 [ " $status " -eq 0 ]
359374 [ -z " $output " ]
@@ -378,15 +393,16 @@ EVENTS
378393 ignore_file_ext=" $ext_file_orig " # restore before any return path
379394 local _owner_filter_args=()
380395 monitor_scan_owner_filters=" 0"
396+ # ${arr+"${arr[@]}"} — Bash 4.2-safe empty-array expansion under set -u (centos7)
381397 # .php is admitted; .log is excluded by ignore_fext_args
382398 run find " $tmpfile_php " -maxdepth 0 -type f \
383399 -size +" ${scan_min_filesize} c" \
384- " ${ignore_fext_args[@]} " " ${_owner_filter_args[@]} "
400+ " ${ignore_fext_args[@]} " ${_owner_filter_args+ " ${_owner_filter_args[@]} " }
385401 [ " $status " -eq 0 ]
386402 [ " $output " = " $tmpfile_php " ]
387403 run find " $tmpfile_log " -maxdepth 0 -type f \
388404 -size +" ${scan_min_filesize} c" \
389- " ${ignore_fext_args[@]} " " ${_owner_filter_args[@]} "
405+ " ${ignore_fext_args[@]} " ${_owner_filter_args+ " ${_owner_filter_args[@]} " }
390406 [ " $status " -eq 0 ]
391407 [ -z " $output " ]
392408 rm -rf " $tmpdir "
0 commit comments