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 ;;
149 if [ "$severity" != "wishlist" ] ; then
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"
163 echo $n "Do you want to include your personal Mutt-ng configuration files? [Y|n] $c"
166 [nN]*) personal=no ;;
170 echo $n "Do you want to include your system's global Mutt-ng configuration file? [Y|n] $c"
177 if test -f /etc/debian_version ; then
179 echo $n "Checking whether Mutt-ng has been installed as a package... $c"
180 DEBIANVERSION="`dpkg -l muttng | grep '^[ih]' | awk '{print $3}'`" 2> /dev/null
181 if test "$DEBIANVERSION" ; then
187 if [ "$DPKG" == "yes" ] ; then
189 echo $n "File this bug with Debian? [Y|n] $c"
200 if [ "$DPKG" == "yes" ] ; then
202 echo "Use reportbug muttng to report the bug to the debian bug tracking system..."
205 if rpm -q mutt > /dev/null 2> /dev/null ; then
206 echo "Mutt seems to come from an RPM package."
207 RPMVERSION="`rpm -q mutt`"
208 RPMPACKAGER="`rpm -q -i muttng | sed -n -e 's/^Packager *: *//p'`"
211 MUTTVERSION="`muttng -v | awk '{print $2 $3; exit; }'`"
212 test "$DPKG" = "yes" && SUBMIT="$SUBMIT, $DEBIAN_SUBMIT"
216 test "$EMAIL" && echo "From: $EMAIL"
217 test "$REPLYTO" && echo "Reply-To: $REPLYTO"
218 test "$ORGANIZATION" && echo "Organization: $ORGANIZATION"
220 echo "Subject: Mutt-ng-$MUTTVERSION: $SUBJECT"
222 test "$EMAIL" && echo "Bcc: ${EMAIL}"
224 echo "Package: muttng"
225 echo "Version: ${DEBIANVERSION-${RPMVERSION-$MUTTVERSION}}"
226 echo "Severity: $severity"
228 echo "-- Please type your report below this line"
233 if test "$DEBIAN" = "yes" ; then
234 echo "Obtaining Debian-specific information..." > /dev/tty
235 bug -p -s dummy muttng < /dev/null 2> /dev/null | \
236 sed -n -e "/^-- System Information/,/^---/p" | \
239 echo "-- System Information"
240 echo "System Version: `uname -a`"
241 test -z "$RPMPACKAGER" || echo "RPM Packager: $RPMPACKAGER";
242 test -f /etc/redhat-release && echo "RedHat Release: `cat /etc/redhat-release`"
243 test -f /etc/SuSE-release && echo "SuSE Release: `sed 1q /etc/SuSE-release`"
244 # Please provide more of these if you have any.
248 echo "-- Build environment information"
250 echo "(Note: This is the build environment installed on the system"
251 echo "muttbug is run on. Information may or may not match the environment"
252 echo "used to build mutt.)"
254 echo "- gcc version information"
262 echo "-- Mutt-ng Version Information"
266 if test "$CORE" && test -f "$CORE" ; then
268 echo "-- Core Dump Analysis Output"
272 *sdb) debug_sdb $CORE ;;
273 *dbx) debug_dbx $CORE ;;
274 *gdb) debug_gdb $CORE ;;
280 if test "$personal" = "yes" ; then
281 CANDIDATES=".muttngrc-${MUTTVERSION} .muttngrc .muttng/muttngrc-${MUTTVERSION} .muttng/muttngrc"
283 for f in $CANDIDATES; do
284 if test -f "${HOME}/$f" ; then
290 if test "$MATCHED" = "none" ; then
291 echo "Warning: Can't find your personal .muttngrc." >&2
293 include_file $MATCHED
298 if test "$global" = "yes" ; then
299 CANDIDATES="Muttngrc-${MUTTVERSION} Muttngrc"
300 DIRECTORIES="$sysconfdir $pkgdatadir"
302 for d in $DIRECTORIES ; do
303 for f in $CANDIDATES; do
304 if test -f $d/$f ; then
309 test "$MATCHED" = "none" || break
312 if test "$MATCHED" = "none" ; then
313 echo "Warning: Can't find global Muttngrc." >&2
315 include_file $MATCHED
321 cp $TEMPLATE $SCRATCH/mutt-bug.txt
325 if test "$input" = "e" ; then
326 ${VISUAL-${EDITOR-vi}} $SCRATCH/mutt-bug.txt
327 if cmp $SCRATCH/mutt-bug.txt ${TEMPLATE} > /dev/null ; then
328 echo "Warning: Bug report was not modified!"
332 echo $n "Submit, Edit, View, Quit? [S|e|v|q] $c"
334 input="`echo $_input | tr EVSQ evsq`"
337 v*) ${PAGER-more} $SCRATCH/mutt-bug.txt ;;
338 s*|"") $SENDMAIL -t < $SCRATCH/mutt-bug.txt ; exit ;;