The Samba-Bugzilla – Bug 3819
Can't delete folder on a Mac if it contains a resource fork for a non-existant file (Solaris specific problem)
Last modified: 2007-03-06 07:32:12 UTC
Our users have discovered a problem with the interaction Macintosh OS X clients and Samba and running on Solaris.
Several different versions of Mac OS X including the latest have been tested, Solaris 8, 9 and 10 have been tested, both x86 and Sparc, several different versions of Samba have been tested including the latest.
Several Sambas running on Linux have been tested as well as MS-Windows servers with Mac OS X clients and in that scenario the problem is NOT present.
The problem can be replicated as follows..
Mount a Samba share onto a PowerPC Mac OS 10.3.5,10.4,10.5 (those are all we've tested ourselves, others probably have the problem too, haven't tried X86 Macs) from a Samba server running Solaris.
Open a shell on the Mac and change dir to the mount and make a directory there like so..
fatcat:~ schaefert$ cd /Volumes/schaefert
fatcat:/Volumes/schaefert schaefert$ mkdir foo
create a file in that directory that begins with ._, like so...
fatcat:/Volumes/schaefert schaefert$ cd foo
fatcat:/Volumes/schaefert/foo schaefert$ touch ._bar
fatcat:/Volumes/schaefert/foo schaefert$ ls -a
. .. ._bar
In the Gui of the Mac try to delete the folder by dragging it into the trash. You will get an error like the following..
Moving "foo" to "Trash"
The operation cannot be completed because an item with the name "foo" already ex
If there had been other stuff in the folder besides the file without a matching resource fork file (the ._ file) everything in the folder would have actually got deleted except for the unmatched ._ file and the folder itself.
This looks like it might be a MacOS/X client bug. Have you raised a bug report with Apple ? Do you have an ethereal trace of the problem or smbd debug level 10 log ?
(In reply to comment #1)
> This looks like it might be a MacOS/X client bug. Have you raised a bug report
> with Apple ? Do you have an ethereal trace of the problem or smbd debug level
> 10 log ?
No, I haven't reported it to Apple. The problem does NOT occur if you are using a Macintosh client in conjunction with disk served off Samba running on Linux or disk served from a MS-Windows system. (Nor does the problem happen if you use the Mac's local disk). The problem only occurs when Samba is running on Solaris.
I don't currently have level 10 debug logs or Ethereal traces but I'll gather it together if you're willing to look at it.
Quite a ways back Jeremy you corrected another problem for me that only occurred against Solaris. I forget the details but the long and short of it was that Solaris returned a 2 to indicate the success of some operation but you where only checking to see if the result code was equal to 1. My hunch is that this is another situation like that one.
Created attachment 1943 [details]
Created attachment 1944 [details]
level 10 log
In the attached case capture/log I was connected from a Macintosh at 220.127.116.11 to a Samba server at 18.104.22.168. The Samba server was running Solaris 10 x86 with and Sun's latest release of a Samba package - 3.0.11.
The share name is \\test_share It had a folder in it named test_folder which contained a single file named ._test_file. Nothing else existed on the share. I tried to delete the folder test_folder using the Macintosh's GUI and received the error that file with the name test_folder already exists.
Here's the summary lines of what appears to me as the actual failure happening in the Ethereal trace..
120 4.724181 22.214.171.124 126.96.36.199 SMB Delete Directory Request, Directory: \test_folder
121 4.725027 188.8.131.52 184.108.40.206 SMB Delete Directory Response, Error: STATUS_OBJECT_NAME_COLLISION
And as viewed in the samba log of the exact same event..
[2006/06/05 11:10:21, 3] smbd/process.c:(886)
switch message SMBrmdir (pid 5822) conn 0x8344cb8
[2006/06/05 11:10:21, 4] smbd/uid.c:(194)
change_to_user: Skipping user change - already user
[2006/06/05 11:10:21, 5] smbd/filename.c:(108)
unix_convert called on file "test_folder"
[2006/06/05 11:10:21, 10] smbd/statcache.c:(243)
stat_cache_lookup: lookup succeeded for name [TEST_FOLDER] -> [test_folder]
[2006/06/05 11:10:21, 3] smbd/reply.c:(3484)
rmdir_internals: couldn't remove directory test_folder : File exists
[2006/06/05 11:10:21, 10] smbd/trans2.c:(2240)
set_bad_path_error: err = 17 bad_path = 0
[2006/06/05 11:10:21, 3] smbd/error.c:(105)
error string = File exists
[2006/06/05 11:10:21, 3] smbd/error.c:(129)
error packet at smbd/trans2.c(2249) cmd=1 (SMBrmdir) NT_STATUS_OBJECT_NAME_COLLISION
Anecdotal: I have this problem with Samba 3.0.23c running on AIX. The problem didn't exist with Samba 3.0.20.