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 VERSIONING
="@VERSIONING@"
15 BUILD_STATIC
="@static@"
16 BUILD_SHARED
="@shared@"
17 BUILD_PIC_DEFAULT
="@pic_default@"
18 BUILD_PROFILE
="@profile@"
19 BUILD_OMITFP
="@omitfp@"
20 BUILD_BOUNDED
="@bounded@"
21 BUILD_STATIC_NSS
="@static_nss@"
24 PATH
=/bin
:/usr
/bin
:/usr
/local
/bin
:$PATH
29 BUGADDR
=${1-$BUGGLIBC}
30 ENVIRONMENT
=`uname -a`
34 : ${USER=${LOGNAME-`whoami`}}
36 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
37 trap 'rm -f $TEMP $TEMP.x' 0
40 # How to read the passwd database.
41 PASSWD
="cat /etc/passwd"
43 if [ -f /usr
/lib
/sendmail
] ; then
44 MAIL_AGENT
="/usr/lib/sendmail -oi -t"
45 elif [ -f /usr
/sbin
/sendmail
] ; then
46 MAIL_AGENT
="/usr/sbin/sendmail -oi -t"
51 # Figure out how to echo a string without a trailing newline
54 *c
) ECHON1
='echo -n' ECHON2
= ;;
55 *) ECHON1
=echo ECHON2
='\c' ;;
58 # Find out the name of the originator of this PR.
59 if [ -n "$NAME" ]; then
61 elif [ -f $HOME/.fullname
]; then
62 ORIGINATOR
="`sed -e '1q' $HOME/.fullname`"
64 # Must use temp file due to incompatibilities in quoting behavior
65 # and to protect shell metacharacters in the expansion of $LOGNAME
66 $PASSWD |
grep "^$LOGNAME:" |
awk -F: '{print $5}' |
sed -e 's/,.*//' > $TEMP
67 ORIGINATOR
="`cat $TEMP`"
71 if [ -n "$ORGANIZATION" ]; then
72 if [ -f "$ORGANIZATION" ]; then
73 ORGANIZATION
="`cat $ORGANIZATION`"
76 if [ -f $HOME/.organization
]; then
77 ORGANIZATION
="`cat $HOME/.organization`"
78 elif [ -f $HOME/.signature
]; then
79 ORGANIZATION
=`sed -e "s/^/ /" $HOME/.signature; echo ">"`
83 # If they don't have a preferred editor set, then use
84 if [ -z "$VISUAL" ]; then
85 if [ -z "$EDITOR" ]; then
94 # Find out some information.
95 SYSTEM
=`( [ -f /bin/uname ] && /bin/uname -a ) || \
96 ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
97 ARCH
=`[ -f /bin/arch ] && /bin/arch`
98 MACHINE
=`[ -f /bin/machine ] && /bin/machine`
100 ORGANIZATION_C
='<organization of PR author (multiple lines)>'
101 SYNOPSIS_C
='<synopsis of the problem (one line)>'
102 SEVERITY_C
='<[ non-critical | serious | critical ] (one line)>'
103 PRIORITY_C
='<[ low | medium | high ] (one line)>'
104 CLASS_C
='<[ sw-bug | doc-bug | change-request | support ] (one line)>'
105 RELEASE_C
='<release number or tag (one line)>'
106 ENVIRONMENT_C
='<machine, os, target, libraries (multiple lines)>'
107 DESCRIPTION_C
='<precise description of the problem (multiple lines)>'
108 HOW_TO_REPEAT_C
='<code/input/activities to reproduce the problem (multiple lines)>'
109 FIX_C
='<how to correct or work around the problem, if known (multiple lines)>'
113 SEND-PR: -*- send-pr -*-
114 SEND-PR: Lines starting with \`SEND-PR' will be removed automatically, as
115 SEND-PR: will all comments (text enclosed in \`<' and \`>').
119 Subject: [50 character or so descriptive subject here (for reference)]
122 >Originator: ${ORIGINATOR}
124 ${ORGANIZATION- $ORGANIZATION_C}
126 >Synopsis: $SYNOPSIS_C
127 >Severity: $SEVERITY_C
128 >Priority: $PRIORITY_C
131 >Release: libc-${VERSION}
134 `[ -n "$HOST" ] && echo Host type: $HOST`
135 `[ -n "$SYSTEM" ] && echo System: $SYSTEM`
136 `[ -n "$ARCH" ] && echo Architecture: $ARCH`
137 `[ -n "$MACHINE" ] && echo Machine: $MACHINE`
138 `[ -n "$ADDONS" ] && echo Addons: $ADDONS`
139 `[ -n "$CFLAGS" ] && echo Build CFLAGS: $CFLAGS`
140 `[ -n "$CC" ] && echo Build CC: $CC`
141 `[ -n "$VERSIONING" ] && echo Versioning: $VERSIONING`
142 `[ -n "$BUILD_STATIC" ] && echo Build static: $BUILD_STATIC`
143 `[ -n "$BUILD_SHARED" ] && echo Build shared: $BUILD_SHARED`
144 `[ -n "$BUILD_PIC_DEFAULT" ] && echo Build pic-default: $BUILD_PIC_DEFAULT`
145 `[ -n "$BUILD_PROFILE" ] && echo Build profile: $BUILD_PROFILE`
146 `[ -n "$BUILD_OMITFP" ] && echo Build omitfp: $BUILD_OMITFP`
147 `[ -n "$BUILD_BOUNDED" ] && echo Build bounded: $BUILD_BOUNDED`
148 `[ -n "$BUILD_STATIC_NSS" ] && echo Build static-nss: $BUILD_STATIC_NSS`
149 `[ -n "$STDIO" ] && echo Stdio: $STDIO`
164 if cmp -s $TEMP $TEMP.x
; then
165 echo "File not changed, no bug report submitted."
170 # Check the enumeration fields
172 # This is a "sed-subroutine" with one keyword parameter
173 # (with workaround for Sun sed bug)
193 SEVERITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
195 ""|non-critical|serious|critical
) CNT
=`expr $CNT + 1` ;;
196 *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
202 PRIORITY
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
204 ""|low|medium|high
) CNT
=`expr $CNT + 1` ;;
205 *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
211 CLASS
=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
213 ""|sw-bug|doc-bug|change-request|support
) CNT
=`expr $CNT + 1` ;;
214 *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
218 echo "Errors were found with the problem report."
221 $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
225 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
226 cat $TEMP >> $HOME/dead.glibcbug
240 # Remove comments and send the problem report
241 # (we have to use patterns, where the comment contains regex chars)
243 # /^>Originator:/s;$ORIGINATOR;;
246 /^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
247 /^>Confidential:/s;<.*>;;
248 /^>Synopsis:/s;$SYNOPSIS_C;;
249 /^>Severity:/s;<.*>;;
250 /^>Priority:/s;<.*>;;
252 /^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
253 /^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
254 /^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
255 /^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
256 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
259 if $MAIL_AGENT < $TEMP.x
; then
260 echo "$COMMAND: problem report sent"
263 echo "$COMMAND: mysterious mail failure, report not sent."
264 echo "$COMMAND: problem report saved in $HOME/dead.glibcbug."
265 cat $TEMP >> $HOME/dead.glibcbug