[issue19430] argparse replaces \$ with $ (if in commandline)

telmich report at bugs.python.org
Tue Oct 29 10:45:56 CET 2013


telmich added the comment:

Background information:

cdist is written in python 3 and makes heavy use of argparse.
One common task is to run a cdist type with some arguments, which
in the end configure a remote system.

We triggered the bug by running

__line ps1 --file /etc/bash.bashrc --line "PS1='[\t] \[\033[1m\]\h\[\033[0m\]:\w\$ '"

which should have ensured that the line is found in /etc/bash.bashrc.

But in reality we found

PS1='[\t] \[\033[1m\]\h\[\033[0m\]:\w$ '

instead of

PS1='[\t] \[\033[1m\]\h\[\033[0m\]:\w\$ '

This is a rather nasty bug, as you would not suspect argparse doing that and dig through all your code looking for errors.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19430>
_______________________________________


More information about the Python-bugs-list mailing list