[policycoreutils] Fix dpi handling in sandbox

Daniel J Walsh dwalsh at fedoraproject.org
Tue Nov 29 20:25:54 UTC 2011


commit c165d4c12adbde59e44cb531417558547f0a5eba
Author: Dan Walsh <dwalsh at redhat.com>
Date:   Tue Nov 29 15:25:50 2011 -0500

    Fix dpi handling in sandbox

 policycoreutils-rhat.patch |   43 ++++++++++++++++++++++++-------------------
 policycoreutils.spec       |    5 ++++-
 2 files changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch
index 83c0d52..d5da8c8 100644
--- a/policycoreutils-rhat.patch
+++ b/policycoreutils-rhat.patch
@@ -111,7 +111,7 @@ index 1c458f1..96c6795 100644
  	install -m 4755 seunshare $(SBINDIR)/
  	-mkdir -p $(SHAREDIR)
 diff --git a/policycoreutils/sandbox/sandbox b/policycoreutils/sandbox/sandbox
-index 486cd4e..a21e508 100644
+index 486cd4e..6987652 100644
 --- a/policycoreutils/sandbox/sandbox
 +++ b/policycoreutils/sandbox/sandbox
 @@ -118,10 +118,30 @@ def reserve(level):
@@ -160,35 +160,27 @@ index 486cd4e..a21e508 100644
  
  def fullpath(cmd):
         for i in [ "/", "./", "../" ]:
-@@ -160,6 +183,17 @@ class Sandbox:
+@@ -160,7 +183,7 @@ class Sandbox:
          self.__level = None
          self.__homedir = None
          self.__tmpdir = None
-+        self.__set_dpi()
+-
 +    
-+    def __set_dpi(self):
-+        rc, out = commands.getstatusoutput("/usr/bin/xrdb -query")
-+        if rc != 0:
-+               self.dpi = 96
-+        else:
-+               for i in out.split("\n"):
-+                      if i.startswith("Xft.dpi:"):
-+                             self.dpi = i.split()[1]
-+                             break;
- 
      def __validate_mount(self):
             if self.__options.level:
-@@ -278,6 +312,9 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
+                   if not self.__options.homedir or not self.__options.tmpdir:
+@@ -278,6 +301,10 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
                            action="callback", callback=self.__mount_callback, 
                            help=_("mount new home and/or tmp directory"))
  
 +        parser.add_option("-d", "--dpi", 
-+                          dest="dpi", action="store",default=self.dpi,
-+                          help=_("dots per inch for X display: (%s)" % self.dpi))
++                          dest="dpi", action="store",
++                          help=_("dots per inch for X display"))
++
          parser.add_option("-S", "--session", action="store_true",  dest="session", 
                            default=False,  help=_("run complete desktop session within sandbox"))
  
-@@ -322,7 +359,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
+@@ -322,7 +349,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
  
          if self.__options.X_ind:
                 self.setype = DEFAULT_X_TYPE
@@ -197,12 +189,25 @@ index 486cd4e..a21e508 100644
          if self.__options.setype:
                 self.setype = self.__options.setype
  
-@@ -408,7 +445,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
+@@ -401,6 +428,12 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
+                          cmds +=  [ "-t", self.__tmpdir, "-h", self.__homedir ]
+ 
+                          if self.__options.X_ind:
++                                if self.__options.dpi:
++                                       dpi = self.__options.dpi:
++                                else:
++                                       import gtk
++                                       dpi = gtk.settings_get_default().props.gtk_xft_dpi/1024
++
+                                 xmodmapfile = self.__homedir + "/.xmodmap"
+                                 xd = open(xmodmapfile,"w")
+                                 subprocess.Popen(["/usr/bin/xmodmap","-pke"],stdout=xd).wait()
+@@ -408,7 +441,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
  
                                  self.__setup_sandboxrc(self.__options.wm)
  
 -                                cmds += [ "--", SANDBOXSH, self.__options.windowsize, self.dpi ]
-+                                cmds += [ "--", SANDBOXSH, self.__options.windowsize, self.__options.dpi ]
++                                cmds += [ "--", SANDBOXSH, self.__options.windowsize, dpi ]
                           else:
                                  cmds += [ "--" ] + self.__paths
                           return subprocess.Popen(cmds).wait()
diff --git a/policycoreutils.spec b/policycoreutils.spec
index 1e3da80..e17e2f6 100644
--- a/policycoreutils.spec
+++ b/policycoreutils.spec
@@ -7,7 +7,7 @@
 Summary: SELinux policy core utilities
 Name:	 policycoreutils
 Version: 2.1.8
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: GPLv2
 Group:	 System Environment/Base
 # Based on git repository with tag 20101221
@@ -352,6 +352,9 @@ fi
 /bin/systemctl try-restart restorecond.service >/dev/null 2>&1 || :
 
 %changelog
+* Tue Nov 29 2011 Dan Walsh <dwalsh at redhat.com> - 2.1.8-7
+- Fix dpi handling in sandbox 
+
 * Wed Nov 16 2011 Dan Walsh <dwalsh at redhat.com> - 2.1.8-6
 - Add listing of distribution equivalence class from semanage fcontext -l
 - Add checking to semanage fcontext -a to guarantee a file specification will not be masked by an equivalence


More information about the scm-commits mailing list