elog/mod_save: fix permissions for logrotate
authorZac Medico <zmedico@gentoo.org>
Mon, 11 Jul 2011 21:02:40 +0000 (14:02 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 11 Jul 2011 21:02:40 +0000 (14:02 -0700)
These permissions should be compatible with our default logrotate
config as discussed in bug 374287.

pym/portage/elog/mod_save.py
pym/portage/elog/mod_save_summary.py
pym/portage/package/ebuild/prepare_build_dirs.py

index 36654b3f227dee85ffb7b226bfe379b8063dedf7..9350a6e580b666c20e4a2173ab2ebfe0115666b3 100644 (file)
@@ -8,7 +8,7 @@ from portage import os
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
-from portage.data import portage_gid
+from portage.data import portage_gid, portage_uid
 from portage.package.ebuild.prepare_build_dirs import _ensure_log_subdirs
 from portage.util import ensure_dirs, normalize_path
 
@@ -23,7 +23,9 @@ def process(mysettings, key, logentries, fulltext):
                # Only initialize group/mode if the directory doesn't
                # exist, so that we don't override permissions if they
                # were previously set by the administrator.
-               ensure_dirs(logdir, gid=portage_gid, mode=0o2770)
+               # NOTE: These permissions should be compatible with our
+               # default logrotate config as discussed in bug 374287.
+               ensure_dirs(logdir, uid=portage_uid, gid=portage_gid, mode=0o2770)
 
        cat = mysettings['CATEGORY']
        pf = mysettings['PF']
index f090deaf0fd8e649cf01d65a66dede78473f8230..4adc6f34cae9338b7c86458ef396709c9fb49d27 100644 (file)
@@ -8,7 +8,7 @@ from portage import os
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
-from portage.data import portage_gid
+from portage.data import portage_gid, portage_uid
 from portage.localization import _
 from portage.package.ebuild.prepare_build_dirs import _ensure_log_subdirs
 from portage.util import apply_permissions, ensure_dirs, normalize_path
@@ -23,7 +23,9 @@ def process(mysettings, key, logentries, fulltext):
                # Only initialize group/mode if the directory doesn't
                # exist, so that we don't override permissions if they
                # were previously set by the administrator.
-               ensure_dirs(logdir, gid=portage_gid, mode=0o2770)
+               # NOTE: These permissions should be compatible with our
+               # default logrotate config as discussed in bug 374287.
+               ensure_dirs(logdir, uid=portage_uid, gid=portage_gid, mode=0o2770)
 
        elogdir = os.path.join(logdir, "elog")
        _ensure_log_subdirs(logdir, elogdir)
index aaf0740d8846c282a9a69ceac65bd014e8aead4a..616dc2e06844438f12eed35768b2bfe47784bc06 100644 (file)
@@ -286,6 +286,11 @@ def _prepare_workdir(mysettings):
                try:
                        modified = ensure_dirs(mysettings["PORT_LOGDIR"])
                        if modified:
+                               # Only initialize group/mode if the directory doesn't
+                               # exist, so that we don't override permissions if they
+                               # were previously set by the administrator.
+                               # NOTE: These permissions should be compatible with our
+                               # default logrotate config as discussed in bug 374287.
                                apply_secpass_permissions(mysettings["PORT_LOGDIR"],
                                        uid=portage_uid, gid=portage_gid, mode=0o2770)
                except PortageException as e: