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
genPathname corrupts filenames with backslashes in them via convertStepCharsInPath #558
Comments
genPathname
corrupts filenames with backslashes in them via convertStepCharsInPath
Yes, I can confirm this problem. The replacement should not be done for Linux, MacOS and others which only use |
Question: are there valid path names in unix that have these double back-slashes? How would such a path, as you show above, be interpreted by the file system? Also, are there valid path names in unix with a single back-slash? |
And finally, is that a valid path name in Windows? |
Yes, those exist, every backslash just needs to be escaped with another backslash from the shell, but the string (in bytes) would just contain one backslash for each backslash.
Quick test in Python (every backslash is also escaped with a backslash):
The
Yes, the example I showed actually had just a single back slash in the actual file name, it's just that I (and gdb) had to escape the back slashes for the string literals and in the shell itself. EDIT: I think that |
My windows-fu isn't that strong, but I know that both |
Thank you! From what you have said, on unix systems all backslashes must be preserved. (Which is what you said in your initial posting. I will fix this. |
Thank you! |
I can confirm that this solves the problem for me, by the way. Applied the patch it on top of Ubuntu 20.04's |
Thank you for confirming we're ok. |
Noticed as a problem in Tesseract initially: tesseract-ocr/tesseract#3178
It looks like
genPathname
does not like backslashes in filenames on UNIX, even though this is valid:It looks like
convertStepCharsInPath
is causing this problem, it's converting'\\'
to/
even on UNIX, which is not what it should be doing, as far as I can tell.The text was updated successfully, but these errors were encountered: