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

[email protected] ("dianerrr at hotmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             dianerrr at hotmail dot com
Operating system: Linux + WinXp
PHP version:      5.2.9
PHP Bug Type:     Directory function related
Bug description:  Rename fails to move non-empty directories around on same remote WinXP fullcont

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 bug report at http://bugs.php.net/?id=47827&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=47827&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=47827&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=47827&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=47827&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47827&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=47827&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=47827&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=47827&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=47827&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=47827&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=47827&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=47827&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=47827&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=47827&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47827&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47827&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=47827&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=47827&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=47827&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=47827&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=47827&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.