emergelog: only set permission on creation
authorZac Medico <zmedico@gentoo.org>
Fri, 29 Apr 2011 16:07:25 +0000 (09:07 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 29 Apr 2011 16:07:25 +0000 (09:07 -0700)
This will fix bug #365319.

pym/_emerge/emergelog.py

index 4006530513b9e4b2ab9ede0a86753ebb359c42ce..dde662ead9c79cc056b9c5bba48da8f3db50aed1 100644 (file)
@@ -32,13 +32,15 @@ def emergelog(xterm_titles, mystr, short_msg=None):
                xtermTitle(short_msg)
        try:
                file_path = os.path.join(_emerge_log_dir, 'emerge.log')
+               existing_log = os.path.isfile(file_path)
                mylogfile = codecs.open(_unicode_encode(file_path,
                        encoding=_encodings['fs'], errors='strict'),
                        mode='a', encoding=_encodings['content'],
                        errors='backslashreplace')
-               portage.util.apply_secpass_permissions(file_path,
-                       uid=portage.portage_uid, gid=portage.portage_gid,
-                       mode=0o660)
+               if not existing_log:
+                       portage.util.apply_secpass_permissions(file_path,
+                               uid=portage.portage_uid, gid=portage.portage_gid,
+                               mode=0o660)
                mylock = None
                try:
                        mylock = portage.locks.lockfile(mylogfile)