The Samba-Bugzilla – Bug 3792
Retrieve files with a space character after the namefile fails
Last modified: 2017-11-07 00:22:20 UTC
When a file with a space (%20) exists after the filename in the share all file operations fails on non Linux clients.
smb://share/CAPA-ARTEFINALGESTAO.cdr_ <-- ( _ = white space)
Properties report file size of 0 bytes instead of 245590 on M$ clients. Delete is also imposible.
Is possible fix it trimming the white space, but only at the server side.
Is also possible make a patch to trim it automatically?
(In reply to comment #0)
> When a file with a space (%20) exists after the filename in the share all file
> operations fails on non Linux clients.
> smb://share/CAPA-ARTEFINALGESTAO.cdr_ <-- ( _ = white space)
> Properties report file size of 0 bytes instead of 245590 on M$ clients. Delete
> is also imposible.
> Is possible fix it trimming the white space, but only at the server side.
> Is also possible make a patch to trim it automatically?
Following is information from link
* Do not end a file or directory name with a trailing space or a period. Although the underlying file system may support such names, the operating system does not. You can start a name with a period (.).
Essentially windows does not like filenames ending with spaces. In explorer if you try creating file "hello " it creates one as "hello" by truncating trailing spaces. Taking a wild guess that explorer or programs are truncating these does not seem to be true.
I wrote small console program to create an empty file. If I run the program by pasing it filename ending with spaces windows still truncates it.
But if SAMBA share is cifs mounted on Linux using same program it is possible to create files ending with spaces. IMHO this should not be allowed.
Further on samba share if you have 2 files "hello " and "hello" explorer does show the spaces but if you try opening "hello " it always opens file without the ending spaces as it sends requests to samba for "hello" and not for "hello "
Created attachment 2755 [details]
Packet capture while trying to create filename ending with spaces on Samba share
Samba share is mounted on Windows 2K. A program which creates empty file is ran with a command line argument ( a filename to be created ) with filename ending with spaces.
Evident from the packet capture that Windows sends filename by truncating trailing spaces.