Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: fix default filemod in copyFile
......................................................................

packaging: fix default filemod in copyFile

copyFile used to call os.chmod(file, filemod) with filemod defaulting
to '-1'. Older linux kernels kept the mode unchanged in such a case, but
newer ones don't:
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/fs/open.c?id=e57712ebebbb9db7d8dcef216437b3171ddcf115

This change defaults filemod to None and only calls os.chown if filemod
is set.

Change-Id: I9e436d72e8ffb8d48e05201727d5b46797881556
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M packaging/fedora/setup/common_utils.py
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/19557/1

diff --git a/packaging/fedora/setup/common_utils.py 
b/packaging/fedora/setup/common_utils.py
index 94e02cc..cfe0435 100755
--- a/packaging/fedora/setup/common_utils.py
+++ b/packaging/fedora/setup/common_utils.py
@@ -701,7 +701,7 @@
     else:
         raise Exception(errMsg)
 
-def copyFile(filename, destination, uid=-1, gid=-1, filemod=-1):
+def copyFile(filename, destination, uid=-1, gid=-1, filemod=None):
     """
     copy filename to
     the destDir path
@@ -712,7 +712,7 @@
     destination  - full path to target dir or filename
     uid          - integer with user id (default -1 leaves the original uid)
     gid          - integer with group id (default -1 leaves the original gid)
-    filemod      - integer with file mode (default -1 keeps original mode)
+    filemod      - integer with file mode (default None keeps original mode)
     """
     # If the source is a directory, throw an exception since this func handles 
only files
     if (os.path.isdir(filename)):
@@ -737,8 +737,9 @@
     logging.debug("setting file %s uid/gid ownership"%(targetFile))
     os.chown(targetFile, uid, gid)
 
-    logging.debug("setting file %s mode to %d"%(targetFile, filemod))
-    os.chmod(targetFile, filemod)
+    if filemod is not None:
+        logging.debug("setting file %s mode to %d"%(targetFile, filemod))
+        os.chmod(targetFile, filemod)
 
 def getDbAdminUser():
     """


-- 
To view, visit http://gerrit.ovirt.org/19557
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e436d72e8ffb8d48e05201727d5b46797881556
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: engine_3.2
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to