OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [gccbug.in] - Blame information for rev 861

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 280 jeremybenn
#!/bin/sh
2
# Submit a problem report to a GNATS site.
3
# Copyright (C) 1993, 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
4
# Contributed by Brendan Kehoe (brendan@cygnus.com), based on a
5
# version written by Heinz G. Seidl (hgs@cygnus.com).
6
#
7
# This file is part of GNU GNATS.
8
#
9
# GNU GNATS is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 3, or (at your option)
12
# any later version.
13
#
14
# GNU GNATS is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with GNU GNATS; see the file COPYING3.  If not see
21
# .
22
 
23
# The version of this send-pr.
24
VERSION=3.113
25
 
26
# The submitter-id for your site.
27
SUBMITTER=net
28
 
29
# The default mail address for PR submissions.
30
GNATS_ADDR=gcc-gnats@gcc.gnu.org
31
 
32
# The default release for this host.
33
# We have to guess at what program_transform_name might have done.
34
# "sed 1q" because neither "head -1" nor "head -n 1" is universal, argh.
35
 
36
DEFAULT_GCC="`echo $0 | sed -e 's/bug//'`"
37
DEFAULT_RELEASE="`$DEFAULT_GCC --version | sed 1q`"
38
 
39
# The default organization.
40
DEFAULT_ORGANIZATION=
41
 
42
# What mailer to use.  This must come after the config file, since it is
43
# host-dependent.
44
# Copied from cvsbug
45
if [ -f /usr/sbin/sendmail ]; then
46
    MAIL_AGENT="/usr/sbin/sendmail -oi -t"
47
else
48
    MAIL_AGENT="/usr/lib/sendmail -oi -t"
49
fi
50
MAILER=`echo $MAIL_AGENT | sed -e 's, .*,,'`
51
if [ ! -f "$MAILER" ] ; then
52
    echo "$COMMAND: Cannot file mail program \"$MAILER\"."
53
    echo "$COMMAND: Please fix the MAIL_AGENT entry in the $COMMAND file."
54
    exit 1
55
fi
56
 
57
 
58
# How to read the passwd database.
59
PASSWD="cat /etc/passwd"
60
 
61
ECHON=bsd
62
 
63
if [ $ECHON = bsd ] ; then
64
  ECHON1="echo -n"
65
  ECHON2=
66
elif [ $ECHON = sysv ] ; then
67
  ECHON1=echo
68
  ECHON2='\c'
69
else
70
  ECHON1=echo
71
  ECHON2=
72
fi
73
 
74
#
75
 
76
if [ -z "$TMPDIR" ]; then
77
  TMPDIR=/tmp
78
else
79
  if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then
80
    TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`"
81
  fi
82
fi
83
 
84
if [ @have_mktemp_command@ = yes ]; then
85
        TEMP0=`mktemp $TMPDIR/poXXXXXX` || exit 1
86
        TEMP=`mktemp $TMPDIR/pXXXXXX` || exit 1
87
        BAD=`mktemp $TMPDIR/pbadXXXXXX` || exit 1
88
        REF=`mktemp $TMPDIR/pfXXXXXX` || exit 1
89
        REMOVE_TEMP="rm -f $TEMP0 $TEMP $BAD $REF"
90
else
91
        TEMPD=$TMPDIR/pd$$
92
        TEMP0=$TEMPD/po$$
93
        TEMP=$TEMPD/p$$
94
        BAD=$TEMPD/pbad$$
95
        REF=$TEMPD/pf$$
96
        mkdir $TEMPD || exit 1
97
        REMOVE_TEMP="rm -rf $TEMPD"
98
fi
99
 
100
# find a user name
101
if [ "$LOGNAME" = "" ]; then
102
        if [ "$USER" != "" ]; then
103
                LOGNAME="$USER"
104
        else
105
                LOGNAME="UNKNOWN"
106
        fi
107
fi
108
 
109
FROM="$LOGNAME"
110
REPLY_TO="${REPLY_TO:-${REPLYTO:-$LOGNAME}}"
111
 
112
# Find out the name of the originator of this PR.
113
if [ -n "$NAME" ]; then
114
  ORIGINATOR="$NAME"
115
elif [ -f $HOME/.fullname ]; then
116
  ORIGINATOR="`sed -e '1q' $HOME/.fullname`"
117
else
118
  # Must use temp file due to incompatibilities in quoting behavior
119
  # and to protect shell metacharacters in the expansion of $LOGNAME
120
  $PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP0
121
  ORIGINATOR="`cat $TEMP0`"
122
  rm -f $TEMP0
123
fi
124
 
125
if [ -n "$ORGANIZATION" ]; then
126
  if [ -f "$ORGANIZATION" ]; then
127
    ORGANIZATION="`cat $ORGANIZATION`"
128
  fi
129
else
130
  if [ -n "$DEFAULT_ORGANIZATION" ]; then
131
    ORGANIZATION="$DEFAULT_ORGANIZATION"
132
  elif [ -f $HOME/.organization ]; then
133
    ORGANIZATION="`cat $HOME/.organization`"
134
  fi
135
fi
136
 
137
# If they don't have a preferred editor set, then use
138
if [ -z "$VISUAL" ]; then
139
  if [ -z "$EDITOR" ]; then
140
    EDIT=vi
141
  else
142
    EDIT="$EDITOR"
143
  fi
144
else
145
  EDIT="$VISUAL"
146
fi
147
 
148
# Find out some information.
149
SYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \
150
        ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
151
ARCH=`[ -f /bin/arch ] && /bin/arch`
152
MACHINE=`[ -f /bin/machine ] && /bin/machine`
153
 
154
COMMAND=`echo $0 | sed -e 's,.*/,,'`
155
USAGE="Usage: $COMMAND [-PVL] [-t address] [-f filename] [-s severity]
156
       [-c address] [--request-id] [--version]"
157
REMOVE=
158
BATCH=
159
CC=
160
SEVERITY_C=
161
 
162
while [ $# -gt 0 ]; do
163
  case "$1" in
164
    -r) ;;              # Ignore for backward compat.
165
    -t | --to) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
166
        shift ; GNATS_ADDR="$1"
167
        EXPLICIT_GNATS_ADDR=true
168
        ;;
169
    -f | --file) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
170
        shift ; IN_FILE="$1"
171
        if [ "$IN_FILE" != "-" -a ! -r "$IN_FILE" ]; then
172
          echo "$COMMAND: cannot read $IN_FILE"
173
          $REMOVE_TEMP
174
          exit 1
175
        fi
176
        ;;
177
    -b | --batch) BATCH=true ;;
178
    -c | --cc) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
179
        shift ; CC="$1"
180
        ;;
181
    -s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
182
        shift ; SEVERITY_C="$1"
183
        ;;
184
    -p | -P | --print) PRINT=true ;;
185
    -L | --list) FORMAT=norm ;;
186
    -l | -CL | --lisp) FORMAT=lisp ;;
187
    --request-id) REQUEST_ID=true ;;
188
    -h | --help) echo "$USAGE"; $REMOVE_TEMP; exit 0 ;;
189
    -V | --version) cat <
190
gccbug (GCC) $DEFAULT_RELEASE
191
Copyright (C) 2002 Free Software Foundation, Inc.
192
This is free software; see the source for copying conditions.  There is NO
193
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
194
 
195
EOF
196
        $REMOVE_TEMP; exit 0 ;;
197
    -*) echo "$USAGE" ; $REMOVE_TEMP; exit 1 ;;
198
    *) echo "$USAGE" ; $REMOVE_TEMP; exit 1
199
 esac
200
 shift
201
done
202
 
203
# spam does not need to be listed here
204
CATEGORIES="ada bootstrap c++ c debug driver fortran inline-asm java libgcj libobjc libstdc++ middle-end objc other pch preprocessor rtl-optimization target tree-optimization web"
205
 
206
case "$FORMAT" in
207
  lisp) echo "$CATEGORIES" | \
208
        awk 'BEGIN {printf "( "} {printf "(\"%s\") ",$0} END {printf ")\n"}'
209
        $REMOVE_TEMP
210
        exit 0
211
        ;;
212
  norm) l=`echo "$CATEGORIES" | \
213
        awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
214
             END {print max + 1;}'`
215
        c=`expr 70 / $l`
216
        if [ $c -eq 0 ]; then c=1; fi
217
        echo "$CATEGORIES" | \
218
        awk 'BEGIN {print "Known categories:"; i = 0 }
219
          { printf ("%-'$l'.'$l's", $0); if ((++i % '$c') == 0) { print "" } }
220
            END { print ""; }'
221
        $REMOVE_TEMP
222
        exit 0
223
        ;;
224
esac
225
 
226
ORIGINATOR_C=''
227
ORGANIZATION_C=''
228
SYNOPSIS_C=''
229
if [ -z "$SEVERITY_C" ]; then
230
  SEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
231
fi
232
PRIORITY_C='<[ low | medium ] (one line)>'
233
CATEGORY_C=''
234
RELEASE_C=''
235
ENVIRONMENT_C=''
236
DESCRIPTION_C=''
237
HOW_TO_REPEAT_C=''
238
FIX_C=''
239
 
240
# Catch some signals. ($xs kludge needed by Sun /bin/sh)
241
xs=0
242
trap '$REMOVE_TEMP; exit $xs' 0
243
trap 'echo "$COMMAND: Aborting ..."; $REMOVE_TEMP; xs=1; exit' 1 3 13 15
244
 
245
# If they told us to use a specific file, then do so.
246
if [ -n "$IN_FILE" ]; then
247
  if [ "$IN_FILE" = "-" ]; then
248
    # The PR is coming from the standard input.
249
    if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
250
      sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" > $TEMP
251
    else
252
      cat > $TEMP
253
    fi
254
  else
255
    # Use the file they named.
256
    if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
257
      sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" $IN_FILE > $TEMP
258
    else
259
      cat $IN_FILE > $TEMP
260
    fi
261
  fi
262
else
263
 
264
  if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
265
    # If their PR_FORM points to a bogus entry, then bail.
266
    if [ ! -f "$PR_FORM" -o ! -r "$PR_FORM" -o ! -s "$PR_FORM" ]; then
267
      echo "$COMMAND: can't seem to read your template file (\`$PR_FORM'), ignoring PR_FORM"
268
      sleep 1
269
      PRINT_INTERN=bad_prform
270
    fi
271
  fi
272
 
273
  if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
274
    cp $PR_FORM $TEMP ||
275
      ( echo "$COMMAND: could not copy $PR_FORM" ; xs=1; exit )
276
  else
277
    for file in $TEMP $REF ; do
278
      cat  > $file << '__EOF__'
279
SEND-PR: -*- send-pr -*-
280
SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
281
SEND-PR: will all comments (text enclosed in `<' and `>').
282
SEND-PR:
283
SEND-PR: Please consult the GCC manual if you are not sure how to
284
SEND-PR: fill out a problem report.
285
SEND-PR: Note that the Synopsis field is mandatory.  The Subject (for
286
SEND-PR: the mail) will be made the same as Synopsis unless explicitly
287
SEND-PR: changed.
288
SEND-PR:
289
SEND-PR: Choose from the following categories:
290
SEND-PR:
291
__EOF__
292
 
293
      # Format the categories so they fit onto lines.
294
        l=`echo "$CATEGORIES" | \
295
        awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
296
             END {print max + 1;}'`
297
        c=`expr 61 / $l`
298
        if [ $c -eq 0 ]; then c=1; fi
299
        echo "$CATEGORIES" | \
300
        awk 'BEGIN {printf "SEND-PR: "; i = 0 }
301
          { printf ("%-'$l'.'$l's", $0);
302
            if ((++i % '$c') == 0) { printf "\nSEND-PR: " } }
303
            END { printf "\nSEND-PR:\n"; }' >> $file
304
 
305
      cat >> $file << __EOF__
306
To: $GNATS_ADDR
307
Subject:
308
From: $FROM
309
Reply-To: $REPLYTO
310
Cc: $CC
311
X-send-pr-version: $VERSION
312
X-GNATS-Notify:
313
 
314
 
315
>Submitter-Id:  $SUBMITTER
316
>Originator:    $ORIGINATOR
317
>Organization:  ${ORGANIZATION-$ORGANIZATION_C}
318
>Confidential:  no
319
SEND-PR: Leave "Confidential" as "no"; all GCC PRs are public.
320
>Synopsis:      $SYNOPSIS_C
321
>Severity:      $SEVERITY_C
322
SEND-PR: critical     GCC is completely not operational; no work-around known.
323
SEND-PR: serious      GCC is not working properly; a work-around is possible.
324
SEND-PR: non-critical Report indicates minor problem.
325
>Priority:      $PRIORITY_C
326
SEND-PR: medium       The problem should be solved in the next release.
327
SEND-PR: low          The problem should be solve in a future release.
328
>Category:      $CATEGORY_C
329
>Class:         <[ doc-bug | accepts-illegal | rejects-legal | wrong-code | ice-on-legal-code| ice-on-illegal-code | pessimizes-code | sw-bug | change-request | support ] (one line)>
330
SEND-PR: doc-bug          The documentation is incorrect.
331
SEND-PR: accepts-illegal  GCC fails to reject erroneous code.
332
SEND-PR: rejects-legal    GCC gives an error message for correct code.
333
SEND-PR: wrong-code       The machine code generated by gcc is incorrect.
334
SEND-PR: ice-on-legal-code   GCC gives an Internal Compiler Error (ICE)
335
SEND-PR:                     for correct code
336
SEND-PR: ice-on-illegal-code GCC gives an ICE instead of reporting an error
337
SEND-PR: pessimizes-code     GCC misses an important optimization opportunity
338
SEND-PR: sw-bug              Software bug of some other class than above
339
SEND-PR: change-request      A feature in GCC is missing.
340
SEND-PR: support             I need help with gcc.
341
>Release:       ${DEFAULT_RELEASE-$RELEASE_C}
342
>Environment:
343
`[ -n "$SYSTEM" ] && echo System: $SYSTEM`
344
`[ -n "$ARCH" ] && echo Architecture: $ARCH`
345
`[ -n "$MACHINE" ] && echo Machine: $MACHINE`
346
        $ENVIRONMENT_C
347
host: @host@
348
build: @build@
349
target: @target@
350
__EOF__
351
      cat >> $file << \__EOF__
352
configured with: @gcc_config_arguments@
353
__EOF__
354
      cat >> $file << __EOF__
355
>Description:
356
        $DESCRIPTION_C
357
>How-To-Repeat:
358
        $HOW_TO_REPEAT_C
359
>Fix:
360
        $FIX_C
361
__EOF__
362
    done
363
  fi
364
 
365
  if [ "$PRINT" = true -o "$PRINT_INTERN" = true ]; then
366
    cat $TEMP
367
    xs=0; exit
368
  fi
369
 
370
  chmod u+w $TEMP
371
  if [ -z "$REQUEST_ID" ]; then
372
    eval $EDIT $TEMP
373
  else
374
    ed -s $TEMP << '__EOF__'
375
/^Subject/s/^Subject:.*/Subject: request for a customer id/
376
/^>Category/s/^>Category:.*/>Category: send-pr/
377
w
378
q
379
__EOF__
380
  fi
381
 
382
  if cmp -s $REF $TEMP ; then
383
    echo "$COMMAND: problem report not filled out, therefore not sent"
384
    xs=1; exit
385
  fi
386
fi
387
 
388
#
389
#       Check the enumeration fields
390
 
391
# This is a "sed-subroutine" with one keyword parameter
392
# (with workaround for Sun sed bug)
393
#
394
SED_CMD='
395
/$PATTERN/{
396
s|||
397
s|<.*>||
398
s|^[    ]*||
399
s|[     ]*$||
400
p
401
q
402
}'
403
 
404
 
405
while [ -z "$REQUEST_ID" ]; do
406
  CNT=0
407
 
408
  # 1) Confidential
409
  #
410
  PATTERN=">Confidential:"
411
  CONFIDENTIAL=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
412
  case "$CONFIDENTIAL" in
413
    no) CNT=`expr $CNT + 1` ;;
414
    *) echo "$COMMAND: \`$CONFIDENTIAL' is not a valid value for \`Confidential'." ;;
415
  esac
416
  #
417
  # 2) Severity
418
  #
419
  PATTERN=">Severity:"
420
  SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
421
  case "$SEVERITY" in
422
    ""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;;
423
    *)  echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
424
  esac
425
  #
426
  # 3) Priority
427
  #
428
  PATTERN=">Priority:"
429
  PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
430
  case "$PRIORITY" in
431
    ""|low|medium) CNT=`expr $CNT + 1` ;;
432
    high) echo "$COMMAND: \`Priority: high' is reserved for GCC maintainers." ;;
433
    *)  echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
434
  esac
435
  #
436
  # 4) Category
437
  #
438
  PATTERN=">Category:"
439
  CATEGORY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
440
  FOUND=
441
  for C in $CATEGORIES
442
  do
443
    if [ "$C" = "$CATEGORY" ]; then FOUND=true ; break ; fi
444
  done
445
  if [ -n "$FOUND" ]; then
446
    CNT=`expr $CNT + 1`
447
  else
448
    if [ -z "$CATEGORY" ]; then
449
      echo "$COMMAND: you must include a Category: field in your report."
450
    else
451
      echo "$COMMAND: \`$CATEGORY' is not a known category."
452
    fi
453
  fi
454
  #
455
  # 5) Class
456
  #
457
  PATTERN=">Class:"
458
  CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
459
  case "$CLASS" in
460
    ""|doc-bug|accepts-illegal|rejects-legal|wrong-code|ice-on-legal-code|ice-on-illegal-code|pessimizes-code|sw-bug|change-request|support) CNT=`expr $CNT + 1` ;;
461
    *)  echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
462
  esac
463
  #
464
  # 6) Check that synopsis is not empty
465
  #
466
  if grep "^>Synopsis:[         ]*${SYNOPSIS_C}\$" $TEMP > /dev/null
467
  then
468
    echo "$COMMAND: Synopsis must not be empty."
469
  else
470
    CNT=`expr $CNT + 1`
471
  fi
472
 
473
  [ $CNT -lt 6 -a -z "$BATCH" ] &&
474
    echo "Errors were found with the problem report."
475
 
476
  while true; do
477
    if [ -z "$BATCH" ]; then
478
      $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
479
      read input
480
    else
481
      if [ $CNT -eq 6 ]; then
482
        input=s
483
      else
484
        input=a
485
      fi
486
    fi
487
    case "$input" in
488
      a*)
489
        if [ -z "$BATCH" ]; then
490
          echo "$COMMAND: the problem report remains in $BAD and is not sent."
491
          REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF"
492
          mv $TEMP $BAD
493
        else
494
          echo "$COMMAND: the problem report is not sent."
495
        fi
496
        xs=1; exit
497
        ;;
498
      e*)
499
        eval $EDIT $TEMP
500
        continue 2
501
        ;;
502
      s*)
503
        break 2
504
        ;;
505
    esac
506
  done
507
done
508
 
509
#
510
# Make sure the mail has got a Subject.  If not, use the same as
511
# in Synopsis.
512
#
513
 
514
if grep '^Subject:[     ]*$' $TEMP > /dev/null
515
then
516
  SYNOPSIS=`grep '^>Synopsis:' $TEMP | sed -e 's/^>Synopsis:[   ]*//'`
517
  ed -s $TEMP << __EOF__
518
/^Subject:/s/:.*\$/: $SYNOPSIS/
519
w
520
q
521
__EOF__
522
fi
523
 
524
#
525
#       Remove comments and send the problem report
526
#       (we have to use patterns, where the comment contains regex chars)
527
#
528
# /^>Originator:/s;$ORIGINATOR;;
529
sed  -e "
530
/^SEND-PR:/d
531
/^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
532
/^>Confidential:/s;<.*>;;
533
/^>Synopsis:/s;$SYNOPSIS_C;;
534
/^>Severity:/s;<.*>;;
535
/^>Priority:/s;<.*>;;
536
/^>Category:/s;$CATEGORY_C;;
537
/^>Class:/s;<.*>;;
538
/^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
539
/^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
540
/^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
541
/^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
542
/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
543
" $TEMP > $REF
544
 
545
if $MAIL_AGENT < $REF; then
546
  echo "$COMMAND: problem report sent"
547
  xs=0; exit
548
else
549
  echo "$COMMAND: mysterious mail failure."
550
  if [ -z "$BATCH" ]; then
551
    echo "$COMMAND: the problem report remains in $BAD and is not sent."
552
    REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF"
553
    mv $REF $BAD
554
  else
555
    echo "$COMMAND: the problem report is not sent."
556
  fi
557
  xs=1; exit
558
fi

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.