Bug 756181

Summary: [abrt] policycoreutils-python-2.1.4-10.fc16: sandbox:316:__parse_options:AttributeError: Sandbox instance has no attribute 'dpi'
Product: [Fedora] Fedora Reporter: Kevin Fenzi <kevin>
Component: policycoreutilsAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: amit.shah, bressers, bugzilla, cristian.ciupitu, dwalsh, mgrepl, pcfe
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0dd3f27511983aaef5af41cc1dcefc5f0326abc9
Fixed In Version: policycoreutils-2.1.4-12.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-10 19:46:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 494832, 757370, 757920    
Attachments:
Description Flags
output of /usr/bin/xrdb -query
none
Patch that resolves this issue
none
A somewhat more python friendly patch none

Description Kevin Fenzi 2011-11-22 21:42:37 UTC
libreport version: 2.0.7
abrt_version:   2.0.6
cmdline:        /usr/bin/python -Es /usr/bin/sandbox -w 1600x1080 -X midori -p
executable:     /usr/bin/sandbox
kernel:         3.1.0-7.fc16.x86_64
reason:         sandbox:316:__parse_options:AttributeError: Sandbox instance has no attribute 'dpi'
time:           Tue 22 Nov 2011 02:38:12 PM MST
uid:            1000
username:       kevin

backtrace:
:sandbox:316:__parse_options:AttributeError: Sandbox instance has no attribute 'dpi'
:
:Traceback (most recent call last):
:  File "/usr/bin/sandbox", line 487, in <module>
:    rc = sandbox.main()
:  File "/usr/bin/sandbox", line 472, in main
:    self.__parse_options()
:  File "/usr/bin/sandbox", line 316, in __parse_options
:    dest="dpi", action="store",default=self.dpi,
:AttributeError: Sandbox instance has no attribute 'dpi'
:
:Local variables in innermost frame:
:usage: '\nsandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile ] [-W windowmanager ] [ -w windowsize ] [[-i file ] ...] [ -t type ] command\n\nsandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile ] [-W windowmanager ] [ -w windowsize ] [[-i file ] ...] [ -t type ] -S\n\nPolicy defines the following types for use with the -t:\n\tsandbox_x_t\n\tsandbox_min_t\n\tsandbox_net_t\n\tsandbox_web_t\n\tsandbox_t\n\n'
:self: <__main__.Sandbox instance at 0xbbf998>
:parser: <optparse.OptionParser instance at 0xc26a70>
:OptionParser: <class optparse.OptionParser at 0xd12530>
:types: '\nPolicy defines the following types for use with the -t:\n\tsandbox_x_t\n\tsandbox_min_t\n\tsandbox_net_t\n\tsandbox_web_t\n\tsandbox_t\n'

comment:
:Running: 
:
:sandbox -w 1600x1080 -X midori -p

Comment 1 Daniel Walsh 2011-11-23 18:05:32 UTC
What does /usr/bin/xrdb -query

output?

Comment 2 Kevin Fenzi 2011-11-23 18:17:01 UTC
Xft.antialias:	1
Xft.hinting:	-1
Xft.hintstyle:	hintslight
Xft.rgba:	rgb
Xcursor.theme:	
Xcursor.theme_core:	true
Xcursor.size:	0

Comment 3 Patrick C. F. Ernzer 2011-11-25 13:29:37 UTC
Package: policycoreutils-python-2.1.4-10.fc16
Architecture: x86_64
OS Release: Fedora release 16 (Verne)

Comment
-----
1. Have F15 installed
2. Install (not update) F16, keeping old /home
3. use sandbox command from bash history

Meaning, I am not sure if the command to cal has not changed between F15 and F16. If it is a PEBKAC, please excuse the noise.

Comment 4 Patrick C. F. Ernzer 2011-11-25 13:32:54 UTC
Created attachment 536287 [details]
output of /usr/bin/xrdb -query

Comment 5 Miroslav Grepl 2011-11-28 12:49:33 UTC
*** Bug 757370 has been marked as a duplicate of this bug. ***

Comment 6 Cristian Ciupitu 2011-11-29 01:03:58 UTC
*** Bug 757920 has been marked as a duplicate of this bug. ***

Comment 7 Josh Bressers 2011-11-29 13:44:24 UTC
It seems xrdb doesn't contain this information anymore. It can be found from xdpyinfo.

% xdpyinfo| fgrep resolution
  resolution:    96x96 dots per inch

As a hacked up workaround, you can add this to the sandbox script:

    def __set_dpi(self):
        self.dpi='96'     <--- Add this line
        rc, out = commands.getstatusoutput("/usr/bin/xrdb -query")
        if rc != 0:

Comment 8 Josh Bressers 2011-11-29 15:44:39 UTC
Created attachment 538068 [details]
Patch that resolves this issue

Here's a patch that fixes the issue. I admit, how it finds the dpi info is a bit dodgy.

Comment 9 Josh Bressers 2011-11-29 16:07:24 UTC
Created attachment 538088 [details]
A somewhat more python friendly patch

This patch does things in a more python friendly manner. On a very slow computer the user may notice a small window pop up and vanish while the dpi is calculated via tk. I'll leave it up to the author to decide how they want to approach this solution.

Comment 10 Daniel Walsh 2011-11-29 20:16:17 UTC
print gtk.settings_get_default().props.gtk_xft_dpi/1024

Seems to do it.

Comment 11 Daniel Walsh 2011-11-29 20:41:26 UTC
Fixed in policycoreutils-2.1.4-11.fc16

Comment 12 Fedora Update System 2011-11-30 15:10:43 UTC
policycoreutils-2.1.4-12.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/policycoreutils-2.1.4-12.fc16

Comment 13 Fedora Update System 2011-12-02 21:35:33 UTC
Package policycoreutils-2.1.4-12.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing policycoreutils-2.1.4-12.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-16658/policycoreutils-2.1.4-12.fc16
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2011-12-10 19:46:32 UTC
policycoreutils-2.1.4-12.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.