Bug #54097 [NEW]: rename() of dirs accross devices produces confusing copy error

From: Date: Fri, 25 Feb 2011 01:11:00 +0000
Subject: Bug #54097 [NEW]: rename() of dirs accross devices produces confusing copy error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159029@lists.php.net to get a copy of this message
From:             
Operating system: Linux (Ubuntu)
PHP version:      5.3.6RC1
Package:          Filesystem function related
Bug Type:         Bug
Bug description:rename() of dirs accross devices produces confusing copy error

Description:
------------
When a user tries to rename a directory accross filesystems, they are
presented 
with this warning:


PHP Warning:  rename(): The first argument to copy() function cannot be a 
directory in Command line code on line 1
PHP Warning:  rename(t2,/var/run/test/t2): Invalid cross-device link in
Command 
line code on line 1

To contrast this, running 'mv t2 /var/run/test/t2' works without any
problems.


Test script:
---------------
$ sudo mkdir /var/run/test && sudo chown whoami /var/run/test
$ mkdir t2
$ touch t2/a.file
$ php -r "rename('t2','/var/run/test/t2');"


Expected result:
----------------
I would expect the directory to be copied with its contents in their
entirety to 
the new destination, *OR* at the very least, an error message that
specifies that 
one cannot rename directories, as its confusing that it mentions copy
during a 
rename.

Actual result:
--------------
PHP Warning:  rename(): The first argument to copy() function cannot be a 
directory in Command line code on line 1
PHP Warning:  rename(t2,/var/run/test/t2): Invalid cross-device link in
Command 
line code on line 1

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54097&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=54097&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=54097&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=54097&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=54097&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54097&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=54097&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=54097&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=54097&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=54097&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=54097&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=54097&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=54097&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=54097&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=54097&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54097&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54097&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=54097&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=54097&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=54097&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=54097&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=54097&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#159029) next »