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 RMAIL
="/usr/lib/sendmail -oi -t"
33 elif [ -f /usr
/sbin
/sendmail
] ; then
34 RMAIL
="/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 CONFIDENTIAL_C
='<[ yes | no ] (one line)>'
90 SYNOPSIS_C
='<synopsis of the problem (one line)>'
91 SEVERITY_C
='<[ non-critical | serious | critical ] (one line)>'
92 PRIORITY_C
='<[ low | medium | high ] (one line)>'
93 CLASS_C
='<[ sw-bug | doc-bug | change-request | support ] (one line)>'
94 RELEASE_C
='<release number or tag (one line)>'
95 ENVIRONMENT_C
='<machine, os, target, libraries (multiple lines)>'
96 DESCRIPTION_C
='<precise description of the problem (multiple lines)>'
97 HOW_TO_REPEAT_C
='<code/input/activities to reproduce the problem (multiple lines)>'
98 FIX_C
='<how to correct or work around the problem, if known (multiple lines)>'
102 SEND-PR: -*- send-pr -*-
103 SEND-PR: Lines starting with \`SEND-PR' will be removed automatically, as
104 SEND-PR: will all comments (text enclosed in \`<' and \`>').
108 Subject: [50 character or so descriptive subject here (for reference)]
110 >Submitter-Id: <submitter ID>
111 >Originator: ${ORIGINATOR}
113 ${ORGANIZATION- $ORGANIZATION_C}
114 >Confidential: $CONFIDENTIAL_C
115 >Synopsis: $SYNOPSIS_C
116 >Severity: $SEVERITY_C
117 >Priority: $PRIORITY_C
120 >Release: libc-${VERSION}
122 <machine, os, target, libraries (multiple lines)>
123 `[ -n "$SYSTEM" ] && echo System: $SYSTEM`
124 `[ -n "$ARCH" ] && echo Architecture: $ARCH`
125 `[ -n "$MACHINE" ] && echo Machine: $MACHINE`
126 `[ -n "$ADDONS" ] && echo Addons: $ADDONS`
141 if cmp -s $TEMP $TEMP.x
; then
142 echo "File not changed, no bug report submitted."
147 # Check the enumeration fields
149 # This is a "sed-subroutine" with one keyword parameter
150 # (with workaround for Sun sed bug)
168 PATTERN
=">Confidential:"
169 CONFIDENTIAL
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
170 case "$CONFIDENTIAL" in
171 ""|
yes|no
) CNT
=`expr $CNT + 1` ;;
172 *) echo "$COMMAND: \`$CONFIDENTIAL' is not a valid value for \`Confidential'." ;;
178 SEVERITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
180 ""|non-critical|serious|critical
) CNT
=`expr $CNT + 1` ;;
181 *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
187 PRIORITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
189 ""|low|medium|high
) CNT
=`expr $CNT + 1` ;;
190 *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
196 CLASS
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
198 ""|sw-bug|doc-bug|change-request|support
) CNT
=`expr $CNT + 1` ;;
199 *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
203 echo "Errors were found with the problem report."
206 $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
210 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
211 cat $TEMP >> $HOME/dead.glibcbug
225 # Remove comments and send the problem report
226 # (we have to use patterns, where the comment contains regex chars)
228 # /^>Originator:/s;$ORIGINATOR;;
231 /^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
232 /^>Confidential:/s;<.*>;;
233 /^>Synopsis:/s;$SYNOPSIS_C;;
234 /^>Severity:/s;<.*>;;
235 /^>Priority:/s;<.*>;;
237 /^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
238 /^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
239 /^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
240 /^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
241 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
244 if $MAIL_AGENT < $REF; then
245 echo "$COMMAND: problem report sent"
248 echo "$COMMAND: mysterious mail failure, report not sent."
249 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
250 cat $TEMP >> $HOME/dead.glibcbug