|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47827 Rename fails to move non-empty directories around on same remote WinXP fullcont
Submitted: 2009-03-29 12:28 UTC Modified: 2009-04-21 01:00 UTC
Avg. Score:4.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: dianerrr at hotmail dot com Assigned:
Status: No Feedback Package: Directory function related
PHP Version: 5.2.9 OS: Linux + WinXp
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-03-29 12:28 UTC] dianerrr at hotmail dot com
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
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" );
//Warning: rename(######,#######): Permission denied in ....

Expected result:
Renamed directory on WinXP-share

Actual result:
Warning and a empty copy of directory on WinXP share


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-13 17:51 UTC]
Does it work if you only call rename() in CLI, like this:

# php -r 'rename("foo", "bar");' 

 [2009-04-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 15:01:31 2024 UTC