On Thu, Aug 12, 2021 at 01:47:16PM +0800, Kairui Song wrote:
This mass update is done with the assistant of shellcheck and shfmt.
This patch series fixed most syntax issues found by shellcheck, tons of corner cases and issues are fixed.
Also simplified a lot of code according to suggestions by shellcheck. All related shellcheck warn/error/suggest info links are included in the commit message.
And since shellcheck can help to detect non-POSIX syntax issue in POSIX script (#!/bin/sh), and the code base coding style in kexec-tools package is very messy, this series refactored the code structure in following way:
Now kdumpctl, mkdumprd, mkfadumprd, *-module-setup.sh and kdump-lib.sh is "bash only" script. We rely on bash only syntax heavily, and they will only be used in the first kernel, so just let them leverage bash syntax for better maintainability and better performance.
kdump-lib-initramfs.sh, and dracut-kdump.sh is now POSIX compatible, and will be used in the second kernel.
kdump-lib.sh is still sourced by kdump-lib-initramfs.sh which is used in the second kernel. So I guess kdump-lib-initramfs.sh is not POSIX compatible. Btw, "[PATCH 40/47] kdump-lib.sh: batch update" replace single square bracket with double square brackets which are not POSIX.
This refactor also enables kdump to use dash or busybox, instead of bash in the second kernel, which improves performance and memory usage. Tested with latest dracut on Fedora 34, now "dash" in second kernel works well, it's faster than bash and save a lot of memory.
We may test dash or busybox as default kdump shell in the future for better performance.
Kairui Song (47): Add a .editorconfig file kdump-lib.sh: add a config format and read helper kdump-lib.sh: add a config value retrive helper kdump-lib.sh: use kdump_get_conf_val to read config values kdumpctl: simplify code and fix corner cases using new helper kdumpctl: get rid of a `wc` call kdumpctl: fix fragile loops over find output mkdumprd: use kdump_get_conf_val to read config values mkdumprd: make dracut_args an array again mkdumprd: remove some redundant echo mkdumprd: fix multiple issues with get_ssh_size mkfadumprd: make _dracut_isolate_args an array dracut-module-setup.sh: rework kdump_get_ip_route_field dracut-module-setup.sh: remove an unused variable dracut-module-setup.sh: fix _bondoptions wrong references dracut-module-setup.sh: use "*" to expend array as string dracut-module-setup.sh: fix a ambiguous variable reference dracut-module-setup.sh: fix a loop over ls issue dracut-module-setup.sh: make iscsi check fail early if cd failed bash scripts: remove useless cat bash scripts: get rid of expr and let bash scripts: get rid of unnessary sed calls bash scripts: always use "read -r" bash scripts: use $(...) notation instead of legacy `...` bash scripts: replace '[ ]' with '[[ ]]' for bash scripts bash scripts: fix variable quoting issue bash scripts: fix redundant exit code check bash scripts: declare and assign separately bash scripts: reformat with shfmt Prepare to make kdump-lib-initramfs.sh a POSIX compatible lib Merge kdump-error-handler.sh into kdump.sh kdump-lib-initramfs.sh: move dump raleted functions to kdump.sh dracut-kdump.sh: don't put KDUMP_SCRIPT_DIR in PATH dracut-kdump.sh: remove add_dump_code dracut-kdump.sh: simplify dump_ssh dracut-kdump.sh: POSIX doesn't support pipefail dracut-kdump.sh: make it POSIX compatible dracut-kdump.sh: reformat with shfmt kdump-lib-initramfs.sh: make it POSIX compatible kdump-lib.sh: batch update kdump-lib.sh: fix and simplify get_nmcli_value_by_field kdump-lib.sh: fix word splitting of nmcli params kdump-lib.sh: batch fix issues found with shellcheck kdump-lib.sh: reformat with shfmt kdump-logger.sh: refactor to remove some bash only syntax kdump-logger.sh: make it POSIX compatible mkdumprd: allow using dash
.editorconfig | 32 + dracut-early-kdump-module-setup.sh | 11 +- dracut-kdump-emergency.service | 2 +- dracut-kdump-error-handler.sh | 10 - dracut-kdump.sh | 762 ++++++++++------ dracut-module-setup.sh | 672 +++++++------- kdump-lib-initramfs.sh | 346 ++----- kdump-lib.sh | 1356 +++++++++++++--------------- kdump-logger.sh | 117 +-- kdumpctl | 604 ++++++------- kexec-tools.spec | 2 - mkdumprd | 603 ++++++------- mkfadumprd | 21 +- 13 files changed, 2238 insertions(+), 2300 deletions(-) create mode 100644 .editorconfig delete mode 100755 dracut-kdump-error-handler.sh
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@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