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.org"
13 PATH
=/bin
:/usr
/bin
:/usr
/local
/bin
:$PATH
18 BUGADDR
=${1-$BUGGLIBC}
19 ENVIRONMENT
=`uname -a`
23 : ${USER=${LOGNAME-`whoami`}}
25 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
26 trap 'rm -f $TEMP $TEMP.x' 0
29 # How to read the passwd database.
30 PASSWD
="cat /etc/passwd"
32 if [ -f /usr
/lib
/sendmail
] ; then
33 MAIL_AGENT
="/usr/lib/sendmail -oi -t"
34 elif [ -f /usr
/sbin
/sendmail
] ; then
35 MAIL_AGENT
="/usr/sbin/sendmail -oi -t"
40 # Figure out how to echo a string without a trailing newline
43 *c
) ECHON1
='echo -n' ECHON2
= ;;
44 *) ECHON1
=echo ECHON2
='\c' ;;
47 # Find out the name of the originator of this PR.
48 if [ -n "$NAME" ]; then
50 elif [ -f $HOME/.fullname
]; then
51 ORIGINATOR
="`sed -e '1q' $HOME/.fullname`"
53 # Must use temp file due to incompatibilities in quoting behavior
54 # and to protect shell metacharacters in the expansion of $LOGNAME
55 $PASSWD |
grep "^$LOGNAME:" |
awk -F: '{print $5}' |
sed -e 's/,.*//' > $TEMP
56 ORIGINATOR
="`cat $TEMP`"
60 if [ -n "$ORGANIZATION" ]; then
61 if [ -f "$ORGANIZATION" ]; then
62 ORGANIZATION
="`cat $ORGANIZATION`"
65 if [ -f $HOME/.organization
]; then
66 ORGANIZATION
="`cat $HOME/.organization`"
67 elif [ -f $HOME/.signature
]; then
68 ORGANIZATION
=`sed -e "s/^/ /" $HOME/.signature; echo ">"`
72 # If they don't have a preferred editor set, then use
73 if [ -z "$VISUAL" ]; then
74 if [ -z "$EDITOR" ]; then
83 # Find out some information.
84 SYSTEM
=`( [ -f /bin/uname ] && /bin/uname -a ) || \
85 ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
86 ARCH
=`[ -f /bin/arch ] && /bin/arch`
87 MACHINE
=`[ -f /bin/machine ] && /bin/machine`
89 ORGANIZATION_C
='<organization of PR author (multiple lines)>'
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)]
111 >Originator: ${ORIGINATOR}
113 ${ORGANIZATION- $ORGANIZATION_C}
115 >Synopsis: $SYNOPSIS_C
116 >Severity: $SEVERITY_C
117 >Priority: $PRIORITY_C
120 >Release: libc-${VERSION}
123 `[ -n "$HOST" ] && echo Host type: $HOST`
124 `[ -n "$SYSTEM" ] && echo System: $SYSTEM`
125 `[ -n "$ARCH" ] && echo Architecture: $ARCH`
126 `[ -n "$MACHINE" ] && echo Machine: $MACHINE`
127 `[ -n "$ADDONS" ] && echo Addons: $ADDONS`
142 if cmp -s $TEMP $TEMP.x
; then
143 echo "File not changed, no bug report submitted."
148 # Check the enumeration fields
150 # This is a "sed-subroutine" with one keyword parameter
151 # (with workaround for Sun sed bug)
171 SEVERITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
173 ""|non-critical|serious|critical
) CNT
=`expr $CNT + 1` ;;
174 *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
180 PRIORITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
182 ""|low|medium|high
) CNT
=`expr $CNT + 1` ;;
183 *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
189 CLASS
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
191 ""|sw-bug|doc-bug|change-request|support
) CNT
=`expr $CNT + 1` ;;
192 *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
196 echo "Errors were found with the problem report."
199 $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
203 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
204 cat $TEMP >> $HOME/dead.glibcbug
218 # Remove comments and send the problem report
219 # (we have to use patterns, where the comment contains regex chars)
221 # /^>Originator:/s;$ORIGINATOR;;
224 /^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
225 /^>Confidential:/s;<.*>;;
226 /^>Synopsis:/s;$SYNOPSIS_C;;
227 /^>Severity:/s;<.*>;;
228 /^>Priority:/s;<.*>;;
230 /^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
231 /^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
232 /^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
233 /^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
234 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
237 if $MAIL_AGENT < $TEMP.x
; then
238 echo "$COMMAND: problem report sent"
241 echo "$COMMAND: mysterious mail failure, report not sent."
242 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
243 cat $TEMP >> $HOME/dead.glibcbug