* [PATCH] btrfs-progs: change filename limit to 255 when creating subvolume
@ 2018-09-12 7:39 Su Yanjun
2018-09-14 14:34 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Su Yanjun @ 2018-09-12 7:39 UTC (permalink / raw)
To: linux-btrfs; +Cc: Su Yanjun
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.fnst@cn.fujitsu.com>
---
cmds-subvolume.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index e7a884af..fe97fca3 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -715,7 +715,7 @@ static int cmd_subvol_snapshot(int argc, char **argv)
}
len = strlen(newname);
- if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
+ if (len > BTRFS_VOL_NAME_MAX) {
error("snapshot name too long '%s'", newname);
goto out;
}
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: change filename limit to 255 when creating subvolume
2018-09-12 7:39 [PATCH] btrfs-progs: change filename limit to 255 when creating subvolume Su Yanjun
@ 2018-09-14 14:34 ` David Sterba
2018-09-17 3:19 ` Su Yanjun <suyj.fnst@cn.fujitsu.com>
0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2018-09-14 14:34 UTC (permalink / raw)
To: Su Yanjun; +Cc: linux-btrfs
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.fnst@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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: change filename limit to 255 when creating subvolume
2018-09-14 14:34 ` David Sterba
@ 2018-09-17 3:19 ` Su Yanjun <suyj.fnst@cn.fujitsu.com>
0 siblings, 0 replies; 3+ messages in thread
From: Su Yanjun <suyj.fnst@cn.fujitsu.com> @ 2018-09-17 3:19 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs
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.fnst@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-17 8:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-12 7:39 [PATCH] btrfs-progs: change filename limit to 255 when creating subvolume Su Yanjun
2018-09-14 14:34 ` David Sterba
2018-09-17 3:19 ` Su Yanjun <suyj.fnst@cn.fujitsu.com>
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).