[Pyrus issue] Fails to remove empty folders on uninstall

From: Date: Mon, 05 Sep 2011 20:34:58 +0000
Subject: [Pyrus issue] Fails to remove empty folders on uninstall
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-54481@lists.php.net to get a copy of this message
Hi everyone. I seem to be unable to report a bug from the Pyrus' page (the link from http://pear2.php.net/PEAR2_Pyrus to https://github.com/pear2/PEAR2_Pyrus/issues/new gives a 404), so I'm reporting it here. When uninstalling a package, Pyrus seems to fail to remove empty folders, and it spits warnings and everything. The files are removed successfully. It's just the folders that are left behind. Initially I thought the problem is in the order of file items traversed, but on a closer inspection of the output, the folders were in the correct order. Looking at the source, it seems the problem has more to do with the fact the folder removal is attempted before the file removal. From PEAR2_Pyrus-2.0.0a3/php/PEAR2/Pyrus/Uninstaller.php, starting at line 180: ==== AtomicFileTransaction::rmEmptyDirs($dirtrees); AtomicFileTransaction::commit(); $reg->commit(); AtomicFileTransaction::removeBackups(); ==== I think this should instead be ==== AtomicFileTransaction::commit(); AtomicFileTransaction::rmEmptyDirs($dirtrees); $reg->commit(); AtomicFileTransaction::removeBackups(); === AtomicFileTransaction::rmEmptyDirs() seems to operate outside of the transaction, i.e. it removes folders right there, independently from whether a commit is issued, which is the reason for the suggested swap. If it's supposed to operate within the transaction, I guess the fix would be a little more complicated (I haven't studied the transaction code in enough detail yet to suggest a patch). I have PHP 5.3.8, Windows Server 2008 R2, in case that's relevant. Regards.

« previous php.pear.dev (#54481) next »