Can JDK-8190546 be re-opened or "how do I delete a file ending with a space on Windows"
Brian Burkhalter
brian.burkhalter at oracle.com
Wed May 11 15:35:57 UTC 2022
Redirect discussion to nio-dev.
Brian
> On May 11, 2022, at 7:29 AM, Maxim Kartashev <maxim.kartashev at jetbrains.com> wrote:
>
> Win32 documentation [1] kind of discourages the use of space at the very
> end of a file name. Based on that, JDK-8190546 (File.toPath() reject
> directory names with trailing space) had been closed a long time ago. I
> would like to poll the public on the matter of re-opening the bug.
>
> There isn't anything new that I can throw in support of allowing JDK to
> work with such file names. But the old points can perhaps be re-visited.
> AFAIU, the only reason to explicitly forbid that (see
> WindowsPathParser.normalize()) was that the parsing is based on Windows
> documentation like [1]. That documentation says the following:
> "Do not end a file or directory name with a space or a period. Although the
> underlying file system may support such names, the Windows shell and user
> interface does not"
> Indeed, it's hard or even impossible to create such a file using "normal"
> windows GUI, but you can use that GUI to delete such a file. In Java, you
> can't do either. Working in a cygwin terminal, you can fairly easily create
> a file name ending with a space. And when you turn to your Java-based IDE
> to delete it, you get an error from the very basic level of NIO that you
> can't overrule, which seems to be quite unfortunate.
>
> If there's any interest in resolving this - or at least not enough
> opposition to let it be resolved - I am willing to make the necessary
> changes and open a PR.
>
> References
> [1]
> https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
> [2] https://bugs.openjdk.java.net/browse/JDK-8190546
More information about the nio-dev
mailing list