2017-09-25 13:09:21 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# check that sanitized names with matching crc do not contain unprintable
|
|
|
|
# characters, namely 0x7f
|
|
|
|
|
2023-04-19 15:08:41 +00:00
|
|
|
source "$TEST_TOP/common" || exit
|
2017-09-25 13:09:21 +00:00
|
|
|
|
|
|
|
check_prereq mkfs.btrfs
|
|
|
|
check_prereq btrfs
|
|
|
|
|
2023-04-11 23:51:28 +00:00
|
|
|
setup_root_helper
|
2017-09-25 13:09:21 +00:00
|
|
|
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
|
|
|
|
|
2022-09-15 14:02:09 +00:00
|
|
|
_mktemp_local img
|
|
|
|
_mktemp_local img.restored
|
|
|
|
_mktemp_local 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
|