Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Nov 2013 17:18:40 -0700
From:      Benjamin Lee <ben@b1c1l1.com>
To:        Colin Percival <cperciva@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Automated submission of kernel panic reports
Message-ID:  <20131102171840.4505cb02@b1c1l1.com>
In-Reply-To: <526F8EB3.1040205@freebsd.org>
References:  <526F8EB3.1040205@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/sWu=gIRINNgEnv.Emfppnvg
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Tue, 29 Oct 2013 03:32:19 -0700, Colin Percival <cperciva@freebsd.org> w=
rote:
> Hi all,
>=20
> I've written some code for automatically submitting kernel panic reports,
> and I'd like some feedback before I place it into the ports tree.

Just a style question, any reason not to place the file names into
variables?  Something like:

--- panicmail.orig      2013-11-02 16:47:42.117858435 -0700
+++ panicmail   2013-11-02 17:06:15.388951568 -0700
@@ -38,19 +38,23 @@
 panicmail_gather()
 {
        local tmpfile=3D`mktemp` || exit 1
+       local kernel_file=3D`sysctl -n kern.bootfile` || exit 1
+       local info_file=3D"${dumpdir}/info.$1"
+       local vmcore_file=3D"${dumpdir}/vmcore.$1"
+       local panicmail_file=3D"${dumpdir}/panicmail.$1"
=20
        # We want the dump header.
-       cat "${dumpdir}/info.$1" > "${dumpdir}/panicmail.$1"
-       echo >> "${dumpdir}/panicmail.$1"
+       cat "${info_file}" > "${panicmail_file}"
+       echo >> "${panicmail_file}"
=20
        # 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 "Backtrace:" >> "${panicmail_file}"
        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"
+       kgdb -q "${kernel_file}" "${vmcore_file}" \
+           < ${tmpfile} >> "${panicmail_file}" 2> /dev/null
+       echo >> "${panicmail_file}"
        rm ${tmpfile}
 }
=20


--=20
Benjamin Lee
http://www.b1c1l1.com/

--Sig_/sWu=gIRINNgEnv.Emfppnvg
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJSdZZjAAoJEIdV4+NBZRmFQwwP/RdXWHiBst38Ir2vJ8LErOMl
BPNaWUez7QP/UXvTtThNFgTngPFnetbDxh0leMiT7+RnYp1oDkyBtEjAedywbtZN
+BvgMYXkJ2I4IxGrHS07yeVDcNVMo0JmrnPdbvRvAMRducF1cAQ4aCjhlmNSIXaA
uGxrDANNssljxGYsY1aTeGS9PkMfacST7ApQkrrHeMVxdQe8FmMdi9+GxiTcBfac
gJWLSUi6sRUxAjko9lxKXm1v2LhjalPgPAC9RJIHkGMbV6f521MVy3Bz3pCPNBz4
f4TqBW5HGurv8UDCbMJFX7AhL88D/kTbHxHBs905BKA+91OSpfTF1ocBJ9OjmzRU
CyabnFiUNtofAoKRrIJzemptS5E1j3yH8gv3Cw+/dmp5y0fps6i9zilyXl43nxLJ
VgEBJdDUF+jqf2xK7F7pAKIdZuy3aS9beTJHlQt+rnMmJYROXyonuDbtDZOilRDQ
SuZFoZc+YNVmZHK+l4kbgaTQJml8sH5DqjBLNHxD/PylSODRpI5ZgpMPWFPmkCij
YlOcwoZPODDdLc15hxDysgv9/j2MD5SG2B6ItONWaZBe60RbSYdQUjO1fVkLm/cR
I3gHEgQd53C+dpvsSThAKPgt/BnFoUT7SOc1/HR3mlUX47Dl5FNkscpMtsUAG1Ho
3ExHIpF4t9SXsRx69xCp
=WlVA
-----END PGP SIGNATURE-----

--Sig_/sWu=gIRINNgEnv.Emfppnvg--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131102171840.4505cb02>