653edd kdump-lib.sh: fix variable quoting issue

Authored and Committed by liutgnu 2 years ago
1 file changed. 67 lines added. 65 lines removed.
    kdump-lib.sh: fix variable quoting issue
    
    upstream: fedora
    resolves: bz2003832
    conflict: none
    
    commit 4f01cb1b0a4e1ea9467e9ace34d14dcb2fbe135a
    Author: Kairui Song <kasong@redhat.com>
    Date:   Mon Sep 13 01:18:04 2021 +0800
    
        kdump-lib.sh: fix variable quoting issue
    
        Fixed quoting issues found by shellcheck, no feature
        change. This should fix many errors when there is space
        in any shell variables.
    
        And fixed how remove_cmdline_param is being called in prepare_cmdline.
        Kernel parameters can have space like: param="spaces in here". So currently
        remove_cmdline_param is broken since its args always get split by space.
        But prepare_cmdline is expecting remove_cmdline_param to split its args
        by space and passing a list of kernel args separated by space as a whole arg.
        So fix that by using `xargs` to parse and split the args properly, then
        call remove_cmdline_param.
    
        Following quoting related issues are fixed (check the link
        for example code and what could go wrong):
    
        https://github.com/koalaman/shellcheck/wiki/SC1007
        https://github.com/koalaman/shellcheck/wiki/SC2046
        https://github.com/koalaman/shellcheck/wiki/SC2053
        https://github.com/koalaman/shellcheck/wiki/SC2060
        https://github.com/koalaman/shellcheck/wiki/SC2068
        https://github.com/koalaman/shellcheck/wiki/SC2086
    
        Signed-off-by: Kairui Song <kasong@redhat.com>
    
    Signed-off-by: Tao Liu <ltao@redhat.com>
    
        
file modified
+67 -65