From:             
Operating system: Linux 3.0.0-14-generic #23-Ubunt
PHP version:      5.3.8
Package:          Filesystem function related
Bug Type:         Bug
Bug description:unlink() bug with some files path

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

Reply via email to