File: octave-bug.in

package info (click to toggle)
octave 2.0.16-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 26,276 kB
  • ctags: 16,450
  • sloc: cpp: 67,548; fortran: 41,514; ansic: 26,682; sh: 7,361; makefile: 4,077; lex: 2,008; yacc: 1,849; lisp: 1,702; perl: 1,676; exp: 123
file content (325 lines) | stat: -rwxr-xr-x 6,991 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
#! /bin/sh -
#
# octave-bug - create a bug report and mail it to the bug-octave
# mailing list.
#
# Patterned after the bashbug script from bash 1.14.
#
# John W. Eaton
# jwe@bevo.che.wisc.edu
# University of Wisconsin-Madison
# Department of Chemical Engineering

# Configuration:  these variables are filled in when running make to
# compile Octave.

config_opts=%config_opts%
VERSION=%VERSION%
MACHINE=%CANONICAL_HOST_TYPE%
F77=%F77%
FFLAGS=%FFLAGS%
FPICFLAG=%FPICFLAG%
FLIBS=%FLIBS%
F2C=%F2C%
F2CFLAGS=%F2CFLAGS%
CPPFLAGS=%CPPFLAGS%
INCFLAGS=%INCFLAGS%
CC=%CC%
CC_VERSION=%CC_VERSION%
CFLAGS=%CFLAGS%
CPICFLAG=%CPICFLAG%
CXX=%CXX%
CXX_VERSION=%CXX_VERSION%
CXXFLAGS=%BUG_CXXFLAGS%
CXXPICFLAG=%CXXPICFLAG%
LDFLAGS=%LDFLAGS%
LIBFLAGS=%LIBFLAGS%
RLD_FLAG=%RLD_FLAG%
TERMLIBS=%TERMLIBS%
LIBS=%LIBS%
LEXLIB=%LEXLIB%
LIBPLPLOT=%LIBPLPLOT%
LIBDLFCN=%LIBDLFCN%
DEFS=%DEFS%

: ${USER=$LOGNAME}

CC_AND_VERSION=
if test -n "$CC_VERSION"; then
  CC_AND_VERSION="$CC, version $CC_VERSION"
fi

CXX_AND_VERSION=
if test -n "$CXX_VERSION"; then
  CXX_AND_VERSION="$CXX, version $CXX_VERSION"
fi

PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:$PATH
export PATH

TEMP=/tmp/octave-bug.$$

: ${EDITOR=emacs}
: ${PAGER=more}

trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
trap 'rm -f $TEMP $TEMP.x' 0

UN=
if (uname) > /dev/null 2>&1; then
  UN=`uname -a`
fi

HAVE_FMT=false
if (fmt < /dev/null) > /dev/null 2>&1; then
  HAVE_FMT=true
fi

# Check whether to use -n or \c to keep echo from printing a newline
# character.  Stolen from autoconf, which borrowed the idea from dist 3.0.

if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
    echo_n=
    echo_c='
'
  else
    echo_n=-n
    echo_c=
  fi
else
  echo_n=
  echo_c='\c'
fi

ss_p=`echo $VERSION | grep "^ss-"`
if test -n "$ss_p"; then
  BUGADDR="octave-maintainers@bevo.che.wisc.edu"
else
  pretest_p=`echo $VERSION \
    | sed 's,.*\.\([0-9]*\).*,\1,' \
    | grep -v '\.' \
    | grep '[0-9]'`

  if test -n "$pretest_p" && test "$pretest_p" -ge 90; then
    BUGADDR="octave-maintainers@bevo.che.wisc.edu"
  else
    BUGADDR="bug-octave@bevo.che.wisc.edu"
  fi
fi

SUBJECT="[50 character or so descriptive subject here (for reference)]"
if test $# -gt 0; then
  case "$1" in
    -s)
      shift
      if test $# -gt 0; then
        SUBJECT="$1"
        shift
      else
        echo "usage: octave-bug [-s subject]"
        exit 1
      fi
    ;;
  esac
fi

cat > $TEMP << EOF
To: $BUGADDR
EOF
if test -n "$USER"; then
cat >> $TEMP << EOF
Cc: $USER
EOF
fi
cat >> $TEMP << EOF
Subject: $SUBJECT
--------
Bug report for Octave $VERSION configured for $MACHINE

Description:
-----------

  * Please replace this item with a detailed description of the
    problem.  Suggestions or general comments are also welcome.

Repeat-By:
---------

  * Please replace this item with a description of the sequence of
    events that causes the problem to occur. 

Fix:
---

  * If possible, replace this item with a description of how to
    fix the problem (if you don't have a fix for the problem, don't
    include this section, but please do submit your report anyway).



Configuration (please do not edit this section):
-----------------------------------------------

uname output:     $UN
configure opts:   $config_opts
Fortran compiler: $F77
FFLAGS:           $FFLAGS
F2C:              $F2C
F2CFLAGS:         $F2CFLAGS
FLIBS:            $FLIBS
CPPFLAGS:         $CPPFLAGS
INCFLAGS:         $INCFLAGS
C compiler:       $CC_AND_VERSION
CFLAGS:           $CFLAGS
CPICFLAG:         $CPICFLAG
C++ compiler:     $CXX_AND_VERSION
CXXFLAGS:         $CXXFLAGS
CXXPICFLAG:       $CXXPICFLAG
LDFLAGS:          $LDFLAGS
LIBFLAGS:         $LIBFLAGS
RLD_FLAG:         $RLD_FLAG
TERMLIBS:         $TERMLIBS
LIBS:             $LIBS
LEXLIB:           $LEXLIB
LIBPLPLOT:        $LIBPLPLOT
LIBDLFCN:         $LIBDLFCN
DEFS:

EOF

if $HAVE_FMT; then
  echo $DEFS | fmt | sed 's/^/  /' >> $TEMP
else
  echo $DEFS >> $TEMP
fi

if test $# -gt 0; then
  if test -f "$1"; then
    cat >> $TEMP << EOF

User-preferences (please do not edit this section):
--------------------------------------------------

EOF
    cat $1 >> $TEMP
  fi
fi

chmod u+w $TEMP
cp $TEMP $TEMP.x

status=0

editing=true

while $editing; do
  if $EDITOR $TEMP; then
    while $editing; do
      echo $echo_n "(a)bort, (e)dit, (l)ist, (s)end? $echo_c"
      read ans
      case "$ans" in
        a* | A*)
          status=1
          editing=false
        ;;
        e* | E*)
          break;
        ;;
        l* | L*)
          $PAGER $TEMP
        ;;
        s* | S*)
          editing=false
        ;;
      esac
    done
  else
    echo "problems with edit -- no bug report submitted"
    status=1
    editing=false
  fi
done

if test $status -eq 0; then
  if cmp -s $TEMP $TEMP.x; then
    echo "file not changed -- no bug report submitted"
    status=1
  elif test `wc $TEMP | awk '{print $1}'` -eq 0; then
    echo "empty bug report file -- not submitted"
    status=1
  else

# Try to extract the recipient address, in case the To: line in the
# message template has been changed.  Also get cc: lines.

    TO_ADDR=`sed -e '/^--------[ \t]*$/q' $TEMP | sed -n -e 's/^[Tt][Oo]://p'`
    CC_ADDR=`sed -e '/^--------[ \t]*$/q' $TEMP | sed -n -e 's/^[Cc][Cc]://p'`

    if test -z "$TO_ADDR"; then
      echo "no valid \`To:' field found in header -- using $BUGADDR instead"
    else
      BUGADDR="$TO_ADDR"      
    fi

    BUGADDR="$BUGADDR $CC_ADDR"

    TMP_SUB=`sed -e '/^--------[ \t]*$/q' $TEMP | sed -n -e 's/^Subject://p'`

    if test -n "$TMP_SUB"; then
      SUBJECT="$TMP_SUB"
    fi

# Delete the `--------' separator in the message.

# Don't pretty-print this.  Odd whitespace kills Ultrix AWK!

    awk 'BEGIN{in_header=1;} /^--------[ \t]*$/ {
      if (in_header) { in_header=0; print ""; next; }
    } { print $0; }' $TEMP > $TEMP.x

# Now try to mail it.

    ( /bin/mail $BUGADDR < $TEMP.x ) > /dev/null 2>&1
    status=$?
    if test $status -ne 0; then
      ( Mail -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1
      status=$?
      if test $status -ne 0; then
	( /usr/ucb/mail -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1
	status=$?
	if test $status -ne 0; then
	  ( mailx -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1
	  status=$?
	fi
      fi
    fi

    if test $status -ne 0; then
      echo "unable to send mail..."
    fi
  fi
fi

if test $status -ne 0; then
  dead_bug_file=$HOME/dead-octave-bug
  looking_for_file=true;
  n=1
  while $looking_for_file; do
    if test -f "$dead_bug_file-$n"; then
      n=`expr $n + 1`
    else
      looking_for_file=false
      dead_bug_file=$dead_bug_file-$n
    fi
  done
  echo "saving message in $dead_bug_file";
  cat $TEMP >> $dead_bug_file;
  exit 1
else
  echo "bug report sent to: $TO_ADDR"
  echo "             cc to: $CC_ADDR"
fi

exit $status