Bug 2769 - Windows clients can't handle dotfile filenames with two trailing spaces
Windows clients can't handle dotfile filenames with two trailing spaces
 Status: RESOLVED FIXED None Samba 3.0 Unclassified File Services (show other bugs) 3.0.10 All Linux P3 normal none Jeremy Allison Samba QA Contact (view as bug list)

 Reported: 2005-06-03 14:06 UTC by Jason Hoover 2005-09-29 07:40 UTC (History) 2 users (show) kostya lukie+samba

Attachments
Patch (1.68 KB, patch)
2005-09-28 18:25 UTC, Jeremy Allison
no flags Details

 Note You need to log in before you can comment on or make changes to this bug.
 Jason Hoover 2005-06-03 14:06:29 UTC As the summary states, windows clients (at least 2000) can't handle filenames with two trailing spaces. For example, create the file ".foo\\", then try to copy it using explorer. It will work fine in smbclient, but explorer will report a "Cannot copy from source disk" error. However, the filename of ".foo" will work just fine. Jason Hoover 2005-06-03 14:22:48 UTC Correction: I spoke too soon. This seems to occur on ANY file name with a space after the .extention part. Including (but probably not limited too); foo.foo\ .foo\ foo.foo.foo\ Again, grapeshot accordingly if already reported or fixed. Jeremy Allison 2005-06-03 16:18:53 UTC Can you catagorise the names that need to be mangled and I'll add them to the mangling rules on the server. Thanks, Jeremy. Jason Hoover 2005-06-03 16:35:54 UTC Hmm. Not sure I quite get what you mean but... I think it boils down to; "Filenames with trailing spaces". even foo\ inclusive. In fact, windows mistakes these files for folders when I try to copy them from samba. When you add a space to the end of a filename in windows it says: "Cannot rename file, source and destination are the same", and when you rename a file and add a space at the end, it just trims the space. I suspect spaces are used internally in NTFS to indicate folders. Sorry if I'm being too verbose, I just hate vauge bug reports. Jeremy Allison 2005-06-03 20:02:09 UTC What I mean is it's not clear from your message if it's only path\to\directory\any other characters or path\to\directory\any other characters or path\to\directory\any other characters\another pathname or path\to\directory\any other characters\another pathname See ? Many such variations. I'm hoping you can narrow this down for me to save me a lot of time. Thanks, Jeremy. Jason Hoover 2005-06-03 21:47:36 UTC I did some more testing, and it can be summed up as I did in the previous comment. "Filenames and directories that end in spaces" While explorer can browse to directories with trailing spaces, and even copy files from within them (though the window will suspiciously dissapear instantly), it cannot copy the directory itself. Sorry for the ambiguity and confusion. Colin JN Breame 2005-09-28 03:09:18 UTC I'm seeing this problem as well, which can easily be tested (assuming you have access to a windows box). 1. Create a file on the share with a trailing space. e.g. 'echo hello > test\ ' 2. On my XP box, copying the file from the share to the local filesystem results in the message 'Cannot copy file: Cannot read from the source file or disk' I was wonder if it would be more appropriate to change the summary to something like "Windows clients cannot copy filenames with trailing spaces." or similar. Kind Regards,  Jason Hoover 2005-09-28 10:56:48 UTC (In reply to comment #6) > I was wonder if it would be more appropriate to change the summary to something > like "Windows clients cannot copy filenames with trailing spaces." or similar. It would be. I made the discovery that it includes ALL Trailing spaces later. From: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp "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." Gerald (Jerry) Carter (dead mail address) 2005-09-28 13:17:35 UTC Jeremy, do you want to mark this on as WONTFIX ? Or try to mangle the filename ? Jeremy Allison 2005-09-28 17:58:04 UTC Probably add this as a mangle condition - check the last character (coping with mb characters of course :-) is a space and always mangle if so. Target for 3.0.21. Jeremy.  Jeremy Allison 2005-09-28 18:25:24 UTC Created attachment 1462 [details] Patch This is the patch for 3.0.21. It also fixes an old bug in mangle_hash method where we weren't mangling filename with multiple dots that end in a dot. Jeremy. Jeremy Allison 2005-09-28 18:29:32 UTC Fixed in SVN for SAMBA_3_0 and HEAD. Not pulled into 3.0.20a but will be in 3.0.21. Jeremy. Gerald (Jerry) Carter (dead mail address) 2005-09-29 05:37:38 UTC *** Bug 601 has been marked as a duplicate of this bug. *** Gerald (Jerry) Carter (dead mail address) 2005-09-29 07:40:06 UTC *** Bug 1328 has been marked as a duplicate of this bug. ***