Bug 1261285 - Properly remove the config.log logging handler before running old-configure. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 01 Apr 2016 15:24:54 +0900
changeset 347481 26ef15a511d6dae36af0c709913bcf707cc1a459
parent 347480 c0daa17bdb2f513644005d3b65ced0441264dd2d
child 347482 5ace1101d043f3b99624ec5476d58236940a3ddc
push id14592
push userbmo:mh+mozilla@glandium.org
push dateMon, 04 Apr 2016 23:32:36 +0000
reviewersted
bugs1261285
milestone48.0a1
Bug 1261285 - Properly remove the config.log logging handler before running old-configure. r=ted Because closing the handler is not enough (it eventually reopens itself), the dumping of config.log overwrites the file, and confuses the process of reading it to dump it in the first place, showing incomplete logs. The intent from the start was that nothing would be logged in the FileHandler, so on top of closing it, actively remove it.
build/moz.configure/old.configure
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -406,16 +406,17 @@ def old_configure(prepare_configure, ext
     # Our logging goes to config.log, the same file old.configure uses.
     # We can't share the handle on the file, so close it. We assume nothing
     # beyond this point is going to be interesting to log to config.log from
     # our end, so we don't make the effort to recreate a logging.FileHandler.
     logger = logging.getLogger('moz.configure')
     for handler in logger.handlers:
         if isinstance(handler, logging.FileHandler):
             handler.close()
+            logger.removeHandler(handler)
 
     log_size = os.path.getsize('config.log')
 
     ret = subprocess.call(cmd)
     if ret:
         with log.queue_debug():
             with encoded_open('config.log', 'r') as fh:
                 fh.seek(log_size)