Skip to content
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

Demonstrating py2.6 shlex madness #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

lrq3000
Copy link
Member

@lrq3000 lrq3000 commented Oct 30, 2016

On python 2.6, shlex fails miserably the unit test because it inserts null characters after each character of any command read from the Makefile:

>>  assert ("hello world" in u'[\'k\\x00e\\x00y\\x00b\\x00o\\x00a\\x00r\\x00d\\x
00m\\x00a\\x00s\\x00h\\x00i\\x00t\\x00a\\x00l\\x00l\\x00t\\x00o\\x00g\\x00e\\x00
t\\x00h\\x00e\\x00r\\x00t\\x00h\\x00i\\x00s\\x00s\\x00h\\x00o\\x00u\\x00l\\x00d\
\x00n\\x00o\\x00t\\x00r\\x00u\\x00n\\x00o\\x00t\\x00h\\x00e\\x00r\\x00w\\x00i\\x
00s\\x00e\\x00u\\x00n\\x00i\\x00t\\x00t\\x00e\\x00s\\x00t\\x00s\\x00w\\x00i\\x00
l\\x00l\\x00f\\x00a\\x00i\\x00l\']\r\nkeyboardmashitalltogetherthisshouldnotruno
therwiseunittestswillfail\r\nTraceback (most recent call last):\r\n  File "<stri
ng>", line 1, in <module>\r\n  File "pymake\\_main.py", line 56, in main\r\n
ignore_errors=opts[\'--ignore-errors\'])\r\n  File "pymake\\_pymake.py", line 16
7, in execute_makefile_commands\r\n    check_call(parsed_cmd)\r\n  File "c:\\pyt
hon26\\lib\\subprocess.py", line 483, in check_call\r\n    retcode = call(*popen
args, **kwargs)\r\n  File "c:\\python26\\lib\\subprocess.py", line 470, in call\
r\n    return Popen(*popenargs, **kwargs).wait()\r\n  File "c:\\python26\\lib\\s
ubprocess.py", line 623, in __init__\r\n    errread, errwrite)\r\n  File "c:\\py
thon26\\lib\\subprocess.py", line 833, in _execute_child\r\n    startupinfo)\r\n
TypeError: CreateProcess() argument 2 must be string without null bytes or None,
 not str\r\n')

If you look carefully, this:

'k\\x00e\\x00y\\x00b\\x00o\\x00a\\x00r\\x00d\\x
00m\\x00a\\x00s\\x00h\\x00i\\x00t\\x00a\\x00l\\x00l\\x00t\\x00o\\x00g\\x00e\\x00
t\\x00h\\x00e\\x00r\\x00t\\x00h\\x00i\\x00s\\x00s\\x00h\\x00o\\x00u\\x00l\\x00d\
\x00n\\x00o\\x00t\\x00r\\x00u\\x00n\\x00o\\x00t\\x00h\\x00e\\x00r\\x00w\\x00i\\x
00s\\x00e\\x00u\\x00n\\x00i\\x00t\\x00t\\x00e\\x00s\\x00t\\x00s\\x00w\\x00i\\x00
l\\x00l\\x00f\\x00a\\x00i\\x00l\'

Is in fact the same as:

keyboardmashitalltogetherthisshouldnotruno therwiseunittestswillfail

But with null characters between each character.

I tried everything I could, but I could not overcome this issue. It does not happen on newer versions of Python.

See this issue for more details. A possible alternative here (but it does not support comments yet) and also interesting reads here and here.

Signed-off-by: Stephen L. <lrq3000@gmail.com>
…slated...)

Signed-off-by: Stephen L. <lrq3000@gmail.com>
Signed-off-by: Stephen L. <lrq3000@gmail.com>
Signed-off-by: Stephen L. <lrq3000@gmail.com>
Signed-off-by: Stephen L. <lrq3000@gmail.com>
@coveralls
Copy link

coveralls commented Oct 30, 2016

Coverage Status

Coverage increased (+0.2%) to 95.935% when pulling f940f35 on py2-shlex-madness into e7cbe64 on master.

@casperdcl casperdcl force-pushed the master branch 4 times, most recently from a71d429 to b882682 Compare October 30, 2016 23:19
@codecov-io
Copy link

Current coverage is 93.49% (diff: 78.94%)

Merging #3 into master will decrease coverage by 0.57%

@@             master         #3   diff @@
==========================================
  Files             6          6          
  Lines           118        123     +5   
  Methods           0          0          
  Messages          0          0          
  Branches         25         24     -1   
==========================================
+ Hits            111        115     +4   
- Misses            4          5     +1   
  Partials          3          3          

Powered by Codecov. Last update b882682...f940f35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants