File: test.sh

package info (click to toggle)
btrfs-progs 6.17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,612 kB
  • sloc: ansic: 127,282; sh: 7,915; python: 1,384; makefile: 900; asm: 296
file content (34 lines) | stat: -rwxr-xr-x 844 bytes parent folder | download | duplicates (3)
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
#!/bin/bash
# check that sanitized names with matching crc do not contain unprintable
# characters, namely 0x7f

source "$TEST_TOP/common" || exit

check_prereq mkfs.btrfs
check_prereq btrfs

setup_root_helper
prepare_test_dev

run_check_mkfs_test_dev
run_check_mount_test_dev
run_check $SUDO_HELPER chmod a+rw "$TEST_MNT"

# known to produce char 0x7f == 127
touch "$TEST_MNT/|5gp!"

run_check_umount_test_dev

_mktemp_local img
_mktemp_local img.restored
_mktemp_local img.dump
run_check $SUDO_HELPER "$TOP/btrfs-image" -ss "$TEST_DEV" img
run_check $SUDO_HELPER "$TOP/btrfs-image" -r img img.restored
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-tree img.restored > img.dump

ch7f=$(echo -en '\x7f')
if grep -q "$ch7f" img.dump; then
	_fail "found char 0x7f in the sanitized names"
fi

rm -f -- img img.restored img.dump