Prevent hp-fab traceback when run as root.

This commit is contained in:
Tim Waugh 2010-11-12 10:40:51 +00:00
parent 87bab890b5
commit 284d663dfa
2 changed files with 41 additions and 1 deletions

View File

@ -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):

View File

@ -1,7 +1,7 @@
Summary: HP Linux Imaging and Printing Project Summary: HP Linux Imaging and Printing Project
Name: hplip Name: hplip
Version: 3.10.9 Version: 3.10.9
Release: 5%{?dist} Release: 6%{?dist}
License: GPLv2+ and MIT License: GPLv2+ and MIT
Group: System Environment/Daemons Group: System Environment/Daemons
Conflicts: system-config-printer < 0.6.132 Conflicts: system-config-printer < 0.6.132
@ -41,6 +41,7 @@ Patch24: hplip-addgroup.patch
Patch25: hplip-raw_deviceID-traceback.patch Patch25: hplip-raw_deviceID-traceback.patch
Patch26: hplip-UnicodeDecodeError.patch Patch26: hplip-UnicodeDecodeError.patch
Patch27: hplip-emit-SIGNAL.patch Patch27: hplip-emit-SIGNAL.patch
Patch28: hplip-fab-root-crash.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 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). # Don't emit SIGNALs in ui4.setupdialog.SetupDialog the PyQt3 way (bug #623834).
%patch27 -p1 -b .emit-SIGNAL %patch27 -p1 -b .emit-SIGNAL
# Prevent hp-fab traceback when run as root.
%patch28 -p1 -b .fab-root-crash
sed -i.duplex-constraints \ sed -i.duplex-constraints \
-e 's,\(UIConstraints.* \*Duplex\),//\1,' \ -e 's,\(UIConstraints.* \*Duplex\),//\1,' \
prnt/drv/hpcups.drv.in prnt/drv/hpcups.drv.in
@ -476,6 +480,9 @@ fi
%postun libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig
%changelog %changelog
* Thu Nov 12 2010 Tim Waugh <twaugh@redhat.com> - 3.10.9-6
- Prevent hp-fab traceback when run as root.
* Thu Nov 1 2010 Jiri Popelka <jpopelka@redhat.com> 3.10.9-5 * Thu Nov 1 2010 Jiri Popelka <jpopelka@redhat.com> 3.10.9-5
- Don't emit SIGNALs in ui4.setupdialog.SetupDialog the PyQt3 way (bug #623834). - Don't emit SIGNALs in ui4.setupdialog.SetupDialog the PyQt3 way (bug #623834).