This file is indexed.

/var/lib/pcp/testsuite/354 is in pcp-testsuite 3.9.10.

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
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
#! /bin/sh
# PCP QA Test No. 354
# more serious exercising of record mode in libpcp_gui
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

signal=$PCP_BINADM_DIR/pmsignal
host=`hostname`
status=1	# failure is the default!
trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
rm -rf $tmp
mkdir $tmp
if [ ! -d $tmp ]
then
    echo "Arrgh, failed to mkdir \"$tmp\""
    ls -ld $tmp
fi
cd $tmp

_build_sed()
{
    echo "s/$host/HOST/g" >$tmp.sed
    $PCP_AWK_PROG <$1 >>$tmp.sed '
BEGIN	{ numpid = 0; pid[""] = 1 }
/pid:/	{ if ($6 == 0) next
	  for (i in pid) {
	    if ($6 == pid[i]) next
	  }
	  numpid++
	  pid[numpid] = $6
	  print "s/ " $6 " / pmlogger-pid-" numpid " /g"
	}'
}

_filter()
{
    sed <$1 \
	-e 's/$/ /' \
	-e 's/^/ /' \
    | sed -f $tmp.sed \
    | sed \
	-e 's/ $//' \
	-e 's/^ //' \
	-e "s/$MKTEMP/MKTEMP/" \
	-e "s/$host/HOST/" \
	-e 's/[0-9][^ ]* [kmKM]*bytes/SOME bytes/g' \
	-e 's/[0-9][^ ]* seconds/SOME seconds/g' \
	-e "s/$seq-$$/SEQ-PID/g" \
	-e '/xconfirm: Not found/d' \
	-e '/pmRecordControl/s/Bad file descriptor/Invalid argument/' \
    | _filter_pmlogger_log \
    | sed \
        -e 's/\/[A-Z]*\/tmp/\/tmp/' \
        -e 's/\/[a-z]*\/tmp/\/tmp/' 
}

_filter_ps()
{
$PCP_AWK_PROG '
NR == 1	{ if ($2 != "PID") {
	    print "PID not in field 2 of ps output!"
	    print
	    exit(1)
	  }
	  if ($8 == "CMD")
	    # Linux
	    cmd = 8
	  else if ($11 == "COMMAND")
	    # Darwin
	    cmd = 11
	  else {
	    print "CMD (or COMMAND) not in field 8 (or 11) of ps output!"
	    print
	    exit(1)
	  }
	  next
	}
	{ print "ps:",$2,$cmd,$(cmd+1),$(cmd+2),$(cmd+3),$(cmd+4) }'
}

rm -f $here/$seq.full

# NOT the default pmconfirm(1), please
#
cat <<'End-of-File' >$tmp.xconfirm
#!/bin/sh
# generate no output so pmlogger will report the message
exit 0
End-of-File
chmod 755 $tmp.xconfirm
export PCP_XCONFIRM_PROG=$tmp.xconfirm

# real QA test starts here

echo
echo "=== folio name relative to cwd ==="
echo "=== folio name relative to cwd ===" >>$here/$seq.full
echo

$here/src/record foo no-1 1 $host localhost $host localhost 2>&1 >$tmp.out &
sleep 10

# We used to have the temp basename created and left over (this was a bug).
# In fixing the bug we've made this test much harder ...
# typical output from ls looks like
# lZYiOHa.localhost.0
# lZYiOH.localhost.0
# and we need to extract lZYiOH not lZYiOHa
#
MKTEMP=`ls *.localhost.0 \
        | tee -a $here/$seq.full \
	| awk '{ print length($0),$0 }' \
	| sort -n \
	| sed -e 's/^[0-9][0-9]* //' -e 's/\.localhost\.0//' -e 1q`
echo "MKTEMP=$MKTEMP" >>$here/$seq.full
_build_sed $tmp.out
_filter $tmp.out
cat $tmp.out >>$here/$seq.full
echo
echo "pmlogger processes:"
echo "pmlogger processes:" >>$here/$seq.full
ps $PCP_PS_ALL_FLAGS 2>&1 \
| tee -a $here/$seq.full \
| sed -n -e 1p -e '/[p]mlogger.*-x/p' \
| _filter_ps \
| tee $tmp.tmp \
| sed -f $tmp.sed \
| LC_COLLATE=POSIX sort
pid=`$PCP_AWK_PROG '{ print $2 }' <$tmp.tmp`
if [ -z "$pid" ]
then
    # oops!
    #
    echo "Arrgh, no pmlogger process found ... see $seq.full"
    exit
else
    echo "pmlogger pid: $pid" >>$here/$seq.full
    npmlogger=`echo "$pid" | wc -w | sed -e 's/ //g'`
    if [ "$npmlogger" -ne 1 ]
    then
	echo "Arrgh, expecting 1 pmlogger process found $npmlogger processes ... see $seq.full"
	exit
    fi
    $signal -s TERM $pid
fi

for i in 1 2 3 4 5
do
    if pmlc $pid </dev/null 2>&1 | egrep "Connection refused|Transport endpoint is not connected" >/dev/null
    then
	# pmlogger has gone away, continue
	#
	break
    else
	# pmlogger still present
	#
	if [ $i = 5 ]
	then
	    echo "Arrgh, pmlogger process ($pid) will not die ... see $seq.full"
	    exit
	else
	    sleep 2
	fi
    fi
done

echo
echo "files:"
for file in *
do
    new=`echo $file | sed -e "s/$MKTEMP/MKTEMP/" -e "s/$host/HOST/"`
    [ "$new" != "$file" ] && mv $file $new
done
LC_COLLATE=POSIX ls
for log in `LC_COLLATE=POSIX ls *.log`
do
    echo
    echo "=== $log ==="
    echo "=== $log ===" >>$here/$seq.full
    _filter $log
    cat $log >>$here/$seq.full
done

rm -rf *
echo
echo "=== absolute folio name ==="
echo "=== absolute folio name ===" >>$here/$seq.full
echo

$here/src/record `pwd`/foo no-2 0 $host localhost $host localhost 2>&1 >$tmp.out &
sleep 10
# see note above
MKTEMP=`ls *.localhost.0 \
        | tee -a $here/$seq.full \
	| awk '{ print length($0),$0 }' \
	| sort -n \
	| sed -e 's/^[0-9][0-9]* //' -e 's/\.localhost\.0//' -e 1q`
echo "MKTEMP=$MKTEMP" >>$here/$seq.full
_build_sed $tmp.out
cat $tmp.out >>$here/$seq.full
_filter $tmp.out
echo
echo "pmlogger processes:"
echo "pmlogger processes:" >>$here/$seq.full
ps $PCP_PS_ALL_FLAGS 2>&1 \
| tee -a $here/$seq.full \
| sed -n -e 1p -e '/[p]mlogger.*-x/p' \
| _filter_ps \
| tee $tmp.tmp \
| sed -f $tmp.sed \
| LC_COLLATE=POSIX sort
pid=`$PCP_AWK_PROG '{ print $2 }' <$tmp.tmp`
if [ -z "$pid" ]
then
    # oops!
    #
    echo "Arrgh, no pmlogger process found ... see $seq.full"
    exit
else
    echo "pmlogger pid: $pid" >>$here/$seq.full
    $signal -s TERM $pid
fi

for i in 1 2 3 4 5
do
    if pmlc $pid </dev/null 2>&1 | egrep "Connection refused|Transport endpoint is not connected" >/dev/null
    then
	# pmlogger has gone away, continue
	#
	break
    else
	# pmlogger still present
	#
	if [ $i = 5 ]
	then
	    echo "Arrgh, pmlogger process ($pid) will not die ... see $seq.full"
	    exit
	else
	    sleep 2
	fi
    fi
done

echo
echo "files:"
for file in *
do
    new=`echo $file | sed -e "s/$MKTEMP/MKTEMP/" -e "s/$host/HOST/"`
    [ "$new" != "$file" ] && mv $file $new
done
LC_COLLATE=POSIX ls
for log in `LC_COLLATE=POSIX ls *.log`
do
    echo
    echo "=== $log ==="
    echo "=== $log ===" >>$here/$seq.full
    _filter $log
    cat $log >>$here/$seq.full
done

# success, all done
status=0
exit