4 # File a bug against the Mutt mail user agent.
8 # $Id: muttbug.sh.in,v 3.7 2005/01/09 15:35:51 roessler Exp $
12 # Copyright (c) 2000 Thomas Roessler <roessler@guug.de>
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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
30 SUBMIT="mutt-ng-devel@lists.berlios.de"
31 DEBIAN_SUBMIT="submit@bugs.debian.org"
37 sysconfdir=@sysconfdir@
38 pkgdatadir=@pkgdatadir@
44 sed -e 's/^-/- -/' $1 | egrep -v '^[ ]*(#|$)'
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/'`"
104 echo "Please enter your e-mail address [$EMAIL]:"
108 if test -n "$EMAILTMP" ; then
112 echo "Please enter a one-line description of the problem you experience:"
117 What should the severity for this bug report be?
119 0) Feature request, or maybe a bug which is very difficult to
120 fix due to major design considerations.
122 1) The package fails to perform correctly in some conditions,
123 or on some systems, or fails to comply with current policy
124 documents. Most bugs are in this category.
126 2) This bug makes this version of the package unsuitable for
129 3) Dangerous bug. Makes the package in question unusable by
130 anyone or mostly so, or causes data loss, or introduces a
131 security hole allowing access to the accounts of users who
134 4) Critical bug. Makes unrelated software on the system (or
135 the whole system) break, or causes serious data loss, or
136 introduces a security hole on systems where you install the
140 echo $n "Severity? [01234] $c"
143 0|[Ww]) severity=wishlist ;;
144 2|[Ii]) severity=important ;;
145 3|[Gg]) severity=grave ;;
146 4|[Cc]) severity=critical ;;
147 *) severity=normal ;;
150 if test -x $DEBUGGER ; then
151 test -f core && CORE=core
152 echo "If Mutt-ng has crashed, it may have saved some program state in"
153 echo "a file named core. We can include this information with the bug"
154 echo "report if you wish so."
155 echo "Do you want to include information gathered from a core file?"
156 echo "If yes, please enter the path - otherwise just say no: [$CORE]"
159 test "$_CORE" && CORE="$_CORE"
162 echo $n "Do you want to include your personal Mutt-ng configuration files? [Y|n] $c"
165 [nN]*) personal=no ;;
169 echo $n "Do you want to include your system's global Mutt-ng configuration file? [Y|n] $c"
176 if test -f /etc/debian_version ; then
178 echo $n "Checking whether mutt-ng has been installed as a package... $c"
179 DEBIANVERSION="`dpkg -l muttng | grep '^[ih]' | awk '{print $3}'`" 2> /dev/null
180 if test "$DEBIANVERSION" ; then
187 echo $n "File this bug with Debian? [Y|n] $c"
198 if rpm -q mutt > /dev/null 2> /dev/null ; then
199 echo "Mutt seems to come from an RPM package."
200 RPMVERSION="`rpm -q mutt`"
201 RPMPACKAGER="`rpm -q -i muttng | sed -n -e 's/^Packager *: *//p'`"
204 MUTTVERSION="`muttng -v | awk '{print $2 $3; exit; }'`"
205 test "$DPKG" = "yes" && SUBMIT="$SUBMIT, $DEBIAN_SUBMIT"
209 test "$EMAIL" && echo "From: $EMAIL"
210 test "$REPLYTO" && echo "Reply-To: $REPLYTO"
211 test "$ORGANIZATION" && echo "Organization: $ORGANIZATION"
213 echo "Subject: Mutt-ng-$MUTTVERSION: $SUBJECT"
215 test "$EMAIL" && echo "Bcc: ${EMAIL}"
217 echo "Package: muttng"
218 echo "Version: ${DEBIANVERSION-${RPMVERSION-$MUTTVERSION}}"
219 echo "Severity: $severity"
221 echo "-- Please type your report below this line"
226 if test "$DEBIAN" = "yes" ; then
227 echo "Obtaining Debian-specific information..." > /dev/tty
228 bug -p -s dummy muttng < /dev/null 2> /dev/null | \
229 sed -n -e "/^-- System Information/,/^---/p" | \
232 echo "-- System Information"
233 echo "System Version: `uname -a`"
234 test -z "$RPMPACKAGER" || echo "RPM Packager: $RPMPACKAGER";
235 test -f /etc/redhat-release && echo "RedHat Release: `cat /etc/redhat-release`"
236 test -f /etc/SuSE-release && echo "SuSE Release: `sed 1q /etc/SuSE-release`"
237 # Please provide more of these if you have any.
241 echo "-- Build environment information"
243 echo "(Note: This is the build environment installed on the system"
244 echo "muttbug is run on. Information may or may not match the environment"
245 echo "used to build mutt.)"
247 echo "- gcc version information"
256 echo "-- Mutt-ng Version Information"
260 if test "$CORE" && test -f "$CORE" ; then
262 echo "-- Core Dump Analysis Output"
266 *sdb) debug_sdb $CORE ;;
267 *dbx) debug_dbx $CORE ;;
268 *gdb) debug_gdb $CORE ;;
274 if test "$personal" = "yes" ; then
275 CANDIDATES=".muttngrc-${MUTTVERSION} .muttngrc .muttng/muttngrc-${MUTTVERSION} .muttng/muttngrc"
277 for f in $CANDIDATES; do
278 if test -f "${HOME}/$f" ; then
284 if test "$MATCHED" = "none" ; then
285 echo "Warning: Can't find your personal .muttngrc." >&2
287 include_file $MATCHED
292 if test "$global" = "yes" ; then
293 CANDIDATES="Muttngrc-${MUTTVERSION} Muttngrc"
294 DIRECTORIES="$sysconfdir $pkgdatadir"
296 for d in $DIRECTORIES ; do
297 for f in $CANDIDATES; do
298 if test -f $d/$f ; then
303 test "$MATCHED" = "none" || break
306 if test "$MATCHED" = "none" ; then
307 echo "Warning: Can't find global Muttngrc." >&2
309 include_file $MATCHED
315 cp $TEMPLATE $SCRATCH/mutt-bug.txt
319 if test "$input" = "e" ; then
320 ${VISUAL-${EDITOR-vi}} $SCRATCH/mutt-bug.txt
321 if cmp $SCRATCH/mutt-bug.txt ${TEMPLATE} > /dev/null ; then
322 echo "Warning: Bug report was not modified!"
326 echo $n "Submit, Edit, View, Quit? [S|e|v|q] $c"
328 input="`echo $_input | tr EVSQ evsq`"
331 v*) ${PAGER-more} $SCRATCH/mutt-bug.txt ;;
332 s*|"") $SENDMAIL -t < $SCRATCH/mutt-bug.txt ; exit ;;