Discussion:
[PATCH] Manually set the permmissions for tempfile created cachefiles. BZ 833350.
James Antill
2012-10-04 21:09:58 UTC
Permalink
---
createrepo/yumbased.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/createrepo/yumbased.py b/createrepo/yumbased.py
index ac06196..15e1a7f 100644
--- a/createrepo/yumbased.py
+++ b/createrepo/yumbased.py
@@ -16,6 +16,11 @@


import os
+def _get_umask():
+ oumask = os.umask(0)
+ os.umask(oumask)
+ return oumask
+_b4rpm_oumask = _get_umask()
import rpm
import types

@@ -86,6 +91,9 @@ class CreateRepoPackage(YumLocalPackage):
csumo = os.fdopen(csumo, 'w', -1)
csumo.write(checksum)
csumo.close()
+ # tempfile forces 002 ... we want to undo that, so that users
+ # can share the cache. BZ 833350.
+ os.fchmod(csumo, 0777 ^ _b4rpm_oumask)
os.rename(tmpfilename, csumfile)
except:
pass
--
1.7.6.5
Loading...