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.

Author neologix
Recipients brett.cannon, neologix, pitrou, python-dev, vstinner
Date 2011-11-02.16:28:59
SpamBayes Score 7.4815604e-10
Marked as misclassified No
Message-id <1320251340.89.0.927849038846.issue13303@psf.upfronthosting.co.za>
In-reply-to
Content
mkstemp() creates the file with mode 0600, which can be surprising.
I'm note sure about the best way to handle this:
1) change the file mode after creating it with fchmod(), using the source file mode. But we must also take into account the umask, so we'd have to do:
mask = umask(0); 
umask(mask);
[...]
fd = mkstemp(cpathname_tmp)
fchmod(fd, mode & ~mask);

The double call to umask() is necessary because we can't just retrieve the umask
2) don't use mkstemp(), and use something like:

    sprintf(cpathname_tmp, "%s.%x", cpathname, 0xffff & getpid());

    d = open(cpathname_tmp, O_WRONLY|O_CREAT|O_EXCL);

to mimic what's done in Lib/importlib/_bootstrap.py (pseudo-temp file).

3) Fall back to the original ".tmp" suffix (with the risk of stale tmp file).

Thoughts?
History
Date User Action Args
2011-11-02 16:29:00neologixsetrecipients: + neologix, brett.cannon, pitrou, vstinner, python-dev
2011-11-02 16:29:00neologixsetmessageid: <1320251340.89.0.927849038846.issue13303@psf.upfronthosting.co.za>
2011-11-02 16:29:00neologixlinkissue13303 messages
2011-11-02 16:28:59neologixcreate