[issue7507] pipes.quote does not correctly escape !

Georg Brandl report at bugs.python.org
Sat Jan 9 11:25:26 CET 2010


Georg Brandl <georg at python.org> added the comment:

I'm attaching a patch that changes quote() logic.  It also fixes #7476, the empty argument case.

Strings with unsafe characters are now always quoted with single quotes. Single quotes themselves are replaced by a single quote in double quotes, so that

    te$t'quoting

becomes

    'te$t'"'"'quoting'

which I believe is portable across all commonly used shells.

(Another implementation would be to just backslash-quote all unsafe chars, but it makes for less readable results.)

Assigning to David for review -- you recently claimed to like shells :)

----------
assignee:  -> r.david.murray
nosy: +georg.brandl, r.david.murray

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


More information about the Python-bugs-list mailing list