Bug #18834 [Com]: Bug #18056 regression on windows

From: Date: Wed, 02 May 2012 08:37:47 +0000
Subject: Bug #18834 [Com]: Bug #18056 regression on windows
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8599@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=18834&edit=1 ID: 18834 Comment by: joewp Reported By: joe at joeparente dot com Summary: Bug #18056 regression on windows Status: Assigned Type: Bug Package: PEAR Package Version: 1.9.4 PHP Version: 5.3.8 Assigned To: dufuz New Comment: As a quick fix, I commented out line 286 in REST.php: $cachefile_lstat['dev'] == $cachefile_fstat['dev'] && And that seemed to fix it on Windows 7. Quick and dirty, I know. Previous Comments: ------------------------------------------------------------------------ [2011-12-06 17:14:28] miau Although PEAR_REST compares lstat['dev'] and fstat['dev'], those differ from each other on Windows even if it is a normal file. https://github.com/pear/pear-core/blob/e9b322b44e3389dde64b5dae9a3d1935a413a407/PEAR/REST.php#L286 Here is a testing code. ===== start of stat_test.php ===== <?php $tmpfile = tempnam('.', ''); $f = fopen($tmp, "w"); $fstat = fstat($f); fclose($f); $lstat = lstat($tmpfile); unlink $tmpfile; echo "lstat['dev']: $lstat['dev']\n"; echo "fstat['dev']: $fstat['dev']\n"; ===== end of stat_test.php ===== >:: on Windows 7 >php stat_test.php.txt lstat['dev']: 2 fstat['dev']: 0 $# on CentOS $ php stat_test.php lstat['dev']: 64768 fstat['dev']: 64768 How about using is_link() like PEAR_Downloader? https://github.com/pear/pear-core/blob/e9b322b44e3389dde64b5dae9a3d1935a413a407/PEAR/Downloader.php#L1711 It seems to be enough to check if the file is a symbolic link. >:: on Windows 7 >mklink link.txt target.txt symbolic link created for link.txt <<===>> target.txt >php -r "var_dump(is_link('target.txt'));" bool(false) >php -r "var_dump(is_link('link.txt'));" bool(true) ------------------------------------------------------------------------ [2011-09-18 09:02:17] doconnor <div id="changeset"> <span class="removed">-Assigned To:</span> <span class="added">+Assigned To: dufuz</span> </div> ------------------------------------------------------------------------ [2011-09-15 06:45:57] doconnor Description: ------------ The fixes for Bug #18056 appear to be too aggressive on a windows environment. I don't believe even the latest windows have anything like a symlink; so potentially checking the OS will fix this Test script: --------------- C:\pear\packages\Cache\trunk>pear upgrade pear Expected result: ---------------- No errors Actual result: -------------- C:\pear\packages\Cache\trunk>pear upgrade pear Error getting channel info from pear.php.net: SECURITY ERROR: Will not write to c:\tmp\cache\6d1f6e892384ae452db9a1bd59ee95f5rest.cache id as it is symlinked to c:\tmp\cache\6d1f6e892384ae452db9a1bd59ee95f5rest.cache id - Possible symlink att ack Nothing to upgrade C:\pear\packages\Cache\trunk> ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=18834&edit=1

« previous php.pear.bugs (#8599) next »