htsjdk
htsjdk copied to clipboard
DiskBackedQueue closeIOResources is broken
Description of the issue:
When calling clear() on a DiskBackedQueue, rather than deleting the file in question, the path to the temp file is split into its constituent pieces and each treated as file names to be deleted- thus failing to delete the intended file, and potentially deleting random other files.
This is due to the use of IOUtil.deletePaths, which calls Arrays.asList() on whatever you pass it, converting our correct Path into an array of the folder names making it up.
Steps to reproduce
Create a DiskBackedQueue with some directory for TMP_DIR, fill it enough that it spills to disk, and then call clear() on it
Expected behaviour
The temp file should be deleted
Actual behaviour
The folder names making up the path to the temp file are treated as file names, and each of these file names attempt deletion from the current working directory.
That sounds nasty... Will fix. Thank you for reporting that.
Just added a PR with a fix
https://github.com/samtools/htsjdk/pull/1415/commits
Oh, that's even better :) . Thank you.