This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author robodan
Recipients eric.araujo, eric.smith, niemeyer, robodan
Date 2011-11-25.19:25:34
SpamBayes Score 3.7003733e-13
Marked as misclassified No
Message-id <CAEcGQ+POMTHT1PmJdRc4jF5bo=1z31kvu_08deY_8vD2sE25fw@mail.gmail.com>
In-reply-to <1322240479.95.0.427549844498.issue1521950@psf.upfronthosting.co.za>
Content
I've attached a diff to test_shlex.py and a script that I used to
verify what the shells actually do.
Both are relative to Python-3.Lib/test

I'm completely ignoring the quotes issue for now.  That should
probably be an enhancement.  I don't think it really matters until the
parsing issues are resolved.

ref_shlex is python 2 syntax.  python -3 shows that it should convert cleanly.
./ref_shlex.py
It will run by default against /bin/*sh
If you don't want that, do something like: export SHELLS='/bin/sh,/bin/csh'
It runs as a unittest.  So you will only see dots if all shells do
what it expects.  Some shells are flaky (e.g. zsh, tcsh), so you may
need to run it multiple times.

Getting this into the mainline will be interesting.  I would think it
would take some community discussion.  I may be able to convince
people that the current behaviour is wrong, but I can't tell you what
will break if it is "fixed".  And should the fix be the default?  As
you mentioned, it depends on what people expect it to do and how it is
currently being used.  I see the first step as presenting a clear case
of how it should work.

-Dan

On Fri, Nov 25, 2011 at 10:01 AM, Éric Araujo <report@bugs.python.org> wrote:
>
> Éric Araujo <merwok@netwok.org> added the comment:
>
>> Of course, that's how it's used.  That's all it can do right now.
> :) What I meant is that it is *meant* to be used in this way.
>
>> I was was splitting and combining commands (using ;, &&, and ||) and then running the resulting
>> (mega) one liners over ssh.  It still gets run by a shell, but I was specifying the control flow.
> Thank you for the reply.  It is indeed a valuable use case to pass a command line as one string to ssh, and the split/quote combo should round-trip and be useful for this usage.
>
>> I'll see if I can come up with a reference case and maybe a unittest this weekend
> Great!  A new argument (with a default value which gets us the previous behavior) will probably be needed, to preserve backward compatibility.
>
> ----------
> nosy: +niemeyer
> versions: +Python 3.3 -Python 3.2
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue1521950>
> _______________________________________
>
Files
File name Uploaded
ref_shlex.py robodan, 2011-11-25.19:25:33
test_shlex.diff robodan, 2011-11-25.19:25:34
History
Date User Action Args
2011-11-25 19:25:36robodansetrecipients: + robodan, niemeyer, eric.smith, eric.araujo
2011-11-25 19:25:34robodanlinkissue1521950 messages
2011-11-25 19:25:34robodancreate