BIND 10 #267: python log shouldn't die with OSError

BIND 10 Development do-not-reply at isc.org
Wed Jun 30 23:00:17 UTC 2010


#267: python log shouldn't die with OSError
---------------------+------------------------------------------------------
 Reporter:  jinmei   |       Owner:  zzchen_pku                 
     Type:  defect   |      Status:  new                        
 Priority:  major    |   Milestone:  06. 4th Incremental Release
Component:  logging  |    Keywords:                             
Sensitive:  0        |  
---------------------+------------------------------------------------------
 If the log file directory can't be created due to a permission problem,
 log.py propagates OSError to the application, and the app could die.
 xfrout suffers from this problem:

 {{{
 [bind10] Resurrected b10-xfrout (PID 51110)
 Traceback (most recent call last):
   File "/Users/jinmei/src/isc/bind10/trunk/src/bin/xfrout/b10-xfrout",
 line 497, in <module>
     xfrout_server = XfroutServer()
   File "/Users/jinmei/src/isc/bind10/trunk/src/bin/xfrout/b10-xfrout",
 line 409, in __init__
     self._config_data.get('log_max_bytes'), True)
   File "/Users/jinmei/src/isc/bind10/trunk/src/lib/python/isc/log/log.py",
 line 146, in __init__
     self._add_rotate_handler(self._log_file, self._versions,
 self._max_bytes)
   File "/Users/jinmei/src/isc/bind10/trunk/src/lib/python/isc/log/log.py",
 line 164, in _add_rotate_handler
     maxBytes = max_bytes, backupCount = backup_count)
   File "/Users/jinmei/src/isc/bind10/trunk/src/lib/python/isc/log/log.py",
 line 45, in __init__
     os.makedirs(dir[0])
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/os.py",
 line 143, in makedirs
     mkdir(name, mode)
 }}}

 Since logging is an optional feature in many cases, it doesn't make much
 sense to have the application expect and handle such exceptions or die.

 The attached patch solves this particular problem, but os.makedirs() could
 be called via a different path, so I think it's better to revisit the
 entire failure mode in this module.

 I'm giving this ticket to Jerry.

-- 
Ticket URL: <http://bind10.isc.org/ticket/267>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list