mutt stable branch with some hacks
at master 337 lines 7.8 kB view raw
1#!/bin/sh 2 3# 4# File a bug against the Mutt mail user agent. 5# 6 7# 8# $Id$ 9# 10 11# 12# Copyright (c) 2000 Thomas Roessler <roessler@does-not-exist.org> 13# 14# 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. 19# 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. 24# 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. 28# 29 30SUBMIT="fleas@mutt.org" 31DEBIAN_SUBMIT="submit@bugs.debian.org" 32 33prefix=@prefix@ 34 35DEBUGGER=@DEBUGGER@ 36SENDMAIL=@SENDMAIL@ 37sysconfdir=@sysconfdir@ 38pkgdatadir=@pkgdatadir@ 39 40include_file () 41{ 42 echo 43 echo "--- Begin $1" 44 sed -e '/^[ ]*#/d; /^[ ]*$/d; s/^-/- -/' $1 45 echo "--- End $1" 46 echo 47} 48 49debug_gdb () 50{ 51 cat << EOF > $SCRATCH/gdb.rc 52bt 53list 54quit 55EOF 56 $DEBUGGER -n -x $SCRATCH/gdb.rc -c $CORE mutt 57} 58 59debug_dbx () 60{ 61 cat << EOF > $SCRATCH/dbx.rc 62where 63list 64quit 65EOF 66 $DEBUGGER -s $SCRATCH/dbx.rc mutt $CORE 67} 68 69debug_sdb () 70{ 71 cat << EOF > $SCRATCH/sdb.rc 72t 73w 74q 75EOF 76 $DEBUGGER mutt $CORE < $SCRATCH/sdb.rc 77} 78 79case `echo -n` in 80"") n=-n; c= ;; 81 *) n=; c='\c' ;; 82esac 83 84 85exec > /dev/tty 86exec < /dev/tty 87 88SCRATCH=${TMPDIR-/tmp}/`basename $0`.`hostname`.$$ 89 90mkdir ${SCRATCH} || \ 91{ 92 echo "`basename $0`: Can't create temporary directory." >& 2 ; 93 exit 1 ; 94} 95 96trap "rm -r -f ${SCRATCH} ; trap '' 0 ; exit" 0 1 2 97 98TEMPLATE=${SCRATCH}/template.txt 99 100if test -z "$EMAIL" ; then 101 EMAIL="`mutt -Q from 2> /dev/null | sed -e 's/^from=.\(.*\).$/\1/'`" 102fi 103 104EMAILTMP='' 105while test -z "$EMAILTMP" 106do 107 echo "Please enter your e-mail address [$EMAIL]:" 108 echo $n "> $c" 109 read EMAILTMP 110 111 if test -z "$EMAILTMP"; then EMAILTMP="$EMAIL"; fi 112 113 if ! echo "$EMAILTMP" | grep -q @ 114 then 115 echo "$EMAILTMP does not appear to be a valid email address" 116 EMAILTMP='' 117 continue 118 fi 119 120 EMAIL="$EMAILTMP" 121done 122 123echo "Please enter a one-line description of the problem you experience:" 124echo $n "> $c" 125read SUBJECT 126 127cat <<EOF 128What should the severity for this bug report be? 129 130 0) Feature request, or maybe a bug which is very difficult to 131 fix due to major design considerations. 132 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. 136 137 2) This bug makes this version of the package unsuitable for 138 a stable release. 139 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 143 use the package. 144 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 148 package. 149 150EOF 151echo $n "Severity? [01234] $c" 152read severity 153case "$severity" in 1540|[Ww]) severity=wishlist ;; 1552|[Ii]) severity=important ;; 1563|[Gg]) severity=grave ;; 1574|[Cc]) severity=critical ;; 158 *) severity=normal ;; 159esac 160 161if 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]" 168 echo $n "> $c" 169 read _CORE 170 test "$_CORE" && CORE="$_CORE" 171fi 172 173echo $n "Do you want to include your personal mutt configuration files? [Y|n] $c" 174read personal 175case "$personal" in 176[nN]*) personal=no ;; 177 *) personal=yes ;; 178esac 179 180echo $n "Do you want to include your system's global mutt configuration file? [Y|n] $c" 181read global 182case "$global" in 183[nN]*) global=no ;; 184 *) global=yes ;; 185esac 186 187if test -f /etc/debian_version ; then 188 DEBIAN=yes 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 192 DPKG=yes 193 else 194 DPKG=no 195 unset DEBIANVERSION 196 fi 197 echo "$DPKG" 198 echo $n "File this bug with Debian? [Y|n] $c" 199 read DPKG 200 case "$DPKG" in 201 [nN]) DPKG=no ;; 202 *) DPKG=yes ;; 203 esac 204else 205 DEBIAN=no 206 DPKG=no 207fi 208 209if 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'`" 213fi 214 215MUTTVERSION="`mutt -v | awk '{print $2; exit; }'`" 216test "$DPKG" = "yes" && SUBMIT="$SUBMIT, $DEBIAN_SUBMIT" 217 218exec > ${TEMPLATE} 219 220test "$EMAIL" && echo "From: $EMAIL" 221test "$REPLYTO" && echo "Reply-To: $REPLYTO" 222test "$ORGANIZATION" && echo "Organization: $ORGANIZATION" 223 224echo "Subject: mutt-$MUTTVERSION: $SUBJECT" 225echo "To: $SUBMIT" 226test "$EMAIL" && echo "Bcc: ${EMAIL}" 227echo 228echo "Package: mutt" 229echo "Version: ${DEBIANVERSION-${RPMVERSION-$MUTTVERSION}}" 230echo "Severity: $severity" 231echo 232echo "-- Please type your report below this line" 233echo 234echo 235echo 236 237if 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" | \ 241 grep -v '^---' 242else 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. 249fi 250 251echo 252echo "-- Mutt Version Information" 253echo 254LC_ALL=C mutt -v 255 256if test "$CORE" && test -f "$CORE" ; then 257 echo 258 echo "-- Core Dump Analysis Output" 259 echo 260 261 case "$DEBUGGER" in 262 *sdb) debug_sdb $CORE ;; 263 *dbx) debug_dbx $CORE ;; 264 *gdb) debug_gdb $CORE ;; 265 esac 266 267 echo 268fi 269 270if test "$personal" = "yes" ; then 271 xdg_cfg_home=${XDG_CONFIG_HOME:-${HOME}/.config} 272 CANDIDATES="muttrc-${MUTTVERSION} muttrc" 273 DIRECTORIES="${HOME}/. ${HOME}/.mutt/ $xdg_cfg_home/mutt/" 274 MATCHED="none" 275 for d in $DIRECTORIES ; do 276 for f in $CANDIDATES; do 277 if test -f ${d}${f} ; then 278 MATCHED="${d}${f}" 279 break 280 fi 281 done 282 test "$MATCHED" = "none" || break 283 done 284 285 if test "$MATCHED" = "none" ; then 286 echo "Warning: Can't find your personal .muttrc." >&2 287 else 288 include_file $MATCHED 289 fi 290fi 291 292 293if test "$global" = "yes" ; then 294 CANDIDATES="Muttrc-${MUTTVERSION} Muttrc" 295 DIRECTORIES="$sysconfdir $pkgdatadir" 296 MATCHED="none" 297 for d in $DIRECTORIES ; do 298 for f in $CANDIDATES; do 299 if test -f $d/$f ; then 300 MATCHED="$d/$f" 301 break 302 fi 303 done 304 test "$MATCHED" = "none" || break 305 done 306 307 if test "$MATCHED" = "none" ; then 308 echo "Warning: Can't find global Muttrc." >&2 309 else 310 include_file $MATCHED 311 fi 312fi 313 314exec > /dev/tty 315 316cp $TEMPLATE $SCRATCH/mutt-bug.txt 317 318input="e" 319while : ; do 320 if test "$input" = "e" ; then 321 ${VISUAL-${EDITOR-vi}} $SCRATCH/mutt-bug.txt 322 if cmp $SCRATCH/mutt-bug.txt ${TEMPLATE} > /dev/null ; then 323 echo "Warning: Bug report was not modified!" 324 fi 325 fi 326 327 echo $n "Submit, Edit, View, Quit? [S|e|v|q] $c" 328 read _input 329 input="`echo $_input | tr EVSQ evsq`" 330 case $input in 331 e*) ;; 332 v*) ${PAGER-more} $SCRATCH/mutt-bug.txt ;; 333 s*|"") $SENDMAIL -t < $SCRATCH/mutt-bug.txt ; exit ;; 334 q*) exit 335 esac 336done 337