From 6c43817d23a940ba030b8eb6c3e929d7d4e40317 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Nov 03 2021 08:10:13 +0000 Subject: kdumpctl: fix fragile loops over find output upstream: fedora resolves: bz2003832 conflict: none commit dfb76467c9d9462e91e4dd8838f461fb7ab2538f Author: Kairui Song Date: Wed Aug 4 16:22:17 2021 +0800 kdumpctl: fix fragile loops over find output For loops over find output are fragile, use a while read loop: https://github.com/koalaman/shellcheck/wiki/SC2044 Signed-off-by: Kairui Song Acked-by: Philipp Rudo --- diff --git a/kdumpctl b/kdumpctl index 1d738e3..4eb3599 100755 --- a/kdumpctl +++ b/kdumpctl @@ -912,12 +912,12 @@ selinux_relabel() return fi - for _i in $(find $_path); do - _attr=$(getfattr -m "security.selinux" $_i 2>/dev/null) + while IFS= read -r -d '' _i; do + _attr=$(getfattr -m "security.selinux" "$_i" 2>/dev/null) if [ -z "$_attr" ]; then - restorecon $_i; + restorecon "$_i"; fi - done + done < <(find "$_path" -print0) } check_fence_kdump_config()