From ec8111936b45dbf549e19c6bef2a0e95e6c020c5 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Mon, 9 Mar 2009 17:45:23 +0000 Subject: [PATCH] - Fixed no-root-config patch (bug #489055). --- hplip-no-root-config.patch | 36 ++++++++++++++++++------------------ hplip.spec | 5 ++++- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/hplip-no-root-config.patch b/hplip-no-root-config.patch index 0076916..57448a6 100644 --- a/hplip-no-root-config.patch +++ b/hplip-no-root-config.patch @@ -1,30 +1,30 @@ diff -up hplip-3.9.2/base/g.py.no-root-config hplip-3.9.2/base/g.py --- hplip-3.9.2/base/g.py.no-root-config 2009-02-20 00:36:51.000000000 +0000 -+++ hplip-3.9.2/base/g.py 2009-02-20 11:13:28.000000000 +0000 -@@ -110,6 +110,10 @@ class ConfigBase(object): - keys = options ++++ hplip-3.9.2/base/g.py 2009-03-09 17:43:15.000000000 +0000 +@@ -111,6 +111,10 @@ class ConfigBase(object): def read(self): -+ if filename.startswith ("/root/") or filename.startswith ("/var/"): -+ # Don't try opening a file in root's home directory. -+ return -+ if self.filename is not None: ++ filename = self.filename ++ if filename.startswith ("/root/") or filename.startswith ("/var/"): ++ # Don't try opening a file in root's home directory. ++ return try: fp = open(self.filename, "r") -@@ -119,6 +123,15 @@ class ConfigBase(object): - log.debug("Unable to open file %s for reading." % self.filename) + self.conf.readfp(fp) +@@ -120,6 +124,15 @@ class ConfigBase(object): def write(self): -+ filename = self.filename -+ if filename.startswith ("/root/") or filename.startswith ("/var/"): -+ # Don't try writing a file in root's home directory. -+ return -+ elif filename.startswith ("/etc/"): -+ # Certainly don't try writing the system-wide config file! -+ # See bug #479178. -+ return -+ if self.filename is not None: ++ filename = self.filename ++ if filename.startswith ("/root/") or filename.startswith ("/var/"): ++ # Don't try writing a file in root's home directory. ++ return ++ elif filename.startswith ("/etc/"): ++ # Certainly don't try writing the system-wide config file! ++ # See bug #479178. ++ return ++ try: fp = open(self.filename, "w") + self.conf.write(fp) diff --git a/hplip.spec b/hplip.spec index ba931f3..721300c 100644 --- a/hplip.spec +++ b/hplip.spec @@ -1,7 +1,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.9.2 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ and MIT Group: System Environment/Daemons Conflicts: system-config-printer < 0.6.132 @@ -326,6 +326,9 @@ fi exit 0 %changelog +* Mon Mar 9 2009 Tim Waugh 3.9.2-4 +- Fixed no-root-config patch (bug #489055). + * Tue Feb 24 2009 Fedora Release Engineering - 3.9.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild