Bug 56700 - Delete task should not follow symlinks by default
Summary: Delete task should not follow symlinks by default
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-06 23:22 UTC by Trejkaz (pen name)
Modified: 2016-04-20 06:54 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trejkaz (pen name) 2014-07-06 23:22:23 UTC
Our builds always clean the build dir like this:

    <delete dir="build" />

However, I just deleted a couple of my applications, thanks to having a symlink to /Applications and Ant's default behaviour being to follow the symlinks.

I now know that I have to do this to get safe behaviour (added in Bug 22632):

    <delete quiet="true" removeNotFollowedSymlinks="true">
        <fileset dir="build" followsymlinks="false"/>
    </delete>

I know that having the less useful defaults for tasks is something like an Ant culture, but in this particular case, the potential for damage is quite high, so I think that the default behaviour should be the safe behaviour.
Comment 1 Trejkaz (pen name) 2016-04-20 06:54:30 UTC
This workaround of using removeNotFollowedSymlinks="true" doesn't appear to delete symlinks... so I'm not sure there is a real workaround without using <exec>.

Currently we have to use rm directly.

        <exec executable="rm">
            <arg value="-rf"/>
            <arg path="build"/>
        </exec>