https://bz.apache.org/bugzilla/show_bug.cgi?id=65212
Bug ID: 65212 Summary: Apache Ant 1.10.9 version generating temp folders which are prefixed by Ant Product: Ant Version: 1.10.9 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: Core Assignee: notifications@ant.apache.org Reporter: rajesh.pu...@appdynamics.com Target Milestone: --- Created attachment 37791 --> https://bz.apache.org/bugzilla/attachment.cgi?id=37791&action=edit Screenshot showing temp folders created by Ant We are using Apache Ant 1.10.9 under our project. What we noticed is Ant is creating too many empty folders with name prefixed with ant. Please find attached screenshot. All of them are deleted on JVM exit. Strangely there are no files created under those folders. Instead of using one temp folder for storing files, Ant is creating too many empty folders as shown in attachment. This was noticed on Linux. Tested on both Ubuntu and AIX and replicable on them. Earlier we were using Apache Ant 1.10.8 and this problem was not noticed. Problem is with Apache Ant 1.10.9 version. try { final File projectTempDir = Files.createTempDirectory(systemTempDirPath, "ant", TMPDIR_ATTRIBUTES) .toFile(); projectTempDir.deleteOnExit(); p = projectTempDir.getAbsolutePath(); project.setProperty(MagicNames.AUTO_TMPDIR, p); } catch (IOException ex) { // silently fall back to system temp directory } { File result; String p = null; if (parentDir != null) { p = parentDir.getPath(); } else if (project != null && project.getProperty(MagicNames.TMPDIR) != null) { p = project.getProperty(MagicNames.TMPDIR); } else if (project != null && deleteOnExit) { if (project.getProperty(MagicNames.AUTO_TMPDIR) != null) { p = project.getProperty(MagicNames.AUTO_TMPDIR); } else { final Path systemTempDirPath = new File(System.getProperty("java.io.tmpdir")).toPath(); final PosixFileAttributeView systemTempDirPosixAttributes = Files.getFileAttributeView(systemTempDirPath, PosixFileAttributeView.class); if (systemTempDirPosixAttributes != null) { // no reason to create an extra temp dir if we cannot set permissions try { final File projectTempDir = Files.createTempDirectory(systemTempDirPath, "ant", TMPDIR_ATTRIBUTES) .toFile(); projectTempDir.deleteOnExit(); p = projectTempDir.getAbsolutePath(); project.setProperty(MagicNames.AUTO_TMPDIR, p); } catch (IOException ex) { // silently fall back to system temp directory } } } } final String parent = p != null ? p : System.getProperty("java.io.tmpdir"); if (prefix == null) { prefix = NULL_PLACEHOLDER; } if (suffix == null) { suffix = NULL_PLACEHOLDER; } if (createFile) { try { final Path parentPath = new File(parent).toPath(); final PosixFileAttributeView parentPosixAttributes = Files.getFileAttributeView(parentPath, PosixFileAttributeView.class); result = Files.createTempFile(parentPath, prefix, suffix, parentPosixAttributes != null ? TMPFILE_ATTRIBUTES : NO_TMPFILE_ATTRIBUTES) .toFile(); } catch (IOException e) { throw new BuildException("Could not create tempfile in " + parent, e); } } else { DecimalFormat fmt = new DecimalFormat("#####"); synchronized (rand) { do { result = new File(parent, prefix + fmt.format(rand.nextInt(Integer.MAX_VALUE)) + suffix); } while (result.exists()); } } if (deleteOnExit) { result.deleteOnExit(); } return result; } Please look into it and let us know your thoughts here -- You are receiving this mail because: You are the assignee for the bug.