import kdump-utils-1.0.45-5.el10

cs10 imports/cs10/kdump-utils-1.0.45-5.el10
MSVSphere Packaging Team 3 months ago
parent 18a2dc3722
commit d45ba766fe
Signed by: sys_gitsync
GPG Key ID: B2B0B9F29E528FE8

@ -0,0 +1,115 @@
From 4244c20ba021e8563a9f0bc297060338ed3a1158 Mon Sep 17 00:00:00 2001
From: Coiby Xu <coxu@redhat.com>
Date: Tue, 15 Oct 2024 15:11:48 +0800
Subject: [PATCH 2/2] Allow ssh opts to be processed correctly
Resolves: https://github.com/rhkdump/kdump-utils/issues/46
ssh opts shouldn't be quoted otherwise it will be treated as one
argument. For clarity, also rename ssh_opt to ssh_opts.
Fixes: 7218f584 ("99kdumpbase: fix shellcheck warnings")
Reported-by: Jean-Baptiste Trystram <jbtrystram@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
dracut/99kdumpbase/kdump.sh | 43 +++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 16 deletions(-)
diff --git a/dracut/99kdumpbase/kdump.sh b/dracut/99kdumpbase/kdump.sh
index e35a76d..00a61f9 100755
--- a/dracut/99kdumpbase/kdump.sh
+++ b/dracut/99kdumpbase/kdump.sh
@@ -396,7 +396,7 @@ dump_raw() {
# $2: ssh address in <user>@<host> format
dump_ssh() {
_ret=0
- _ssh_opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
+ _ssh_opts="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
_ssh_dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
if is_ipv6_address "$2"; then
_scp_address=${2%@*}@"[${2#*@}]"
@@ -407,31 +407,37 @@ dump_ssh() {
dinfo "saving to $2:$_ssh_dir"
cat /var/lib/random-seed > /dev/urandom
- ssh -q "$_ssh_opt" "$2" mkdir -p "$_ssh_dir" || return 1
+ # shellcheck disable=SC2086 # ssh_opts needs to be split
+ ssh -q $_ssh_opts "$2" mkdir -p "$_ssh_dir" || return 1
- save_vmcore_dmesg_ssh "$DMESG_COLLECTOR" "$_ssh_dir" "$_ssh_opt" "$2"
+ save_vmcore_dmesg_ssh "$DMESG_COLLECTOR" "$_ssh_dir" "$_ssh_opts" "$2"
dinfo "saving vmcore"
KDUMP_LOG_DEST=$2:$_ssh_dir/
- KDUMP_LOG_OP="scp -q $_ssh_opt '$KDUMP_LOG_FILE' '$_scp_address:$_ssh_dir/'"
+ KDUMP_LOG_OP="scp -q $_ssh_opts '$KDUMP_LOG_FILE' '$_scp_address:$_ssh_dir/'"
- save_opalcore_ssh "$_ssh_dir" "$_ssh_opt" "$2" "$_scp_address"
+ save_opalcore_ssh "$_ssh_dir" "$_ssh_opts" "$2" "$_scp_address"
if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then
- scp -q "$_ssh_opt" /proc/vmcore "$_scp_address:$_ssh_dir/vmcore-incomplete"
+ # shellcheck disable=SC2086 # ssh_opts needs to be split
+ scp -q $_ssh_opts /proc/vmcore "$_scp_address:$_ssh_dir/vmcore-incomplete"
_ret=$?
_vmcore="vmcore"
else
- # shellcheck disable=SC2029
- $CORE_COLLECTOR /proc/vmcore | ssh "$_ssh_opt" "$2" "umask 0077 && dd bs=512 of='$_ssh_dir/vmcore-incomplete'"
+ # shellcheck disable=SC2029,SC2086
+ # - _ssh_opts needs to be split
+ # - _ssh_dir needs to be expanded
+ $CORE_COLLECTOR /proc/vmcore | ssh $_ssh_opts "$2" "umask 0077 && dd bs=512 of='$_ssh_dir/vmcore-incomplete'"
_ret=$?
_vmcore="vmcore.flat"
fi
if [ $_ret -eq 0 ]; then
- # shellcheck disable=SC2029
- ssh "$_ssh_opt" "$2" "mv '$_ssh_dir/vmcore-incomplete' '$_ssh_dir/$_vmcore'"
+ # shellcheck disable=SC2029,SC2086
+ # - _ssh_opts needs to be split
+ # - _ssh_dir needs to be expanded
+ ssh $_ssh_opts "$2" "mv '$_ssh_dir/vmcore-incomplete' '$_ssh_dir/$_vmcore'"
_ret=$?
if [ $_ret -ne 0 ]; then
derror "moving vmcore failed, exitcode:$_ret"
@@ -461,13 +467,16 @@ save_opalcore_ssh() {
dinfo "saving opalcore:$OPALCORE to $3:$1"
- if ! scp "$2" "$OPALCORE" "$4:$1/opalcore-incomplete"; then
+ # shellcheck disable=SC2086 # $2 (_ssh_opts) needs to be split
+ if ! scp $2 "$OPALCORE" "$4:$1/opalcore-incomplete"; then
derror "saving opalcore failed"
return 1
fi
- # shellcheck disable=SC2029
- ssh "$2" "$3" mv "$1/opalcore-incomplete" "$1/opalcore"
+ # shellcheck disable=SC2029,SC2086
+ # - $1 (dump path) needs to be expanded
+ # - $2 (_ssh_opts) needs to be split
+ ssh $2 "$3" mv "$1/opalcore-incomplete" "$1/opalcore"
dinfo "saving opalcore complete"
return 0
}
@@ -478,9 +487,11 @@ save_opalcore_ssh() {
# $4: ssh address in <user>@<host> format
save_vmcore_dmesg_ssh() {
dinfo "saving vmcore-dmesg.txt to $4:$2"
- # shellcheck disable=SC2029
- if "$1" /proc/vmcore | ssh "$3" "$4" "umask 0077 && dd of='$2/vmcore-dmesg-incomplete.txt'"; then
- ssh -q "$3" "$4" mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt"
+ # shellcheck disable=SC2029,SC2086
+ # - $2 (_ssh_dir) needs to be expanded
+ # - $3 (_ssh_opts) needs to be split
+ if "$1" /proc/vmcore | ssh $3 "$4" "umask 0077 && dd of='$2/vmcore-dmesg-incomplete.txt'"; then
+ ssh -q $3 "$4" mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt"
dinfo "saving vmcore-dmesg.txt complete"
else
derror "saving vmcore-dmesg.txt failed"
--
2.47.0

@ -2,7 +2,7 @@
## (rpmautospec version 0.6.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 3;
release_number = 5;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
@ -22,6 +22,9 @@ Source0: https://github.com/rhkdump/kdump-utils/archive/v%{version}/%{name}-%{ve
# Return the correct exit code of rebuild initrd
# Author: Tao Liu <ltao@redhat.com>
Patch1: 0001-Return-the-correct-exit-code-of-rebuild-initrd.patch
# Allow ssh opts to be processed correctly
# Author: Coiby Xu <coxu@redhat.com>
Patch2: 0002-Allow-ssh-opts-to-be-processed-correctly.patch
%ifarch ppc64 ppc64le
Requires(post): servicelog
@ -60,16 +63,8 @@ target.
%post
# don't try to systemctl preset the kdump service for old kexec-tools
#
# when the old kexec-tools gets removed, this trigger will be excuted to
# create a file. So later the posttrans scriptlet will know there is no need to
# systemctl preset the kdump service.
# This solution can be dropped in F41 when we assume no users will use old
# version of kexec-tools.
%define kexec_tools_no_preset %{_localstatedir}/lib/rpm-state/kexec-tools.no-preset
%triggerun -- kexec-tools
touch %{kexec_tools_no_preset}
# kdumpctl will only set up default crashkernel when kdump.service is enabled
%systemd_post kdump.service
touch /etc/kdump.conf
@ -89,14 +84,6 @@ servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh >/de
%systemd_preun kdump.service
%posttrans
# don't try to systemctl preset the kdump service for old kexec-tools
if [[ -f %{kexec_tools_no_preset} ]]; then
# this if branch can be removed in F41 when we assume no users will use the old kexec-tools
rm %{kexec_tools_no_preset}
else
# Initial installation
%systemd_post kdump.service
fi
# Try to reset kernel crashkernel value to new default value or set up
# crasherkernel value for new install
#
@ -104,6 +91,7 @@ fi
# 1. Skip ostree systems as they are not supported.
# 2. For Fedora 36 and RHEL9, "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade;
# For Fedora > 36, "[ $1 == 1 ]" only means install and "[ $1 == 2 ]" means upgrade
# 3. osbuild depends on "kdumpctl _reset-crashkernel-for-installed_kernel" to set up crashkernel
if [ ! -f /run/ostree-booted ] && [ $1 == 1 -o $1 == 2 ]; then
kdumpctl _reset-crashkernel-after-update
:
@ -147,6 +135,12 @@ fi
%changelog
## START: Generated by rpmautospec
* Fri Nov 15 2024 Philipp Rudo <prudo@redhat.com> - 1.0.45-5
- Allow ssh opts to be processed correctly
* Fri Nov 01 2024 Coiby Xu <coxu@redhat.com> - 1.0.45-4
- Set up crashkernel value for osbuild
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.0.45-3
- Bump release for October 2024 mass rebuild:

Loading…
Cancel
Save