This file is indexed.

/usr/share/checkbox/scripts/disk_stats_test is in checkbox 0.13.7.

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
#!/bin/bash

#Simple script to gather some data about a disk to verify it's seen by the OS
#and is properly represented.  Defaults to sda if not passed a disk at run time

DISK="sda"

check_return_code() {
    if [ "${1}" -ne "0" ]; then
        echo "ERROR # ${1} : ${2}"
        exit ${1}
    fi
}

if [[ "$1" != '' ]]; then
    DISK="$1"
fi

#Make sure we can run. This shouldn't run on removable drives (USB/Firewire)
echo "Checking that we can run"
[[ `cat /sys/block/$DISK/removable` == "1" ]] && echo "This should not be run on removable media" && exit 0

#Get some baseline stats for use later
echo "Getting baseline stats"
PROC_STAT_BEGIN=`grep -m 1 $DISK /proc/diskstats`
SYS_STAT_BEGIN=`cat /sys/block/$DISK/stat`

#Generate some disk activity using hdparm -t
echo "Generating some disk activity"
hdparm -t "/dev/$DISK" 2&> /dev/null

#Sleep 5 to let the stats files catch up
sleep 5

#Check /proc/partitions, exit with fail if disk isn't found
echo "Checking /proc/partitions"
grep -q $DISK /proc/partitions
check_return_code $? "Disk $DISK not found in /proc/partitions"

#Next, check /proc/diskstats
echo "Checking /proc/diskstats"
grep -q -m 1 $DISK /proc/diskstats
check_return_code $? "Disk $DISK not found in /proc/diskstats"

#Verify the disk shows up in /sys/block/
echo "Checking /sys/block"
ls /sys/block | grep -q $DISK
check_return_code $? "Disk $DISK not found in /sys/block"

#Verify there are stats in /sys/block/$DISK/stat
echo "Checking /sys/block/$DISK/stat"
[[ -s "/sys/block/$DISK/stat" ]]
check_return_code $? "stat is either empty or nonexistant in /sys/block/$DISK/"

#Sleep 5 to let the stats files catch up
sleep 5

#Make sure the stats have changed:
echo "Getting ending stats"
PROC_STAT_END=`grep -m 1 $DISK /proc/diskstats`
SYS_STAT_END=`cat /sys/block/$DISK/stat`

echo "Checking /proc/diskstats for changes"
[[ "$PROC_STAT_BEGIN" != "$PROC_STAT_END" ]]
check_return_code $? "Stats in Proc did not change"

echo "Checking /sys/block/$DISK/stat for changes"
[[ "$SYS_STAT_BEGIN" != "$SYS_STAT_END" ]]
check_return_code $? "Stats in Sys did not change"

exit 0