Bug 210961 - can't create the file that filename has backslash
Summary: can't create the file that filename has backslash
Status: ASSIGNED
Alias: None
Product: File System
Classification: Unclassified
Component: CIFS (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_cifs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-30 02:45 UTC by Xiaoli Feng
Modified: 2021-01-01 03:39 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.10.0+
Subsystem:
Regression: No
Bisected commit-id:


Attachments
fix to cifs.ko to allow files or directories to be created with \ in them (2.81 KB, application/mbox)
2021-01-01 03:39 UTC, Steve French
Details

Description Xiaoli Feng 2020-12-30 02:45:45 UTC
File this bug because xfstests generic/453 fail. Test to create the special filename. It's failed if the filename includes backslash.

[root@hpe-dl380pgen8-02-vm-15 ~]# cat /etc/samba/smb.conf
[global]
ea support = yes
strict allocate = yes
[test]
path=/mnt/test
writeable=yes
[scratch]
path=/mnt/scratch
writeable=yes
[root@hpe-dl380pgen8-02-vm-15 ~]# mount //localhost/test cifs -o
user=root,password=redhat
[root@hpe-dl380pgen8-02-vm-15 ~]# cd cifs
[root@hpe-dl380pgen8-02-vm-15 cifs]#  touch "urk\xc0\xafmoo"
touch: setting times of 'urk\xc0\xafmoo': Invalid argument

As I know, the filename included backslash can't be created in windows. But I'm not sure if it's the same for samba server.

[root@hpe-dl380pgen8-02-vm-15 cifs]# ./test-453.sh
+ str='urk\xc0\xafmoo'
++ echo -e 'urk\xc0\xafmoo'
+ str1=$'urk\300\257moo'
+ echo $'urk\300\257moo'
urk��moo
+ echo hello
./test-453.sh: line 5: urk��moo: No such file or directory
[root@hpe-dl380pgen8-02-vm-15 cifs]# cat test-453.sh
#!/bin/bash -x
str="urk\xc0\xafmoo"
str1="$(echo -e $str)"
echo "$str1"
echo "hello" > "$str1"

Here the error is "No such file or directory" not "Invalid argument". Not sure if they are the same issue. By the way, all the tests above are passed for nfs and xfs.
Comment 1 Steve French 2021-01-01 03:38:07 UTC
I fixed the problem (see attached patch) with creating a file with \ in it.  If out find out the cause of the next part of the test that fails, let me know.
Comment 2 Steve French 2021-01-01 03:39:36 UTC
Created attachment 294461 [details]
fix to cifs.ko to allow files or directories to be created with \ in them

Note You need to log in before you can comment on or make changes to this bug.