4 # File a bug against the Mutt mail user agent.
12 # Copyright (c) 2000 Thomas Roessler <roessler@does-not-exist.org>
15 # This program is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 SUBMIT="fleas@mutt.org"
31 DEBIAN_SUBMIT="submit@bugs.debian.org"
36 SENDMAIL=/usr/sbin/sendmail
38 pkgdatadir=@pkgdatadir@
44 sed -e '/^[ ]*#/d; /^[ ]*$/d; s/^-/- -/' $1
51 cat << EOF > $SCRATCH/gdb.rc
56 $DEBUGGER -n -x $SCRATCH/gdb.rc -c $CORE mutt
61 cat << EOF > $SCRATCH/dbx.rc
66 $DEBUGGER -s $SCRATCH/dbx.rc mutt $CORE
71 cat << EOF > $SCRATCH/sdb.rc
76 $DEBUGGER mutt $CORE < $SCRATCH/sdb.rc
88 SCRATCH=${TMPDIR-/tmp}/`basename $0`.`hostname`.$$
92 echo "`basename $0`: Can't create temporary directory." >& 2 ;
96 trap "rm -r -f ${SCRATCH} ; trap '' 0 ; exit" 0 1 2
98 TEMPLATE=${SCRATCH}/template.txt
100 if test -z "$EMAIL" ; then
101 EMAIL="`mutt -Q from 2> /dev/null | sed -e 's/^from=.\(.*\).$/\1/'`"
105 while test -z "$EMAILTMP"
107 echo "Please enter your e-mail address [$EMAIL]:"
111 if test -z "$EMAILTMP"; then EMAILTMP="$EMAIL"; fi
113 if ! echo "$EMAILTMP" | grep -q @
115 echo "$EMAILTMP does not appear to be a valid email address"
123 echo "Please enter a one-line description of the problem you experience:"
128 What should the severity for this bug report be?
130 0) Feature request, or maybe a bug which is very difficult to
131 fix due to major design considerations.
133 1) The package fails to perform correctly in some conditions,
134 or on some systems, or fails to comply with current policy
135 documents. Most bugs are in this category.
137 2) This bug makes this version of the package unsuitable for
140 3) Dangerous bug. Makes the package in question unusable by
141 anyone or mostly so, or causes data loss, or introduces a
142 security hole allowing access to the accounts of users who
145 4) Critical bug. Makes unrelated software on the system (or
146 the whole system) break, or causes serious data loss, or
147 introduces a security hole on systems where you install the
151 echo $n "Severity? [01234] $c"
154 0|[Ww]) severity=wishlist ;;
155 2|[Ii]) severity=important ;;
156 3|[Gg]) severity=grave ;;
157 4|[Cc]) severity=critical ;;
158 *) severity=normal ;;
161 if test -x $DEBUGGER ; then
162 test -f core && CORE=core
163 echo "If mutt has crashed, it may have saved some program state in"
164 echo "a file named core. We can include this information with the bug"
165 echo "report if you wish so."
166 echo "Do you want to include information gathered from a core file?"
167 echo "If yes, please enter the path - otherwise just say no: [$CORE]"
170 test "$_CORE" && CORE="$_CORE"
173 echo $n "Do you want to include your personal mutt configuration files? [Y|n] $c"
176 [nN]*) personal=no ;;
180 echo $n "Do you want to include your system's global mutt configuration file? [Y|n] $c"
187 if test -f /etc/debian_version ; then
189 echo $n "Checking whether mutt has been installed as a package... $c"
190 DEBIANVERSION="`dpkg -l mutt | grep '^[ih]' | awk '{print $3}'`" 2> /dev/null
191 if test "$DEBIANVERSION" ; then
198 echo $n "File this bug with Debian? [Y|n] $c"
209 if rpm -q mutt > /dev/null 2> /dev/null ; then
210 echo "Mutt seems to come from an RPM package."
211 RPMVERSION="`rpm -q mutt`"
212 RPMPACKAGER="`rpm -q -i mutt | sed -n -e 's/^Packager *: *//p'`"
215 MUTTVERSION="`mutt -v | awk '{print $2; exit; }'`"
216 test "$DPKG" = "yes" && SUBMIT="$SUBMIT, $DEBIAN_SUBMIT"
220 test "$EMAIL" && echo "From: $EMAIL"
221 test "$REPLYTO" && echo "Reply-To: $REPLYTO"
222 test "$ORGANIZATION" && echo "Organization: $ORGANIZATION"
224 echo "Subject: mutt-$MUTTVERSION: $SUBJECT"
226 test "$EMAIL" && echo "Bcc: ${EMAIL}"
229 echo "Version: ${DEBIANVERSION-${RPMVERSION-$MUTTVERSION}}"
230 echo "Severity: $severity"
232 echo "-- Please type your report below this line"
237 if test "$DEBIAN" = "yes" ; then
238 echo "Obtaining Debian-specific information..." > /dev/tty
239 bug -p -s dummy mutt < /dev/null 2> /dev/null | \
240 sed -n -e "/^-- System Information/,/^---/p" | \
243 echo "-- System Information"
244 echo "System Version: `uname -a`"
245 test -z "$RPMPACKAGER" || echo "RPM Packager: $RPMPACKAGER";
246 test -f /etc/redhat-release && echo "RedHat Release: `cat /etc/redhat-release`"
247 test -f /etc/SuSE-release && echo "SuSE Release: `sed 1q /etc/SuSE-release`"
248 # Please provide more of these if you have any.
252 echo "-- Build environment information"
254 echo "(Note: This is the build environment installed on the system"
255 echo "muttbug is run on. Information may or may not match the environment"
256 echo "used to build mutt.)"
258 echo "- gcc version information"
263 echo -Wall -pedantic -Wno-long-long -Wall -g -O2
267 echo "-- Mutt Version Information"
271 if test "$CORE" && test -f "$CORE" ; then
273 echo "-- Core Dump Analysis Output"
277 *sdb) debug_sdb $CORE ;;
278 *dbx) debug_dbx $CORE ;;
279 *gdb) debug_gdb $CORE ;;
285 if test "$personal" = "yes" ; then
286 CANDIDATES=".muttrc-${MUTTVERSION} .muttrc .mutt/muttrc-${MUTTVERSION} .mutt/muttrc"
288 for f in $CANDIDATES; do
289 if test -f "${HOME}/$f" ; then
295 if test "$MATCHED" = "none" ; then
296 echo "Warning: Can't find your personal .muttrc." >&2
298 include_file $MATCHED
303 if test "$global" = "yes" ; then
304 CANDIDATES="Muttrc-${MUTTVERSION} Muttrc"
305 DIRECTORIES="$sysconfdir $pkgdatadir"
307 for d in $DIRECTORIES ; do
308 for f in $CANDIDATES; do
309 if test -f $d/$f ; then
314 test "$MATCHED" = "none" || break
317 if test "$MATCHED" = "none" ; then
318 echo "Warning: Can't find global Muttrc." >&2
320 include_file $MATCHED
326 cp $TEMPLATE $SCRATCH/mutt-bug.txt
330 if test "$input" = "e" ; then
331 ${VISUAL-${EDITOR-vi}} $SCRATCH/mutt-bug.txt
332 if cmp $SCRATCH/mutt-bug.txt ${TEMPLATE} > /dev/null ; then
333 echo "Warning: Bug report was not modified!"
337 echo $n "Submit, Edit, View, Quit? [S|e|v|q] $c"
339 input="`echo $_input | tr EVSQ evsq`"
342 v*) ${PAGER-more} $SCRATCH/mutt-bug.txt ;;
343 s*|"") $SENDMAIL -t < $SCRATCH/mutt-bug.txt ; exit ;;