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"
14 BUILD_SHARED
="@shared@"
15 BUILD_PROFILE
="@profile@"
16 BUILD_OMITFP
="@omitfp@"
19 PATH
=/bin
:/usr
/bin
:/usr
/local
/bin
:$PATH
24 BUGADDR
=${1-$BUGGLIBC}
25 ENVIRONMENT
=`uname -a`
29 : ${USER=${LOGNAME-`whoami`}}
31 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
32 trap 'rm -f $TEMP $TEMP.x' 0
35 # How to read the passwd database.
36 PASSWD
="cat /etc/passwd"
38 if [ -f /usr
/lib
/sendmail
] ; then
39 MAIL_AGENT
="/usr/lib/sendmail -oi -t"
40 elif [ -f /usr
/sbin
/sendmail
] ; then
41 MAIL_AGENT
="/usr/sbin/sendmail -oi -t"
46 # Figure out how to echo a string without a trailing newline
49 *c
) ECHON1
='echo -n' ECHON2
= ;;
50 *) ECHON1
=echo ECHON2
='\c' ;;
53 # Find out the name of the originator of this PR.
54 if [ -n "$NAME" ]; then
56 elif [ -f $HOME/.fullname
]; then
57 ORIGINATOR
="`sed -e '1q' $HOME/.fullname`"
59 # Must use temp file due to incompatibilities in quoting behavior
60 # and to protect shell metacharacters in the expansion of $LOGNAME
61 $PASSWD |
grep "^$LOGNAME:" |
awk -F: '{print $5}' |
sed -e 's/,.*//' > $TEMP
62 ORIGINATOR
="`cat $TEMP`"
66 if [ -n "$ORGANIZATION" ]; then
67 if [ -f "$ORGANIZATION" ]; then
68 ORGANIZATION
="`cat $ORGANIZATION`"
71 if [ -f $HOME/.organization
]; then
72 ORGANIZATION
="`cat $HOME/.organization`"
73 elif [ -f $HOME/.signature
]; then
74 ORGANIZATION
=`sed -e "s/^/ /" $HOME/.signature; echo ">"`
78 # If they don't have a preferred editor set, then use
79 if [ -z "$VISUAL" ]; then
80 if [ -z "$EDITOR" ]; then
89 # Find out some information.
90 SYSTEM
=`( [ -f /bin/uname ] && /bin/uname -a ) || \
91 ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
92 ARCH
=`[ -f /bin/arch ] && /bin/arch`
93 MACHINE
=`[ -f /bin/machine ] && /bin/machine`
95 ORGANIZATION_C
='<organization of PR author (multiple lines)>'
96 SYNOPSIS_C
='<synopsis of the problem (one line)>'
97 SEVERITY_C
='<[ non-critical | serious | critical ] (one line)>'
98 PRIORITY_C
='<[ low | medium | high ] (one line)>'
99 CLASS_C
='<[ sw-bug | doc-bug | change-request | support ] (one line)>'
100 RELEASE_C
='<release number or tag (one line)>'
101 ENVIRONMENT_C
='<machine, os, target, libraries (multiple lines)>'
102 DESCRIPTION_C
='<precise description of the problem (multiple lines)>'
103 HOW_TO_REPEAT_C
='<code/input/activities to reproduce the problem (multiple lines)>'
104 FIX_C
='<how to correct or work around the problem, if known (multiple lines)>'
108 SEND-PR: -*- send-pr -*-
109 SEND-PR: Lines starting with \`SEND-PR' will be removed automatically, as
110 SEND-PR: will all comments (text enclosed in \`<' and \`>').
114 Subject: [50 character or so descriptive subject here (for reference)]
117 >Originator: ${ORIGINATOR}
119 ${ORGANIZATION- $ORGANIZATION_C}
121 >Synopsis: $SYNOPSIS_C
122 >Severity: $SEVERITY_C
123 >Priority: $PRIORITY_C
126 >Release: libc-${VERSION}
129 `[ -n "$HOST" ] && echo Host type: $HOST`
130 `[ -n "$SYSTEM" ] && echo System: $SYSTEM`
131 `[ -n "$ARCH" ] && echo Architecture: $ARCH`
132 `[ -n "$MACHINE" ] && echo Machine: $MACHINE`
133 `[ -n "$ADDONS" ] && echo Addons: $ADDONS`
134 `[ -n "$CFLAGS" ] && echo Build CFLAGS: $CFLAGS`
135 `[ -n "$CC" ] && echo Build CC: $CC`
136 `[ -n "$BUILD_SHARED" ] && echo Build shared: $BUILD_SHARED`
137 `[ -n "$BUILD_PROFILE" ] && echo Build profile: $BUILD_PROFILE`
138 `[ -n "$BUILD_OMITFP" ] && echo Build omitfp: $BUILD_OMITFP`
139 `[ -n "$STDIO" ] && echo Stdio: $STDIO`
154 if cmp -s $TEMP $TEMP.x
; then
155 echo "File not changed, no bug report submitted."
160 # Check the enumeration fields
162 # This is a "sed-subroutine" with one keyword parameter
163 # (with workaround for Sun sed bug)
183 SEVERITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
185 ""|non-critical|serious|critical
) CNT
=`expr $CNT + 1` ;;
186 *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
192 PRIORITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
194 ""|low|medium|high
) CNT
=`expr $CNT + 1` ;;
195 *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
201 CLASS
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
203 ""|sw-bug|doc-bug|change-request|support
) CNT
=`expr $CNT + 1` ;;
204 *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
208 echo "Errors were found with the problem report."
211 $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
215 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
216 cat $TEMP >> $HOME/dead.glibcbug
230 # Remove comments and send the problem report
231 # (we have to use patterns, where the comment contains regex chars)
233 # /^>Originator:/s;$ORIGINATOR;;
236 /^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
237 /^>Confidential:/s;<.*>;;
238 /^>Synopsis:/s;$SYNOPSIS_C;;
239 /^>Severity:/s;<.*>;;
240 /^>Priority:/s;<.*>;;
242 /^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
243 /^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
244 /^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
245 /^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
246 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
249 if $MAIL_AGENT < $TEMP.x
; then
250 echo "$COMMAND: problem report sent"
253 echo "$COMMAND: mysterious mail failure, report not sent."
254 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
255 cat $TEMP >> $HOME/dead.glibcbug