Debian Codegraph @

debian/panic-action

raw symbols SCIP
1 #!/bin/sh
2
3 # bail out if there's no "mail" command
4 type mail >/dev/null 2>&1 || exit 0
5
6 # Redirect all output to our mail command
7 (
8 # We must be given a pid to look at
9 if [ -z "$1" ]; then
10 echo "$0 called with no arguments."
11 exit 1
12 fi
13
14 if [ ! -d "/proc/$1" ]; then
15 echo "$0: No such process: $1"
16 exit 1
17 fi
18
19 # Find out what binary we're debugging
20 BINARYNAME=`readlink "/proc/$1/exe"`
21
22 # Generic header for our email
23 echo "The Samba 'panic action' script, $0,"
24 echo "was called for PID $1 ($BINARYNAME)."
25 echo
26
27 echo "This means the program found itself in a state from which it could not continue."
28 echo "It could be caused by misconfiguration, a segfault, memory allocation failure,"
29 echo "data corruption, or some other problem."
30
31 if [ -z "$BINARYNAME" ]; then
32 echo "However, the executable could not be found for process $1."
33 echo "It may have died unexpectedly, or this script may not have permission to"
34 echo "debug the process."
35 exit 1
36 fi
37
38 # No debugger
39 if [ ! -x /usr/bin/gdb ]; then
40 echo "However, gdb was not found on your system, so the error could not be"
41 echo "debugged. Please install the gdb package so that debugging information"
42 echo "is available the next time such a problem occurs."
43 exit 1
44 fi
45
46 echo "Below is a backtrace for this process generated with gdb, which shows"
47 echo "the state of the program at the time the error occurred. The Samba log"
48 echo "files should contain additional information about the problem."
49 echo
50 echo "If the problem persists, you are encouraged to first install the"
51 echo "samba-dbgsym package, which contains the debugging symbols for the Samba"
52 echo "binaries. Then submit the provided information as a bug report to"
53 if [ -x "`which lsb_release 2>/dev/null`" ] \
54 && [ "`lsb_release -s -i`" = "Ubuntu" ]
55 then
56 echo "Ubuntu by visiting this link:"
57 echo "https://launchpad.net/ubuntu/+source/samba/+filebug"
58 else
59 echo "Debian. For information about the procedure for submitting bug reports,"
60 echo "please see http://www.debian.org/Bugs/Reporting or the reportbug(1)"
61 echo "manual page."
62 fi
63 echo
64 gdb -x /etc/samba/gdbcommands -batch "$BINARYNAME" "$1"
65 ) | mail -s "Panic or segfault in Samba" root