[gnome-ostree] compile-one: Ensure that we install world-readable files



commit 9664e6610dd6186034caa367abb2e770d15284f2
Author: Colin Walters <walters verbum org>
Date:   Sun Aug 26 17:00:57 2012 -0400

    compile-one: Ensure that we install world-readable files
    
    The OSTree model just doesn't really support non-world-readable files.
    We could hunt down and patch each individual broken module (at the
    moment, pppd), but let's just globally ensure it right here.

 src/ostbuild/pyostbuild/builtin_compile_one.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtin_compile_one.py b/src/ostbuild/pyostbuild/builtin_compile_one.py
index 33d5981..1965ccf 100755
--- a/src/ostbuild/pyostbuild/builtin_compile_one.py
+++ b/src/ostbuild/pyostbuild/builtin_compile_one.py
@@ -254,6 +254,17 @@ class OstbuildCompileOne(builtins.Builtin):
         if not os.path.isdir(dirname):
             os.makedirs(dirname)
 
+        # Ensure that all installed files are at least rw-rw-r--;
+        # we don't support private/hidden files.
+        # Directories also need u+x, i.e. they're rwxrw-r--
+        if not stat.S_ISLNK(statsrc.st_mode):
+            minimal_mode = (stat.S_IRUSR | stat.S_IWUSR |
+                            stat.S_IRGRP | stat.S_IWGRP |
+                            stat.S_IROTH)
+            if stat.S_ISDIR(statsrc.st_mode):
+                minimal_mode |= stat.S_IXUSR
+            os.chmod(src, statsrc.st_mode | minimal_mode)
+
         if stat.S_ISDIR(statsrc.st_mode):
             if not os.path.isdir(dest):
                 os.mkdir(dest)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]