Bug 2769 - Windows clients can't handle dotfile filenames with two trailing spaces
Summary: Windows clients can't handle dotfile filenames with two trailing spaces
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: File Services (show other bugs)
Version: 3.0.10
Hardware: All Linux
: P3 normal
Target Milestone: none
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
: 601 1328 (view as bug list)
Depends on:
Reported: 2005-06-03 14:06 UTC by Jason Hoover
Modified: 2005-09-29 07:40 UTC (History)
2 users (show)

See Also:

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.
Description 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\<space>\<space>", 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.
Comment 1 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);


Again, grapeshot accordingly if already reported or fixed.
Comment 2 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.
Comment 3 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\<space> inclusive.

In fact, windows mistakes these files for folders when I try to copy them from

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.
Comment 4 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\<spaces>any other characters


path\to\directory\any other characters<spaces>


path\to\directory\<spaces>any other characters\another pathname


path\to\directory\any other characters<spaces>\another pathname

See ? Many such variations. I'm hoping you can narrow this down for me to save
me a lot of time.


Comment 5 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.
Comment 6 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  
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,  
Comment 7 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.


"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."
Comment 8 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 ?
Comment 9 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.
Comment 10 Jeremy Allison 2005-09-28 18:25:24 UTC
Created attachment 1462 [details]

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.
Comment 11 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.
Comment 12 Gerald (Jerry) Carter (dead mail address) 2005-09-29 05:37:38 UTC
*** Bug 601 has been marked as a duplicate of this bug. ***
Comment 13 Gerald (Jerry) Carter (dead mail address) 2005-09-29 07:40:06 UTC
*** Bug 1328 has been marked as a duplicate of this bug. ***