This file is indexed.

/usr/lib/x86_64-linux-gnu/metview/mvrun is in metview 4.6.1-5build1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
#!/bin/ksh

# **************************** LICENSE START ***********************************
#
# Copyright 2012 ECMWF and INPE. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************

#                                                (vk Sep-95, rev 991011)
#
# This script was written only for ECMWF and it has not been
# designed to be portable...
#
# Script executes a metview module and reports crashes by mail.
# (within time this script has grown toooo looooooonnnngggggggg!)

set +e
Module=`basename $1`
start_date=`date`
running_bin="`ls -l $1 | cut -c43-`"
send_mail=NO

#-- execute module, with possible parameters
if [ $METVIEW_LOG = no_log -o "$METVIEW_LOG" = "-" ]
then
  "$@"
  SUCCESS_STATUS=$?
else
  MYLOG="$SCRATCH/$METVIEW_LOG.$Module.log"
  echo "[mvrun info] process $$ starting `date` with cmd:" > $MYLOG
  echo "[mvrun info] $@"                      >> $MYLOG
  echo "[mvrun info] mode is $METVIEW_MODE\n" >> $MYLOG
  "$@"                                        >> $MYLOG
  SUCCESS_STATUS=$?
  echo "\n[mvrun info] process $$ ended `date`" >> $MYLOG
  echo "[mvrun info] process exit status was $SUCCESS_STATUS" >> $MYLOG
fi

st_sig=`expr $SUCCESS_STATUS / 128`
st_signal=`expr $SUCCESS_STATUS % 128`
#-- (x:y) were used when divided by 16, now [x:y] when div 128
st_text="$SUCCESS_STATUS [$st_sig:$st_signal]"

current_bin="`ls -l $1 | cut -c43-`"
if [ "$running_bin" != "$current_bin" ]
then
  st_text="UPDATED!"
fi

MVUSERID=$USER
[ "$MVUSERID" = "" ] && MVUSERID=$LOGNAME
[ "$MVUSERID" = "" ] && MVUSERID="???"

if [ $st_sig -ne 0 ]
then
  send_mail=YES
  case $st_signal in
    1)
      send_mail=NO
      ;;
    2)
      send_mail=NO
      ;;
    4)
      st_reason="Illegal Instruction"
      ;;
    5)
      st_reason="Trace/Breakpoint Trap"
      ;;
    6)
      st_reason="Abort"
      ;;
    7)
      st_reason="Emulation Trap"
      ;;
    8)
      st_reason="Arithmetic Exception"
      ;;
    10)
      st_reason="Bus Error"
      ;;
    11)
      st_reason="Segmentation Fault"
      ;;
    12)
      st_reason="Bad System Call"
      ;;
    *)
      send_mail=NO
      st_reason="(reason not decoded)"

      MV_CRASH_LOG="/home/graphics/cgx/public/Metview_crashlog_nomail"
      if [ ! -f $MV_CRASH_LOG ]
      then
        touch $MV_CRASH_LOG
        chmod 666 $MV_CRASH_LOG
        #-- give file to cgx (not to decrease users available disk quota) --
        chown cgx $MV_CRASH_LOG
      fi
      #echo "`date -u '+%d.%m.%Y %R'`; $Module; `echo $METVIEW_MODE | cut -c1`; $st_text; $MVUSERID; `hostname`; `cat $METVIEW_DIR_SHARE/app-defaults/MvTitleBarVersionText`" >> $MV_CRASH_LOG
      echo "`date -u '+%d.%m.%Y %R'`; $MVUSERID; `echo $METVIEW_MODE | cut -c1`; $st_text; $Module; `hostname`; `cat $METVIEW_DIR_SHARE/app-defaults/MvTitleBarVersionText`" >> $MV_CRASH_LOG
      ;;
  esac
fi

#-- do the hard work if really crashed
if [ $send_mail = YES ]
then
  UserMsg=/tmp/crash_$$.$Module.UserMsg
  MailMsg=/tmp/crash_$$.$Module.MailMsg
  Person=`finger $LOGNAME | grep "name: $LOGNAME" | cut -f3 -d: | head -1`

  #-- log into logfile --
  MV_CRASH_LOG="/home/graphics/cgx/public/Metview_crashlog_`cat $METVIEW_DIR_SHARE/MvVersion`"
  if [ ! -f $MV_CRASH_LOG ]
  then
    touch $MV_CRASH_LOG
    chmod 666 $MV_CRASH_LOG
    #-- give file to cgx (not to decrease users available disk quota) --
    chown cgx $MV_CRASH_LOG
  fi
  #-- new crash file format 25.3.1998, add METVIEW_MODE first letter 6.8.1998 --
  #echo "`date` $Module; $MVUSERID; `hostname`; $st_text; `cat $METVIEW_DIR_SHARE/app-defaults/MvTitleBarVersionText`" >> $MV_CRASH_LOG
  #echo "`date -u '+%d.%m.%Y %R'`; $Module; `echo $METVIEW_MODE | cut -c1`; $st_text; $MVUSERID; `hostname`; `cat $METVIEW_DIR_SHARE/app-defaults/MvTitleBarVersionText`" >> $MV_CRASH_LOG
  #-- 2000-08-18: make column widths more even i.e. constant width values first --
  echo "`date -u '+%d.%m.%Y %R'`; $MVUSERID; `echo $METVIEW_MODE | cut -c1`; $st_text; $Module; `hostname`; `cat $METVIEW_DIR_SHARE/app-defaults/MvTitleBarVersionText`" >> $MV_CRASH_LOG

  #-- inform user about crash and core --
  echo "\nThis is an automatic message to Metview user $Person:" > $UserMsg
  echo "a module '$Module' just crashed in your Metview session !">>$UserMsg

  if [ "$running_bin" != "$current_bin" ]
  then
    echo "________\n\nTHIS CRASH WAS CAUSED BY A METVIEW UPDATE !!!!!" >> $UserMsg
  fi
  echo "________\n" >> $UserMsg

  if [ -s core ]
  then
    echo "You have the following core file in your directory:" >> $UserMsg
    ls -l core >> $UserMsg
    file core >> $UserMsg
    echo "________\n" >> $UserMsg
    #-- ecquota is an ECMWF modification for HP servers --
    ecquota -v >> $UserMsg
  else
    echo "No core file was produced or the core file is empty !" >> $UserMsg
  fi
  echo " " >> $UserMsg

  if [ "$running_bin" = "$current_bin" ]
  then
   echo "+---------------------------------------------------------+">>$UserMsg
   echo "|   If you have the power to crash Metview repeatedly,    |">>$UserMsg
   echo "|  please inform Graphics Group how you manage to do it!  |">>$UserMsg
   echo "+---------------------------------------------------------+">>$UserMsg
   echo " " >> $UserMsg
  fi 

  [ -s core ] && echo "Check your disk quota" >> $UserMsg
  echo "  M e t v i e w" >> $UserMsg

  if [ $METVIEW_MODE = batch ]
  then
    /usr/bin/mail $MVUSERID < $UserMsg
  else
    xterm -title "Metview Crash Info" -bg gray -fg red4 -b 12 -e view $UserMsg &
    #-- try to make sure window appears even when network is slow...
    sleep 15
  fi

  #-- inform Metview group by mail --
  echo "Subject: Metview $METVIEW_RELEASE: $Module crashed!" > $MailMsg
  cat $METVIEW_DIR_SHARE/app-defaults/MvTitleBarVersionText >> $MailMsg
  echo "\n$Module: $st_reason! (status=$SUCCESS_STATUS: code=$st_sig, signal=$st_signal)" >> $MailMsg
  echo "User is $MVUSERID:$Person on `hostname` (informed)" >> $MailMsg

  #-- phone number is an ECMWF command!!!
  pn "\[$MVUSERID" >> $MailMsg

  echo " " >> $MailMsg
  echo "Started: $start_date" >> $MailMsg
  echo "Crashed: `date`" >> $MailMsg
  echo " " >> $MailMsg
  echo "Crashed binary: $running_bin" >> $MailMsg
  echo "Current binary: $current_bin" >> $MailMsg
  if [ "$running_bin" != "$current_bin" ]
  then
    echo "\n!!!!!! CRASH DUE TO EXECUTABLE UPDATE !!!!!" >> $MailMsg
  fi
  echo " " >> $MailMsg

  if [ -s core ]
  then
    CoreOk=`file core | grep $Module`
    file core >> $MailMsg
    echo "file etc.: `ls -l core | cut -c17-`" >> $MailMsg
    echo "directory: `pwd`" >> $MailMsg
    chmod 777 core

    if [ "$CoreOk" != "" ]
    then
      #-- examine call stack, redirect & tee to catch crash reason
      echo " " >> $MailMsg
      echo "where;quit" | dbx $1 core 2>&1 | tee -a $MailMsg
    else
      echo "\nWrong core file !" >> $MailMsg
    fi
  else
    echo "No core file or core file empty !" >> $MailMsg
  fi

  /usr/bin/mail $METVIEW_SUPPORT_MAIL < $MailMsg
  #mail cgh < $MailMsg

  rm -f $MailMsg
  rm -f $UserMsg
fi
exit $SUCCESS_STATUS