Edit report at https://bugs.php.net/bug.php?id=60704&edit=1

 ID:                 60704
 Comment by:         carloschilazo at gmail dot com
 Reported by:        dean at dacunha dot net
 Summary:            unlink() bug with some files path
 Status:             Open
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Linux 3.0.0-14-generic #23-Ubunt
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Does this happen also in 5.3.9 ?

Please confirm so I can look into it

Thanks


Previous Comments:
------------------------------------------------------------------------
[2012-01-10 19:58:07] dean at dacunha dot net

Description:
------------
unlink() function truncates the file path name argument in some cases.

This bug appears also with the rename() function in the same cases.

The given source code use link() to duplicate a file, then unlink() to remove 
the 
source file. link() function works and unlink() bugs.

Test script:
---------------
#!/usr/local/bin/php
<?php

$Target="/mnt/M://BRASIL/Carlinhos Brown/Alfagamabetizado - Angel's Robot 
List.mp3";
$Link="/mnt/M:/NEWBASE/BRASIL/Carlinhos Brown/Alfagamabetizado - Angel's Robot 
List.1.2.mp3";

link($Target,$Link);
unlink($Target);


?>


Expected result:
----------------
unlink() should remove the "/mnt/M://BRASIL/Carlinhos Brown/Alfagamabetizado - 
Angel's Robot List.mp3" file


Actual result:
--------------
root@djavanubu:/# ./b.php

Warning: unlink(BRASIL/Carlinhos Brown/Alfagamabetizado - Angel's Robot 
List.mp3): No such file or directory in /b.php on line 8

###################
below trace shows the truncated file path given to unlink() syscall:
[...]
lstat("/mnt/M://BRASIL", {st_mode=S_IFDIR|0755, st_size=69632, ...}) = 0
link("/mnt/M://BRASIL/Carlinhos Brown/Alfagamabetizado - Angel's Robot 
List.mp3", "/mnt/M:/NEWBASE/BRASIL/Carlinhos Brown/Alfagamabetizado - Angel's 
Robot List.1.2.mp3") = 0
unlink("BRASIL/Carlinhos Brown/Alfagamabetizado - Angel's Robot List.mp3") = -1 
ENOENT (No such file or directory)
write(1, "\nWarning: unlink(BRASIL/Carlinho"..., 130
Warning: unlink(BRASIL/Carlinhos Brown/Alfagamabetizado - Angel's Robot 
List.mp3): No such file or directory in /b.php on line 8
) = 130
[...]


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60704&edit=1

Reply via email to