3 # glibcbug - create a bug report and mail it to the bug address.
5 # configuration section:
6 # these variables are filled in by configure
9 BUGGLIBC
="bugs@gnu.ai.mit.edu"
12 PATH
=/bin
:/usr
/bin
:/usr
/local
/bin
:$PATH
17 BUGADDR
=${1-$BUGGLIBC}
18 ENVIRONMENT
=`uname -a`
22 : ${USER=${LOGNAME-`whoami`}}
24 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
25 trap 'rm -f $TEMP $TEMP.x' 0
28 # How to read the passwd database.
29 PASSWD
="cat /etc/passwd"
31 if [ -f /usr
/lib
/sendmail
] ; then
32 MAIL_AGENT
="/usr/lib/sendmail -oi -t"
33 elif [ -f /usr
/sbin
/sendmail
] ; then
34 MAIL_AGENT
="/usr/sbin/sendmail -oi -t"
39 # Figure out how to echo a string without a trailing newline
42 *c
) ECHON1
='echo -n' ECHON2
= ;;
43 *) ECHON1
=echo ECHON2
='\c' ;;
46 # Find out the name of the originator of this PR.
47 if [ -n "$NAME" ]; then
49 elif [ -f $HOME/.fullname
]; then
50 ORIGINATOR
="`sed -e '1q' $HOME/.fullname`"
52 # Must use temp file due to incompatibilities in quoting behavior
53 # and to protect shell metacharacters in the expansion of $LOGNAME
54 $PASSWD |
grep "^$LOGNAME:" |
awk -F: '{print $5}' |
sed -e 's/,.*//' > $TEMP
55 ORIGINATOR
="`cat $TEMP`"
59 if [ -n "$ORGANIZATION" ]; then
60 if [ -f "$ORGANIZATION" ]; then
61 ORGANIZATION
="`cat $ORGANIZATION`"
64 if [ -f $HOME/.organization
]; then
65 ORGANIZATION
="`cat $HOME/.organization`"
66 elif [ -f $HOME/.signature
]; then
67 ORGANIZATION
=`sed -e "s/^/ /" $HOME/.signature; echo ">"`
71 # If they don't have a preferred editor set, then use
72 if [ -z "$VISUAL" ]; then
73 if [ -z "$EDITOR" ]; then
82 # Find out some information.
83 SYSTEM
=`( [ -f /bin/uname ] && /bin/uname -a ) || \
84 ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
85 ARCH
=`[ -f /bin/arch ] && /bin/arch`
86 MACHINE
=`[ -f /bin/machine ] && /bin/machine`
88 ORGANIZATION_C
='<organization of PR author (multiple lines)>'
89 SYNOPSIS_C
='<synopsis of the problem (one line)>'
90 SEVERITY_C
='<[ non-critical | serious | critical ] (one line)>'
91 PRIORITY_C
='<[ low | medium | high ] (one line)>'
92 CLASS_C
='<[ sw-bug | doc-bug | change-request | support ] (one line)>'
93 RELEASE_C
='<release number or tag (one line)>'
94 ENVIRONMENT_C
='<machine, os, target, libraries (multiple lines)>'
95 DESCRIPTION_C
='<precise description of the problem (multiple lines)>'
96 HOW_TO_REPEAT_C
='<code/input/activities to reproduce the problem (multiple lines)>'
97 FIX_C
='<how to correct or work around the problem, if known (multiple lines)>'
101 SEND-PR: -*- send-pr -*-
102 SEND-PR: Lines starting with \`SEND-PR' will be removed automatically, as
103 SEND-PR: will all comments (text enclosed in \`<' and \`>').
107 Subject: [50 character or so descriptive subject here (for reference)]
110 >Originator: ${ORIGINATOR}
112 ${ORGANIZATION- $ORGANIZATION_C}
114 >Synopsis: $SYNOPSIS_C
115 >Severity: $SEVERITY_C
116 >Priority: $PRIORITY_C
119 >Release: libc-${VERSION}
122 `[ -n "$SYSTEM" ] && echo System: $SYSTEM`
123 `[ -n "$ARCH" ] && echo Architecture: $ARCH`
124 `[ -n "$MACHINE" ] && echo Machine: $MACHINE`
125 `[ -n "$ADDONS" ] && echo Addons: $ADDONS`
140 if cmp -s $TEMP $TEMP.x
; then
141 echo "File not changed, no bug report submitted."
146 # Check the enumeration fields
148 # This is a "sed-subroutine" with one keyword parameter
149 # (with workaround for Sun sed bug)
169 SEVERITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
171 ""|non-critical|serious|critical
) CNT
=`expr $CNT + 1` ;;
172 *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
178 PRIORITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
180 ""|low|medium|high
) CNT
=`expr $CNT + 1` ;;
181 *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
187 CLASS
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
189 ""|sw-bug|doc-bug|change-request|support
) CNT
=`expr $CNT + 1` ;;
190 *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
194 echo "Errors were found with the problem report."
197 $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
201 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
202 cat $TEMP >> $HOME/dead.glibcbug
216 # Remove comments and send the problem report
217 # (we have to use patterns, where the comment contains regex chars)
219 # /^>Originator:/s;$ORIGINATOR;;
222 /^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
223 /^>Confidential:/s;<.*>;;
224 /^>Synopsis:/s;$SYNOPSIS_C;;
225 /^>Severity:/s;<.*>;;
226 /^>Priority:/s;<.*>;;
228 /^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
229 /^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
230 /^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
231 /^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
232 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
235 if $MAIL_AGENT < $TEMP.x
; then
236 echo "$COMMAND: problem report sent"
239 echo "$COMMAND: mysterious mail failure, report not sent."
240 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
241 cat $TEMP >> $HOME/dead.glibcbug