[New-bugs-announce] [issue28392] shlex - non-posix-mode: error in Multiple occurances of quotes substrings/words

Arno-Can Uestuensoez report at bugs.python.org
Sun Oct 9 04:02:45 EDT 2016


New submission from Arno-Can Uestuensoez:

See also 28391: Multiple occurances of: Closing quotes separate words

The issue 28391 is accepted, as it is defined:
 Quotes *within* words are ignored, only a leading quoted string will result in a separate word.  (That's recursive: try '"Do""This""Separate).

So I implement for compatibility mode your proposal.

But the example does not seem to work as expected, so seems to hint to a bug. Thus openning a seperate issue:

snip-->
import shlex

sopts = """-a "Do""This""Separate" """
resx = ["-a", '"Do"', 'ThisSeparate', ]
res=shlex.split(sopts,posix=False)

print "sopts  ="+str(sopts)
print "resx   ="+str(resx)
print "res    ="+str(res)
assert res == resx 

"""
Results in:

sopts  =-a "Do""This""Separate" 
resx   =['-a', '"Do"', 'ThisSeparate']
res    =['-a', '"Do"', '"This"', '"Separate"']
Traceback (most recent call last):
  File "shlex_demo.py", line 52, in <module>
    assert res == resx 
AssertionError

"""

<--snip

I also checked the variant with a trailing quoted word for completeness, which is not enclosed. Does not split at all:

sopts  =-a Do"SeparateThis" 
resx   =['-a', 'Do', '"SeparateThis"']
res    =['-a', 'Do"SeparateThis"']

----------
components: Library (Lib)
messages: 278351
nosy: Andrey.Kislyuk, acue, cvrebert, eric.araujo, eric.smith, ezio.melotti, python-dev, r.david.murray, robodan, vinay.sajip
priority: normal
severity: normal
status: open
title: shlex - non-posix-mode: error in Multiple occurances of quotes substrings/words
type: behavior
versions: Python 2.7

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


More information about the New-bugs-announce mailing list