classification
Title: distutils.command.config uses fragile constant temporary file name
Type: Stage: resolved
Components: Distutils Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Amir, Arfrever, eric.araujo, mgorny, steve.dower, tarek
Priority: normal Keywords: easy

Created on 2013-01-06 12:44 by mgorny, last changed 2021-02-03 18:03 by steve.dower. This issue is now closed.

Messages (5)
msg179179 - (view) Author: Michał Górny (mgorny) * Date: 2013-01-06 12:44
The distutils.command.config module reads:

    def _gen_temp_sourcefile(self, body, headers, lang):
        filename = "_configtest" + LANG_EXT[lang]

which means that every time one of the functions is used, a temporary file with the same name will be created. This is really fragile and fails terribly whenever more than one process tries to use the relevant functions in the same working directory.

I believe this code should use the tempfile module to generate unique temporary files names instead.
msg179706 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-01-11 17:14
Thanks for the report.  Did you find this by looking at the code or while using distutils?  In other words, if this is just a theoretical issue / code quality problem, it won’t be changed.  (distutils is not improved anymore.)
msg179721 - (view) Author: Michał Górny (mgorny) * Date: 2013-01-11 19:24
While using. We run parallel merges with out-of-source builds in Gentoo, and I found this to result in a failure when building the 'egenix-mx-base' package [1] which uses the 'config' command.

[1]:http://pypi.python.org/pypi/egenix-mx-base
msg380808 - (view) Author: Amir Mohamadi (Amir) * Date: 2020-11-12 09:39
Can I open a PR for it?
msg386233 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:03
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2021-02-03 18:03:27steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386233

resolution: out of date
stage: needs patch -> resolved
2020-11-12 09:39:18Amirsetnosy: + Amir
messages: + msg380808
2020-11-09 00:00:57eric.araujosetassignee: eric.araujo ->
stage: needs patch
2020-11-09 00:00:21iritkatrielsetkeywords: + easy
2020-11-08 23:59:37iritkatrielsetversions: + Python 3.8, Python 3.9, Python 3.10, - Python 2.6, Python 2.7, Python 3.2, Python 3.3, Python 3.4
2013-01-13 08:36:51Arfreversetnosy: + Arfrever
2013-01-11 19:24:36mgornysetmessages: + msg179721
2013-01-11 17:14:55eric.araujosetmessages: + msg179706
versions: + Python 3.4, - Python 3.1
2013-01-06 12:44:37mgornycreate