Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Nov 2013 22:29:50 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Colin Percival <cperciva@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Automated submission of kernel panic reports
Message-ID:  <20131103212950.GA22571@stack.nl>
In-Reply-To: <526F8EB3.1040205@freebsd.org>
References:  <526F8EB3.1040205@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 29, 2013 at 03:32:19AM -0700, Colin Percival wrote:
> The code is in
>   http://svnweb.freebsd.org/base/user/cperciva/panicmail/
> and it uses my FreeBSD-base-system-only public-key encryption code:
>   http://svnweb.freebsd.org/base/user/cperciva/pkesh/

Some remarks about panicmail:

> local tmpfile=`mktemp` || exit 1

This kind of thing does not do what you expect. The 'local' utility
returns 0 because it successfully created the local variable, ignoring
the status from the command substitution. Use
  local tmpfile
  tmpfile=`mktemp` || exit 1
in both occurrences.

> # 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):

It looks like the problem is, in fact, that gdb will not read from a
pipe. When the pipe is at EOF, poll() returns POLLHUP status and gdb
aborts with "Hangup detected on fd 0" even though there is unread data
in the kernel buffer.

Earlier kernels incorrectly did not return POLLHUP, hiding the gdb bug.
Some other shells (but not ash-derived ones such as all versions of
FreeBSD sh) provide here-document input as a temporary file, avoiding
the gdb bug.

> return 0;

It would be better style to omit the redundant semicolon here (occurs
several times).

Some remarks about pkesh:

> D=`mktemp -d "${TMP:-/tmp}/pkesh.XXXXXX"`

I think the usual environment variable for the directory for temporary
files is TMPDIR, not TMP.

The rest of the script uses $D mostly unquoted, unlike the change that
was made to panicmail.

-- 
Jilles Tjoelker



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