[issue8890] Use tempfile instead of /tmp in examples
Geoff Wilson added the comment: Patch for 2.7, with most references to /tmp removed or replaced. References remain in Doc/install/index.rst and Doc/library/rexec.rst as they seem to make sense in context. -- nosy: +gmwils Added file: http://bugs.python.org/file29183/Issue8890.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Geoff Wilson added the comment: Attaching patch for 3.2 (Issue8890-3.2.patch) -- Added file: http://bugs.python.org/file29190/Issue8890-3.2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Geoff Wilson added the comment: Attaching patch for 3.3 that also works for 3.4/default (Issue8890-3.3.patch) -- Added file: http://bugs.python.org/file29191/Issue8890-3.3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Roundup Robot added the comment: New changeset 488957f9b664 by Petri Lehtinen in branch '2.7': Issue #8890: Stop advertising an insecure use of /tmp in docs http://hg.python.org/cpython/rev/488957f9b664 New changeset 7556601180c8 by Petri Lehtinen in branch '3.2': Issue #8890: Stop advertising an insecure use of /tmp in docs http://hg.python.org/cpython/rev/7556601180c8 New changeset 18e20e146396 by Petri Lehtinen in branch '3.3': Issue #8890: Stop advertising an insecure use of /tmp in docs http://hg.python.org/cpython/rev/18e20e146396 New changeset 6b0ca4cb7e4e by Petri Lehtinen in branch 'default': Issue #8890: Stop advertising an insecure use of /tmp in docs http://hg.python.org/cpython/rev/6b0ca4cb7e4e -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Petri Lehtinen added the comment: Applied, thanks! -- resolution: accepted - fixed stage: patch review - committed/rejected status: open - closed versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Petri Lehtinen pe...@digip.org added the comment: I think this issue was closed too hastily. Only the logging documentation has been fixed. @grubert: I agree with the assumption that /tmp is mostly used because it's writable. In my opinion, the directory could just be left out and only leave the file name. -- nosy: +petri.lehtinen status: closed - open versions: +Python 3.3 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Dave King d...@davbo.org added the comment: Spotted another use of /tmp/ in the logging howto. Attached a diff. -- nosy: +davbo Added file: http://bugs.python.org/file22483/tmp_logging_howto.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Roundup Robot devnull@devnull added the comment: New changeset 1ed71544fceb by Raymond Hettinger in branch '3.2': Issue #8890: Remove /tmp from examples. http://hg.python.org/cpython/rev/1ed71544fceb New changeset fcf242243d46 by Raymond Hettinger in branch 'default': Issue #8890: Remove /tmp from examples. http://hg.python.org/cpython/rev/fcf242243d46 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
engelbert gruber grub...@users.sourceforge.net added the comment: Assumption: /tmp is used in examples so the examples work because /tmp is always writeable module tempfile is for creating temporary files, the name of which is unimported, when a user is trying code from documentation it might be hard on him/her to additionally guess/save the random filenames. ``grep tmp -r CPython3.3/Doc`` (trimmed results and grouped) * Doc/distutils/install.rst, Doc/install/install.rst: e.g. ``--install-base=/tmp`` maybe ``--install-base=other-python-base-directory`` if someone installs to another directory, one has a reason and therefore knows the directory. * all other e.g. :: Doc/library/sqlite3.rst::file:`/tmp/example` file:: Doc/library/sqlite3.rst: conn = sqlite3.connect('/tmp/example') use ``/tmp`` because it is writeable, but assuming the user wants to program i think it is not so big a burden to assume him/her to grasp the concept of directories, files and write protection. So either it can be left out, as in sqlite3.rst, maybe a file extension would be more helpful, or replaced by a placeholder like ``my-log-directory`` or ``directory-for-tempfiles``. I am unsure about the chars ? list of files: Doc/distutils/install.rst Doc/documenting/fromlatex.rst Doc/howto/logging-cookbook.rst Doc/install/install.rst Doc/library/atexit.rst Doc/library/cgi.rst Doc/library/imghdr.rst Doc/library/mailcap.rst Doc/library/nntplib.rst Doc/library/optparse.rst Doc/library/packaging.database.rst Doc/library/packaging.pypi.simple.rst Doc/library/pipes.rst Doc/library/sqlite3.rst Doc/library/tempfile.rst Doc/library/trace.rst Doc/library/zipimport.rst Doc/tools/sphinxext/susp-ignored.csv Doc/tutorial/inputoutput.rst So which way ? -- nosy: +grubert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Actually, I don't think it's a great idea in general to use temporary files for logging, though of course there are specific cases where one might do this. So for the logging examples in the docs (which used '/tmp/XXX') I just removed the '/tmp/' part. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Éric Araujo mer...@netwok.org added the comment: Whatsnew documents are not edited after the corresponding release is done. Using either /home/user or tempfile depending on the example seems good to me. -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
anatoly techtonik techto...@gmail.com added the comment: On Mon, Nov 22, 2010 at 3:59 PM, Éric Araujo rep...@bugs.python.org wrote: Using either /home/user or tempfile depending on the example seems good to me. There is no /home/user on Windows. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Mauro Navarro Baraldi mauro.bara...@gmail.com added the comment: Reviewing this thread and talking with another friends, I thought that the pythonic way to solve it should be use the tempfile module. And here is a suggestion using the logging module with tempfile. import logging import tempfile fp, LOG_FILENAME = tempfile.mkstemp(suffix=.log) logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG) logging.debug('This message should go to the log file') LOG_FILENAME '/tmp/tmprBhZz1.log' -- components: +Demos and Tools -Documentation ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Changes by Éric Araujo mer...@netwok.org: -- assignee: - d...@python components: +Documentation -Demos and Tools ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Mauro Navarro Baraldi mauro.bara...@gmail.com added the comment: Replace to most use of /tmp/tempfile for just tempfile, as sugested before. -- keywords: +patch nosy: +maurobaraldi Added file: http://bugs.python.org/file19698/py3k-docs.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Éric Araujo mer...@netwok.org added the comment: Who wants to make a patch to update the documentation? For command-line examples (like “python setup.py install --install-base /tmp”), someone has to research what standard variable to use (TMPDIR, TMP, something else?). -- keywords: +easy stage: - needs patch title: Modules have dangerous examples in documentation - Use tempfile instead of /tmp in examples versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Éric Araujo mer...@netwok.org added the comment: Patch submission guidelines are found at http://www.python.org/dev/patches/ Since patches are made for the py3k branch, some matches in Henri’s grep won’t get patched: bsddb, compiler, posixfile and rexec have been removed. The person that will commit the patch will have to edit those too when merging into 2.7, unless a kind soul provides one patch per branch (not a requirement). Last remark: tempfile is a false positive; editing old whatsnew is not worth it IMO. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com