This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 176851 - Distribution directory delete follows symbolic links and deletes there too
Summary: Distribution directory delete follows symbolic links and deletes there too
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: Macintosh Mac OS X
: P1 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-14 19:18 UTC by ianb
Modified: 2009-11-30 09:38 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ianb 2009-11-14 19:18:54 UTC
Summary

When the contents of the distribution directory are being deleted the IDE follows any symbolic links it finds and deletes the contents of the directories at the end of the link. These directories are not IDE built and should not be touched.


In more detail

I have a symbolic link called "P:" in my distribution directory. It is a link to the data for the application. Whenever the IDE deletes the content of the distribution directory (usually during rebuilding or refactoring) the delete operation finds my P: symbolic link, follows it to the data directory, and deletes the contents i.e. it deletes all the data for the application. Not good !

(Why do I have a symbolic link in my distribution directory ? I want my application to work in a convenient distributed manner on Windows and Unix/Mac. All data for the application is on a network drive (Windows) or shared drive (Unix/Mac). To satisfy both I call the root of my data "P:". On Windows this is a drive letter and therefore absolute. On Unix it is a relative name so the code will look for P: in the distribution directory so I place there a link to the shared drive. Yes, there are many ways around this but in the end the IDE shouldn't follow the link I think.)
Comment 1 dlipin 2009-11-16 09:34:42 UTC
Looks like a data loss case => P1, even though corner case.

For me it looks like the issue of nbproject/build-impl.xml ("-do-clean" target, probably) been generated for the project.

ianb, what is the type of your project? Java Application? or something else?
Comment 2 ianb 2009-11-16 23:59:05 UTC
The problem was on Java application projects.
Comment 3 Tomas Zezula 2009-11-18 05:20:43 UTC
P2 as the dist folder should not contain the user data, it's a build folder.
The problem is related to the Ant issue https://issues.apache.org/bugzilla/show_bug.cgi?id=1550.
I am going to change the usage of <delete> task to use fileset with followsymlinks='false' as described in the issue.
Comment 4 Tomas Zezula 2009-11-18 05:24:45 UTC
The <delete> task with followsymlinks='false' seems to work fine. Everything else except the symlink is deleted. The dist folder cannot be deleted as it's not empty => after clean the dist folder is not removed and it cotains just the sym link (P: in your case).
Comment 5 Tomas Zezula 2009-11-18 05:55:48 UTC
The same behavior can be now achieved even without filesets using
<delete dir="${dist.dir}" followsymlinks="false"/>
but the problem is that if followsymlinks == false the top level folder is not deleted for some reason.
Comment 6 Tomas Zezula 2009-11-18 06:20:30 UTC
Fixed 928e51ce13df
Not yet integrated as the repository is closed.
Comment 7 Jiri Prox 2009-11-20 08:31:03 UTC
Fix seems to be ok
Comment 8 Jiri Prox 2009-11-24 08:36:19 UTC
Tomasi, can you please integrate the fix.
thanks
Comment 9 Tomas Zezula 2009-11-24 09:36:24 UTC
Already done.
T.
Comment 10 Quality Engineering 2009-11-24 19:05:49 UTC
Integrated into 'main-golden', will be available in build *200911241400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/928e51ce13df
User: Tomas Zezula <tzezula@netbeans.org>
Log: #176851:Distribution directory delete follows symbolic links and deletes there too
Comment 11 Jiri Prox 2009-11-25 05:07:35 UTC
verified, 
if I'm right the fix is in 6.9 -> correcting TM
Comment 12 Jan Lahoda 2009-11-30 03:15:15 UTC
The fix seems OK to me.
Comment 13 Tomas Zezula 2009-11-30 09:38:32 UTC
Integrated into 68