[tor-commits] [nyx/master] Errors when saving torrc caused stacktrace

atagar at torproject.org atagar at torproject.org
Tue Nov 28 19:37:14 UTC 2017


commit 5378d759ed53377fc48649e333073f032cedd974
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Nov 28 11:34:48 2017 -0800

    Errors when saving torrc caused stacktrace
    
    Why was I catching an IOError here? Stem generally raises an OperationFailed,
    and possibly others when there's a malformed response. Caught thanks to
    Dbryrtfbcbhgf...
    
      https://trac.torproject.org/projects/tor/ticket/24409
    
      Traceback (most recent call last):
        File "/usr/local/bin/nyx", line 11, in <module>
          sys.exit(main())
        ...
        File "/usr/local/lib/python3.5/dist-packages/nyx/__init__.py", line 243, in draw_loop
          keybinding.handle(key)
        File "/usr/local/lib/python3.5/dist-packages/nyx/panel/__init__.py", line 84, in handle
          self._action()
        File "/usr/local/lib/python3.5/dist-packages/nyx/panel/config.py", line 219, in _show_write_dialog
          controller.save_conf()
        File "/usr/local/lib/python3.5/dist-packages/stem/control.py", line 3220, in save_conf
          raise stem.OperationFailed(response.code, response.message)
      stem.OperationFailed: Unable to write configuration to disk.
---
 nyx/panel/config.py      | 2 +-
 web/changelog/index.html | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/nyx/panel/config.py b/nyx/panel/config.py
index 67ab218..0b2f1dc 100644
--- a/nyx/panel/config.py
+++ b/nyx/panel/config.py
@@ -218,7 +218,7 @@ class ConfigPanel(nyx.panel.Panel):
       try:
         controller.save_conf()
         show_message('Saved configuration to %s' % controller.get_info('config-file', '<unknown>'), HIGHLIGHT, max_wait = 2)
-      except IOError as exc:
+      except stem.ControllerError as exc:
         show_message('Unable to save configuration (%s)' % exc.strerror, HIGHLIGHT, max_wait = 2)
 
     self.redraw()
diff --git a/web/changelog/index.html b/web/changelog/index.html
index c47869b..f622f04 100644
--- a/web/changelog/index.html
+++ b/web/changelog/index.html
@@ -76,7 +76,8 @@
 
         <li><span class="component">Configuration Editor</span>
           <ul>
-            <li>New tor configuration options crashed nyx when shown (<b><a href="https://trac.torproject.org/projects/tor/ticket/24401">ticket</a></b>)
+            <li>New tor configuration options crashed nyx when shown (<b><a href="https://trac.torproject.org/projects/tor/ticket/24401">ticket</a></b>)</li>
+            <li>Errors when saving the configuration could result in a stacktrace (<b><a href="https://trac.torproject.org/projects/tor/ticket/24409">ticket</a></b>)</li>
           </ul>
         </li>
       </ul>



More information about the tor-commits mailing list