Bug 210961

Summary: can't create the file that filename has backslash
Product: File System Reporter: Xiaoli Feng (fengxiaoli0714)
Component: CIFSAssignee: fs_cifs (fs_cifs)
Status: ASSIGNED ---    
Severity: normal CC: smfrench
Priority: P1    
Hardware: All   
OS: Linux   
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

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