From 284d663dfa38d26a96f0c024bc34cf7ed5f51086 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Fri, 12 Nov 2010 10:40:51 +0000 Subject: [PATCH] Prevent hp-fab traceback when run as root. --- hplip-fab-root-crash.patch | 33 +++++++++++++++++++++++++++++++++ hplip.spec | 9 ++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 hplip-fab-root-crash.patch diff --git a/hplip-fab-root-crash.patch b/hplip-fab-root-crash.patch new file mode 100644 index 0000000..a6e31d9 --- /dev/null +++ b/hplip-fab-root-crash.patch @@ -0,0 +1,33 @@ +diff -up hplip-3.10.9/fax/fax.py.fab-root-crash hplip-3.10.9/fax/fax.py +--- hplip-3.10.9/fax/fax.py.fab-root-crash 2010-11-12 10:36:30.504796972 +0000 ++++ hplip-3.10.9/fax/fax.py 2010-11-12 10:38:39.906166234 +0000 +@@ -203,17 +203,19 @@ class FaxAddressBook(object): # Pickle b + self.load() + + def load(self): +- self._fab = os.path.join(prop.user_dir, "fab.pickle") +- #old_fab = os.path.join(prop.user_dir, "fab.db") ++ self._fab = "/dev/null" ++ if prop.user_dir != None: ++ self._fab = os.path.join(prop.user_dir, "fab.pickle") ++ #old_fab = os.path.join(prop.user_dir, "fab.db") ++ ++ # Load the existing pickle if present ++ if os.path.exists(self._fab): ++ pickle_file = open(self._fab, "r") ++ self._data = cPickle.load(pickle_file) ++ pickle_file.close() + +- # Load the existing pickle if present +- if os.path.exists(self._fab): +- pickle_file = open(self._fab, "r") +- self._data = cPickle.load(pickle_file) +- pickle_file.close() +- +- else: +- self.save() # save the empty file to create the file ++ else: ++ self.save() # save the empty file to create the file + + + def set(self, name, title, firstname, lastname, fax, groups, notes): diff --git a/hplip.spec b/hplip.spec index c10a29d..4daf38f 100644 --- a/hplip.spec +++ b/hplip.spec @@ -1,7 +1,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.10.9 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ and MIT Group: System Environment/Daemons Conflicts: system-config-printer < 0.6.132 @@ -41,6 +41,7 @@ Patch24: hplip-addgroup.patch Patch25: hplip-raw_deviceID-traceback.patch Patch26: hplip-UnicodeDecodeError.patch Patch27: hplip-emit-SIGNAL.patch +Patch28: hplip-fab-root-crash.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -250,6 +251,9 @@ done # Don't emit SIGNALs in ui4.setupdialog.SetupDialog the PyQt3 way (bug #623834). %patch27 -p1 -b .emit-SIGNAL +# Prevent hp-fab traceback when run as root. +%patch28 -p1 -b .fab-root-crash + sed -i.duplex-constraints \ -e 's,\(UIConstraints.* \*Duplex\),//\1,' \ prnt/drv/hpcups.drv.in @@ -476,6 +480,9 @@ fi %postun libs -p /sbin/ldconfig %changelog +* Thu Nov 12 2010 Tim Waugh - 3.10.9-6 +- Prevent hp-fab traceback when run as root. + * Thu Nov 1 2010 Jiri Popelka 3.10.9-5 - Don't emit SIGNALs in ui4.setupdialog.SetupDialog the PyQt3 way (bug #623834).