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

Not possible to have quotes in environment variable settings #328

Open
sfriesel opened this issue Dec 17, 2013 · 5 comments · Fixed by #329 · May be fixed by #1613
Open

Not possible to have quotes in environment variable settings #328

sfriesel opened this issue Dec 17, 2013 · 5 comments · Fixed by #329 · May be fixed by #1613

Comments

@sfriesel
Copy link
Contributor

It is not possible to pass environment variable values containing quotes, e.g.

[program:x]
command=bash -c export
environment=MYSQL_PW="5ny6{wo'\"7n"

throws

ERROR: CANT_REREAD: No closing quotation

Currently shlex is used in legacy mode to parse the env settings, which does not allow any kind of escaping and also has some other odd edge cases (http://docs.python.org/2/library/shlex.html#parsing-rules). I'd propose switching the lexer to posix mode. Ideally, we would like to be able to dump any string dictionary and have it load correctly as environment for the process.

sfriesel added a commit to sfriesel/supervisor that referenced this issue Dec 17, 2013
Fixes Supervisor#328

This allows (escaped) quotes in the values as well as empty
values.
@pykler
Copy link

pykler commented Jun 22, 2016

Bumped into this bug ... seems ubuntu keeps a rather old version of supervisor in the deb packages.

@pykler
Copy link

pykler commented Jun 23, 2016

@mnaberez any idea why this change never made it into the supervisor releases? supervisor@3.3.0 doesn't have this change.

@mnaberez
Copy link
Member

any idea why this change never made it into the supervisor releases? supervisor@3.3.0 doesn't have this change.

It requires Python 2.6 but the minimum required version for Supervisor 3.x is Python 2.4. This change was merged into the master branch, which will become Supervisor 4, and raises the minimum Python version to 2.6.

mnaberez added a commit that referenced this issue Jan 17, 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
@mnaberez mnaberez reopened this Jan 17, 2017
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
@jstaf

This comment has been minimized.

@mnaberez
Copy link
Member

mnaberez commented Apr 28, 2020

Note for maintainers: Commit description 431b3a1 has more background. We tried to fix this once already but had to revert that fix because of a bug in Python stdlib.

Comments above about Python 2.4 are outdated. Support for Python versions below 2.7 was dropped in Supervisor 4.0.0 (2019-04-05). Supervisor 3.x is no longer maintained.

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
@vereszol vereszol linked a pull request Dec 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants