Unnamed repository
Go to file
Tao Liu 14205c1d6f kdump-lib.sh: add a config value retrive helper
upstream: fedora
resolves: bz2003832
conflict: none

commit 09ccf88405793220af640c5317cbadb71cf03d36
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Aug 16 23:25:14 2021 +0800

    kdump-lib.sh: add a config value retrive helper
    Add a helper kdump_get_conf_val to replace get_option_value.

    It can help cover more corner cases in the code, like when there are
    multiple spaces in config file, config value separated by a tab,
    heading spaces, or trailing comments.

    And this uses "sed group command" and "sed hold buffer", make it much
    faster than previous `grep <config> | tail -1`.

    This helper is supposed to provide a universal way for kexec-tools
    scripts to read in config value. Currently, different scripts are
    reading the config in many different fragile ways.

    For example, following codes are found in kexec-tools script code base:
      1. grep ^force_rebuild $KDUMP_CONFIG_FILE
	 echo $_force_rebuild | cut -d' '  -f2

      2. grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\  -f2

      3. awk '/^sshkey/ {print $2}' $conf_file

      4. grep ^path $KDUMP_CONFIG_FILE | cut -d' '  -f2-

    1, 2, and 4 will fail if the space is replaced by, e.g. a tab

    1 and 2 might fail if there are multiple spaces between config name
    and config value:
    "kdump_post  /var/crash/scripts/kdump-post.sh"
    A space will be read instead of config value.

    1, 2, 3 will fail if there are space in file path, like:
    "kdump_post /var/crash/scripts dir/kdump-post.sh"

    4 will fail if there are trailing comments:
    "path /var/crash # some comment here"

    And all will fail if there are heading space,
    " path /var/crash"

    And all will most likely cause problems if the config file contains
    the same option more than once.

    And all of them are slower than the new sed call. Old get_option_value
    is also very slow and doesn't handle heading space.

    Although we never claim to support heading space or tailing comments
    before, it's harmless to be more robust on config reading, and many
    conf files in /etc support heading spaces. And have a faster and
    safer config reading helper makes it easier to clean up the code.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:08:50 +08:00
tests Merged update from upstream sources 2020-11-20 12:35:49 +00:00
.editorconfig Add a .editorconfig file 2021-11-03 16:06:56 +08:00
.gitignore RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
60-kdump.install Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable 2021-06-23 09:34:40 +08:00
92-crashkernel.install Add a new hook: 92-crashkernel.install 2021-07-08 15:42:34 +08:00
98-kexec.rules RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
98-kexec.rules.ppc64 Stop reloading kdump service on CPU hotplug event for FADump 2021-05-14 14:27:03 +08:00
README RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
crashkernel-howto.txt Add a crashkernel-howto.txt doc 2021-07-08 15:43:40 +08:00
dracut-early-kdump-module-setup.sh Merged update from upstream sources 2021-01-22 08:12:00 +00:00
dracut-early-kdump.sh Merged update from upstream sources 2021-01-22 08:12:00 +00:00
dracut-fadump-init-fadump.sh fadump-init: clean up mount points properly 2021-07-20 15:43:43 +08:00
dracut-fadump-module-setup.sh fadump: isolate fadump initramfs image within the default one 2021-07-20 15:43:11 +08:00
dracut-kdump-capture.service RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
dracut-kdump-emergency.service Remove the kdump error handler isolation wrapper 2021-06-04 14:29:28 +08:00
dracut-kdump-emergency.target RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
dracut-kdump-error-handler.sh RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
dracut-kdump.sh kdump-lib.sh: add a config format and read helper 2021-11-03 16:08:22 +08:00
dracut-module-setup.sh kdump-lib.sh: add a config value retrive helper 2021-11-03 16:08:50 +08:00
dracut-monitor_dd_progress RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
early-kdump-howto.txt RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
fadump-howto.txt Clear old crashkernl=auto in comment and doc 2021-08-06 01:33:34 +00:00
gating.yaml Add gating.yaml to RHEL-9 kexec-tools 2021-06-08 20:03:41 +08:00
kdump-dep-generator.sh Merged update from upstream sources 2021-01-22 08:12:00 +00:00
kdump-in-cluster-environment.txt RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
kdump-lib-initramfs.sh kdump-lib.sh: add a config format and read helper 2021-11-03 16:08:22 +08:00
kdump-lib.sh kdump-lib.sh: add a config value retrive helper 2021-11-03 16:08:50 +08:00
kdump-logger.sh Merged update from upstream sources 2020-11-20 12:35:49 +00:00
kdump-udev-throttler RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
kdump.conf Merged update from upstream sources 2021-01-22 08:12:00 +00:00
kdump.conf.5 Merged update from upstream sources 2021-01-22 08:12:00 +00:00
kdump.service Merged update from upstream sources 2020-11-05 05:34:29 +00:00
kdump.sysconfig Disable CMA in kdump 2nd kernel 2021-05-14 14:27:03 +08:00
kdump.sysconfig.aarch64 Disable CMA in kdump 2nd kernel 2021-05-14 14:27:03 +08:00
kdump.sysconfig.i386 Disable CMA in kdump 2nd kernel 2021-05-14 14:27:03 +08:00
kdump.sysconfig.ppc64 Disable CMA in kdump 2nd kernel 2021-05-14 14:27:03 +08:00
kdump.sysconfig.ppc64le Disable CMA in kdump 2nd kernel 2021-05-14 14:27:03 +08:00
kdump.sysconfig.s390x kdump.sysconfig.s390: Remove "prot_virt" from kdump kernel cmdline 2021-07-20 17:27:12 +02:00
kdump.sysconfig.x86_64 Revert "Revert "x86_64: enable the kexec file load by default"" 2021-07-14 09:21:57 +08:00
kdumpctl kdump-lib.sh: add a config value retrive helper 2021-11-03 16:08:50 +08:00
kdumpctl.8 kdumpctl: Add kdumpctl reset-crashkernel 2021-07-08 15:42:14 +08:00
kexec-kdump-howto.txt Merged update from upstream sources 2021-01-22 08:12:00 +00:00
kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
kexec-tools-2.0.22-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-5.patch Increase SECTION_MAP_LAST_BIT to 5 2021-06-28 22:05:35 +08:00
kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-making-ELF-dumpfile.patch check for invalid physical address of /proc/kcore when making ELF dumpfile 2021-06-29 13:14:08 +08:00
kexec-tools.spec Remove hard requirement on grubby 2021-10-28 13:26:19 +08:00
live-image-kdump-howto.txt RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00
mkdumprd kdump-lib.sh: add a config format and read helper 2021-11-03 16:08:22 +08:00
mkdumprd.8 Merged update from upstream sources 2020-12-23 10:00:07 +00:00
mkfadumprd fadump: kdumpctl should check the modules used by the fadump initramfs 2021-07-20 15:43:26 +08:00
sources update makedumpfile to v1.6.9 2021-05-14 14:27:03 +08:00
supported-kdump-targets.txt Add file supported-kdump-targets.txt to kexec-tools 2021-09-07 14:32:27 +08:00
zanata-notes.txt RHEL 9.0.0 Alpha bootstrap 2020-10-15 14:45:57 +02:00

README

Adding a patch to kexec-tools
=============================
There is a mailing list kexec@lists.fedoraproject.org where all the dicussion
related to fedora kexec-tools happen. All the patches are posted there for
inclusion and committed to kexec-tools after review.

So if you want your patches to be included in fedora kexec-tools package,
post these to kexec@lists.fedoraproject.org.

One can subscribe to list and browse through archives here.

https://admin.fedoraproject.org/mailman/listinfo/kexec