-
Notifications
You must be signed in to change notification settings - Fork 5
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
Word splitting: filter out empty fields #15
base: master
Are you sure you want to change the base?
Conversation
Unquoted fields that resulted from expansion and contain nothing but IFS whitespace are now removed during splitting.
Interesting, thank you! What did Smoosh do on this test case before your changes? |
Before the change, some of it would end up as an empty field, but the last one was ignored. The output of the test was:
|
Gotcha. Let me double check that this change doesn't hurt POSIX conformance. (If I don't get back to you within a week, please ping me!) |
When an expansion ends with a field separator, the following user field separator should be merged into it. The easiest way to achieve this is to turn them into whitespace field separators.
I wasn't satisfied with the previous approach as it didn't actually fix the actual issue that caused the empty fields to remain. They should have been removed in The additional test passes on bash, dash, mksh and zsh (I did not test any other), but fails on smoosh without this commit. In case you are curious, the results without this change (the actual argument counts) are:
|
Thanks for the update! I still haven't had a chance to fix the POSIX suite under Docker, but will hopefully have time after I'm back from Thanksgiving travel. |
For the last variable in read, the original separators need to be preserved.
Another change, this time to preserve delimiters for the last variable in It's a bit more involved than the previous changes, but I found no easier way to do it. |
I'm planning on migrating to GPLv3 for Smoosh. (Integrating with the GPLv3 Morbig parser will require it.) Would you like me to merge your code first, while things are still under an MIT license, or is it okay if I wait and the merged code will be under GPLv3? As I make the change, I plan on making a CONTRIBUTORS.md file in the root, and I'd like to acknowledge your work there. How would you like to be listed? |
Take your time, I don't mind the GPL at all. Do you need my legal name for the contributors file? |
I'm honestly unsure what I need. I think the licensing itself works best if contributors disclaim copyright/assign it to me. I was thinking of If you have a thought or preference here, I'm happy to honor it. |
I'm unsure where the POSIX specification mentions this, but all of the implementations I tried (bash, dash, mksh, zsh) seem to agree on it.