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: OS-specific location in Lib/tempfile.py for OpenBSD
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: neologix, rpointel, vstinner
Priority: normal Keywords:

Created on 2011-08-23 11:30 by rpointel, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch-Lib_tempfile_py rpointel, 2011-08-23 11:30 patch to add specific case for OpenBSD
Messages (9)
msg142803 - (view) Author: Remi Pointel (rpointel) * Date: 2011-08-23 11:30
Hello,

/usr/tmp is not (used) on OpenBSD.

We have specific patch to do this, but I prefer to have this modification upstream.

2.5: http://www.openbsd.org/cgi-bin/cvsweb/ports/lang/python/2.5/patches/patch-Lib_tempfile_py
2.7: http://www.openbsd.org/cgi-bin/cvsweb/ports/lang/python/2.7/patches/patch-Lib_tempfile_py
3.2: http://www.openbsd.org/cgi-bin/cvsweb/ports/lang/python3/3.2/patches/patch-Lib_tempfile_py

Is it possible to add a specific location to remove /usr/tmp of the dirlist?

Attached file is the patch to do this:
--- Lib/tempfile.py.orig        Thu Aug  4 17:05:24 2011
+++ Lib/tempfile.py     Tue Aug 23 12:55:40 2011
@@ -138,6 +138,8 @@
     # Failing that, try OS-specific locations.
     if _os.name == 'nt':
         dirlist.extend([ r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ])
+    elif _sys.platform.startswith('openbsd'):
+        dirlist.extend([ '/tmp', '/var/tmp' ])
     else:
         dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ])
, '/var/tmp' ])

Thanks,
Remi.
msg142808 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-08-23 11:59
> /usr/tmp is not (used) on OpenBSD.

How is that a problem?
Those are just possible temporary directories to try, so if it doesn't exist, it won't be used (typically ENOENT will be catched when opening a tmpfile).
Also, since it's listed last, that's not a performance problem either.
msg142810 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-08-23 12:05
Because it's not exactly a bug, can you only apply the patch to Python 3.3?
msg142813 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-08-23 12:26
> can you only apply the patch ...

Hum, I mean can *we* only apply ...
msg142835 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-08-23 15:45
> Because it's not exactly a bug, can you only apply the patch to Python 3.3?

Well, we could, but:
- it doesn't fix a bug
- it doesn't bring any obvious benefit (performance, security, etc)
- it introduces an OS-specific case for no reason

I'm open to changing my mind though, maybe I'm missing something.
msg142836 - (view) Author: Remi Pointel (rpointel) * Date: 2011-08-23 15:52
I was reporting this because I thought it was better to include this upstream.
However, I understand if you don't want to include this specific case.

We can keep this patch in our tree, I understand your position.
msg142838 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-08-23 15:59
> We can keep this patch in our tree, I understand your position.

I could be missing something, but why do you have this patch in the first place?
If it turns out to be useful, then it's of course better to include it upstream, I just don't see what this patch is supposed to solve/improve.
msg142840 - (view) Author: Remi Pointel (rpointel) * Date: 2011-08-23 16:06
> I could be missing something, but why do you have this patch in the first place?

I'm recently working on porting Python for OpenBSD, and this patch exists since python2.5 (since 4 years in our tree). So I don't have all responses, but I think this issue could be closed/rejected, and it seems that this patch could be safely removed from our port tree.

Thanks for all information.

Remi.
msg142841 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-08-23 16:09
> it seems that this patch could be safely removed from our port tree.

Alright, I'm closing then.

> Thanks for all information.

And thanks for your help and bug reports concerning OpenBSD-specific issues!
History
Date User Action Args
2022-04-11 14:57:21adminsetgithub: 57036
2011-08-23 16:09:36neologixsetstatus: open -> closed
resolution: rejected
messages: + msg142841

stage: resolved
2011-08-23 16:06:12rpointelsetmessages: + msg142840
2011-08-23 15:59:03neologixsetmessages: + msg142838
2011-08-23 15:52:25rpointelsetmessages: + msg142836
2011-08-23 15:45:57neologixsetmessages: + msg142835
2011-08-23 12:26:42vstinnersetmessages: + msg142813
2011-08-23 12:05:46vstinnersetnosy: + vstinner
messages: + msg142810
2011-08-23 11:59:54neologixsetnosy: + neologix
messages: + msg142808
2011-08-23 11:30:56rpointelcreate