/var/lib/pcp/testsuite/badarchives/mk.badlabel 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 | #!/bin/sh
#
# Recipes for making badlabel-* family of archives.
#
# Every one is based on a version of ./ok-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 badlabel-X archive
#
X=0
while true
do
[ ! -f badlabel-$X.index ] && break
X=`expr $X + 1`
if [ $X -eq 100 ]
then
echo "Botch: all archives badlabel-0...badlabel-99 already exist?"
exit 1
fi
done
if [ $X -eq 0 ]
then
cp ./ok-foo.0 badlabel-0.0
cp ./ok-foo.meta badlabel-0.meta
cp ./ok-foo.index badlabel-0.index
X=1
fi
case $X
in
1) # bad magic in metadata label
vol=meta
if cp ./ok-foo.$vol badlabel-$X.$vol
then
:
else
echo "Failed: cp ./ok-foo.$vol badlabel-$X.$vol"
exit 1
fi
echo '4s\\...\\deadbe\\' >$tmp.ex
;;
2) # bad version in index label
vol=index
if cp ./ok-foo.$vol badlabel-$X.$vol
then
:
else
echo "Failed: cp ./ok-foo.$vol badlabel-$X.$vol"
exit 1
fi
echo '7s\\.\\00\\' >$tmp.ex
;;
*)
echo "Error: no recipe for badlabel-$X"
exit 1
esac
if [ -f $tmp.ex ]
then
echo 'w' >>$tmp.ex
echo 'q' >>$tmp.ex
for file in badlabel-$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
for file in badlabel-$X.0 badlabel-$X.meta badlabel-$X.index
do
if [ -f $file ]
then
:
else
target=`echo $file | sed -e "s/-$X\./-0./"`
if ln $target $file
then
:
else
echo "Failed: ln $target $file"
exit 1
fi
fi
done
echo "badlabel-$X created."
fi
exit
|