This file is indexed.

/var/lib/pcp/testsuite/badarchives/mk.badti 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
#!/bin/sh
#
# Recipes for making badti-* 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.
#
# This is the good temporal index
#
# Timestamp    Log Vol    end(meta)     end(log)     offset
#                                                         0 <- label record
# 04:34:32.257       0          132          132	132
# 04:34:33.248       0          350          284	152
# 04:34:40.258       0          851         1768	172
#                                                       191 <- EOF

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 badti-X archive
    #
    X=`ls badti-*.index 2>/dev/null | tail -1 | sed -e 's/badti-//' -e 's/\.index//'`
    if [ -z "$X" ]
    then
	X=1
    else
	X=`expr $X + 1`
    fi
elif [ $# -eq 1 ]
then
    X="$1"
    rm -f badti-$X.*
else
    echo "Usage: mkbadti [case#]"
    exit 1
fi

# byte offsets into ok-foo.index
# 0	start label record
# 132	start entry[1]
# 152	start entry[2]
# 172	start entry[3]
#
# within an entry
# +0	timestamp.tv_sec
# +4	timestamp.tv_usec
# +8	volume
# +12	metadata offset
# +16	log offset
#
case $X
in
    1)	# index broken in the middle of an entry
	dd if=$src.index of=badti-$X.index bs=1 count=162
	;;

    2)	# entry[1] volume is negative
	# entry[2] tv_usec in timestamp is >99999
	# entry[3] tv_sec in timestamp is negative
	# entry[3] tv_usec in timestamp is negative
	cp $src.index badti-$X.index
	echo '140s\\....\\FFFFFFFF\\' >$tmp.ex
	echo '156s\\....\\000F4240\\' >>$tmp.ex
	echo '172s\\....\\FFFFFFFE\\' >>$tmp.ex
	echo '176s\\....\\FFFFFFFC\\' >>$tmp.ex
	;;

    3)	# entry[2] volume -> non existant file, and then volume goes backwards
	# entry[2] meta and log offsets past end of file
	cp $src.index badti-$X.index
	echo '160s\\....\\00000002\\' >$tmp.ex
	echo '144s\\....\\00000354\\' >>$tmp.ex
	echo '148s\\....\\000007B9\\' >>$tmp.ex
	;;

    4)	# entry[1] meta and log offsets point into label record
	# entry[2] timestamp goes backwards
	cp $src.index badti-$X.index
	echo '144s\\....\\00000083\\' >$tmp.ex
	echo '148s\\....\\00000001\\' >>$tmp.ex
	echo '152s\\....\\2FAF0800\\' >>$tmp.ex
	;;

    *)
	echo "Error: no recipe for badti-$X"
	exit 1
	;;

esac

if [ -f $tmp.ex ]
then
    echo 'w' >>$tmp.ex
    echo 'q' >>$tmp.ex

    for file in badti-$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 badti-$X.0 badti-$X.meta badti-$X.index
do
    if [ -f $file ]
    then
	:
    else
	target=`echo $file | sed -e "s/badti-$X\./.\/ok-foo./"`
	if cp $target $file
	then
	    :
	else
	    echo "Failed: cp $target $file"
	    exit 1
	fi
    fi
done

echo "badti-$X created."

exit