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.

classification
Title: Usage of `tmpnam_r` and `tempname` is dangerous, better use `mkstemp`
Type: Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, matrixise, serhiy.storchaka
Priority: normal Keywords: easy (C)

Created on 2019-03-05 08:39 by matrixise, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg337172 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-05 08:39
Hi,

I got these warning messages

/usr/bin/ld: libpython2.7.a(posixmodule.o): in function `posix_tmpnam':
/home/stephane/src/github.com/python/cpython/./Modules/posixmodule.c:7648: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/usr/bin/ld: libpython2.7.a(posixmodule.o): in function `posix_tempnam':
/home/stephane/src/github.com/python/cpython/./Modules/posixmodule.c:7595: warning: the use of `tempnam' is dangerous, better use `mkstemp'


Because the EOL of 2.7 is in 2020-01-01, do you think we should fix this issue?
msg337173 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-05 08:43
The fix of this issue is Python 3.
msg337174 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-05 08:47
yep, sure and there is a RuntimeWarning exception (tmpnam is a potential security risk to your program) when we want to use os.tmpnam().

And in the doc, there is a warning section.

Ok, I close this issue.
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80373
2019-03-05 08:47:51matrixisesetstatus: open -> closed

messages: + msg337174
stage: resolved
2019-03-05 08:43:15serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg337173
2019-03-05 08:39:41matrixisecreate