jshell (tests?) leaking files in /tmp
jonathan.gibbons at oracle.com
Tue Aug 2 20:12:59 UTC 2016
I note that Files.createTempDirectory says this:
> As with the |createTempFile| methods, this method is only part of a
> temporary-file facility. A |shutdown-hook|
> or the |File.deleteOnExit()|
> mechanism may be used to delete the directory automatically.
That being said, it would think it is better to avoid using
Files.createTempDirectory, and to then use the favor of createTempFile
that creates files directly in the default temporary directory, and to
explicitly delete the file when it is no longer required.
public staticPath <http://download.java.net/java/jdk9/docs/api/java/nio/file/Path.html> createTempFile(String <http://download.java.net/java/jdk9/docs/api/java/lang/String.html> prefix,
String <http://download.java.net/java/jdk9/docs/api/java/lang/String.html> suffix,
FileAttribute <http://download.java.net/java/jdk9/docs/api/java/nio/file/attribute/FileAttribute.html><?>... attrs)
On 08/02/2016 01:03 PM, Andrei Eremeev wrote:
> According to source code of JShell, a new temp file is created in ExternalEditor when a code snippet is modified.
> method setupWatch:
> this.dir = Files.createTempDirectory("jshelltemp");
> this.tmpfile = Files.createTempFile(dir, null, ".edit");
> The created file is not removed.
> I reproduced the problem with vim:
> int h = 10;
> /set editor vim
> /edit h
> A file is created in tmp if /edit is executed.
> Best regards,
> Andrei Eremeev
>> Tuesday, August 2, 2016 8:43 PM +03:00 from Jonathan Gibbons <jonathan.gibbons at oracle.com>:
>> On 08/02/2016 10:37 AM, Jonathan Gibbons wrote:
>>> A simple script to execute the jshell tests one at a time, and to
>>> check the /tmp directory after executing each test, shows that the
>>> culprit is ToolretainTest.java
>>> I'll file a bug.
>>> -- Jon
More information about the kulla-dev