Ticket #221 (assigned enhancement)

Opened 5 months ago

Last modified 5 months ago

Support for copying symlinks as is

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

Description

Currently when the CopyTask encounters symlink to a file, it copies it as if it was an ordinary file (thus creating two files in the destination directory where there were only one file + one symbolic link to it in the source directory).

The attached patch (against svn HEAD) adds support for copying symlinks as is (thus they will remain symlinks in the destination directory).

Notes: 1) I did not test it on Windows (though it should degrade gracefully) 2) It fails on symbolic links to directories (they become copies in the destination directory). 3) It is somewhat dirty as it passes the $resolveSymlinks flag from CopyTask to FileUtils to File to FileSystem - I couldn't find more elegant approach 4) I filed it under phing-core category because the main changes were in the core, not in the CopyTask itself.

Attachments

phing[1].patch (6.6 kB) - added by Bruce Weirdan <weirdan@gmail.com> on 02/16/08 19:39:15.
Support for copying symbolic links as is. No support for symlinks to directories.
phing.symlinks[1].patch (8.5 kB) - added by Bruce Weirdan <weirdan@gmail.com> on 02/27/08 15:53:03.
patch that adds ability to copy symlinks 'as is' both for directories and files

Change History

02/16/08 19:39:15 changed by Bruce Weirdan <weirdan@gmail.com>

  • attachment phing[1].patch added.

Support for copying symbolic links as is. No support for symlinks to directories.

02/27/08 15:53:03 changed by Bruce Weirdan <weirdan@gmail.com>

  • attachment phing.symlinks[1].patch added.

patch that adds ability to copy symlinks 'as is' both for directories and files

02/27/08 15:54:51 changed by Bruce Weirdan <weirdan@gmail.com>

when applying the second patch you need to revert the first one

02/28/08 10:56:02 changed by hans

  • status changed from new to assigned.

This patch looks great. Would you mind creating one against the 2.3 branch? Currently head development is PHP 5.3 only (as a result of namespaces). If you put this into 2.3, though, we can probably release it with 2.3.1. If you don't get a chance to do it, I can take care of this later too. We appreciate the help!

02/28/08 11:05:16 changed by Bruce Weirdan <weirdan@gmail.com>

I'll try to get this working tonight (EET). Originally the patch was against the outdated and customized 2.3 branch.

03/05/08 10:47:30 changed by Bruce Weirdan <weirdan@gmail.com>

Unfortunately I've got no time at the moment to beat this patch in shape - be aware that it's not complete and introduces several bugs, so there's no point in applying it as is unless you ready to spend a lot of time testing it.


Add/Change #221 (Support for copying symlinks as is)