Skip to content

Commit 68b8429

Browse files
committed
Adjust cf-support core dump finding to include more CFEngine binary locations
For example, httpd is outside of /var/cfengine/bin but could still coredump and we want to catch that. (cherry picked from commit 56205a1)
1 parent 7f71367 commit 68b8429

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

misc/cf-support

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ fi
158158
if expr "$_sysctl_kernel_core_pattern" : ".*/systemd-coredump.*" > /dev/null 2>&1; then
159159
echo "Found systemd-coredump used in sysctl kernel.core_pattern \"$_sysctl_kernel_core_pattern\""
160160
echo "Using coredumpctl to analyze CFEngine core dumps"
161-
coredumpctl info /var/cfengine/bin/cf-* 2>/dev/null >> "$_core_log" || true
161+
coredumpctl info /var/cfengine/* 2>/dev/null >> "$_core_log" || true
162162
elif command -v apport-unpack >/dev/null; then
163163
echo "Using apport-unpack to analyze CFEngine core dumps"
164164
# each crash report has a line with ExecutablePath: which tells us if it is a CFEngine core dump
165-
crash_reports=`grep -H "ExecutablePath: /var/cfengine/bin" /var/crash/* | sed "s/:ExecutablePath.*$//"`
165+
crash_reports=`grep -H "ExecutablePath: /var/cfengine" /var/crash/* | sed "s/:ExecutablePath.*$//"`
166166
if [ -n "$crash_reports" ]; then
167167
if ! command -v gdb >/dev/null; then
168168
echo "CFEngine related core dumps were found but gdb is not installed. Please install gdb and retry the cf-support command."
@@ -182,14 +182,14 @@ elif command -v apport-unpack >/dev/null; then
182182
fi
183183
else
184184
if [ "$non_interactive" -eq 0 ]; then
185-
printf "Analyze coredumps found under /var/cfengine/bin? [Y/<enter alternate path>/n]: "
185+
printf "Analyze coredumps found under /var/cfengine? [Y/<enter alternate path>/n]: "
186186
read -r response
187187
fi
188-
response=${response:-/var/cfengine/bin}
188+
response=${response:-/var/cfengine}
189189
if [ "$response" != "n" ]; then
190190
# file command on core files results in lines like the following which we parse for cf-* binaries
191191
# core: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style, from '/var/cfengine/bin/cf-key', real uid: 0, effective uid: 0, realgid: 0, effective gid: 0, execfn: '/var/cfengine/bin/cf-key', platform: 'x86_64'
192-
cf_core_files=`find "$response/." \( -name . -o -prune \) -name 'core*' -type f -exec file {} \; 2>/dev/null | grep "core file" | grep "cf-" | cut -d' ' -f1 | sed 's/:$//'`
192+
cf_core_files=`find "$response/." \( -name . -o -prune \) -name 'core*' -type f -exec file {} \; 2>/dev/null | grep "core file" | cut -d' ' -f1 | sed 's/:$//'`
193193
if [ -n "$cf_core_files" ]; then
194194
if [ "$OS" != "solaris" ]; then
195195
if ! command -v gdb >/dev/null; then

0 commit comments

Comments
 (0)