Message146843
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? |
|
Date |
User |
Action |
Args |
2011-11-02 16:29:00 | neologix | set | recipients:
+ neologix, brett.cannon, pitrou, vstinner, python-dev |
2011-11-02 16:29:00 | neologix | set | messageid: <1320251340.89.0.927849038846.issue13303@psf.upfronthosting.co.za> |
2011-11-02 16:29:00 | neologix | link | issue13303 messages |
2011-11-02 16:28:59 | neologix | create | |
|