Debian Codegraph @

debian/panic-action

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