[#5931] MKDIR Regression with newer SAMBA versions
Summary MKDIR Regression with newer SAMBA versions
Queue Gollem
Queue Version 1.0.3
Type Bug
State Resolved
Priority 1. Low
Owners Chuck Hagenbuch <chuck (at) horde (dot) org>
Requester felix (dot) leimbach (at) gmx (dot) net
Created 11/27/2007 (220 days ago)
Due
Updated 11/30/2007 (217 days ago)
Assigned 11/27/2007 (220 days ago)
Resolved 11/30/2007 (217 days ago)
Attachments gollem-smb.patch Download
Milestone
Patch No

History
11/30/2007 Chuck Hagenbuch Comment #10
Assigned to Chuck Hagenbuch
State ⇒ Resolved
Reply to this comment
Committed an equivalent patch to HEAD (will be in the next Horde 3.2 RC):
http://lists.horde.org/archives/cvs/Week-of-Mon-20071126/072815.html

Thanks!
11/30/2007 Chuck Hagenbuch Deleted Attachment: gollem-smb-foldercreation.patch
 
11/30/2007 felix (dot) leimbach (at) gmx (dot) net Comment #9
New Attachment: gollem-smb.patch Download
Reply to this comment
Attached an updated patch which superseedes the old one. Improvements:
* also fixes file deletion and recursive folder deletion
* doesn't use rexexps any more

The patch passed the following tests on both samba-3.0.24 and 3.0.27a:
* create root level folders
* create subfolders
* create files in subfolders
* delete files in subfolders
* delete folder with subfolders and files in those subfolders

While I'm using it in production now I recommend you give it a bit of 
testing with other samba versions and environments as I cannot do that.
11/29/2007 Chuck Hagenbuch Comment #8 Reply to this comment
Since the change works in both versions I don't see a real reason not 
to apply it (though I'd fix the patch to not use a regexp when it 
really doesn't need it). I'll commit in a day or so if there's no 
negative feedback.

Is this perhaps the same issue with deleting? Any progress there?
11/29/2007 felix (dot) leimbach (at) gmx (dot) net Comment #7 Reply to this comment
topic is tracked back to the erroneous samba commit and now waits for 
developer feedback.

Even if it gets fixed soon I propose you put a warning about the 
incompatibility in gollem's readme with a link to this ticket. Distros 
will carry the affected samba versions for some time and people will 
stumble over the issue.
11/28/2007 felix (dot) leimbach (at) gmx (dot) net Comment #6 Reply to this comment
11/27/2007 felix (dot) leimbach (at) gmx (dot) net Comment #5
New Attachment: gollem-smb-foldercreation.patch
Reply to this comment
Attachment
11/27/2007 felix (dot) leimbach (at) gmx (dot) net Comment #4 Reply to this comment
I will bring up the issue on the samba mailing list and see what the 
devs intended. I remember reading something about an intended small 
smbclient syntax change a while ago but can't find it anymore.

Attached a workaround for the folder-creation problem. When patched, 
gollem properly creates folders with new AND old samba versions, so no 
harm in applying that one.

Also I found out that there are more operations which don't work after 
the samba upgrade. Deleting files f.ex. yields this error:
Cannot delete "test.txt": "/temp/test.txt" is not a directory.

Don't have time for further investigation and patching now, but might 
return to it later.
11/27/2007 Jan Schneider Comment #3
State ⇒ Feedback
Reply to this comment
Honestly, this is really a bug in samba and I tend to not workaround 
that. It should be fixed in smbclient.
11/27/2007 felix (dot) leimbach (at) gmx (dot) net Comment #2 Reply to this comment
Further debugging yields:

The critical statement sent by _command() in lib/VFS/smb.php:
/usr/bin/smbclient "//1.2.3.4/sharename" "-p139" "-Uusername" -D 
"/temp" -I 1.2.3.4 -c "mkdir \"subdir1\";"

When fired from the command line this statement does what expected in 
samba-3.0.24 and misbehaves as described in the bugreport with 
samba-3.0.25c and higher.

SOLUTION:
Appending a backslash in the -D argument solves the problem FOR BOTH 
SAMBA VERSIONS:
/usr/bin/smbclient "//1.2.3.4/sharename" "-p139" "-Uusername" -D 
"/temp/" -I 1.2.3.4 -c "mkdir \"subdir1\";"

Will create a patch to smb.php soon.
11/27/2007 felix (dot) leimbach (at) gmx (dot) net Comment #1
Type ⇒ Bug
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Summary ⇒ MKDIR Regression with newer SAMBA versions
Queue ⇒ Gollem
Reply to this comment
Regression with gollem's SMB backend between SAMBA-3.0.24 and 3.0.25c.

Problem with 3.0.25c and newer:
* Creating a folder "folder2" in ROOT/folder1 results in 
ROOT/folder1folder2 being created
* Creating a folder "folder3" in ROOT/folder1/folder2 results in 
ROOT/folder1/folder2folder3 being created

3.0.24 and lower work as expected.

Horde Framework: 3.1.4

The $dir and $mkdir variables in lib/VFS/smb.php's createFolder() are 
the same, regardless of the samba version:
Trying to create ROOT/temp/subdir1: $dir=/temp $mkdir=subdir1