#47827 [Opn->Fbk]: Rename fails to move non-empty directories around on same remote WinXP fullcont

From: Date: Mon, 13 Apr 2009 17:51:10 +0000
Subject: #47827 [Opn->Fbk]: Rename fails to move non-empty directories around on same remote WinXP fullcont
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-135776@lists.php.net to get a copy of this message
ID: 47827 Updated by: jani@php.net Reported By: dianerrr at hotmail dot com -Status: Open +Status: Feedback Bug Type: Directory function related Operating System: Linux + WinXp PHP Version: 5.2.9 New Comment: Does it work if you only call rename() in CLI, like this: # php -r 'rename("foo", "bar");' Previous Comments: ------------------------------------------------------------------------ [2009-03-29 12:28:48] dianerrr at hotmail dot com Description: ------------ I've noticed the following (cornercase of usage), but still faulty behavior of rename: I mount a WindowsXP full control share This share contains directories and all directories contain files and directories (otherwise reproduction will fail) I created a piece of code that mounts a samba share and then I try to move the non-empty directory "EXAMPLE" to "EXAMPLE_OLD" so to have some form of rotation. However the rename-function fails right after it created a directory named "EXAMPLE_OLD". So now I have two directories, the original (still non-empty) and the 'copy' (i didn't want) without any files. It seems like the internals of rename are incompatible with WindowsXP + Samba share. BTW: I tried the same items in normal bash and that worked flawlessly. I ran the PHP script as root on my bash and the WinXP share is fullcontrol to everyone. Reproduce code: --------------- --- From manual page: function.rename --- #!/bin/php <?php shell_exec( "mount -t smbfs -o password=\"\" ". $this->url ." ". TEMP_MOUNT_TARGET ); $files = scandir( $inboxDir ); for( $i=0; $i<count( $files ); $i++ ) { $file = $files[$i]; if( $file != "." && $file != ".." ) { rename( $Dir ."/$file", $Dir ."/$file_old" ); //ERROR! //Warning: rename(######,#######): Permission denied in .... } } ?> Expected result: ---------------- Renamed directory on WinXP-share Actual result: -------------- Warning and a empty copy of directory on WinXP share ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47827&edit=1

« previous php.bugs (#135776) next »