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
shlex: bug in posix mode handling of empty strings #66198
Comments
Minimal testcase of the problem situation is tokenising (with posix mode on): ''), Specifically, an empty string, followed by a non-word character, followed by a non-space character. In this case, the token buffer is empty and due to a missing check for (self.posix and quoted), an extra token is consumed and returned in the wrong order: >>> s = shlex.shlex("'')abc", posix=True)
>>> s.get_token()
'abc'
>>> s.get_token()
')'
>>> s.get_token()
>>> I have patches to fix this issue in both default and 2.7. I've also checked there are no other occurrences of the same typo. |
Vinay has a patch improving shlex parsing in bpo-1521950, but it doesn't seem to address this case, so I'm adding him as nosy. |
I've updated the patch on bpo-1521950 to address this case, and also added a test there (which is not in this patch). Thanks, RDM, for the notification. |
After the patch for bpo-1521950 was applied, this problem no longer occurs on default/3.6. Removing 3.4 as it's in "security patches only" mode. |
New changeset cf04243e8d7d by Vinay Sajip in branch '2.7': |
New changeset 4f02ad46a0a8 by Vinay Sajip in branch '3.5': New changeset a8e74448678c by Vinay Sajip in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: