On 9/14/2018 10:34 PM, David Sterba wrote:
On Wed, Sep 12, 2018 at 03:39:03PM +0800, Su Yanjun wrote:
Modify the file name length limit to meet the Linux naming convention.
In addition, the file name length is always bigger than 0, no need to
compare with 0 again.
Issue: #145
Signed-off-by: Su Yanjun <suyj.f...@cn.fujitsu.com>
Looks good, please send a test, thanks. You can copy portions of the
misc-tests/014-filesystem-label that does similar string length check
for the label.
The following is the tests for the patch.
[suyj@sarch tests]$ vim misc-tests-results.txt
=== START TEST
/home/suyj/btrfs-progs/tests//misc-tests/033-filename-length-limit
$TEST_DEV not given, using /home/suyj/btrfs-progs/tests//test.img as
fallback
====== RUN CHECK /home/suyj/btrfs-progs/mkfs.btrfs -L BTRFS-TEST-LABEL
-f /home/suyj/btrfs-progs/tests//test.img
btrfs-progs v4.17.1
See http://btrfs.wiki.kernel.org for more information.
Label: BTRFS-TEST-LABEL
UUID: 925425a2-5557-4dea-93d3-3b4543707082
Node size: 16384
Sector size: 4096
Filesystem size: 2.00GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 102.38MiB
System: DUP 8.00MiB
SSD detected: no
Incompat features: extref, skinny-metadata
Number of devices: 1
Devices:
ID SIZE PATH
1 2.00GiB /home/suyj/btrfs-progs/tests//test.img
====== RUN CHECK root_helper mount -t btrfs -o loop
/home/suyj/btrfs-progs/tests//test.img /home/suyj/btrfs-progs/tests//mnt
====== RUN CHECK root_helper chmod a+rw /home/suyj/btrfs-progs/tests//mnt
====== RUN CHECK root_helper /home/suyj/btrfs-progs/btrfs subvolume
create aaa
Create subvolume './aaa'
====== RUN CHECK root_helper /home/suyj/btrfs-progs/btrfs subvolume
create
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
Create subvolume
'./012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234'
====== RUN MUSTFAIL root_helper /home/suyj/btrfs-progs/btrfs subvolume
create
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345
ERROR: cannot access
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345:
File name too long
failed (expected): root_helper /home/suyj/btrfs-progs/btrfs subvolume
create
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345
====== RUN MUSTFAIL root_helper /home/suyj/btrfs-progs/btrfs subvolume
create
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
ERROR: cannot access
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234:
File name too long
failed (expected): root_helper /home/suyj/btrfs-progs/btrfs subvolume
create
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234