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 213226 - does not delete project if it is located inside the sources directory
Summary: does not delete project if it is located inside the sources directory
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.2
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-30 10:21 UTC by steady
Modified: 2012-06-06 05:53 UTC (History)
0 users

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 steady 2012-05-30 10:21:02 UTC
Product Version = NetBeans IDE Dev (Build 201205280002)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.6.0_26
Runtime = Java HotSpot(TM) Client VM 20.1-b02

To reproduce:

1. take some directory with C/C++ source(s), create empty 'makefile' in root of the sources directory
    (we need that to create the NetBeans project around the sources we want to analyse using IDE)

2. file --> new project --> C/C++ Project with existing sources --> [Next] -->
    specify the folder that contains existing sources as one that contains empty makefile,
    then select "custom" and
    then locate the new project inside the sources directory in the further dialogs of the wizard

3. right mouse click on the new created project, select 'Delete', press [Yes]

4. watch the directory with sources in the filesystem

Result: NetBeans project directory still existing with all files inside

Expected behaviour: NetBeans removes the project directory

Note: This is the regression since 7.1.2
Comment 1 igor_nikiforov 2012-06-01 10:56:27 UTC
Despite very good test case description I cannot reproduce the issue neither on Windowx XP nor on other systems. Probably I'm doing something not the way you did or the issue has gone already.

So here are my steps in great details.

Testcase 1:
  1. Place the following files to F:\999 folder:
         - welcome.c and welcome.h from Welcome sample;
         - empty Makefile.
  2. In Project with Existing Sources wizard:
         - First screen: Folder that contains sources - F:\999, Configuration Mode - Custom;
         - Second screen: next;
         - Third screen: next;
         - Fourth screen: next;
         - Fifth screen: next;
         - Sixth screen: finish.
      The  nbproject  folder  is created  in  F:\999.
  3. Right-click on project in Projects view and choose Delete.
  4. In appeared dialog leave "Also delete..." checkbox unchecked and press Delete.
  5. Check the F:\999 folder: it contains only sources and empty Makefile.

Testcase 2:
  1. Place the welcome.c and welcome.h from Welcome sample to F:\999\src folder and place empty Makefile to F:\999.
  2. In Project with Existing Sources wizard:
         - First screen: Folder that contains sources - F:\999, Configuration Mode - Custom;
         - Second screen: next;
         - Third screen: next;
         - Fourth screen: next (or alternative add F:\999\src to the list);
         - Fifth screen: next;
         - Sixth screen: finish.
      The  nbproject  folder  is created  in  F:\999.
  3. Right-click on project in Projects view and choose Delete.
  4. In appeared dialog leave "Also delete..." checkbox unchecked and press Delete.
  5. Check the F:\999 folder: it contains only src folder and empty Makefile.
       
Testcase 3:
  1., 2. All the same as testcase 2, but on very last screen name project prj and place it to src.
     The  nbproject folder is created in  F:\999\src\prj.
  3. Right-click on project in Projects view and choose Delete.
  4. In appeared dialog leave "Also delete..." checkbox unchecked and press Delete.
  5. Check the F:\999\src folder: it contains only welcome.h and welcome.c.

Could you please provide a very detailed testcase If this still doesn't work for you in the very latest NetBeans development build.
Comment 2 steady 2012-06-04 08:49:24 UTC
To reproduce the bug you have to execute the Testcase 2 from the comment #1, but after the step 1 you have to go in the console into the directory 'f:\999' and do the following:
hg init

This creates empty mercurial repository in 'f:\999'. After you execute the rest of the test steps, you see the defect.
Comment 3 igor_nikiforov 2012-06-04 10:58:28 UTC
Looks like some VCS-related issue. Moving to appropriate category. 

Take a look at FilesystemInterceptor.java from Versioning/Master Filesystem Bridge module. Code from getDeleteHandler always tries to delete nbproject directory and ignores all attempts to delete it's files first.

It looks that such kind of situation was guarded by the 
   assert dummy.equals(file);  
But now it is commented.
Comment 4 Ondrej Vrabec 2012-06-04 12:23:46 UTC
right, seems masterfs (or masterfs bridge) groups files to be deleted and asks mercurial to delete the whole folder at once. Alas mercurial is not ready for this and expects its sources to be deleted one by one. Needs to be fixed in FS (or the bridge) or Mercurial and Git directly.
Comment 5 Tomas Stupka 2012-06-04 16:10:14 UTC
> right, seems masterfs (or masterfs bridge) groups files to be deleted and asks mercurial 
> to delete the whole folder at once.
WAD - this way it is possible to remove the whole folder by one vcs operation like e.g. svn rm. Systems like mercurial (where folders) aren't versioned have to implement the neccessary delete logic
Comment 6 Ondrej Vrabec 2012-06-05 09:48:01 UTC
fix: http://hg.netbeans.org/core-main/rev/edbb0415bd59
Comment 7 Ondrej Vrabec 2012-06-05 09:50:39 UTC
i fixed this in hg and git. However FilesystemInterceptor in masterfs bridge still works strangely. DeleteHandler always deletes a file it was constructed with instead of a file provided as a parameter of its delete method.
Comment 8 Tomas Stupka 2012-06-05 13:30:26 UTC
(In reply to comment #7)
> i fixed this in hg and git. However FilesystemInterceptor in masterfs bridge
> still works strangely. DeleteHandler always deletes a file it was constructed
> with instead of a file provided as a parameter of its delete method.
yes, even if thats a corner case caused by a wrong impl in the responsible vcs module, will try to delegate also for the particular child files, so that they get properly removed by the vcs even if the remove of a folder root fails.
Comment 9 Tomas Stupka 2012-06-05 14:01:39 UTC
> will try to delegate also for the particular child files, so that they
> get properly removed by the vcs even if the remove of a folder root fails
fixed core-main #950e8e73319e
Comment 10 steady 2012-06-05 15:42:36 UTC
(In reply to comment #8)
> yes, even if thats a corner case caused by a wrong impl in the responsible vcs
> module, will try to delegate also for the particular child files, so that they
> get properly removed by the vcs even if the remove of a folder root fails.

I tell more. This is expected behaviour of the mercurial - not to delete non-versioned files.
Comment 11 Quality Engineering 2012-06-06 05:53:43 UTC
Integrated into 'main-golden', will be available in build *201206060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/edbb0415bd59
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #213226 - does not delete project if it is located inside the sources directory
making mercurial and git capable of deleting folders recursively