On Wed, Sep 1, 2021 at 2:56 PM Coiby Xu <coxu(a)redhat.com> wrote:
On Thu, Aug 19, 2021 at 07:39:06PM +0800, Kairui Song wrote:
>For loops over find output are fragile, use a while read loop:
>https://github.com/koalaman/shellcheck/wiki/SC2044
>
>Signed-off-by: Kairui Song <kasong(a)redhat.com>
>---
> kdumpctl | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/kdumpctl b/kdumpctl
>index 82010fd7..548054bd 100755
>--- a/kdumpctl
>+++ b/kdumpctl
>@@ -944,12 +944,12 @@ selinux_relabel()
> return
> fi
>
>- for _i in $(find $_path); do
>- _attr=$(getfattr -m "security.selinux" $_i 2>/dev/null)
>+ while read -r _i; do
>+ _attr=$(getfattr -m "security.selinux" "$_i"
2>/dev/null)
> if [ -z "$_attr" ]; then
>- restorecon $_i;
>+ restorecon "$_i";
> fi
>- done
>+ done <<< "$(find "$_path")"
> }
I notice your solution is different from what's given in SC2044. Out of
curiosity, I find your solution couldn't address the case where there is
line break in the filename. Btw, I create line break in the filename by
typing "Alt+Enter" in zsh.
Thanks, I thought this way makes it looks cleaner, I'll update this
part to cover this case.
>
> check_fence_kdump_config()
>--
>2.31.1
>_______________________________________________
>kexec mailing list -- kexec(a)lists.fedoraproject.org
>To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
>Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
>List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
>List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
>Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure
--
Best regards,
Coiby
--
Best Regards,
Kairui Song