From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 3 21:30:08 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E24CEADF; Sun, 3 Nov 2013 21:30:08 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A1F52239A; Sun, 3 Nov 2013 21:30:08 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 764AC120206; Sun, 3 Nov 2013 22:29:50 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id 16918CB4E; Sun, 3 Nov 2013 22:29:50 +0100 (CET) Date: Sun, 3 Nov 2013 22:29:50 +0100 From: Jilles Tjoelker To: Colin Percival Subject: Re: Automated submission of kernel panic reports Message-ID: <20131103212950.GA22571@stack.nl> References: <526F8EB3.1040205@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <526F8EB3.1040205@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2013 21:30:09 -0000 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