[tor-commits] [nyx/master] Accept extra ':' in --interface argument

atagar at torproject.org atagar at torproject.org
Sun Dec 30 19:23:08 UTC 2018


commit 54532316fd15f0bb95b2f883873d432beee68e91
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Dec 30 11:17:22 2018 -0800

    Accept extra ':' in --interface argument
    
    traumschule made the interesting point that it would be nice if 'nyx -i :9051'
    worked. We actually *do* make the address optional, but not if the user
    provides a collon (ie, 'nyx -i 9051').
    
    Accepting this as well.
---
 nyx/arguments.py         | 8 ++++++--
 web/changelog/index.html | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/nyx/arguments.py b/nyx/arguments.py
index 76c7a99..e348a9b 100644
--- a/nyx/arguments.py
+++ b/nyx/arguments.py
@@ -82,14 +82,18 @@ def parse(argv):
 
   for opt, arg in recognized_args:
     if opt in ('-i', '--interface'):
+      address = None
+
       if ':' in arg:
         address, port = arg.split(':', 1)
       else:
-        address, port = args['control_port'][0], arg
+        port = arg
 
-      if address is not None:
+      if address:
         if not stem.util.connection.is_valid_ipv4_address(address):
           raise ValueError("'%s' isn't a valid IPv4 address" % address)
+      else:
+        address = args['control_port'][0]
 
       if not stem.util.connection.is_valid_port(port):
         raise ValueError("'%s' isn't a valid port number" % port)
diff --git a/web/changelog/index.html b/web/changelog/index.html
index 1b96d9e..0bbc01a 100644
--- a/web/changelog/index.html
+++ b/web/changelog/index.html
@@ -76,6 +76,7 @@
             <li>Process renaming could potentially crash (<a href="https://trac.torproject.org/projects/tor/ticket/27556">ticket</a>)</li>
             <li>Blank debug path caused us to crash (<a href="https://trac.torproject.org/projects/tor/ticket/27350">ticket</a>)</li>
             <li>Nyxrc <i>password</i> option for the controller credential (<a href="https://trac.torproject.org/projects/tor/ticket/28295">ticket</a>)</li>
+            <li>Accept shorthand '--interface' arugments with a colon but no address (<a href="https://trac.torproject.org/projects/tor/ticket/28965">ticket</a>)</li>
           </ul>
         </li>
 



More information about the tor-commits mailing list