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>
13 # Parts were written/modified by Nico Golde <nion@muttng.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,
31 SUBMIT="mutt-ng-devel@lists.berlios.de"
32 DEBIAN_SUBMIT="submit@bugs.debian.org"
38 sysconfdir=@sysconfdir@
39 pkgdatadir=@pkgdatadir@
45 sed -e 's/^-/- -/' $1 | egrep -v '^[ ]*(#|$)'
52 cat << EOF > $SCRATCH/gdb.rc
57 $DEBUGGER -n -x $SCRATCH/gdb.rc -c $CORE mutt
62 cat << EOF > $SCRATCH/dbx.rc
67 $DEBUGGER -s $SCRATCH/dbx.rc mutt $CORE
72 cat << EOF > $SCRATCH/sdb.rc
77 $DEBUGGER mutt $CORE < $SCRATCH/sdb.rc
89 SCRATCH=${TMPDIR-/tmp}/`basename $0`.`hostname`.$$
93 echo "`basename $0`: Can't create temporary directory." >& 2 ;
97 trap "rm -r -f ${SCRATCH} ; trap '' 0 ; exit" 0 1 2
99 TEMPLATE=${SCRATCH}/template.txt
101 if test -z "$EMAIL" ; then
102 EMAIL="`muttng -Q from 2> /dev/null | sed -e 's/^from=.\(.*\).$/\1/'`"
105 echo "Please enter your e-mail address [$EMAIL]:"
109 if test -n "$EMAILTMP" ; then
113 echo "Please enter a one-line description of the problem you experience:"
118 What should the severity for this bug report be?
120 0) Feature request, or maybe a bug which is very difficult to
121 fix due to major design considerations.
123 1) The package fails to perform correctly in some conditions,
124 or on some systems, or fails to comply with current policy
125 documents. Most bugs are in this category.
127 2) This bug makes this version of the package unsuitable for
130 3) Dangerous bug. Makes the package in question unusable by
131 anyone or mostly so, or causes data loss, or introduces a
132 security hole allowing access to the accounts of users who
135 4) Critical bug. Makes unrelated software on the system (or
136 the whole system) break, or causes serious data loss, or
137 introduces a security hole on systems where you install the
141 echo $n "Severity? [01234] $c"
144 0|[Ww]) severity=wishlist ;;
145 2|[Ii]) severity=important ;;
146 3|[Gg]) severity=grave ;;
147 4|[Cc]) severity=critical ;;
148 *) severity=normal ;;
150 if [ "$severity" != "wishlist" ] ; then
151 if test -x $DEBUGGER ; then
152 test -f core && CORE=core
153 echo "If Mutt-ng has crashed, it may have saved some program state in"
154 echo "a file named core. We can include this information with the bug"
155 echo "report if you wish so."
156 echo "Do you want to include information gathered from a core file?"
157 echo "If yes, please enter the path - otherwise just say no: [$CORE]"
160 test "$_CORE" && CORE="$_CORE"
164 echo $n "Do you want to include your personal Mutt-ng configuration files? [Y|n] $c"
167 [nN]*) personal=no ;;
171 echo $n "Do you want to include your system's global Mutt-ng configuration file? [Y|n] $c"
178 if test -f /etc/debian_version ; then
180 echo $n "Checking whether Mutt-ng has been installed as a Debian package... $c"
181 DEBIANVERSION="`dpkg -l muttng | grep '^[ih]' | awk '{print $3}'`" 2> /dev/null
182 if test "$DEBIANVERSION" ; then
188 if [ "$DPKG" == "yes" ] ; then
190 echo $n "File this bug with Debian? [Y|n] $c"
201 if [ "$DPKG" == "yes" ] ; then
203 echo "Use reportbug muttng to report the bug to the debian bug tracking system..."
206 if rpm -q mutt-ng > /dev/null 2> /dev/null ; then
207 echo "Mutt-ng seems to come from an RPM package."
208 RPMVERSION="`rpm -q mutt-ng`"
209 RPMPACKAGER="`rpm -q -i mutt-ng | sed -n -e 's/^Packager *: *//p'`"
212 MUTTVERSION="`muttng -v | awk '{print $2 $3; exit; }'`"
213 test "$DPKG" = "yes" && SUBMIT="$SUBMIT, $DEBIAN_SUBMIT"
217 test "$EMAIL" && echo "From: $EMAIL"
218 test "$REPLYTO" && echo "Reply-To: $REPLYTO"
219 test "$ORGANIZATION" && echo "Organization: $ORGANIZATION"
221 echo "Subject: Mutt-ng $MUTTVERSION: $SUBJECT"
223 test "$EMAIL" && echo "Bcc: ${EMAIL}"
225 echo "Package: mutt-ng"
226 echo "Version: ${DEBIANVERSION-${RPMVERSION-$MUTTVERSION}}"
227 echo "Severity: $severity"
229 echo "-- Please type your report below this line"
234 if test "$DEBIAN" = "yes" ; then
235 echo "Obtaining Debian-specific information..." > /dev/tty
236 bug -p -s dummy muttng < /dev/null 2> /dev/null | \
237 sed -n -e "/^-- System Information/,/^---/p" | \
240 echo "-- System Information"
241 echo "System Version: `uname -a`"
242 test -z "$RPMPACKAGER" || echo "RPM Packager: $RPMPACKAGER";
243 test -f /etc/redhat-release && echo "RedHat Release: `cat /etc/redhat-release`"
244 test -f /etc/SuSE-release && echo "SuSE Release: `sed 1q /etc/SuSE-release`"
245 # Please provide more of these if you have any.
249 echo "-- Build environment information"
251 echo "(Note: This is the build environment installed on the system"
252 echo "muttbug is run on. Information may or may not match the environment"
253 echo "used to build mutt.)"
255 echo "- gcc version information"
263 echo "-- Mutt-ng Version Information"
267 if test "$CORE" && test -f "$CORE" ; then
269 echo "-- Core Dump Analysis Output"
273 *sdb) debug_sdb $CORE ;;
274 *dbx) debug_dbx $CORE ;;
275 *gdb) debug_gdb $CORE ;;
281 if test "$personal" = "yes" ; then
282 CANDIDATES=".muttngrc-${MUTTVERSION} .muttngrc .muttng/muttngrc-${MUTTVERSION} .muttng/muttngrc"
284 for f in $CANDIDATES; do
285 if test -f "${HOME}/$f" ; then
291 if test "$MATCHED" = "none" ; then
292 echo "Warning: Can't find your personal .muttngrc." >&2
294 include_file $MATCHED
299 if test "$global" = "yes" ; then
300 CANDIDATES="Muttngrc-${MUTTVERSION} Muttngrc"
301 DIRECTORIES="$sysconfdir $pkgdatadir"
303 for d in $DIRECTORIES ; do
304 for f in $CANDIDATES; do
305 if test -f $d/$f ; then
310 test "$MATCHED" = "none" || break
313 if test "$MATCHED" = "none" ; then
314 echo "Warning: Can't find global Muttngrc." >&2
316 include_file $MATCHED
322 cp $TEMPLATE $SCRATCH/mutt-bug.txt
326 if test "$input" = "e" ; then
327 ${VISUAL-${EDITOR-vi}} $SCRATCH/mutt-bug.txt
328 if cmp $SCRATCH/mutt-bug.txt ${TEMPLATE} > /dev/null ; then
329 echo "Warning: Bug report was not modified!"
333 echo $n "Submit, Edit, View, Quit? [S|e|v|q] $c"
335 input="`echo $_input | tr EVSQ evsq`"
338 v*) ${PAGER-more} $SCRATCH/mutt-bug.txt ;;
339 s*|"") $SENDMAIL -t < $SCRATCH/mutt-bug.txt ; exit ;;