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

Failure to parse environment with quoted empty strings. (Issue #328) #873

Closed
mostrows2 opened this issue Jan 5, 2017 · 1 comment
Closed

Comments

@mostrows2
Copy link

commit aa7d40e is incorrect...

The problem is that the test in the above commit tests the value 'foo=""' -- that works.
However, 'foo="",bar=a' will fail. This seems to be related to the use of "posix=True" with shlex.

#>>> supervisor.datatypes.dict_of_key_value_pairs('foo="",c=d')
Traceback (most recent call last):
File "", line 1, in
File "/home/mostrows/workspace/cmf.build/agents/cmf/ext-py/supervisor-4.0.0.dev0/supervisor/datatypes.py", line 96, in dict_of_key_value_pairs
"Unexpected end of key/value pairs in value '%s'" % arg)
ValueError: Unexpected end of key/value pairs in value 'foo="",c=d'
#>>> supervisor.datatypes.dict_of_key_value_pairs("foo='',c=d")
Traceback (most recent call last):
File "", line 1, in
File "/home/mostrows/workspace/cmf.build/agents/cmf/ext-py/supervisor-4.0.0.dev0/supervisor/datatypes.py", line 96, in dict_of_key_value_pairs
"Unexpected end of key/value pairs in value '%s'" % arg)
ValueError: Unexpected end of key/value pairs in value 'foo='',c=d'
#>>> supervisor.datatypes.dict_of_key_value_pairs("foo=''")
{'foo': ''}
#>>> supervisor.datatypes.dict_of_key_value_pairs('foo=""')
{'foo': ''}
#>>>

@coldnight
Copy link
Contributor

This issue seems caused by the bug of Python, see the detail:

https://hg.python.org/cpython/rev/cf04243e8d7d

It fixed in Python 2.7.13

mnaberez added a commit that referenced this issue May 27, 2017
Pull #329 changed shlex to posix mode to fix quotes inside
quotes (#328).  A side effect of this change is that it
broke parsing empty quotes (#873).  This seems to be due
to a bug in shlex (http://bugs.python.org/issue21999).
Since no release version of Supervisor has shipped with
shlex in posix mode to support quotes inside quotes, we're
reverting it to fix support for empty quotes which has
shipped for many Supervisor versions.  Two unit tests
introduced in #329 pass without posix mode, so those tests
have been retained.  A unit test was also added for #873
in the previous commit.

Reopens #328
Partially reverts #329
Fixes #873
Closes #880
vereszol pushed a commit to vereszol/supervisor that referenced this issue Dec 8, 2023
Fixes Supervisor#328

This allows (escaped) quotes in the values as well as empty
values.

--
This was done in pull request Supervisor#329 but removed as it
broke parsing empty quotes (Supervisor#873) due to a bug in shlex
(http://bugs.python.org/issue21999). This bug is fixed
so posix mode can be used.

Brings back Supervisor#329
Partially reverts Supervisor#880
vereszol pushed a commit to vereszol/supervisor that referenced this issue Dec 8, 2023
Fixes Supervisor#328

This allows (escaped) quotes in the values as well as empty
values.

This was done in pull request Supervisor#329 but removed as it
broke parsing empty quotes (Supervisor#873) due to a bug in shlex
(http://bugs.python.org/issue21999). This bug is fixed
so posix mode can be used.

Brings back Supervisor#329
Partially reverts Supervisor#880
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants