2017-09-25 13:09:21 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# check that sanitized names with matching crc do not contain unprintable
|
|
|
|
# characters, namely 0x7f
|
|
|
|
|
2018-02-08 06:34:19 +00:00
|
|
|
source "$TEST_TOP/common"
|
2017-09-25 13:09:21 +00:00
|
|
|
|
|
|
|
check_prereq mkfs.btrfs
|
|
|
|
check_prereq btrfs
|
|
|
|
|
|
|
|
prepare_test_dev
|
|
|
|
|
2019-06-05 17:09:38 +00:00
|
|
|
run_check_mkfs_test_dev
|
2017-09-25 13:09:21 +00:00
|
|
|
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
|
|
|
|
|
2019-05-02 17:14:13 +00:00
|
|
|
run_check touch img img.restored img.dump
|
|
|
|
run_check chmod a+w img img.restored img.dump
|
2017-09-25 13:09:21 +00:00
|
|
|
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
|