From 2104a1b478d23356cf8603628513482fe79e5d12 Mon Sep 17 00:00:00 2001 From: Patrick Vos <itofzo@gmail.com> Date: Sun, 1 Apr 2012 11:22:22 +0200 Subject: [PATCH] Add check first if need to change permissions, like in fixSetGroupID. On linux when download user and sickbeard user are not the same, moving files will result in download user still owning the files. When SickBeard tries to chmod permissions it results in error, because only root or owner are allowed to do this. Check first if need to change permissions, like in fixSetGroupID. If same do nothing. --- sickbeard/helpers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 26b5a0aec..fe15f8801 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -436,12 +436,16 @@ def chmodAsParent(childPath): return parentMode = stat.S_IMODE(os.stat(parentPath)[stat.ST_MODE]) + childPath_mode = stat.S_IMODE(os.stat(childPath)[stat.ST_MODE]) if ek.ek(os.path.isfile, childPath): childMode = fileBitFilter(parentMode) else: childMode = parentMode + if childPath_mode == childMode: + return + try: ek.ek(os.chmod, childPath, childMode) logger.log(u"Setting permissions for %s to %o as parent directory has %o" % (childPath, childMode, parentMode), logger.DEBUG) -- GitLab