build of IDEA failed: directory not empty

Answered

I just had a build fail apparently in the process of cleaning the compiler output directory. A directory not empty exception was thrown. The directory contains a .DS_Store file.

I have had similar problems in my own code. I don't know how these files are being created. They are in directories that I have not displayed in Finder. Also I don't know why the files are not deleted.

I have only a screenshot of the error message. Upload id: 2022_05_12_MaLf2TRjayHTbBqK (file: Screen Shot 2022-05-12 at 9.43.59 AM.png)

I am running macOS 12.3.1.

3 comments
Comment actions Permalink

Please clarify

1) what is "a build"? what exactly did you invoke?

2) what is your current IDE version

3) what is the branch of IJ project?

4) please provide all relevant log files in raw form, not screenshots please

0
Comment actions Permalink

 

1) what is "a build"? what exactly did you invoke?


installers.cmd

2) what is your current IDE version

 
 
2022.1.1
 

3) what is the branch of IJ project?

 
 
 
I started with idea/221.5591.52 

4) please provide all relevant log files in raw form, not screenshots please

 
 
 
I would if I could.
 
 
I’m now thinking this is not an IDEA problem but some code of mine that is unexpectedly causing .DS_Store files to be created.
If that happens during a tree walk to delete a directory tree, a failure can occur because a directory that should have been empty is no longer empty.
 
 
 

 

 

 

0
Comment actions Permalink

I now believe that the .DS_Store files are being created by the Finder as part of its implementation of the Calculate All Sizes option in some ancestor directory. The Finder is monitoring the entire directory tree for changes so that it can recalculate the sizes of individual subtrees; when it is notified of a change, it recalculates the content size of the subtree and caches the size in a .DS_Store file, creating it if not already present. IDEA deletes the build output tree using a recursive traversal that deletes the contents of a directory and then deletes the directory. Deleting a file in the directory can trigger the Finder to recalculate the directory size. If this happens after IDEA has deleted any existing .DS_Store file and before IDEA tries to delete the directory, the delete directory operation will fail because of the newly created .DS_Store file. I consider this to be a macOS bug, but it has been around for a while and I am not optimistic that Apple will fix it anytime soon. Some defensive programming in IDEA might be appropriate.

0

Please sign in to leave a comment.