diff --git a/libraries/entropy.py b/libraries/entropy.py index ae29b0407..b017378ec 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -6231,7 +6231,10 @@ class RepoInterface: continue if os.path.isfile(dbfile) and os.access(dbfile,os.W_OK): - self.Entropy.setup_default_file_perms(dbfile) + try: + self.Entropy.setup_default_file_perms(dbfile) + except OSError: # notification applet + pass # database is going to be updated self.dbupdated = True diff --git a/libraries/entropyConstants.py b/libraries/entropyConstants.py index 677f9c670..cc1627e3f 100644 --- a/libraries/entropyConstants.py +++ b/libraries/entropyConstants.py @@ -1098,6 +1098,10 @@ def const_setupEntropyPid(): pass else: raise + try: + const_chmod_entropy_pid() + except OSError: + pass else: #if etpConst['uid'] == 0: @@ -1115,6 +1119,19 @@ def const_setupEntropyPid(): f.flush() f.close() + try: + const_chmod_entropy_pid() + except OSError: + pass + + +def const_chmod_entropy_pid(): + try: + mygid = const_get_entropy_gid() + except KeyError: + mygid = 0 + const_setup_file(etpConst['pidfile'], mygid, 0664) + def const_createWorkingDirectories(): # handle pid file @@ -1380,15 +1397,18 @@ def const_setup_perms(mydir, gid): for item in files: item = os.path.join(currentdir,item) try: - cur_gid = os.stat(item)[stat.ST_GID] - if cur_gid != gid: - os.chown(item,-1,gid) - cur_mod = const_get_chmod(item) - if cur_mod != oct(0664): - os.chmod(item,0664) + const_setup_file(item, gid, 0664) except OSError: pass +def const_setup_file(myfile, gid, chmod): + cur_gid = os.stat(myfile)[stat.ST_GID] + if cur_gid != gid: + os.chown(myfile,-1,gid) + cur_mod = const_get_chmod(myfile) + if cur_mod != oct(chmod): + os.chmod(myfile,chmod) + # you need to convert to int def const_get_chmod(item): st = os.stat(item)[stat.ST_MODE]