[Python-bugs-list] [ python-Bugs-486434 ] Compiler complaints in posixmodule.c

noreply@sourceforge.net noreply@sourceforge.net
Wed, 28 Nov 2001 06:17:24 -0800


Bugs item #486434, was opened at 2001-11-28 03:51
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=486434&group_id=5470

Category: Extension Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: M.-A. Lemburg (lemburg)
Assigned to: M.-A. Lemburg (lemburg)
Summary: Compiler complaints in posixmodule.c

Initial Comment:
The linker on Linux reports some warnings for 
posixmodule.c:

libpython2.2.a(posixmodule.o): In function `posix_tmpnam':
/home/lemburg/projects/Python/Dev-Python/./Modules/posixmodule.c:4486:
the use of `tmpnam_r' is dangerous, better use `mkstemp'
libpython2.2.a(posixmodule.o): In function `posix_tempnam':
/home/lemburg/projects/Python/Dev-Python/./Modules/posixmodule.c:4436:
the use of `tempnam' is dangerous, better use `mkstemp'
Perhaps we ought to follow the advice ?!


----------------------------------------------------------------------

Comment By: M.-A. Lemburg (lemburg)
Date: 2001-11-28 06:17

Message:
Logged In: YES 
user_id=38388

Hmm, the man page on SuSE Linux does not say anything about using tmpfile() instead of mkstemp().

BTW, the warnings are already in place.

I wonder whether it wouldn't be better to remove the Python APIs for these functions altogether and 
instead provide interfaces for the mkstemp() and/or tempfile().

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-11-28 05:56

Message:
Logged In: YES 
user_id=21627

No. The usage of tmpnam is not dangerous; we are just
exposing it to the Python application. It may be reasonable
to produce a warning if tmpnam is called.

We cannot replace tempnam with mkstemp for the same reason
Posix couldn't: one produces a string, the other one a file
handle. 

What we could do is to expose mkstemp(3) where available. I
don't see the value of that, though: it could be done only
on systems where mkstemp is available, and we already expose
tmpfile(3). In fact, the Linux man page for mkstemp(3) says

# Don't use this function, use tmpfile(3) instead. It's 
# bet­ter defined and more portable.
If you still think there is a need for action, please
propose a patch.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=486434&group_id=5470