]> granicus.if.org Git - python/commitdiff
Issue #8890: Stop advertising an insecure use of /tmp in docs
authorPetri Lehtinen <petri@digip.org>
Sat, 23 Feb 2013 18:26:56 +0000 (19:26 +0100)
committerPetri Lehtinen <petri@digip.org>
Sat, 23 Feb 2013 18:27:49 +0000 (19:27 +0100)
14 files changed:
Doc/install/index.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/pipes.rst
Doc/library/sqlite3.rst
Doc/library/trace.rst
Doc/library/zipimport.rst
Doc/tutorial/inputoutput.rst
Misc/ACKS
Misc/NEWS

index 52c75dc58ee314edc93d0aca7fd81753c664595c..c31b1983ce9987e2dcdb8d5b0aeaf9a950f7ca76 100644 (file)
@@ -189,7 +189,7 @@ under the distribution root; if you're excessively concerned with speed, or want
 to keep the source tree pristine, you can change the build directory with the
 :option:`--build-base` option. For example::
 
-   python setup.py build --build-base=/tmp/pybuild/foo-1.0
+   python setup.py build --build-base=/path/to/pybuild/foo-1.0
 
 (Or you could do this permanently with a directive in your system or personal
 Distutils configuration file; see section :ref:`inst-config-files`.)  Normally, this
index 7c76bab50d9a99d9a126e963b013f38da5e73b1a..01cf379df2c8431ca7ffcba8796ebbd66d83a580 100644 (file)
@@ -67,7 +67,7 @@ automatically when the program terminates without relying on the application
 making an explicit call into this module at termination. ::
 
    try:
-       _count = int(open("/tmp/counter").read())
+       _count = int(open("counter").read())
    except IOError:
        _count = 0
 
@@ -76,7 +76,7 @@ making an explicit call into this module at termination. ::
        _count = _count + n
 
    def savecounter():
-       open("/tmp/counter", "w").write("%d" % _count)
+       open("counter", "w").write("%d" % _count)
 
    import atexit
    atexit.register(savecounter)
index 21509d1f0537f12b642fdc6c420a0a881f27a073..478c95a9b00a19a06e12b6eb5b70d6a925693f23 100644 (file)
@@ -79,7 +79,7 @@ program to users of your script, you can have the reports saved to files
 instead, with code like this::
 
    import cgitb
-   cgitb.enable(display=0, logdir="/tmp")
+   cgitb.enable(display=0, logdir="/path/to/logdir")
 
 It's very helpful to use this feature during script development. The reports
 produced by :mod:`cgitb` provide information that can save you a lot of time in
index 32ec9cfc2f6bbd89b8e99e425bc8ff359da49ad0..9e8952339ccae4d685dafed667ea104850b8be41 100644 (file)
@@ -65,6 +65,6 @@ to this variable:
 Example::
 
    >>> import imghdr
-   >>> imghdr.what('/tmp/bass.gif')
+   >>> imghdr.what('bass.gif')
    'gif'
 
index 4bb31bfc05bd8ad1508a13b40be431567f28d16b..8115e42603eac5e03f36fe9ced99231322e1f120 100644 (file)
@@ -71,6 +71,6 @@ An example usage::
 
    >>> import mailcap
    >>> d=mailcap.getcaps()
-   >>> mailcap.findmatch(d, 'video/mpeg', filename='/tmp/tmp1223')
-   ('xmpeg /tmp/tmp1223', {'view': 'xmpeg %s'})
+   >>> mailcap.findmatch(d, 'video/mpeg', filename='tmp1223')
+   ('xmpeg tmp1223', {'view': 'xmpeg %s'})
 
index 247efb7deb4e6c099b5ab86d67fdb445d17fc615..ef8b9b54a17acf5f5b8dab367021e12be0e124f3 100644 (file)
@@ -47,7 +47,7 @@ To post an article from a binary file (this assumes that the article has valid
 headers, and that you have right to post on the particular newsgroup)::
 
    >>> s = nntplib.NNTP('news.gmane.org')
-   >>> f = open('/tmp/article.txt', 'rb')
+   >>> f = open('article.txt', 'rb')
    >>> s.post(f)
    '240 Article posted successfully.'
    >>> s.quit()
index 6a03edf13410d71b3d726d4acd388e27ee0a0e32..13395b636d443cd0809b84fab6efd000240fb843 100644 (file)
@@ -171,10 +171,10 @@ required option
 
 For example, consider this hypothetical command-line::
 
-   prog -v --report /tmp/report.txt foo bar
+   prog -v --report report.txt foo bar
 
 ``-v`` and ``--report`` are both options.  Assuming that ``--report``
-takes one argument, ``/tmp/report.txt`` is an option argument.  ``foo`` and
+takes one argument, ``report.txt`` is an option argument.  ``foo`` and
 ``bar`` are positional arguments.
 
 
index 016a720470f772c8e873b551f3d2615afac17faf..69e891db29feec9822c2ce1d017a28775a7f2873 100644 (file)
@@ -26,12 +26,12 @@ The :mod:`pipes` module defines the following class:
 Example::
 
    >>> import pipes
-   >>> t=pipes.Template()
+   >>> t = pipes.Template()
    >>> t.append('tr a-z A-Z', '--')
-   >>> f=t.open('/tmp/1', 'w')
+   >>> f = t.open('pipefile', 'w')
    >>> f.write('hello world')
    >>> f.close()
-   >>> open('/tmp/1').read()
+   >>> open('pipefile').read()
    'HELLO WORLD'
 
 
index 28edfcff215a8c7b7aab3beef4a66254f0443e5e..0d7baef165df0caffc2dafaf31fda57a3b4eed4e 100644 (file)
@@ -18,10 +18,10 @@ with the DB-API 2.0 specification described by :pep:`249`.
 
 To use the module, you must first create a :class:`Connection` object that
 represents the database.  Here the data will be stored in the
-:file:`/tmp/example` file::
+:file:`example.db` file::
 
    import sqlite3
-   conn = sqlite3.connect('/tmp/example')
+   conn = sqlite3.connect('example.db')
 
 You can also supply the special name ``:memory:`` to create a database in RAM.
 
index c4ddc56cf22497427b74b9e3100014076476f619..9b52f7d18d31b62bd33522029f39b018fc9f3bb6 100644 (file)
@@ -201,7 +201,7 @@ A simple example demonstrating the use of the programmatic interface::
    # run the new command using the given tracer
    tracer.run('main()')
 
-   # make a report, placing output in /tmp
+   # make a report, placing output in the current directory
    r = tracer.results()
-   r.write_results(show_missing=True, coverdir="/tmp")
+   r.write_results(show_missing=True, coverdir=".")
 
index 4f170924e96bc2fe67dc753547447fe7086f0469..60b2bd18352fa9fa11f2e431be2e4423eb2951d5 100644 (file)
@@ -16,7 +16,7 @@ Typically, :data:`sys.path` is a list of directory names as strings.  This modul
 also allows an item of :data:`sys.path` to be a string naming a ZIP file archive.
 The ZIP archive can contain a subdirectory structure to support package imports,
 and a path within the archive can be specified to only import from a
-subdirectory.  For example, the path :file:`/tmp/example.zip/lib/` would only
+subdirectory.  For example, the path :file:`example.zip/lib/` would only
 import from the :file:`lib/` subdirectory within the archive.
 
 Any files may be present in the ZIP archive, but only files :file:`.py` and
@@ -144,8 +144,8 @@ Examples
 Here is an example that imports a module from a ZIP archive - note that the
 :mod:`zipimport` module is not explicitly used. ::
 
-   $ unzip -l /tmp/example.zip
-   Archive:  /tmp/example.zip
+   $ unzip -l example.zip
+   Archive:  example.zip
      Length     Date   Time    Name
     --------    ----   ----    ----
         8467  11-26-02 22:30   jwzthreading.py
@@ -154,8 +154,8 @@ Here is an example that imports a module from a ZIP archive - note that the
    $ ./python
    Python 2.3 (#1, Aug 1 2003, 19:54:32)
    >>> import sys
-   >>> sys.path.insert(0, '/tmp/example.zip')  # Add .zip file to front of path
+   >>> sys.path.insert(0, 'example.zip')  # Add .zip file to front of path
    >>> import jwzthreading
    >>> jwzthreading.__file__
-   '/tmp/example.zip/jwzthreading.py'
+   'example.zip/jwzthreading.py'
 
index 13243593260c30e692a0dc8cbf3a89853ab1c8da..c804e25c8c3c9cba10d8aaf2a60282db8001a957 100644 (file)
@@ -234,12 +234,12 @@ two arguments: ``open(filename, mode)``.
 
 ::
 
-   >>> f = open('/tmp/workfile', 'w')
+   >>> f = open('workfile', 'w')
 
 .. XXX str(f) is <io.TextIOWrapper object at 0x82e8dc4>
 
    >>> print(f)
-   <open file '/tmp/workfile', mode 'w' at 80a0960>
+   <open file 'workfile', mode 'w' at 80a0960>
 
 The first argument is a string containing the filename.  The second argument is
 another string containing a few characters describing the way in which the file
@@ -346,7 +346,7 @@ of the file, 1 uses the current file position, and 2 uses the end of the file as
 the reference point.  *from_what* can be omitted and defaults to 0, using the
 beginning of the file as the reference point. ::
 
-   >>> f = open('/tmp/workfile', 'rb+')
+   >>> f = open('workfile', 'rb+')
    >>> f.write(b'0123456789abcdef')
    16
    >>> f.seek(5)     # Go to the 6th byte in the file
@@ -377,7 +377,7 @@ objects.  This has the advantage that the file is properly closed after its
 suite finishes, even if an exception is raised on the way.  It is also much
 shorter than writing equivalent :keyword:`try`\ -\ :keyword:`finally` blocks::
 
-    >>> with open('/tmp/workfile', 'r') as f:
+    >>> with open('workfile', 'r') as f:
     ...     read_data = f.read()
     >>> f.closed
     True
index bdb39f29e0e29216c34771bd74ba37ad198a9e05..39195ef665c096d211afd2e677df40e877fc1866 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1170,6 +1170,7 @@ Sue Williams
 Gerald S. Williams
 Steven Willis
 Frank Willison
+Geoff Wilson
 Greg V. Wilson
 J Derek Wilson
 Paul Winkler
index e5c37fae9e7c16db76206807db71861cdbb3bf2a..1550d0e6abeb9c1ac7d3380a6fd18ee27ccf226d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1078,6 +1078,10 @@ Tools/Demos
 Documentation
 -------------
 
+- Issue #8890: Stop advertising an insecure practice by replacing uses
+  of the /tmp directory with better alternatives in the documentation.
+  Patch by Geoff Wilson.
+
 - Issue #17203: add long option names to unittest discovery docs.
 
 - Issue #13094: add "Why do lambdas defined in a loop with different values