X-Git-Url: http://git.maemo.org/git/?p=samba;a=blobdiff_plain;f=debian%2Fpanic-action;fp=debian%2Fpanic-action;h=bc2dff2108316b1f921c11c5c2e19be923c55ca1;hp=0000000000000000000000000000000000000000;hb=6bca4ca307d55b6dc888e56cee47aebcddbce786;hpb=7fd70fa738b636089bcc6c961aa3eaa02f20dda2 diff --git a/debian/panic-action b/debian/panic-action new file mode 100644 index 0000000..bc2dff2 --- /dev/null +++ b/debian/panic-action @@ -0,0 +1,53 @@ +#!/bin/sh + +type mail >/dev/null 2>&1 || exit 0 + +# Redirect all output to our mail command +( + # We must be given a pid to look at + if [ -z "$1" ]; then + echo "$0 called with no arguments." + exit 1 + fi + + if [ ! -d "/proc/$1" ]; then + echo "$0: No such process: $1" + exit 1 + fi + + # Find out what binary we're debugging + BINARYNAME=`readlink "/proc/$1/exe"` + + # Generic header for our email + echo "The Samba 'panic action' script, $0," + echo "was called for pid $1 ($BINARYNAME)." + echo + + if [ -z "$BINARYNAME" ]; then + echo "This means there was a problem with the program, such as a segfault." + echo "However, the executable could not be found for process $1." + echo "It may have died unexpectedly, or you may not have permission to" + echo "debug the process." + exit 1 + fi + + # No debugger + if [ ! -x /usr/bin/gdb ]; then + echo "This means there was a problem with the program, such as a segfault." + echo "However, gdb was not found on your system, so the error could not be" + echo "debugged. Please install the gdb package so that debugging information is" + echo "available the next time such a problem occurs." + exit 1 + fi + + echo "Below is a backtrace for this process generated with gdb, which shows" + echo "the state of the program at the time the error occurred. " + echo + echo "If the problem persists, you are encouraged to first install the " + echo "samba-dbg package which contains the debugging symbols for samba " + echo "binaries. Then, submit the provided information as a bug report to Ubuntu." + echo "For information about the procedure for submitting bug reports, please" + echo "see http://www.ubuntulinux.org/support/bugs/document_view" + echo + gdb -x /etc/samba/gdbcommands -batch "$BINARYNAME" "$1" +) | mail -s "Segfault in Samba" root