Ticket #155 (closed defect: fixed)

Opened 10 months ago

Last modified 9 months ago

<delete> fails when it encounters symlink pointing to non-writable file

Reported by: Bruce Weirdan <weirdan@gmail.com> Assigned to: mrook
Priority: major Milestone: 2.3.0
Component: phing-core Version: devel
Keywords: Cc:

Description

Here are two issues: 1. PhingFile::delete() uses FileSystem::checkAccess() before it attempts to delete the file. FileSystem::checkAccess() uses is_writable() to check the file, but does not take into account the fact that is_writable() checks access rights of the file pointed by symlink, not of symlink itself. 2. Checking if file is writable to determine if it could be deleted is completely wrong . On most Unix platforms to be able to delete file you have to have write permissions on the directory containing the file you wish to delete. You don't have to be able to write to file itself.

Thus I propose a fix (see attached file): add abstract method FileSystem::canDelete(PhingFile $f) and override it in descendant classes. In PhingFile::delete() use FileSystem::canDelete() instead of FileSystem::checkAccess() to determine if delete attempt would fail.

Attachments

phing-dev.delete.symlink.bug.patch (1.6 kB) - added by Bruce Weirdan <weirdan@gmail.com> on 09/27/07 13:07:10.

Change History

09/27/07 13:07:10 changed by Bruce Weirdan <weirdan@gmail.com>

  • attachment phing-dev.delete.symlink.bug.patch added.

10/09/07 14:08:24 changed by mrook

  • owner changed from hans to mrook.
  • status changed from new to assigned.

10/09/07 14:11:07 changed by mrook

  • milestone set to 2.3.0.

10/21/07 00:48:37 changed by hans

  • status changed from assigned to closed.
  • resolution set to fixed.

Thank you. I applied a slightly modified version of this in r258.


Add/Change #155 (<delete> fails when it encounters symlink pointing to non-writable file)




Action