This file is indexed.

/var/lib/pcp/testsuite/808 is in pcp-testsuite 4.0.1-1.

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
#!/bin/sh
# PCP QA Test No. 808
# exercise pmlogger stale pid files issues
#
# Copyright (c) 2015 Red Hat.  All Rights Reserved.
# Copyright (c) 2015 Mark Goodwin.  All Rights Reserved.
#

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

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

status=1	# failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15

# real QA test starts here

pid=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep 'pmlogger.*-P' | \
grep -v grep | awk '{print $2}'`

if [ ! -S "$PCP_RUN_DIR/pmlogger.$pid.socket" ]; then
    echo FAIL no primary pmlogger running? pid=$pid
    status=1
else
    echo found primary pmlogger and found control socket in PCP_RUN_DIR

    echo === killing the primary pmlogger with SIGKILL ===
    $sudo kill -9 $pid
    for i in 1 2 3 4 5
    do
	$sudo kill -0 $pid >/dev/null 2>&1 || break
	sleep 1
    done
    $sudo kill -0 $pid >/dev/null 2>&1 && echo "Arrggh, pid $pid won't die!"

    echo === running pmlogger_check to restart primary logger ===
    $sudo $PCP_BINADM_DIR/pmlogger_check -C
    sleep 2

    newpid=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep 'pmlogger.*-P' | \
	grep -v grep | awk '{print $2}'`

    if [ -z "$newpid" ]; then
    	echo FAIL pmlogger failed to start 
	echo pid of killed primary logger is $pid
	echo === ls -l $PCP_RUN_DIR ===
	ls -l $PCP_RUN_DIR
	echo === manually removing stale run files ===
	$sudo rm -f $PCP_RUN_DIR/*pmlogger*
	status=1
	exit
    fi

    # cleanup from SIGKILL
    #
    $sudo rm -f $PCP_TMP_DIR/pmlogger/$pid $PCP_RUN_DIR/pmlogger.$pid.socket


#
# Next test: check primary logger restarts with legacy hardlinks present
# This is a corner case, but can happen.
#
    pid=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep 'pmlogger.*-P' | \
    grep -v grep | awk '{print $2}'`

    echo === checking with stale legacy hard links
    echo === killing the primary pmlogger with SIGKILL ===
    $sudo kill -9 $pid
    for i in 1 2 3 4 5
    do
	$sudo kill -0 $pid >/dev/null 2>&1 || break
	sleep 1
    done
    $sudo kill -0 $pid >/dev/null 2>&1 && echo "Arrggh, pid $pid won't die!"

    # change the stale symlinks into hardlinks, to simulate an upgrade
    # from an earlier version of pcp (before we converted to symlinks)
    $sudo rm -f $PCP_TMP_DIR/pmlogger/primary
    $sudo ln $PCP_TMP_DIR/pmlogger/$pid $PCP_TMP_DIR/pmlogger/primary
    $sudo rm -f $PCP_RUN_DIR/pmlogger.primary.socket
    $sudo ln $PCP_RUN_DIR/pmlogger.$pid.socket $PCP_RUN_DIR/pmlogger.primary.socket

    echo === running pmlogger_check to restart primary logger ===
    $sudo $PCP_BINADM_DIR/pmlogger_check -C
    sleep 2

    newpid=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep 'pmlogger.*-P' | \
	grep -v grep | awk '{print $2}'`

    if [ -z "$newpid" ]; then
    	echo FAIL pmlogger failed to start 
	echo pid of killed primary logger is $pid
	echo === ls -il $PCP_RUN_DIR ===
	ls -il $PCP_RUN_DIR
	echo === manually removing stale run files ===
	$sudo rm -f $PCP_RUN_DIR/*pmlogger*
	status=1
	exit
    fi

    # cleanup from SIGKILL
    #
    $sudo rm -f $PCP_TMP_DIR/pmlogger/$pid $PCP_RUN_DIR/pmlogger.$pid.socket

    # success
    status=0
fi

exit