Skip to content

Commit 26b9e87

Browse files
committed
Issue #8890: Stop advertising an insecure use of /tmp in docs
1 parent ce949b2 commit 26b9e87

17 files changed

Lines changed: 37 additions & 32 deletions

Doc/install/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ under the distribution root; if you're excessively concerned with speed, or want
189189
to keep the source tree pristine, you can change the build directory with the
190190
:option:`--build-base` option. For example::
191191

192-
python setup.py build --build-base=/tmp/pybuild/foo-1.0
192+
python setup.py build --build-base=/path/to/pybuild/foo-1.0
193193

194194
(Or you could do this permanently with a directive in your system or personal
195195
Distutils configuration file; see section :ref:`inst-config-files`.) Normally, this

Doc/library/atexit.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ automatically when the program terminates without relying on the application
7676
making an explicit call into this module at termination. ::
7777

7878
try:
79-
_count = int(open("/tmp/counter").read())
79+
_count = int(open("counter").read())
8080
except IOError:
8181
_count = 0
8282

@@ -85,7 +85,7 @@ making an explicit call into this module at termination. ::
8585
_count = _count + n
8686

8787
def savecounter():
88-
open("/tmp/counter", "w").write("%d" % _count)
88+
open("counter", "w").write("%d" % _count)
8989

9090
import atexit
9191
atexit.register(savecounter)

Doc/library/bsddb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ dictionaries. In addition, they support the methods listed below.
170170
Example::
171171

172172
>>> import bsddb
173-
>>> db = bsddb.btopen('/tmp/spam.db', 'c')
173+
>>> db = bsddb.btopen('spam.db', 'c')
174174
>>> for i in range(10): db['%d'%i] = '%d'% (i*i)
175175
...
176176
>>> db['3']

Doc/library/cgi.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ program to users of your script, you can have the reports saved to files
8181
instead, with code like this::
8282

8383
import cgitb
84-
cgitb.enable(display=0, logdir="/tmp")
84+
cgitb.enable(display=0, logdir="/path/to/logdir")
8585

8686
It's very helpful to use this feature during script development. The reports
8787
produced by :mod:`cgitb` provide information that can save you a lot of time in

Doc/library/compiler.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ examples demonstrate how to use the :func:`parse` function, what the repr of an
540540
AST looks like, and how to access attributes of an AST node.
541541

542542
The first module defines a single function. Assume it is stored in
543-
:file:`/tmp/doublelib.py`. ::
543+
:file:`doublelib.py`. ::
544544

545545
"""This is an example module.
546546

@@ -557,7 +557,7 @@ to create an instance from a repr, you must import the class names from the
557557
:mod:`compiler.ast` module. ::
558558

559559
>>> import compiler
560-
>>> mod = compiler.parseFile("/tmp/doublelib.py")
560+
>>> mod = compiler.parseFile("doublelib.py")
561561
>>> mod
562562
Module('This is an example module.\n\nThis is the docstring.\n',
563563
Stmt([Function(None, 'double', ['x'], [], 0,

Doc/library/gzip.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,23 @@ Examples of usage
9393
Example of how to read a compressed file::
9494

9595
import gzip
96-
f = gzip.open('/home/joe/file.txt.gz', 'rb')
96+
f = gzip.open('file.txt.gz', 'rb')
9797
file_content = f.read()
9898
f.close()
9999

100100
Example of how to create a compressed GZIP file::
101101

102102
import gzip
103103
content = "Lots of content here"
104-
f = gzip.open('/home/joe/file.txt.gz', 'wb')
104+
f = gzip.open('file.txt.gz', 'wb')
105105
f.write(content)
106106
f.close()
107107

108108
Example of how to GZIP compress an existing file::
109109

110110
import gzip
111-
f_in = open('/home/joe/file.txt', 'rb')
112-
f_out = gzip.open('/home/joe/file.txt.gz', 'wb')
111+
f_in = open('file.txt', 'rb')
112+
f_out = gzip.open('file.txt.gz', 'wb')
113113
f_out.writelines(f_in)
114114
f_out.close()
115115
f_in.close()

Doc/library/imghdr.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ to this variable:
6868
Example::
6969

7070
>>> import imghdr
71-
>>> imghdr.what('/tmp/bass.gif')
71+
>>> imghdr.what('bass.gif')
7272
'gif'
7373

Doc/library/mailcap.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ An example usage::
7171

7272
>>> import mailcap
7373
>>> d=mailcap.getcaps()
74-
>>> mailcap.findmatch(d, 'video/mpeg', filename='/tmp/tmp1223')
75-
('xmpeg /tmp/tmp1223', {'view': 'xmpeg %s'})
74+
>>> mailcap.findmatch(d, 'video/mpeg', filename='tmp1223')
75+
('xmpeg tmp1223', {'view': 'xmpeg %s'})
7676

Doc/library/nntplib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ To post an article from a file (this assumes that the article has valid
4646
headers, and that you have right to post on the particular newsgroup)::
4747

4848
>>> s = NNTP('news.gmane.org')
49-
>>> f = open('/tmp/article')
49+
>>> f = open('articlefile')
5050
>>> s.post(f)
5151
'240 Article posted successfully.'
5252
>>> s.quit()

Doc/library/optparse.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ required option
173173

174174
For example, consider this hypothetical command-line::
175175

176-
prog -v --report /tmp/report.txt foo bar
176+
prog -v --report report.txt foo bar
177177

178178
``-v`` and ``--report`` are both options. Assuming that ``--report``
179-
takes one argument, ``/tmp/report.txt`` is an option argument. ``foo`` and
179+
takes one argument, ``report.txt`` is an option argument. ``foo`` and
180180
``bar`` are positional arguments.
181181

182182

0 commit comments

Comments
 (0)