Bug #54097 [Com]: rename() of dirs accross devices produces confusing copy error
Edit report at https://bugs.php.net/bug.php?id=54097&edit=1
ID: 54097
Comment by: php at mike2k dot com
Reported by: clint at ubuntu dot com
Summary: rename() of dirs accross devices produces confusing
copy error
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Linux (Ubuntu)
PHP Version: 5.3.6RC1
Block user comment: N
Private report: N
New Comment:
Still an issue in 5.4.x:
$ uname -a
Linux foo 3.8.0-34-generic #49~precise1-Ubuntu SMP Wed Nov 13 18:05:00 UTC 2013 x86_64 x86_64 x86_64
GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.3 LTS
Release: 12.04
Codename: precise
$ php -v
PHP 5.4.23-1+sury.org~precise+1
Would really appreciate another flag to rename(), or change the behavior as described in the Ubuntu
bug. Something should be done.
Previous Comments:
------------------------------------------------------------------------
[2012-11-01 18:45:24] tyler dot bannister at remote-learner dot net
This bug also affects PHP 5.3.3 on RHEL 5.8.
------------------------------------------------------------------------
[2011-02-25 02:12:28] clint at ubuntu dot com
I forgot to mention, this was reported in Ubuntu here:
https://launchpad.net/bugs/723330
------------------------------------------------------------------------
[2011-02-25 02:10:59] clint at ubuntu dot com
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 this bug report at https://bugs.php.net/bug.php?id=54097&edit=1
Thread (6 messages)