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
|
#!/bin/bash
#
# test file name length limits for subvolumes
source "$TEST_TOP/common"
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"
cd "$TEST_MNT"
longname=\
0123456789\
0123456789\
0123456789\
0123456789\
0123456789\
\
0123456789\
0123456789\
0123456789\
0123456789\
0123456789\
\
0123456789\
0123456789\
0123456789\
0123456789\
0123456789\
\
0123456789\
0123456789\
0123456789\
0123456789\
0123456789\
\
0123456789\
0123456789\
0123456789\
0123456789\
0123456789\
\
01234
# subvolume name length limit test
# short name test
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create subvol
# 255
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$longname"
# 256, must fail
run_mustfail "subvolume with name 256 bytes long succeeded" \
$SUDO_HELPER "$TOP/btrfs" subvolume create "$longname"5
# 255*2, must fail
run_mustfail "subvolume with name 2 * 255 bytes long succeeded" \
$SUDO_HELPER "$TOP/btrfs" subvolume create "$longname$longname"
# snapshot name length limit test
run_check $SUDO_HELPER mkdir snaps
# short name test
run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot subvol snaps/snap
# 255
run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot subvol snaps/"$longname"
# 256, must fail
run_mustfail "snapshot with name 256 bytes long succeeded" \
$SUDO_HELPER "$TOP/btrfs" subvolume snapshot subvol snaps/"$longname"5
# 255*2, must fail
run_mustfail "subvolume with name 2 * 255 bytes long succeeded" \
$SUDO_HELPER "$TOP/btrfs" subvolume snapshot subvol snaps/"$longname$longname"
cd ..
run_check_umount_test_dev
|