/var/lib/pcp/testsuite/src/mkbadlen is in pcp-testsuite 3.9.10.
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 | #!/bin/sh
#
# Recipes for making badlen-* family of archives.
# 
# Every one is based on a version of foo, with binary editing using
# bvi (or similar) and cut-n-paste with dd.
tmp=/var/tmp/$$
trap "rm -f $tmp.*; exit 0" 0 1 2 3 15
# Set up for a new badlen-X archive
#
X=0
while true
do
    [ ! -f badlen-$X.index ] && break
    X=`expr $X + 1`
    if [ $X -eq 100 ]
    then
	echo "Botch: all archives badlen-0...badlen-99 already exist?"
	exit 1
    fi
done
if [ $X -eq 0 ]
then
    cp foo.0 badlen-0.0
    cp foo.meta badlen-0.meta
    cp foo.index badlen-0.index
    X=1
fi
ln badlen-0.meta badlen-$X.meta
ln badlen-0.index badlen-$X.index
case $X
in
    1)	# Trailer len of first pmResult smaller than header len.
	cp foo.0 badlen-$X.0
	echo '263s\\.\\80\\' >$tmp.ex
	;;
    2)	# Data file truncated just before first trailer record ... 132
	# bytes for label and 128 (4 bytes short) for first data record.
	dd if=badlen-0.0 of=badlen-$X.0 bs=1 count=260
	;;
    3)	# Data file truncated mid way thru first pmResult ... 132 bytes for
	# label and 120 (12 bytes short) for first partial data record.
	dd if=badlen-0.0 of=badlen-$X.0 bs=1 count=252
	;;
    4)	# Empty data file
	echo >badlen-$X.0
	;;
    5)	# Short label record (42 bytes, not 132)
	dd if=badlen-0.0 of=badlen-$X.0 bs=1 count=42
	;;
    6)	# Label header len 64 not 132 as expected
	cp foo.0 badlen-$X.0
	echo '3s\\.\\40\\' >$tmp.ex
	;;
    7)	# Label trailer len 64 not 132 as expected
	cp foo.0 badlen-$X.0
	echo '131s\\.\\40\\' >$tmp.ex
	;;
    8)	# Label bad PM_LOG_VER
	cp foo.0 badlen-$X.0
	echo '7s\\.\\FF\\' >$tmp.ex
	;;
    9)  # Truncated metadata file
	cp foo.0 badlen-$X.0
	cp foo.index badlen-$X.index
	rm -f badlen-$X.meta
	dd if=foo.meta of=badlen-$X.meta bs=1 count=840
	;;
    10)	# Data file truncated in trailer of label record
	dd if=badlen-0.0 of=badlen-$X.0 bs=1 count=131
	;;
    11)	# Data file truncated in header of first pmResult
	dd if=badlen-0.0 of=badlen-$X.0 bs=1 count=133
	;;
esac
if [ -f $tmp.ex ]
then
    echo 'w' >>$tmp.ex
    echo 'q' >>$tmp.ex
    if which bvi >/dev/null 2>&1
    then
	bvi -f $tmp.ex badlen-$X.0
    else
	echo "bvi not installed"
	echo "Need to apply the equivalent of this binary editing to badlen-$X.0"
	cat $tmp.ex
    fi
fi
echo "badlen-$X created."
exit
 |