Bug 30795

Summary: Delete task needs a 'verify' safety attribute
Product: Ant Reporter: Thomas Whitmore <thomasw>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: enhancement    
Priority: P3    
Version: 1.6.0   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Thomas Whitmore 2004-08-23 05:21:02 UTC
Hi --

Delete Task needs a 'safety' so its correct targetting can be verified, before
the actual deletion is run. This is a loaded gun, folks, and I've seen it once
already go off in a (substantially) unexpected location with (further)
unexpected results.

I wouldn't do a bulk delete manually without double-checking what I was about to
delete, and filesets etc make this much less visible in the Ant tool. So people
need a way to see & confirm before the delete executes.

I was concerned about the lack of an obvious 'confirm', 'verify', 'displayonly'
or 'safety' feature on the delete task. I spent 40 minutes looking for a way to
confirm this -- or to print the actual targets of a fileset -- none of which
basic troubleshooting/ reliability features seemed to be available. Finally I
decided that Ant must be moderately reliable and just to run the sucker.

This stinks. Because when it ran, the delete targetted the top folder of my
major development project. Spuriously -- I'd quadruple checked the targetting
before, checked after, and still have no idea why the bomb went off there.
Luckily there was no recursion into src folders. Also luckily, but unreliably as
far as the tool goes, some files were erased but not others.

Summary: I'm really disappointed at the lack of basic safety, ability to print
what a fileset targets, and the bizarre and not particularly explainable way
things went wrong. 

My conclusion: never to use the Delete task under any circumstances; but to use
the Move task to some 'trashcan' deleted folder instead.

Suggested enhancements:
1) 'verify' or 'displayonly' attributes for Delete task
2) task to print actual resolved targets of filesets etc

This would allow the buildfile to be tested safely, before turning the 'safety'
attribute for production usage.

Hopefully these would be helpful to developers working on their makefiles. I
absolutely shudder to think of a mis-targetted 'delete bomb' going off in
people's root or major work directory. This could make the term 'major fuckup'
seem a polite understatement :-)

It scared the f**k out of me!

Luckily it should be easy and clean and nice to fix.


Cheers,
Thomas