New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paths with leading separator not handled correctly #142
Comments
So, long story short, the AFS must keep leading separators, because they are relevant on most systems. |
This is a little more complicated in principle than requested. A leading "/" can't just be "kept" because the abstract path representation does not hold any separators. That's the point of having an abstraction. It turned out that cutting it off wasn't even a bug in the AFS code. Instead, the JDK's StringTokenizer used to split the path String simply ignores leading separators. No null element, no "" element, no exception, no configurability, nothing. I only implemented a workaround for the StringLolenizer bug in the string splitting utility method and now causes a ""-identifier root element, which, in turn, causes the leading "/" to be replicated correctly. Also note: |
@tm-ms I still have the same behavior. |
I looked into this again. There is the simple test class for testing leading a separator in the path String
This replicates the correct String in the output. And I tested setting a different base directory via This also works corrects. The storage is located at the specified directory and can be used without exception. This makes me strongly assume that the cause for the problem is not located within the core logic. |
|
I was confused about the specific problem. Since I don't have Linux and the problem hasn't simply been debugged, I did some extensive debugging, testing and research. Rejected JDK bug report: Specifically for Linux: Very similarily, on Windows path variables (%HOMEDRIVE%, %HOMEPATH%) don't work in Java on Windows, either. |
If I understand good: '~' on the screen is only shortcut to home folder.... |
So after two stages of confusion, I searched for a bug regarding the handling of paths with a leading "/". So once again there's quite some idiocy going on in the JDK that makes their code unusable for all cases without additional workarounds. As a workaround, I enhanced my method XIO#Path (already compensating some other idiocy of Path#get) with an explicit check for this case: If the first element of the path is "", then prepend an explicit leading separator. But while this would probably work on Linus, its caused another problem on Windows: So after much research and fiddling, I came up with the following solution:
With that change, testing the path "/some/path/with/leading/separator.test" causes "only" the FileSystemException "\some\path\with: The network path was not found.", which is correct because there is no such network path on my system. As far as I can tell, the absolut path should work now. |
in Linux is correct. |
Edit TM:
this issue turned out to actually be about leading separators in paths. See below
Configuration - setBaseDirectory() has no effect.
Project: Microstream-test
branch: master
test: microstream-test/intern/src/main/java/test/java/microstream/configuration/baseDirectoryTest.java
test:
The text was updated successfully, but these errors were encountered: