Bug #60704 [Opn->Fbk]: unlink() bug with some files path

From: Date: Sun, 29 Jan 2012 02:48:28 +0000
Subject: Bug #60704 [Opn->Fbk]: unlink() bug with some files path
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-166910@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60704&edit=1 ID: 60704 Updated by: rasmus@php.net Reported by: dean at dacunha dot net Summary: unlink() bug with some files path -Status: Open +Status: Feedback 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 Previous Comments: ------------------------------------------------------------------------ [2012-01-27 05:42:04] carloschilazo at gmail dot com Does this happen also in 5.3.9 ? Please confirm so I can look into it Thanks ------------------------------------------------------------------------ [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

« previous php.bugs (#166910) next »