From eef96e5dbf529343c5d16711a4448a43d249c2dc4d9c837a29549cbafabfba8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= Date: Thu, 25 Nov 2021 21:06:05 +0000 Subject: [PATCH 1/2] - Fix kdumprd location for usrmerge kernels (boo#1190920): * kdump-Remove-unused-KernelPath-name.patch * kdump-Store-kdump-initrd-in-kernel-image-path.patch OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=213 --- kdump-Remove-unused-KernelPath-name.patch | 72 +++++++++++++++++++ ...re-kdump-initrd-in-kernel-image-path.patch | 31 ++++++++ kdump.changes | 7 ++ kdump.spec | 8 ++- 4 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 kdump-Remove-unused-KernelPath-name.patch create mode 100644 kdump-Store-kdump-initrd-in-kernel-image-path.patch diff --git a/kdump-Remove-unused-KernelPath-name.patch b/kdump-Remove-unused-KernelPath-name.patch new file mode 100644 index 0000000..fecee99 --- /dev/null +++ b/kdump-Remove-unused-KernelPath-name.patch @@ -0,0 +1,72 @@ +From: Petr Tesarik +Date: Thu Nov 25 21:39:12 2021 +0100 +Subject: Remove unused KernelPath::name() and KernelPath::m_name +Upstream: merged +Git-commit: fd3168af4ba9fd139a55ade3e50b1ad0e08da746 + +This API does not have any users. Let it RIP. + +Signed-off-by: Petr Tesarik + +diff --git a/kdumptool/kernelpath.cc b/kdumptool/kernelpath.cc +index 5a87aae..fd6565f 100644 +--- a/kdumptool/kernelpath.cc ++++ b/kdumptool/kernelpath.cc +@@ -55,25 +55,19 @@ KernelPath::KernelPath(FilePath const &path) + + FilePath canonical = path.getCanonicalPath(); + m_directory = canonical.dirName(); +- m_name = canonical.baseName(); ++ KString name = canonical.baseName(); + + for (auto const pfx : imageNames(Util::getArch())) { +- if (m_name.startsWith(pfx)) { +- if (m_name.length() == pfx.length()) { +- m_name = pfx; +- break; +- } +- if (m_name[pfx.length()] == '-') { +- m_version.assign(m_name, pfx.length() + 1); +- m_name = pfx; +- break; ++ if (name.startsWith(pfx)) { ++ if (name[pfx.length()] == '-') { ++ m_version.assign(name, pfx.length() + 1); + } ++ break; + } + } + +- Debug::debug()->trace("directory=%s, name=%s, version=%s", +- m_directory.c_str(), m_name.c_str(), +- m_version.c_str()); ++ Debug::debug()->trace("directory=%s, version=%s", ++ m_directory.c_str(), m_version.c_str()); + } + + // ----------------------------------------------------------------------------- +diff --git a/kdumptool/kernelpath.h b/kdumptool/kernelpath.h +index 84cba88..332190b 100644 +--- a/kdumptool/kernelpath.h ++++ b/kdumptool/kernelpath.h +@@ -39,7 +39,6 @@ + class KernelPath { + private: + FilePath m_directory; +- KString m_name; + KString m_version; + + public: +@@ -60,12 +59,6 @@ class KernelPath { + const FilePath& directory() + { return m_directory; } + +- /** +- * @return kernel image name +- */ +- const KString& name() +- { return m_name; } +- + /** + * @return kernel version (may be empty) + */ diff --git a/kdump-Store-kdump-initrd-in-kernel-image-path.patch b/kdump-Store-kdump-initrd-in-kernel-image-path.patch new file mode 100644 index 0000000..d2536f1 --- /dev/null +++ b/kdump-Store-kdump-initrd-in-kernel-image-path.patch @@ -0,0 +1,31 @@ +From: Petr Tesarik +Date: Thu Nov 25 21:40:15 2021 +0100 +Subject: Store kdump initrd in the kernel image path +Upstream: merged +Git-commit: 202eef81d13fb0488f6e462e78ce20841a477c86 + +If the kernel image is a symlink, store the kdump initrd in the +same directory as the symlink. This fixes kdump for usrmerge +kernels, where the kernel image is under /usr. + +Canonical path is still used to get the kernel version. + +References: boo#1190920 +Signed-off-by: Petr Tesarik + +diff --git a/kdumptool/kernelpath.cc b/kdumptool/kernelpath.cc +index fd6565f..180e5e5 100644 +--- a/kdumptool/kernelpath.cc ++++ b/kdumptool/kernelpath.cc +@@ -53,9 +53,8 @@ KernelPath::KernelPath(FilePath const &path) + { + Debug::debug()->trace("KernelPath::KernelPath(%s)", path.c_str()); + +- FilePath canonical = path.getCanonicalPath(); +- m_directory = canonical.dirName(); +- KString name = canonical.baseName(); ++ m_directory = path.dirName(); ++ KString name = path.getCanonicalPath().baseName(); + + for (auto const pfx : imageNames(Util::getArch())) { + if (name.startsWith(pfx)) { diff --git a/kdump.changes b/kdump.changes index 86a7456..0125c1f 100644 --- a/kdump.changes +++ b/kdump.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Nov 25 21:04:51 UTC 2021 - Petr Tesařík + +- Fix kdumprd location for usrmerge kernels (boo#1190920): + * kdump-Remove-unused-KernelPath-name.patch + * kdump-Store-kdump-initrd-in-kernel-image-path.patch + ------------------------------------------------------------------- Fri May 28 10:33:45 UTC 2021 - Petr Tesařík diff --git a/kdump.spec b/kdump.spec index b695308..396e76d 100644 --- a/kdump.spec +++ b/kdump.spec @@ -41,6 +41,8 @@ Patch13: %{name}-do-not-iterate-past-end-of-string.patch Patch14: %{name}-fix-incorrect-exit-code-checking.patch Patch15: %{name}-avoid-endless-loop-on-EAI_AGAIN.patch Patch16: %{name}-install-real-resolv.conf.patch +Patch17: %{name}-Remove-unused-KernelPath-name.patch +Patch18: %{name}-Store-kdump-initrd-in-kernel-image-path.patch BuildRequires: asciidoc BuildRequires: cmake BuildRequires: gcc-c++ @@ -63,7 +65,9 @@ Requires: makedumpfile Requires: openssh # FIXME: use proper Requires(pre/post/preun/...) PreReq: %fillup_prereq -PreReq: /usr/bin/mkdir /usr/bin/rm /usr/bin/touch +PreReq: /usr/bin/mkdir +PreReq: /usr/bin/rm +PreReq: /usr/bin/touch Recommends: cifs-utils Recommends: nfs-client # update should detect the split-off from kexec-tools @@ -101,6 +105,8 @@ after a crash dump has occured. %patch14 -p1 %patch15 -p1 %patch16 -p1 +%patch17 -p1 +%patch18 -p1 %build export CXXFLAGS="%{optflags} -std=c++11" From 0d7b1fc32df4c3ee00a01d12f86d9bfe62b63b4a0dc0297978140dab61804b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= Date: Thu, 25 Nov 2021 21:16:00 +0000 Subject: [PATCH 2/2] - kdump-Store-kdump-initrd-in-kernel-image-path.patch: Fix kdumprd location for usrmerge kernels (boo#1190920). OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=214 --- kdump-Remove-unused-KernelPath-name.patch | 72 ------------------- ...re-kdump-initrd-in-kernel-image-path.patch | 49 +++++++++---- kdump.changes | 5 +- kdump.spec | 4 +- 4 files changed, 39 insertions(+), 91 deletions(-) delete mode 100644 kdump-Remove-unused-KernelPath-name.patch diff --git a/kdump-Remove-unused-KernelPath-name.patch b/kdump-Remove-unused-KernelPath-name.patch deleted file mode 100644 index fecee99..0000000 --- a/kdump-Remove-unused-KernelPath-name.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Petr Tesarik -Date: Thu Nov 25 21:39:12 2021 +0100 -Subject: Remove unused KernelPath::name() and KernelPath::m_name -Upstream: merged -Git-commit: fd3168af4ba9fd139a55ade3e50b1ad0e08da746 - -This API does not have any users. Let it RIP. - -Signed-off-by: Petr Tesarik - -diff --git a/kdumptool/kernelpath.cc b/kdumptool/kernelpath.cc -index 5a87aae..fd6565f 100644 ---- a/kdumptool/kernelpath.cc -+++ b/kdumptool/kernelpath.cc -@@ -55,25 +55,19 @@ KernelPath::KernelPath(FilePath const &path) - - FilePath canonical = path.getCanonicalPath(); - m_directory = canonical.dirName(); -- m_name = canonical.baseName(); -+ KString name = canonical.baseName(); - - for (auto const pfx : imageNames(Util::getArch())) { -- if (m_name.startsWith(pfx)) { -- if (m_name.length() == pfx.length()) { -- m_name = pfx; -- break; -- } -- if (m_name[pfx.length()] == '-') { -- m_version.assign(m_name, pfx.length() + 1); -- m_name = pfx; -- break; -+ if (name.startsWith(pfx)) { -+ if (name[pfx.length()] == '-') { -+ m_version.assign(name, pfx.length() + 1); - } -+ break; - } - } - -- Debug::debug()->trace("directory=%s, name=%s, version=%s", -- m_directory.c_str(), m_name.c_str(), -- m_version.c_str()); -+ Debug::debug()->trace("directory=%s, version=%s", -+ m_directory.c_str(), m_version.c_str()); - } - - // ----------------------------------------------------------------------------- -diff --git a/kdumptool/kernelpath.h b/kdumptool/kernelpath.h -index 84cba88..332190b 100644 ---- a/kdumptool/kernelpath.h -+++ b/kdumptool/kernelpath.h -@@ -39,7 +39,6 @@ - class KernelPath { - private: - FilePath m_directory; -- KString m_name; - KString m_version; - - public: -@@ -60,12 +59,6 @@ class KernelPath { - const FilePath& directory() - { return m_directory; } - -- /** -- * @return kernel image name -- */ -- const KString& name() -- { return m_name; } -- - /** - * @return kernel version (may be empty) - */ diff --git a/kdump-Store-kdump-initrd-in-kernel-image-path.patch b/kdump-Store-kdump-initrd-in-kernel-image-path.patch index d2536f1..f6d7fd9 100644 --- a/kdump-Store-kdump-initrd-in-kernel-image-path.patch +++ b/kdump-Store-kdump-initrd-in-kernel-image-path.patch @@ -13,19 +13,42 @@ Canonical path is still used to get the kernel version. References: boo#1190920 Signed-off-by: Petr Tesarik -diff --git a/kdumptool/kernelpath.cc b/kdumptool/kernelpath.cc -index fd6565f..180e5e5 100644 ---- a/kdumptool/kernelpath.cc -+++ b/kdumptool/kernelpath.cc -@@ -53,9 +53,8 @@ KernelPath::KernelPath(FilePath const &path) +--- + kdumptool/findkernel.cc | 4 +--- + kdumptool/kerneltool.cc | 5 ++--- + 2 files changed, 3 insertions(+), 6 deletions(-) + +--- a/kdumptool/kerneltool.cc ++++ b/kdumptool/kerneltool.cc +@@ -142,7 +142,7 @@ bool KernelTool::stripImageName(const Fi + string &rest) { - Debug::debug()->trace("KernelPath::KernelPath(%s)", path.c_str()); + directory = kernelImage.dirName(); +- KString kernel = kernelImage.baseName(); ++ KString kernel = kernelImage.getCanonicalPath().baseName(); -- FilePath canonical = path.getCanonicalPath(); -- m_directory = canonical.dirName(); -- KString name = canonical.baseName(); -+ m_directory = path.dirName(); -+ KString name = path.getCanonicalPath().baseName(); + list imageNames = KernelTool::imageNames(Util::getArch()); + for (list::const_iterator it = imageNames.begin(); +@@ -470,8 +470,7 @@ Kconfig *KernelTool::retrieveKernelConfi + // at first, search for the config on disk + string dir, stripped; - for (auto const pfx : imageNames(Util::getArch())) { - if (name.startsWith(pfx)) { +- if (KernelTool::stripImageName( +- m_kernel.getCanonicalPath(), dir, stripped)) { ++ if (KernelTool::stripImageName(m_kernel, dir, stripped)) { + FilePath config = dir; + config.appendPath("config-" + stripped); + Debug::debug()->dbg("Trying %s for config", config.c_str()); +--- a/kdumptool/findkernel.cc ++++ b/kdumptool/findkernel.cc +@@ -313,9 +313,7 @@ string FindKernel::findInitrd(const File + // use the resolved name, not the symlink to generate the initrd + FilePath dir; + string stripped; +- KernelTool::stripImageName( +- kernelPath.getCanonicalPath(), dir, stripped +- ); ++ KernelTool::stripImageName(kernelPath, dir, stripped); + + string dash; + if (stripped.size() > 0) { diff --git a/kdump.changes b/kdump.changes index 0125c1f..9d2752f 100644 --- a/kdump.changes +++ b/kdump.changes @@ -1,9 +1,8 @@ ------------------------------------------------------------------- Thu Nov 25 21:04:51 UTC 2021 - Petr Tesařík -- Fix kdumprd location for usrmerge kernels (boo#1190920): - * kdump-Remove-unused-KernelPath-name.patch - * kdump-Store-kdump-initrd-in-kernel-image-path.patch +- kdump-Store-kdump-initrd-in-kernel-image-path.patch: Fix kdumprd + location for usrmerge kernels (boo#1190920). ------------------------------------------------------------------- Fri May 28 10:33:45 UTC 2021 - Petr Tesařík diff --git a/kdump.spec b/kdump.spec index 396e76d..b79d886 100644 --- a/kdump.spec +++ b/kdump.spec @@ -41,8 +41,7 @@ Patch13: %{name}-do-not-iterate-past-end-of-string.patch Patch14: %{name}-fix-incorrect-exit-code-checking.patch Patch15: %{name}-avoid-endless-loop-on-EAI_AGAIN.patch Patch16: %{name}-install-real-resolv.conf.patch -Patch17: %{name}-Remove-unused-KernelPath-name.patch -Patch18: %{name}-Store-kdump-initrd-in-kernel-image-path.patch +Patch17: %{name}-Store-kdump-initrd-in-kernel-image-path.patch BuildRequires: asciidoc BuildRequires: cmake BuildRequires: gcc-c++ @@ -106,7 +105,6 @@ after a crash dump has occured. %patch15 -p1 %patch16 -p1 %patch17 -p1 -%patch18 -p1 %build export CXXFLAGS="%{optflags} -std=c++11"