[New-bugs-announce] [issue38570] Shlex does not parse commands containing single quotes correctly

timonegk report at bugs.python.org
Wed Oct 23 17:00:28 EDT 2019


New submission from timonegk <python at timonengelke.de>:

Steps to reproduce:
>>> from shlex import split
>>> line = "export F=$'\\''"
>>> split(line)
ValueError: No closing quotation

However, when printing the line

>>> print(line)
export F=$'\''

and pasting the output in bash, no further quotation marks are required.
The behavior of bash is described in its man page (line 497 for me, Chapter Quoting) and occurs also when bash is called with --posix. Therefore I guess that shlex does not reproduce the posix behavior here.

----------
components: Library (Lib)
messages: 355265
nosy: timonegk
priority: normal
severity: normal
status: open
title: Shlex does not parse commands containing single quotes correctly
type: behavior
versions: Python 2.7, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38570>
_______________________________________


More information about the New-bugs-announce mailing list