classification
Title: Update https://docs.python.org/3/installing/index.html to always quote arguments
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: alexis, brett.cannon, docs@python, dstufft, eric.araujo, ezio.melotti, lemburg, ncoghlan, orsenthil, paul.moore, python-dev, tarek, zach.ware
Priority: normal Keywords: patch

Created on 2016-01-05 17:43 by brett.cannon, last changed 2016-01-18 02:46 by orsenthil. This issue is now closed.

Files
File name Uploaded Description Edit
Issue26017.patch orsenthil, 2016-01-08 07:47
Messages (7)
msg257536 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-01-05 17:43
If you look at https://docs.python.org/3/installing/index.html it lists two commands:

python -m pip install SomePackage==1.0.4    # specific version
python -m pip install 'SomePackage>=1.0.4'  # minimum version

If you notice that beyond the change from `==` to `>=`, you will notice one quotes its argument while the other one doesn't. This is a UNIX shell thing due to what `>` means. But if you don't know how the UNIX shell works this could be easily overlooked. It would be best to simply quote both examples and avoid people messing up by leaving off the quotes.
msg257537 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-01-05 17:55
I'd also suggest using double quotes ("); single quotes don't work on Windows.

C:\>echo 'test>=test'

C:\>dir /b test*
test'

C:\>type "test'"
'test
msg257740 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2016-01-08 07:47
Here is the patch with the changes suggested by Brett.

Having created this patch, I had second thoughts on this change. Folks who use pip often, usually use it without any quotes, like `pip install requests`, `pip install CherryPy`. Pinned down versions are most often required by projects and they mention it in the requirements.txt in an unquoted manner
Ref: https://pip.readthedocs.org/en/1.1/requirements.html
It works fine as it is not the shell which is parsing this file.

Since ">" thing parsed by shell on the command line is a special thing, why not address that scenario with more clarification, instead of quoting all the examples, which seem contrary to the common usage patterns?
msg257769 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2016-01-08 17:41
I think it's enough to add a note that says that if the argument contains > (and possibly other) special characters, then it needs to be quoted.
Examples that use > should also be quoted, but not the others one.
msg258490 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-18 02:42
New changeset 31debd0dc0dc by Senthil Kumaran in branch '3.5':
Issue26017 - Suggest enclosing command args in double quotes when using characters which get interpreted by shell.
https://hg.python.org/cpython/rev/31debd0dc0dc

New changeset 18ae23b69e08 by Senthil Kumaran in branch 'default':
Merge from 3.5
https://hg.python.org/cpython/rev/18ae23b69e08
msg258491 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-18 02:45
New changeset 668827be66d6 by Senthil Kumaran in branch '2.7':
Issue26017 - Suggest enclosing command args in double quotes when using characters which get interpreted by shell.
https://hg.python.org/cpython/rev/668827be66d6
msg258492 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2016-01-18 02:46
Thanks for the review/comment Ezio. Agree with your suggestion and made the change accordingly.
History
Date User Action Args
2016-01-18 02:46:31orsenthilsetstatus: open -> closed
versions: + Python 2.7, Python 3.5, Python 3.6
messages: + msg258492

assignee: docs@python -> orsenthil
resolution: fixed
stage: needs patch -> resolved
2016-01-18 02:45:17python-devsetmessages: + msg258491
2016-01-18 02:43:00python-devsetnosy: + python-dev
messages: + msg258490
2016-01-08 17:41:36ezio.melottisetnosy: + ezio.melotti
messages: + msg257769
2016-01-08 07:47:30orsenthilsetfiles: + Issue26017.patch

nosy: + orsenthil
messages: + msg257740

keywords: + patch
2016-01-05 17:55:43zach.waresetnosy: + zach.ware
messages: + msg257537
2016-01-05 17:43:16brett.cannoncreate