This file is indexed.

/var/lib/pcp/testsuite/878 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
#!/bin/sh
# PCP QA Test No. 878
# Exercise pmdapipe output capture.
#
# Copyright (c) 2015-2016 Red Hat.
#

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

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

[ -f $PCP_PMDAS_DIR/pipe/pmdapipe ] || _notrun "pipe PMDA not installed"
id -u nobody >/dev/null 2>&1 || _notrun "User nobody unavailable"

PIPE_CONF_FILE=$PCP_PMDAS_DIR/pipe/pipe.conf
PIPE_CONF_DIR=$PCP_SYSCONF_DIR/pipe.conf.d
PIPE_INDOM_CACHE=$PCP_VAR_DIR/config/pmda/128.0

status=1	# failure is the default!
username=`id -u -n`
hostname=`hostname`
$sudo rm -rf $tmp $tmp.* $seq.full

_cleanup()
{
    $sudo rm -fr $PIPE_CONF_DIR/config-$seq
    [ -d $PIPE_CONF_DIR.$seq ] && _restore_config $PIPE_CONF_DIR
    [ -f $PIPE_CONF_FILE.$seq ] && _restore_config $PIPE_CONF_FILE
    [ -f $PIPE_INDOM_CACHE.$seq ] && _restore_config $PIPE_INDOM_CACHE
    # note: _restore_auto_restart pmcd done in _cleanup_pmda()
    _cleanup_pmda pipe
}

_prepare_pmda pipe
trap "_cleanup; exit \$status" 0 1 2 3 15

_stop_auto_restart pmcd

# move aside pipe configuration state to be restored later.
[ -d $PIPE_CONF_DIR ] && _save_config $PIPE_CONF_DIR
[ -f $PIPE_CONF_FILE ] && _save_config $PIPE_CONF_FILE
[ -f $PIPE_INDOM_CACHE ] && _save_config $PIPE_INDOM_CACHE

cat <<EOF > $tmp.config
# instance   user        command
empty-line   $username   echo
echo-all     $username   echo \$0
echo-two     $username   echo \$1 \$2
ls-pipe      root        ls $PCP_PMDAS_DIR/pipe | LC_COLLATE=POSIX sort
EOF

cat << EOF1 > $tmp.confdir
noop         nobody      exit
[access]
disallow user $username : noop
EOF1

_filter_pmval()
{
    sed \
	-e "s/[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9]*[0-9]/HH:MM:SS.MSEC/g"\
	-e "s/$hostname/HOST/g" \
    #end
}

# pmdapipe is installed with custom configuration, check it
#
_exercise_pipe()
{
    echo "== basic empty line (ok) =="
    pmval -x '' -i empty-line -t 0.25 -s 8 pipe.firehose | _filter_pmval

    echo "== basic echo mirror (ok) =="
    pmval -x 'hello' -i echo-all -t 0.25 -s 8 pipe.firehose | _filter_pmval

    echo "== extra parameters (ok) =="
    pmval -x '1 two 3' -i echo-two -t 0.25 -s 8 pipe.firehose | _filter_pmval

    echo "== bad parameters (expect failure) =="
    pmval -x '1;2' -i echo-all -t 0.25 -s 3 pipe.firehose | _filter_pmval

    echo "== insufficient parameters (expect failure) =="
    pmval -x 'one' -i echo-two -t 0.25 -s 3 pipe.firehose | _filter_pmval

    echo "== disallowed access (expect failure) =="
    pmval -x '' -i noop -s 3 pipe.firehose | _filter_pmval
}

pmdapipe_remove()
{
    echo
    echo "=== remove pipe agent ==="
    $sudo ./Remove >$tmp.out 2>&1
    _filter_pmda_remove <$tmp.out
}

# install new (deterministic) configuration for pmcd/pmdapipe
#
pmdapipe_install()
{
    # start from known starting points
    cd $PCP_PMDAS_DIR/pipe
    $sudo ./Remove >/dev/null 2>&1

    $sudo rm -rf "$PIPE_CONF_DIR" "$PIPE_CONF_FILE" "$PIPE_INDOM_CACHE"
    $sudo mkdir -m 755 "$PIPE_CONF_DIR"

    $sudo mv $tmp.confdir $PIPE_CONF_DIR/config-$seq
    $sudo mv $tmp.config $PIPE_CONF_FILE

    echo
    echo "=== pipe agent installation ==="
    $sudo ./Install </dev/null >$tmp.out 2>&1
    cat $tmp.out >>$here/$seq.full
    # Check pipe metrics have appeared ... X metrics and Y values
    _filter_pmda_install <$tmp.out \
    | sed \
        -e 's/[0-9][0-9]* warnings, //' \
    | $PCP_AWK_PROG '
/Check pipe metrics have appeared/ { if ($7 >= 5 && $7 <= 25) $7 = "X"
                                     if ($10 >= 3 && $10 <= 25) $10 = "Y"
                                   }
                                   { print }'
}

_filter_pipe()
{
    # cull message resulting from non-event check access (pminfo/pmprobe)
    grep -v 'No value(s) available'
}

# real QA test starts here
pmdapipe_install

# pmcd should have been started by the Install process - check
# a sub-tree that is known-good for all pipe versions
# and setup states.
if pminfo -v pipe > $tmp.info 2> $tmp.err
then
    cat $tmp.info $tmp.err | _filter_pipe
    _exercise_pipe
else
    echo "... failed! ... here is the Install log ..."
    cat $tmp.out
    echo "... pminfo -v pipe ..."
    cat $tmp.info $tmp.err
fi

pmdapipe_remove
status=0
exit