]> git.ipfire.org Git - thirdparty/bash.git/blob - support/bashbug.sh
Imported from ../bash-1.14.7.tar.gz.
[thirdparty/bash.git] / support / bashbug.sh
1 #!/bin/sh -
2 #
3 # bashbug - create a bug report and mail it to bug-bash@prep.ai.mit.edu
4 #
5 # configuration section:
6 # these variables are filled in by the make target in cpp-Makefile
7 #
8 MACHINE="@MACHINE@"
9 OS="@OS@"
10 CC="@CC@"
11 CFLAGS="@CFLAGS@"
12 RELEASE="@RELEASE@"
13 PATCHLEVEL="@PATCHLEVEL@"
14
15 PATH=/bin:/usr/bin:usr/local/bin:$PATH
16 export PATH
17
18 TEMP=/tmp/bashbug.$$
19
20 BUGADDR=${1-bug-bash@prep.ai.mit.edu}
21
22 : ${EDITOR=emacs}
23
24 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
25 trap 'rm -f $TEMP $TEMP.x' 0
26
27 UN=
28 if (uname) >/dev/null 2>&1; then
29 UN=`uname -a`
30 fi
31
32 if [ -f /usr/lib/sendmail ] ; then
33 RMAIL="/usr/lib/sendmail"
34 elif [ -f /usr/sbin/sendmail ] ; then
35 RMAIL="/usr/sbin/sendmail"
36 else
37 RMAIL=rmail
38 fi
39
40 cat > $TEMP <<EOF
41 From: ${USER}
42 To: ${BUGADDR}
43 Subject: [50 character or so descriptive subject here (for reference)]
44
45 Configuration Information [Automatically generated, do not change]:
46 Machine: $MACHINE
47 OS: $OS
48 Compiler: $CC
49 Compilation CFLAGS: $CFLAGS
50 uname output: $UN
51
52 Bash Version: $RELEASE
53 Patch Level: $PATCHLEVEL
54
55 Description:
56 [Detailed description of the problem, suggestion, or complaint.]
57
58 Repeat-By:
59 [Describe the sequence of events that causes the problem
60 to occur.]
61
62 Fix:
63 [Description of how to fix the problem. If you don't know a
64 fix for the problem, don't include this section.]
65 EOF
66
67 chmod u+w $TEMP
68 cp $TEMP $TEMP.x
69
70 if $EDITOR $TEMP
71 then
72 if cmp -s $TEMP $TEMP.x
73 then
74 echo "File not changed, no bug report submitted."
75 exit
76 fi
77
78 ${RMAIL} $BUGADDR < $TEMP || {
79 cat $TEMP >> $HOME/dead.bashbug
80 echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2
81 }
82 fi
83
84 exit 0