]>
git.ipfire.org Git - thirdparty/bash.git/blob - support/bashbug.sh
3 # bashbug - create a bug report and mail it to the bug address
5 # The bug address depends on the release status of the shell. Versions
6 # with status `alpha' or `beta' mail bug reports to chet@po.cwru.edu.
7 # Other versions send mail to bug-bash@gnu.org.
9 # configuration section:
10 # these variables are filled in by the make target in cpp-Makefile
17 PATCHLEVEL
="!PATCHLEVEL!"
18 RELSTATUS
="!RELSTATUS!"
21 PATH
=/bin
:/usr
/bin
:/usr
/local
/bin
:$PATH
24 # If the OS supplies a program to make temp files with semi-random names,
27 for d
in /bin
/usr
/bin
/usr
/local
/bin
; do
28 if [ -x $d/mktemp
]; then
29 TEMP
=`$d/mktemp -t bbug ` ; break;
30 elif [ -x $d/tempfile
]; then
31 TEMP
=` $d/tempfile --prefix bbug --mode 600 `; break
35 USAGE
="Usage: $0 [--help] [--version] [bug-report-email-address]"
36 VERSTR
="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}"
40 while [ $# -gt 0 ]; do
42 --help) shift ; do_help
=y
;;
43 --version) shift ; do_version
=y
;;
45 -*) echo "bashbug: ${1}: invalid option" >&2
52 if [ -n "$do_version" ]; then
57 if [ -n "$do_help" ]; then
62 Bashbug is used to send mail to the Bash maintainers
63 for when Bash doesn't behave like you'd like, or expect.
65 Bashbug will start up your editor (as defined by the shell's
66 EDITOR environment variable) with a preformatted bug report
67 template for you to fill in. The report will be mailed to the
68 bash maintainers by default. See the manual for details.
70 If you invoke bashbug by accident, just quit your editor without
71 saving any changes to the template, and no bug report will be sent.
76 # Figure out how to echo a string without a trailing newline
83 BASHTESTERS
="bash-testers@po.cwru.edu"
86 alpha
*|beta
*|devel
*) BUGBASH
=chet@po.cwru.edu
;;
87 *) BUGBASH
=bug-bash@gnu.org
;;
92 echo "$0: This is a testing release. Would you like your bug report"
93 echo "$0: to be sent to the bash-testers mailing list?"
94 echo $n "$0: Send to bash-testers? $c"
97 y
*|Y
*) BUGBASH
="${BUGBASH},${BASHTESTERS}" ;;
101 BUGADDR
="${1-$BUGBASH}"
103 if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
104 if [ -x /usr
/bin
/editor
]; then
106 elif [ -x /usr
/local
/bin
/ce
]; then
108 elif [ -x /usr
/local
/bin
/emacs
]; then
110 elif [ -x /usr
/contrib
/bin
/emacs
]; then
112 elif [ -x /usr
/bin
/emacs
]; then
114 elif [ -x /usr
/bin
/xemacs
]; then
116 elif [ -x /usr
/contrib
/bin
/jove
]; then
118 elif [ -x /usr
/local
/bin
/jove
]; then
120 elif [ -x /usr
/bin
/vi
]; then
123 echo "$0: No default editor found: attempting to use vi" >&2
129 : ${EDITOR=$DEFEDITOR}
131 : ${USER=${LOGNAME-`whoami`}}
133 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
134 trap 'rm -f $TEMP $TEMP.x' 0
137 if (uname
) >/dev
/null
2>&1; then
141 if [ -f /usr
/lib
/sendmail
] ; then
142 RMAIL
="/usr/lib/sendmail"
144 elif [ -f /usr
/sbin
/sendmail
] ; then
145 RMAIL
="/usr/sbin/sendmail"
158 Subject: [50 character or so descriptive subject here (for reference)]
160 Configuration Information [Automatically generated, do not change]:
164 Compilation CFLAGS: $CFLAGS
166 Machine Type: $MACHTYPE
168 Bash Version: $RELEASE
169 Patch Level: $PATCHLEVEL
170 Release Status: $RELSTATUS
173 [Detailed description of the problem, suggestion, or complaint.]
176 [Describe the sequence of events that causes the problem
180 [Description of how to fix the problem. If you don't know a
181 fix for the problem, don't include this section.]
184 # this is still raceable
189 trap '' 2 # ignore interrupts while in editor
191 until $EDITOR $TEMP; do
192 echo "$0: editor \`$EDITOR' exited with nonzero status."
193 echo "$0: Perhaps it was interrupted."
194 echo "$0: Type \`y' to give up, and lose your bug report;"
195 echo "$0: type \`n' to re-enter the editor."
196 echo $n "$0: Do you want to give up? $c"
204 trap 'rm -f $TEMP $TEMP.x; exit 1' 2 # restore trap on SIGINT
206 if cmp -s $TEMP $TEMP.x
208 echo "File not changed, no bug report submitted."
212 echo $n "Send bug report? [y/n] $c"
218 ${RMAIL} $SMARGS < $TEMP ||
{
219 cat $TEMP >> $HOME/dead.bashbug
220 echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2