This file is indexed.

/var/lib/pcp/testsuite/172 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
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
#! /bin/sh
# PCP QA Test No. 172
# Exercise $PMCD_PORT and $PMLOGGER_PORT mechanisms
#
# Copyright (c) 2014 Red Hat.
# 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

which netstat >/dev/null 2>&1 || _notrun "netstat not installed"

rm -f $seq.out
_get_libpcp_config
if $ipv6 ; then
    ln $seq.out.ipv6 $seq.out || exit 1
else
    case `hostname`
    in
	# vm24 (openSUSE 42.2) is special, ipv6 is not enabled by the
	# test above, but pmlogger still manages to create a port 4300
	# socket for ipv6 ... special case here is a hack so I don't
	# waste any more time trying to investigate the failure on this
	# particular platform
	# - Kenj, Aug 2017
	#
	vm24)
	    ln $seq.out.halfipv6 $seq.out || exit 1
	    ;;
	*)
	    ln $seq.out.nonipv6 $seq.out || exit 1
	    ;;
    esac
fi

LOCALHOST=`hostname`
_needclean=true
status=0

_interrupt()
{
    status=1
}

if [ -d $PCP_LOG_DIR/pmlogger ]
then
    LOGGING_DIR=$PCP_LOG_DIR/pmlogger
else
    LOGGING_DIR=$PCP_LOG_DIR
fi

_cleanup()
{
    if $_needclean
    then
	unset PMCD_PORT
	unset PMLOGGER_PORT
	pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
	&& $sudo sh $tmp.cmd
	if $restore_pcpqa_systemd
	then
	    export PCPQA_SYSTEMD="$save_pcpqa_systemd"
	else
	    unset PCPQA_SYSTEMD
	fi
	_service pcp restart | _filter_pcp_start
	_restore_auto_restart pmcd
	_restore_auto_restart pmlogger
	_wait_for_pmcd
	_wait_for_pmlogger
	_needclean=false
    fi
    rm -f $tmp.*
    exit $status
}

pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
&& $sudo sh $tmp.cmd

trap "_cleanup" 0
trap "_interrupt; _cleanup" 1 2 3 15

_stop_auto_restart pmcd
_stop_auto_restart pmlogger

rm -f $seq.full

# real QA test starts here
PMCD_PORT=42000
PMLOGGER_PORT=43000
export PMCD_PORT PMLOGGER_PORT

# don't want init script to restart pmcd via systemctl, as this
# will clobber the environment, ...
#
_service pcp stop | _filter_pcp_stop
if [ "$PCPQA_SYSTEMD" = x -o "${PCPQA_SYSTEMD-x}" != x ]
then
    # $PCPQA_SYSTEMD is already set ...
    save_pcpqa_systemd="$PCPQA_SYSTEMD"
    restore_pcpqa_systemd=true
else
    restore_pcpqa_systemd=false
fi
export PCPQA_SYSTEMD=no

echo "pmcd with PMCD_PORT=$PMCD_PORT, pmlogger with PMLOGGER_PORT=$PMLOGGER_PORT"
# need to do this indirectly because system sudo cleanses the environment
#
echo "export PMCD_PORT=$PMCD_PORT" >$tmp.start
echo "export PMLOGGER_PORT=$PMLOGGER_PORT" >>$tmp.start
echo "$PCP_RC_DIR/pcp restart" >>$tmp.start

$sudo sh $tmp.start | _filter_pcp_start
_wait_for_pmlogger -P $LOGGING_DIR/$LOCALHOST/pmlogger.log

echo
echo "pminfo with PMCD_PORT=$PMCD_PORT"
pminfo -v pmcd \
| sed -e '/^pmcd\.pmie/d'

echo
echo "pmlc with PMLOGGER_PORT=$PMLOGGER_PORT"
echo "show loggers" | pmlc \
| sed \
    -e '/primary/s/([0-9][0-9]*)/(LOGGER_PID) .../' \
    -e "s/on `hostname`/on HOST/" \
    -e "s/on local:/on HOST/" \
    -e 's/ *[0-9][0-9]*//g'

echo
echo 'port from $PCP_TMP_DIR/pmlogger/primary'
sed -e 1q $PCP_TMP_DIR/pmlogger/primary

# For Mac OS X need to massage lines like ..
# tcp4       0      0  *.42000                *.*                    LISTEN
# tcp6       0      0  *.42000                *.*                    LISTEN
#
echo "... and netstat"
netstat -an \
| tee -a $seq.full \
| sed -n -e '/4[23]000.*LISTEN/{
s/0\.0\.0\.0/inet/g
s/:::/inet6:/g
s/tcp4[ 0]*\*./inet./
s/tcp6[ 0]*\*./inet6./
s/:/./g
s/.*\(inet6*.4[23]000\).*\(LISTEN\).*/... \1 ... \2/
p
}' \
| sort