From f73dda092b33638d2d5e9c35375f687a607b5403 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Tue, 13 Nov 2001 17:56:06 +0000 Subject: Imported from ../bash-2.05a.tar.gz. --- support/bashbug.sh | 126 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 90 insertions(+), 36 deletions(-) (limited to 'support/bashbug.sh') diff --git a/support/bashbug.sh b/support/bashbug.sh index 1064cb4..60eaeb9 100644 --- a/support/bashbug.sh +++ b/support/bashbug.sh @@ -3,11 +3,12 @@ # bashbug - create a bug report and mail it to the bug address # # The bug address depends on the release status of the shell. Versions -# with status `alpha' or `beta' mail bug reports to chet@po.cwru.edu. +# with status `devel', `alpha', `beta', or `rc' mail bug reports to +# chet@po.cwru.edu and, optionally, to bash-testers@po.cwru.edu. # Other versions send mail to bug-bash@gnu.org. # # configuration section: -# these variables are filled in by the make target in cpp-Makefile +# these variables are filled in by the make target in Makefile # MACHINE="!MACHINE!" OS="!OS!" @@ -23,14 +24,32 @@ export PATH # If the OS supplies a program to make temp files with semi-random names, # use it. -TEMP=/tmp/bbug.$$ -for d in /bin /usr/bin /usr/local/bin ; do - if [ -x $d/mktemp ]; then - TEMP=`$d/mktemp -t bbug ` ; break; - elif [ -x $d/tempfile ]; then - TEMP=` $d/tempfile --prefix bbug --mode 600 `; break - fi -done +: ${TMPDIR:=/tmp} +rm_tmp1=false +rm_tmp2=false + +# if we don't have mktemp or tempfile, we don't want to see error messages +# like `mktemp: not found', so temporarily redirect stderr using {...} while +# trying to run them. this may fail using old versions of the bourne shell +# that run {...} blocks with redirections in subshells; in that case we're +# no worse off than previous versions + +{ TEMPFILE1=`mktemp "$TMPDIR/bbug.XXXXXX" 2>/dev/null` ; } 2>/dev/null +if [ -z "$TEMPFILE1" ]; then + { TEMPFILE1=`tempfile --prefix bbug --mode 600 2>/dev/null`; } 2>/dev/null +fi +if [ -z "$TEMPFILE1" ]; then + TEMPFILE1=$TMPDIR/bbug.$$ + rm_tmp1=true +fi +{ TEMPFILE2=`mktemp "$TMPDIR/bbug.XXXXXX" 2>/dev/null`; } 2>/dev/null +if [ -z "$TEMPFILE2" ]; then + { TEMPFILE2=`tempfile --prefix bbug --mode 600 2>/dev/null`; } 2>/dev/null +fi +if [ -z "$TEMPFILE2" ]; then + TEMPFILE2="$TMPDIR/bbug.$$.x" + rm_tmp2=true +fi USAGE="Usage: $0 [--help] [--version] [bug-report-email-address]" VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}" @@ -83,12 +102,12 @@ esac BASHTESTERS="bash-testers@po.cwru.edu" case "$RELSTATUS" in -alpha*|beta*|devel*) BUGBASH=chet@po.cwru.edu ;; -*) BUGBASH=bug-bash@gnu.org ;; +alpha*|beta*|devel*|rc*) BUGBASH=chet@po.cwru.edu ;; +*) BUGBASH=bug-bash@gnu.org ;; esac case "$RELSTATUS" in -alpha*|beta*|devel*) +alpha*|beta*|devel*|rc*) echo "$0: This is a testing release. Would you like your bug report" echo "$0: to be sent to the bash-testers mailing list?" echo $n "$0: Send to bash-testers? $c" @@ -130,8 +149,8 @@ fi : ${USER=${LOGNAME-`whoami`}} -trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15 -trap 'rm -f $TEMP $TEMP.x' 0 +trap 'rm -f "$TEMPFILE1" "$TEMPFILE2"; exit 1' 1 2 3 13 15 +trap 'rm -f "$TEMPFILE1" "$TEMPFILE2"' 0 UN= if (uname) >/dev/null 2>&1; then @@ -149,13 +168,15 @@ else SMARGS="$BUGADDR" fi -# this is raceable -rm -f $TEMP +INITIAL_SUBJECT='[50 character or so descriptive subject here (for reference)]' + +# this is raceable unless (hopefully) we used mktemp(1) or tempfile(1) +$rm_tmp1 && rm -f "$TEMPFILE1" -cat > $TEMP < "$TEMPFILE1" <> $HOME/dead.bashbug +${RMAIL} $SMARGS < "$TEMPFILE1" || { + cat "$TEMPFILE1" >> $HOME/dead.bashbug echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2 } -- cgit v1.2.3