rpms/hplip/devel hplip-no-root-config.patch,1.3,1.4

Tim Waugh (twaugh) fedora-extras-commits at redhat.com
Fri Jun 29 16:59:31 UTC 2007


Author: twaugh

Update of /cvs/pkgs/rpms/hplip/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14829

Modified Files:
	hplip-no-root-config.patch 
Log Message:
Updated no-root-config patch.

hplip-no-root-config.patch:

Index: hplip-no-root-config.patch
===================================================================
RCS file: /cvs/pkgs/rpms/hplip/devel/hplip-no-root-config.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- hplip-no-root-config.patch	28 Jun 2007 15:34:25 -0000	1.3
+++ hplip-no-root-config.patch	29 Jun 2007 16:58:55 -0000	1.4
@@ -1,24 +1,52 @@
---- hplip-1.7.4a/base/g.py.no-root-config	2007-06-14 15:40:43.000000000 +0100
-+++ hplip-1.7.4a/base/g.py	2007-06-28 16:33:47.000000000 +0100
-@@ -88,6 +88,10 @@
-         dict.__setattr__(self, "config_obj", ConfigParser.ConfigParser())
-         dict.__setattr__(self, "filename", filename)
+--- hplip-2.7.6/base/g.py.no-root-config	2007-06-18 17:56:32.000000000 +0100
++++ hplip-2.7.6/base/g.py	2007-06-29 17:58:29.000000000 +0100
+@@ -105,6 +105,10 @@
+ 
+         log.debug("Reading config file %s" % filename)
  
 +        if filename.startswith ("/root/") or os.getuid () == 0:
 +            # Don't try opening a file in root's home directory.
 +            return
 +
          try:
-             pathmode = os.stat(filename)[stat.ST_MODE]
-             if pathmode & 0022 != 0:
-@@ -129,7 +133,9 @@
+             f = file(filename, 'r')
+             self.config_obj.readfp(f)
+@@ -134,23 +138,24 @@
+ # Config file: directories and ports
  prop.sys_config_file = '/etc/hp/hplip.conf'
- prop.user_config_file = os.path.expanduser('~/.hplip.conf')
+ prop.user_dir = os.path.expanduser('~/.hplip')
+-
+-os.umask(0037)
+-try:
+-    if not os.path.exists(prop.user_dir):
+-        os.makedirs(prop.user_dir)
+-except OSError:
+-    pass # This is sometimes OK, if running hpfax: for example
+-    
+ prop.user_config_file = os.path.join(prop.user_dir, 'hplip.conf')
  
 -if not os.path.exists(prop.user_config_file):
 +if (not prop.user_config_file.startswith ("/root/") and
-+    not os.getuid () == 0 and
-+    not os.path.exists(prop.user_config_file)):
++    not os.getuid () == 0):
++    os.umask(0037)
      try:
-         file(prop.user_config_file, 'w').close()
-         s = os.stat(os.path.dirname(prop.user_config_file))
+-        file(prop.user_config_file, 'w').close()
+-        s = os.stat(os.path.dirname(prop.user_config_file))
+-        os.chown(prop.user_config_file, s[stat.ST_UID], s[stat.ST_GID])
+-    except IOError:
+-        pass
++        if not os.path.exists(prop.user_dir):
++            os.makedirs(prop.user_dir)
++    except OSError:
++        pass # This is sometimes OK, if running hpfax: for example
++    
++    if not os.path.exists(prop.user_config_file):
++        try:
++            file(prop.user_config_file, 'w').close()
++            s = os.stat(os.path.dirname(prop.user_config_file))
++            os.chown(prop.user_config_file, s[stat.ST_UID], s[stat.ST_GID])
++        except IOError:
++            pass
+     
+ sys_cfg = Config(prop.sys_config_file, True)
+ user_cfg = Config(prop.user_config_file)




More information about the fedora-extras-commits mailing list