[tor-commits] [nyx/master] Fix lsof line detection for usage of ports

atagar at torproject.org atagar at torproject.org
Sun Sep 24 19:29:37 UTC 2017


commit df9cd999121272effe4323964559981260e7d6bb
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Sep 24 12:28:12 2017 -0700

    Fix lsof line detection for usage of ports
    
    My relay complains with...
    
      19:13:35 [NYX_INFO] Failed three attempts to determine the process using
      active ports (unrecognized output from lsof (lines are expected to have ten
      fields: COMMAND PID   USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME): COMMAND
      PID   USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME)
    
    This is because there's a single space after 'COMMAND' rather than two, causing
    us not to omit the title line from parsing. Making this less strict.
---
 nyx/tracker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nyx/tracker.py b/nyx/tracker.py
index 5d0d1fd..1fbd80e 100644
--- a/nyx/tracker.py
+++ b/nyx/tracker.py
@@ -337,7 +337,7 @@ def _process_for_ports(local_ports, remote_ports):
   if lsof_call:
     results = {}
 
-    if lsof_call[0].startswith('COMMAND  '):
+    if lsof_call[0].startswith('COMMAND'):
       lsof_call = lsof_call[1:]  # strip the title line
 
     for line in lsof_call:



More information about the tor-commits mailing list