-
Notifications
You must be signed in to change notification settings - Fork 162
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
Handle filenames with spaces #44
Conversation
- This breaks all tests, because expected filenames no longer match the ones that are actually written - Spaces are handled correctly in filenames, so this fixes tectonic-typesetting#36
- This fixes the tests again - Spaces are still handled correctly, to fix tectonic-typesetting#36
The tests are no longer broken, because filenames are now quoted only if necessary. New test cases will have to be written with this in mind. |
Thanks for tackling this problem. I have to say that the current version of the solution feels a bit fragile to me; what happens if the user passes in a filename that itself contains quotation marks? And so on. Can you point me to the code which ends up reading and parsing the quoted string? I am wondering if we can give the relevant function a special flag that tells it basically "just use this sequence of bytes as the input file name, no questions asked", and then activate that flag for the toplevel input file. I think that would be more robust against the other kinds of funky filenames that might be passed in. |
@pkgw The file name scanning happens in If we're going to change things at this level, it looks like we should look at |
@pkgw In fact, if we modify it to stop on null bytes (I think modification is necessary, but perhaps I'm not reading carefully enough), then we can probably just turn off the flag |
I've experimented a little with null-terminating the string and turning off that flag, and I haven't been able to get our code to behave without breaking something else down the line. Maybe it would be acceptable to make the quoting code a bit smarter: any unquoted sequence of spaces is itself quoted, and otherwise the string is left alone. That is certainly more fragile than I'd like, but there's a lot to untangle in order to make it better, I think. |
Thanks for your work on this. I would like to credit you in the release notes for the next release; would you prefer that I identify you as Alexander Bauer, I've been thinking about the intersection of this issue and the other issues relating to input file paths. I think I see a more robust solution, and I hope to implement it soon. |
@pkgw Thanks very much for your recognition! I'd love to be credited as Alexander Bauer, and if it's in a context where GitHub user-linking will work, an |
restore enums, datetime::LocalTime, use ttstub
For my notes while developing this, see my comments in #36.