This file is indexed.

/var/lib/pcp/testsuite/766 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
#!/bin/sh
# PCP QA Test No. 766
# Test using the pmfind app to find PCP servers using the active probing
# discovery mechanism. Probe inet only.
#
# Copyright (c) 2014 Red Hat.  All Rights Reserved.
#

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

# get standard environment, filters and checks
. ./common.discovery

_get_libpcp_config
$service_discovery || _notrun "No support for service discovery"

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

_sought_filter()
{
    # Only pmcd is guaranteed to be running, but other services may also be.
    # Transform two cases - no servers vs found servers - into deterministic
    # output for the --all invocations
    sed \
	-e 's/No \(pmproxy servers\) discovered/Sought \1/g' \
	-e 's/No \(pmwebd servers\) discovered/Sought \1/g' \
	-e 's/Discovered \(pmproxy servers\):/Sought \1/g' \
	-e 's/Discovered \(pmwebd servers\):/Sought \1/g' \
    # end
}

_unresolved_filter()
{
    sed -e '/  pcp:/d;
	    /  proxy:/d;
	    /  http:/d' \
    | _sought_filter
}

_resolved_filter()
{
    # Pass unresolved urls, filter the resolved ones.
    sed -e '/  pcp:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{b};
	    /  proxy:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{b};
	    /  http:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{b};
	    /  pcp:/d;
	    /  proxy:/d;
	    /  http:/d' \
    | _sought_filter
}

_error_tolerance_filter()
{
    grep Discovered.pmcd.servers:
    # ignore everything else, incl. errors
}

# real QA test starts here
_control_service_discovery

# Obtain the inet address of an active network interface
# We're extracting a metric of the form:
#
#    inst [0 or "eth0"] value "172.31.0.12"
#
# and then extracting the address
#
echo >$tmp.tmp
pminfo -f network.interface.inet_addr | \
  tail -n +3 | \
  grep -v 127.0.0.1 | \
  awk '{ print $6 }' | \
  sed s/\"//g \
| while read addr
do
    if `host $addr 2>&1 | grep NXDOMAIN >/dev/null`
    then
	# continue, no DNS for this interface, may be partially configured
	# DHCP
	#
	:
    else
	echo $addr >$tmp.tmp
	break
    fi
done

addr=`cat $tmp.tmp`
[ -z addr ] && _notrun "no active inet interfaces with DNS resolution"

echo "addr=$addr" >>$seq.full

# Probe the obtained network.
# Test various combinations of service queries and subnet sizes. Keep the
# subnet size small -- say max 4 bits.
echo "-m probe=$addr/32" >> $seq.full
echo "-m probe=INET_ADDR/32"
pmfind -m probe=$addr/32 | _unresolved_filter
echo "Exit status: $?" | tee -a $seq.full

echo "-s pmcd -m probe=$addr/31" -r >> $seq.full
echo "-s pmcd -m probe=INET_ADDR/31 -r"
pmfind -s pmcd -m probe=$addr/30 -r | _resolved_filter
echo "Exit status: $?" | tee -a $seq.full

echo "-q -m probe=$addr/30" >> $seq.full
echo "-q -m probe=INET_ADDR/30"
pmfind -q -m probe=$addr/29 | _unresolved_filter
echo "Exit status: $?" | tee -a $seq.full

echo "-q -s pmcd -m probe=$addr/29 --resolve" >> $seq.full
echo "-q -s pmcd -m probe=INET_ADDR/29 --resolve"
pmfind -q -s pmcd -m probe=$addr/28 --resolve | _resolved_filter
echo "Exit status: $?" | tee -a $seq.full

echo "-q -s pmcd -m probe=$addr/28,maxThreads=8" >> $seq.full
echo "-q -s pmcd -m probe=INET_ADDR/28,maxThreads=8"
pmfind -q -s pmcd -m probe=$addr/28,maxThreads=8 | _unresolved_filter
echo "Exit status: $?" | tee -a $seq.full

# Try to cause errors; check pmprintf path doesn't blow stack
# pmfind just needs to survive to its result message
echo "ulimit -n 10" >> $seq.full
echo "ulimit -n 10"
bash -c "ulimit -n 10; pmfind -s pmcd -m probe=127.0.0.1/24,maxThreads=64" 2>&1 | tee -a $seq.full | _error_tolerance_filter
echo "Exit status: $?" | tee -a $seq.full

# success, all done
status=0

exit