3 # glibcbug - create a bug report and mail it to the bug address.
5 # configuration section:
6 # these variables are filled in by configure
13 CCVERSION
='@CCVERSION@'
15 SYSINCLUDES
="@SYSINCLUDES@"
16 VERSIONING
="@VERSIONING@"
17 BUILD_STATIC
="@static@"
18 BUILD_SHARED
="@shared@"
19 BUILD_PIC_DEFAULT
="@pic_default@"
20 BUILD_PROFILE
="@profile@"
21 BUILD_OMITFP
="@omitfp@"
22 BUILD_BOUNDED
="@bounded@"
23 BUILD_STATIC_NSS
="@static_nss@"
26 TEMP
=`mktemp -q ${TMPDIR-/tmp}/glibcbugXXXXXX 2>/dev/null`
27 if test $?
-ne 0; then
28 TEMP
={$TMPDIR-/tmp
}/glibcbug.$$
32 TEMPx
=`mktemp -q ${TMPDIR-/tmp}/glibcbugXXXXXX 2>/dev/null`
33 if test $?
-ne 0; then
34 TEMPx
=${TMPDIR-/tmp}/glibcbug.$$.x
39 BUGGLIBC
="glibc-bug-reports-${RELEASE}@gnu.org"
40 BUGADDR
=${1-$BUGGLIBC}
44 : ${USER=${LOGNAME-`whoami`}}
46 trap 'rm -f $TEMP $TEMPx; exit 1' 1 2 3 13 15
47 trap 'rm -f $TEMP $TEMPx' 0
50 # How to read the passwd database.
51 PASSWD
="cat /etc/passwd"
53 if [ -f /usr
/lib
/sendmail
] ; then
54 MAIL_AGENT
="/usr/lib/sendmail -oi -t"
55 elif [ -f /usr
/sbin
/sendmail
] ; then
56 MAIL_AGENT
="/usr/sbin/sendmail -oi -t"
61 # Figure out how to echo a string without a trailing newline
64 *c
) ECHON1
='echo -n' ECHON2
= ;;
65 *) ECHON1
=echo ECHON2
='\c' ;;
68 # Find out the name of the originator of this PR.
69 if [ -n "$NAME" ]; then
71 elif [ -f $HOME/.fullname
]; then
72 ORIGINATOR
="`sed -e '1q' $HOME/.fullname`"
74 # Must use temp file due to incompatibilities in quoting behavior
75 # and to protect shell metacharacters in the expansion of $LOGNAME
76 $PASSWD |
grep "^$LOGNAME:" |
awk -F: '{print $5}' |
sed -e 's/,.*//' > $TEMP
77 ORIGINATOR
="`cat $TEMP`"
80 if [ -n "$ORGANIZATION" ]; then
81 if [ -f "$ORGANIZATION" ]; then
82 ORGANIZATION
="`cat $ORGANIZATION`"
85 if [ -f $HOME/.organization
]; then
86 ORGANIZATION
="`cat $HOME/.organization`"
87 elif [ -f $HOME/.signature
]; then
88 ORGANIZATION
=`sed -e "s/^/ /" $HOME/.signature; echo ">"`
92 # If they don't have a preferred editor set, then use
93 if [ -z "$VISUAL" ]; then
94 if [ -z "$EDITOR" ]; then
103 # Find out some information.
104 SYSTEM
=`( [ -f /bin/uname ] && /bin/uname -a ) || \
105 ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
106 ARCH
=`[ -f /bin/arch ] && /bin/arch`
107 MACHINE
=`[ -f /bin/machine ] && /bin/machine`
109 case $HOST in *linux
*)
110 KHDRS
=`(echo '#include <linux/version.h>'
111 echo '! UTS_RELEASE' ) |
112 $CC $SYSINCLUDES -E - | sed -n '/!/s/[! "]//gp'`;;
115 ORGANIZATION_C
='<organization of PR author (multiple lines)>'
116 SYNOPSIS_C
='<synopsis of the problem (one line)>'
117 SEVERITY_C
='<[ non-critical | serious | critical ] (one line)>'
118 PRIORITY_C
='<[ low | medium | high ] (one line)>'
119 CLASS_C
='<[ sw-bug | doc-bug | change-request | support ] (one line)>'
120 RELEASE_C
='<release number or tag (one line)>'
121 ENVIRONMENT_C
='<machine, os, target, libraries (multiple lines)>'
122 DESCRIPTION_C
='<precise description of the problem (multiple lines)>'
123 HOW_TO_REPEAT_C
='<code/input/activities to reproduce the problem (multiple lines)>'
124 FIX_C
='<how to correct or work around the problem, if known (multiple lines)>'
128 SEND-PR: -*- send-pr -*-
129 SEND-PR: Lines starting with \`SEND-PR' will be removed automatically, as
130 SEND-PR: will all comments (text enclosed in \`<' and \`>').
134 Subject: [50 character or so descriptive subject here (for reference)]
137 >Originator: ${ORIGINATOR}
139 ${ORGANIZATION- $ORGANIZATION_C}
141 >Synopsis: $SYNOPSIS_C
142 >Severity: $SEVERITY_C
143 >Priority: $PRIORITY_C
146 >Release: libc-${VERSION}
149 `[ -n "$HOST" ] && echo Host type: $HOST`
150 `[ -n "$SYSTEM" ] && echo System: $SYSTEM`
151 `[ -n "$ARCH" ] && echo Architecture: $ARCH`
152 `[ -n "$MACHINE" ] && echo Machine: $MACHINE`
153 `[ -n "$ADDONS" ] && echo Addons: $ADDONS`
154 `[ -n "$CFLAGS" ] && echo Build CFLAGS: $CFLAGS`
155 `[ -n "$CC" ] && echo Build CC: $CC`
156 `[ -n "$CCVERSION" ] && echo Compiler version: $CCVERSION`
157 `[ -n "$KHDRS" ] && echo Kernel headers: $KHDRS`
158 `[ -n "$VERSIONING" ] && echo Symbol versioning: $VERSIONING`
159 `[ -n "$BUILD_STATIC" ] && echo Build static: $BUILD_STATIC`
160 `[ -n "$BUILD_SHARED" ] && echo Build shared: $BUILD_SHARED`
161 `[ -n "$BUILD_PIC_DEFAULT" ] && echo Build pic-default: $BUILD_PIC_DEFAULT`
162 `[ -n "$BUILD_PROFILE" ] && echo Build profile: $BUILD_PROFILE`
163 `[ -n "$BUILD_OMITFP" ] && echo Build omitfp: $BUILD_OMITFP`
164 `[ -n "$BUILD_BOUNDED" ] && echo Build bounded: $BUILD_BOUNDED`
165 `[ -n "$BUILD_STATIC_NSS" ] && echo Build static-nss: $BUILD_STATIC_NSS`
166 `[ -n "$STDIO" ] && echo Stdio: $STDIO`
181 if cmp -s $TEMP $TEMPx; then
182 echo "File not changed, no bug report submitted."
187 # Check the enumeration fields
189 # This is a "sed-subroutine" with one keyword parameter
190 # (with workaround for Sun sed bug)
210 SEVERITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
212 ""|non-critical|serious|critical
) CNT
=`expr $CNT + 1` ;;
213 *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
219 PRIORITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
221 ""|low|medium|high
) CNT
=`expr $CNT + 1` ;;
222 *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
228 CLASS
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
230 ""|sw-bug|doc-bug|change-request|support
) CNT
=`expr $CNT + 1` ;;
231 *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
235 echo "Errors were found with the problem report."
238 $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
242 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
243 cat $TEMP >> $HOME/dead.glibcbug
257 # Remove comments and send the problem report
258 # (we have to use patterns, where the comment contains regex chars)
260 # /^>Originator:/s;$ORIGINATOR;;
263 /^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
264 /^>Confidential:/s;<.*>;;
265 /^>Synopsis:/s;$SYNOPSIS_C;;
266 /^>Severity:/s;<.*>;;
267 /^>Priority:/s;<.*>;;
269 /^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
270 /^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
271 /^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
272 /^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
273 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
276 if $MAIL_AGENT < $TEMPx; then
277 echo "$COMMAND: problem report sent"
280 echo "$COMMAND: mysterious mail failure, report not sent."
281 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
282 cat $TEMP >> $HOME/dead.glibcbug