Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 14, 2009, 11:27 AM

Post #1 of 4 (207 views)
Permalink
[issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified

New submission from Roy Smith <roy [at] panix>:

The docs (http://www.python.org/doc/2.5.1/lib/module-tempfile.html) specify that
mkdtemp(), "returns the absolute pathname of the new directory". It does that in
the default case, but if you specify a relative path for 'dir', you get back a
relative path.


$ python
Python 2.5.1 (r251:54863, Oct 17 2008, 14:39:09)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> tempfile.mkdtemp(dir='.')
'./tmpHk1pBD'

similar results were obtained on:

Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin

Note that mkstemp() gets it right:

>>> tempfile.mkdtemp(dir='.')
'./tmpoPXdL7'
>>> tempfile.mkstemp(dir='.')
(3, '/Users/roy2/tmpwTGZ2y')
>>>

----------
components: Library (Lib)
messages: 95256
nosy: roysmith
severity: normal
status: open
title: tempfile.mkdtemp() does not return absolute pathname when dir is specified
type: behavior
versions: Python 2.5

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7325>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 14, 2009, 11:51 AM

Post #2 of 4 (191 views)
Permalink
[issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified [In reply to]

R. David Murray <rdmurray [at] bitdance> added the comment:

This is true on trunk and py3k as well. 2.5 is in security fix only
mode, so I've removed it from the versions list.

Since mkstemp does return in the absolute path in this case, I think
this is a code rather than a documentation bug. However, changing it
would be backward incompatible, so it may not be possible to fix it in
2.6 and 3.1.

----------
keywords: +easy
nosy: +r.david.murray
priority: -> normal
stage: -> test needed
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7325>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 15, 2009, 12:56 PM

Post #3 of 4 (183 views)
Permalink
[issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified [In reply to]

Brett Cannon <brett [at] python> added the comment:

It's a border case for backporting. The docs do say it should be returning
an absolute path, so that is a bug. And chances are anyone who has
discovered this and is working around it simply called os.path.abspath()
on the value instead of some manual calculation (if at all; bigger chance
no one simply noticed).

My vote is to backport. Otherwise the docs should be updated for 2.6/3.1
to mention the bug.

----------
nosy: +brett.cannon

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7325>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 15, 2009, 1:03 PM

Post #4 of 4 (181 views)
Permalink
[issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

I think we should be conservative. People may be relying on it *not*
returning an absolute path; besides, the bug itself wasn't a problem in
practice, so backporting the fix doesn't bring any added value.

----------
nosy: +pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7325>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.