Bug 520664 - Empty ~/.sectoolrc file breaks the sectool and sectool-gui
Summary: Empty ~/.sectoolrc file breaks the sectool and sectool-gui
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: sectool
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Maros Barabas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: RHEL6Sectool
TreeView+ depends on / blocked
 
Reported: 2009-09-01 17:03 UTC by Eduard Benes
Modified: 2009-09-09 14:26 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-09 14:26:19 UTC


Attachments (Terms of Use)
Patch to evade empty configuration files (558 bytes, patch)
2009-09-02 09:31 UTC, Maros Barabas
no flags Details | Diff

Description Eduard Benes 2009-09-01 17:03:21 UTC
Description of problem:
Creating an empty ~/.sectoolrc file breaks the sectool and sectool-gui.
To be precise, the file is not empty, but contains only whitespace(s).

Version-Release number of selected component (if applicable):
# rpm -q sectool{,-gui}
sectool-0.9.4-2.fc11.i586
sectool-gui-0.9.4-2.fc11.i586

How reproducible:
always

Steps to Reproduce:
1. Create te rc file cotaining only whitespaces, e.g.:
   # echo  > ~/.sectoolrc
2. Run sectool-gui or sectool, e.g.:
   # sectool --level 1
   # sectool-gui
3. Observe the tracebacks ...
  
Actual results:
<snip>
# echo  > ~/.sectoolrc 
[root@dhcp-lab-115 ~]# sectool-gui
Traceback (most recent call last):
  File "/usr/bin/sectool-gui", line 534, in __init__
    self.ST_TestLoader = scheduler.ST_TestLoader( level_config=os.path.join(os.path.expanduser("~"), self.scheduler_conf.userfile) )
  File "/usr/share/sectool/scheduler/scheduler.py", line 1103, in __init__
    self.level_override = self.__get_custom_levels(level_config)
  File "/usr/share/sectool/scheduler/scheduler.py", line 1126, in __get_custom_levels
    level_override[splitted[0]] = levels
IndexError: list index out of range
Locals by frame, innermost last

Frame <module> in /usr/bin/sectool-gui at line 1053

Frame run in /usr/bin/sectool-gui at line 1048

Frame __init__ in /usr/bin/sectool-gui at line 131

Frame __init_handlers in /usr/bin/sectool-gui at line 141

Frame __init__ in /usr/bin/sectool-gui at line 537

Frame __init__ in /usr/share/sectool/scheduler/scheduler.py at line 1103

Frame __get_custom_levels in /usr/share/sectool/scheduler/scheduler.py at line 1126
	                   f =  <open file '/root/.sectoolrc', mode 'r' at 0x99bd8e0>
	                self =  <scheduler.scheduler.ST_TestLoader object at 0x9ad1d8c>
	              levels =  [0]
	            splitted =  []
	                line =  

	      level_override =  {}
	        level_config =  /root/.sectoolrc
Traceback (most recent call last):
  File "/usr/bin/sectool-gui", line 1053, in <module>
    run()
  File "/usr/bin/sectool-gui", line 1048, in run
    main = SecToolGUI( )
  File "/usr/bin/sectool-gui", line 131, in __init__
    self.__init_handlers( )
  File "/usr/bin/sectool-gui", line 141, in __init_handlers
    self.testHandler = TestHandler( )
  File "/usr/bin/sectool-gui", line 538, in __init__
    raise str(e)
TypeError: exceptions must be classes or instances, not str

# sectool --level 1
Traceback (most recent call last):
  File "/usr/sbin/sectool", line 453, in run
    action = constructor(options, fmt)
  File "/usr/share/sectool/actions.py", line 371, in __init__
    ST_RunAction.__init__(self, options, formatter, stream)
  File "/usr/share/sectool/actions.py", line 130, in __init__
    ST_Action.__init__(self, options.options, options.args, formatter)
  File "/usr/share/sectool/actions.py", line 35, in __init__
    self.loader = scheduler.ST_TestLoader(level_config=os.path.join(os.path.expanduser("~"), scheduler.SecToolConf.userfile))
  File "/usr/share/sectool/scheduler/scheduler.py", line 1103, in __init__
    self.level_override = self.__get_custom_levels(level_config)
  File "/usr/share/sectool/scheduler/scheduler.py", line 1126, in __get_custom_levels
    level_override[splitted[0]] = levels
IndexError: list index out of range
</snip>

Expected results:
Handle the traceback ... and the sectool{,-gui} should run nicely ...

Additional info:
This is broken in F11, too.

Comment 1 Maros Barabas 2009-09-02 09:31:46 UTC
Created attachment 359493 [details]
Patch to evade empty configuration files


Note You need to log in before you can comment on or make changes to this bug.