Date: Sun, 03 Nov 2013 02:15:25 +0100 From: dt71@gmx.com To: Colin Percival <cperciva@freebsd.org>, freebsd-hackers@freebsd.org Subject: Re: Automated submission of kernel panic reports Message-ID: <5275A3AD.2020501@gmx.com> In-Reply-To: <52758C1F.9080601@freebsd.org> References: <526F8EB3.1040205@freebsd.org> <5271A465.2030206@gmx.com> <5275888E.6010806@freebsd.org> <52758BCD.1000307@gmx.com> <52758C1F.9080601@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090203010501040905000505
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Colin Percival wrote, On 11/03/2013 00:34:
> Let me know if you see anything I missed.
Patch 1: mostly bikeshed stuff.
Patch 2: double quote stuff.
I didn't know anything about dump number rotation. How does that work? By default, upon the 11th dump, the bounds file will contain ``0'', but the last dump will be stored at /var/crash/{info,vmcore}.9 ? Because in that case, the ``bounds - 1'' method won't work.
--------------090203010501040905000505
Content-Type: text/x-patch;
name="1_pedantic.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="1_pedantic.patch"
--- panicmail.old 2013-11-03 01:15:03.000000000 +0100
+++ panicmail.mid 2013-11-03 02:05:20.000000000 +0100
@@ -30,7 +30,7 @@
. /etc/rc.subr
name="panicmail"
-rcvar=panicmail_enable
+rcvar="panicmail_enable"
start_cmd="panicmail_run"
stop_cmd=":"
@@ -51,6 +51,8 @@
kgdb -q `sysctl -n kern.bootfile` "${dumpdir}/vmcore.$1" \
< ${tmpfile} >> "${dumpdir}/panicmail.$1" 2> /dev/null
echo >> "${dumpdir}/panicmail.$1"
+
+ # Remove the temporary file.
rm ${tmpfile}
}
@@ -67,7 +69,7 @@
lam -s '|' ${tmpfile} -s '|' >> "${dumpdir}/panicmail.$1.enc"
echo "-----ENCRYPTED FREEBSD PANIC DATA ENDS HERE-----------------------" >> "${dumpdir}/panicmail.$1.enc"
- # Remove temporary file.
+ # Remove the temporary file.
rm ${tmpfile}
}
@@ -97,7 +99,7 @@
${panicmail_sendto};
you should be able to do this by hitting "Reply" in your mail
client and removing everything up to this point.
-
+
EOF
cat "${dumpdir}/panicmail.$1.enc"
}
@@ -124,7 +126,7 @@
# Quit if we have no dumps.
if ! [ -f "${dumpdir}/bounds" ]; then
- return 0;
+ return 0
fi
# If we have info.last, use that to figure out the last dump number.
@@ -132,20 +134,20 @@
nr=`readlink ${dumpdir}/info.last`
nr=${nr##*.}
else
- # Otherwise get the number from bounds.
+ # Otherwise, get the number from bounds.
nr=$((`cat ${dumpdir}/bounds` - 1))
fi
# Make sure the dump actually exists.
if ! [ -f "${dumpdir}/info.${nr}" ] ||
! [ -f "${dumpdir}/vmcore.${nr}" ]; then
- return 0;
+ return 0
fi
# Have we already sent an email about this one? We compare times in
# order to catch the case where dump numbers repeat.
if [ "${dumpdir}/panicmail.${nr}" -nt "${dumpdir}/vmcore.${nr}" ]; then
- return 0;
+ return 0
fi
# Gather information about this panic.
--------------090203010501040905000505
Content-Type: text/x-patch;
name="2_dqingmyassoff.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="2_dqingmyassoff.patch"
--- panicmail.mid 2013-11-03 02:05:20.000000000 +0100
+++ panicmail.new 2013-11-03 02:11:38.000000000 +0100
@@ -46,14 +46,14 @@
# And we want a backtrace (we should be able to pipe the commands
# directly into kgdb, but that doesn't work with our /bin/sh):
echo "Backtrace:" >> "${dumpdir}/panicmail.$1"
- echo bt > ${tmpfile}
- echo quit >> ${tmpfile}
- kgdb -q `sysctl -n kern.bootfile` "${dumpdir}/vmcore.$1" \
- < ${tmpfile} >> "${dumpdir}/panicmail.$1" 2> /dev/null
+ echo bt > "${tmpfile}"
+ echo quit >> "${tmpfile}"
+ kgdb -q "`sysctl -n kern.bootfile`" "${dumpdir}/vmcore.$1" \
+ < "${tmpfile}" >> "${dumpdir}/panicmail.$1" 2> /dev/null
echo >> "${dumpdir}/panicmail.$1"
# Remove the temporary file.
- rm ${tmpfile}
+ rm "${tmpfile}"
}
# Encrypt the information in the panic report.
@@ -62,15 +62,15 @@
local tmpfile=`mktemp` || exit 1
# Encrypt using pkesh.
- /usr/local/bin/pkesh enc "$2" "${dumpdir}/panicmail.$1" ${tmpfile} || exit 1
+ /usr/local/bin/pkesh enc "$2" "${dumpdir}/panicmail.$1" "${tmpfile}" || exit 1
# Add extra armour.
echo "-----ENCRYPTED FREEBSD PANIC DATA STARTS HERE---------------------" > "${dumpdir}/panicmail.$1.enc"
- lam -s '|' ${tmpfile} -s '|' >> "${dumpdir}/panicmail.$1.enc"
+ lam -s '|' "${tmpfile}" -s '|' >> "${dumpdir}/panicmail.$1.enc"
echo "-----ENCRYPTED FREEBSD PANIC DATA ENDS HERE-----------------------" >> "${dumpdir}/panicmail.$1.enc"
# Remove the temporary file.
- rm ${tmpfile}
+ rm "${tmpfile}"
}
# Construct an email destined for root to review and forward.
@@ -131,11 +131,11 @@
# If we have info.last, use that to figure out the last dump number.
if [ -e "${dumpdir}/info.last" ]; then
- nr=`readlink ${dumpdir}/info.last`
+ nr=`readlink "${dumpdir}/info.last"`
nr=${nr##*.}
else
# Otherwise, get the number from bounds.
- nr=$((`cat ${dumpdir}/bounds` - 1))
+ nr=$((`cat "${dumpdir}/bounds"` - 1))
fi
# Make sure the dump actually exists.
@@ -151,16 +151,16 @@
fi
# Gather information about this panic.
- panicmail_gather ${nr}
+ panicmail_gather "${nr}"
# Encrypt the panic information.
- panicmail_encrypt ${nr} "${panicmail_key}"
+ panicmail_encrypt "${nr}" "${panicmail_key}"
# Generate and send an email.
if checkyesno panicmail_autosubmit; then
- panicmail_auto ${nr} | sendmail -t
+ panicmail_auto "${nr}" | sendmail -t
else
- panicmail_root ${nr} | sendmail -t
+ panicmail_root "${nr}" | sendmail -t
fi
}
--------------090203010501040905000505--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5275A3AD.2020501>
