Renaming directory on Samba share fails

I'm trying to rename directories on a Samba share using "Format value", and the renaming fails with the message that the file can not be found. It seems from the Samba log that Mp3tag does some kind of file operation that is seen by the Samba server as a opening of a directory, instead of creating the new directory. This has been tested on both a network path, and as a mounted drive. Trying to rename a directory on a local disk works fine. I'm running Windows XP SP3 on the client, and Samba 3.0.32 on the server.

Below is an example from the Samba log using log level 3, with some message processing calls removed to reduce size

[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBntcreateX (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2findfirst(1704)
  call_trans2findfirst: dirtype = 16, maxentries = 1366, close_after_first=0, close_if_end = 2 requires_resume_key = 4 level = 0x104, max_data_bytes = 16384
[2008/12/17 18:37:08, 3] smbd/dir.c:dptr_create(515)
  creating new dirptr 256 for path ./, expect_close = 1
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_close(3329)
  close directory fnum=12930
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3244)
  call_trans2qfilepathinfo: TRANSACT2_QFILEINFO: level = 1006
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3355)
  call_trans2qfilepathinfo Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP (fnum = 12931) level=1006 call=7 total_data=0
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2findfirst(1704)
  call_trans2findfirst: dirtype = 16, maxentries = 1366, close_after_first=0, close_if_end = 2 requires_resume_key = 4 level = 0x104, max_data_bytes = 16384
[2008/12/17 18:37:08, 3] smbd/dir.c:dptr_create(515)
  creating new dirptr 256 for path Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP, expect_close = 1
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_close(3329)
  close directory fnum=12931
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBntcreateX (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/dosmode.c:unix_mode(142)
  unix_mode(.) returning 0664
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3244)
  call_trans2qfilepathinfo: TRANSACT2_QFILEINFO: level = 1004
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3355)
  call_trans2qfilepathinfo . (fnum = 12933) level=1004 call=7 total_data=0
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBclose (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_close(3329)
  close directory fnum=12933
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBntcreateX (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfsinfo(2285)
  call_trans2qfsinfo: level = 261
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBclose (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_close(3329)
  close directory fnum=12934
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBntcreateX (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/dosmode.c:unix_mode(142)
  unix_mode(.) returning 0664
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3244)
  call_trans2qfilepathinfo: TRANSACT2_QFILEINFO: level = 1004
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3355)
  call_trans2qfilepathinfo . (fnum = 12936) level=1004 call=7 total_data=0
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBclose (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_close(3329)
  close directory fnum=12936
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBntcreateX (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfsinfo(2285)
  call_trans2qfsinfo: level = 261
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBclose (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_close(3329)
  close directory fnum=12937
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBntcreateX (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/dosmode.c:unix_mode(142)
  unix_mode(Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u) returning 0664
[2008/12/17 18:37:08, 2] smbd/open.c:open_file(391)
  meradan opened file Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u read=Yes write=No (numopen=7)
[2008/12/17 18:37:08, 3] smbd/oplock_linux.c:linux_set_kernel_oplock(138)
  linux_set_kernel_oplock: got kernel oplock on file Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u, dev = 902, inode = 60277083, file_id = 328141
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3244)
  call_trans2qfilepathinfo: TRANSACT2_QFILEINFO: level = 1006
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3355)
  call_trans2qfilepathinfo Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u (fnum = 12938) level=1006 call=7 total_data=0
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3304)
  call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 1004
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3340)
  call_trans2qfilepathinfo: SMB_VFS_STAT of Music/Kopia av Pop/No Doubt - The Singles 1992-2003 failed (No such file or directory)
[2008/12/17 18:37:08, 3] smbd/error.c:unix_error_packet(56)
  unix_error_packet: error string = No such file or directory
[2008/12/17 18:37:08, 3] smbd/error.c:error_packet_set(106)
  error packet at smbd/trans2.c(3341) cmd=50 (SMBtrans2) NT_STATUS_OBJECT_NAME_NOT_FOUND
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBclose (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_close(3338)
  close fd=19 fnum=12938 (numopen=7)
[2008/12/17 18:37:08, 2] smbd/close.c:close_normal_file(406)
  meradan closed file Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u (numopen=6) NT_STATUS_OK
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBntcreateX (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/dosmode.c:unix_mode(142)
  unix_mode(Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u) returning 0664
[2008/12/17 18:37:08, 2] smbd/open.c:open_file(391)
  meradan opened file Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u read=No write=No (numopen=7)
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBtrans2 (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3244)
  call_trans2qfilepathinfo: TRANSACT2_QFILEINFO: level = 1004
[2008/12/17 18:37:08, 3] smbd/trans2.c:call_trans2qfilepathinfo(3355)
  call_trans2qfilepathinfo Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u (fnum = 12939) level=1004 call=7 total_data=0
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBclose (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_close(3338)
  close fd=-1 fnum=12939 (numopen=7)
[2008/12/17 18:37:08, 2] smbd/close.c:close_normal_file(406)
  meradan closed file Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u (numopen=6) NT_STATUS_OK
[2008/12/17 18:37:08, 3] smbd/process.c:switch_message(927)
  switch message SMBmv (pid 30240) conn 0xb7fd5858
[2008/12/17 18:37:08, 3] smbd/reply.c:reply_mv(4844)
  reply_mv : Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u -> Music/Kopia av Pop/No Doubt - The Singles 1992-2003/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u
[2008/12/17 18:37:08, 3] smbd/reply.c:rename_internals(4519)
  rename_internals: case_sensitive = 1, case_preserve = 1, short case preserve = 1, directory = Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u, newname = Music/Kopia av Pop/No Doubt - The Singles 1992-2003/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u, last_component_dest = 00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u, is_8_3 = 0
[2008/12/17 18:37:08, 3] smbd/dosmode.c:unix_mode(142)
  unix_mode(Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u) returning 0664
[2008/12/17 18:37:08, 2] smbd/open.c:open_file(391)
  meradan opened file Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u read=No write=No (numopen=7)
[2008/12/17 18:37:08, 2] smbd/close.c:close_normal_file(406)
  meradan closed file Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u (numopen=6) NT_STATUS_OK
[2008/12/17 18:37:08, 3] smbd/reply.c:rename_internals(4662)
  rename_internals: Error NT_STATUS_OBJECT_NAME_NOT_FOUND rename Music/Kopia av Pop/No_Doubt-The_Singles_(1992-2003)-2003-FSP/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u -> Music/Kopia av Pop/No Doubt - The Singles 1992-2003/00-no_doubt-the_singles_1992-2003-advance-2003-fsp.m3u
[2008/12/17 18:37:08, 3] smbd/error.c:error_packet_set(106)
  error packet at smbd/reply.c(4853) cmd=7 (SMBmv) NT_STATUS_OBJECT_NAME_NOT_FOUND

Unfortunately, I have no Samba here to test this.

Format value on _DIRECTORY does not create new directories but tries to rename the existing directory, so maybe Mp3tag has not enough permissions to do this?

I also had a directory renaming problem (using 2.42b) here on local files … Mp3tag was stuck endlessly, then Windows insisted it had to be aborted. Let me see if I have the log somewhere …

Oops. Overwritten. Sorry, will investigate this again in January …

If I remember correctly, I had about 20 files marked (from the same directory), my logic for artist name folders had since changed (i.e., use »R.E.M_« instead of »R.E.M«) and I wanted to rename the artist folder by something like $validate($ansi(%artist%),_).

The actual folder rename succeeded on the first file (even if Mp3tag was stuck afterwards), so I could kill it and just re-tag the rest. Not an elegant solution and no real debugging, but I was in a hurry … which also explains that I didn’t keep the error log.

Maybe because it had to change in more than one level of folders? My structure is like:
%albumartistsort%\%albumartistsort% - %album%\%artistsort% - %title%
so it had to change the name in both the top level folder and the folder below.