Christopher Hoadley added the comment:

This problem makes it impossible to use shlex to parse commands where a newline 
is intended to separate commands.
 
In the attached sample script, I created two input strings with the same tokens 
in the same order: the only difference is newlines and spaces. In the first 
string, each token is on its own line, and in the second string the first 2 
tokens are on the same line, and the third is on its own.
 
If you look at the lineno association with each token, it is identical between 
the two strings.  But, the two strings have completely different meanings! I 
have no way to distinguish the behavior.
 
If I want to use the feature of shlex where it will automatically include other 
command files, then I can't just sanitize the input before sending it on.
 
As it is, the only way that I can see that I can use shlex is if my command 
language uses some other symbol (i.e. ";") as a command line separator.  Since 
I am defining my own command language, I can do that, but it adds needless 
complication for the users.

----------
nosy: +hoadlck
versions: +Python 3.5 -Python 3.4
Added file: http://bugs.python.org/file43361/ambigious_shlex.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24869>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to