/var/lib/pcp/testsuite/archives/mkbadlog is in pcp-testsuite 3.10.8build1.
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  | #!/bin/sh
#
# Recipes for making badlog-* family of archives.
# 
# Every one is based on a version of ../src/ok-foo, with binary editing using
# bvi (or similar) and cut-n-paste with dd.
#
src=../src/ok-foo
tmp=/var/tmp/$$
trap "rm -f $tmp.*; exit 0" 0 1 2 3 15
if [ $# -eq 0 ]
then
    # Set up for a new badlog-X archive
    #
    X=`ls badlog-*.0 2>/dev/null | tail -1 | sed -e 's/badlog-//' -e 's/\.0//'`
    if [ -z "$X" ]
    then
	X=1
    else
	X=`expr $X + 1`
    fi
elif [ $# -eq 1 ]
then
    X="$1"
    rm -f badlog-$X.*
else
    echo "Usage: mkbadlog [case#]"
    exit 1
fi
# byte offsets into ok-foo.0
# 0	start label record
# 132	start record[1] (preamble)
# 284	start record[2]
# 496	start record[3]
# 708	start record[4]
# 920	start record[5]
#
# within an record (after the first)
# +0	length header
# +4	timestamp.tv_sec
# +8	timestamp.tv_usec
# +12	numpmid
# +16	pmid[0] sample.lights 0x740002E
# +20	numval[0] (1)
# +24	valfmt[0] (1)
# +28	inst[0][0] (-1)
# +32	
# +36	pmid[1] sample.drift 0x7400007
# +40	numval[1] (1)
# +44	valfmt[1] (0)
# +48	inst[1][0] (-1)
# +52	value
# +56	pmid[2] sample.bin 0x7400006
# +60	numval[2] (9)
# +64	valfmt[2] (0)
# +68	inst[2][0] (100)
# +72	value 100
# ...
# +132	inst[2][8] (900)
# +136	value 900
# +140	pmid[3] sample.colour 0x7400005
# +144	numval[3] (3)
# +148	valfmt[3] (0)
# +152	inst[3][0] (0)
# +156	value (for red)
# +160	inst[3][1] (1)
# +164	value (for green)
# +168	inst[3][2] (2)
# +172	value (for blue)
# +176	pmid[4] sample.seconds 0x7400002
# +180	numval[4] (1)
# +184	valfmt[4] (0)
# +188	inst[4][0] (-1)
# +192	value
# +196 ... value block for sample.lights 
#
case $X
in
    1)	# log broken in the middle of an entry
	dd if=$src.0 of=badlog-$X.0 bs=1 count=700
	;;
    2)	# counter goes backwards in record[4] 900 = 708+192
	cp $src.0 badlog-$X.0
	echo '900s\\....\\00000001\\' >$tmp.ex
	;;
    3)	# timestamp goes backwards at record[3] 500 = 496+4
	cp $src.0 badlog-$X.0
	echo '500s\\....\\2FAF0800\\' >$tmp.ex
	;;
    *)
	echo "Error: no recipe for badlog-$X"
	exit 1
	;;
esac
if [ -f $tmp.ex ]
then
    echo 'w' >>$tmp.ex
    echo 'q' >>$tmp.ex
    for file in badlog-$X.*
    do
	if which bvi >/dev/null 2>&1
	then
	    bvi -f $tmp.ex $file
	else
	    echo "bvi not installed"
	    echo "Need to apply the equivalent of this binary editing to $file"
	    cat $tmp.ex
	fi
    done
fi
for file in badlog-$X.0 badlog-$X.meta badlog-$X.index
do
    if [ -f $file ]
    then
	:
    else
	target=`echo $file | sed -e "s/badlog-$X\./..\/src\/ok-foo./"`
	if cp $target $file
	then
	    :
	else
	    echo "Failed: cp $target $file"
	    exit 1
	fi
    fi
done
echo "badlog-$X created."
exit
 |