[tor-bugs] #12225 [arm]: arm fails to start upon invalid attempt to concatenate int and string

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Jun 7 21:24:29 UTC 2014


#12225: arm fails to start upon invalid attempt to concatenate int and string
---------------------+------------------------
 Reporter:  pmezard  |          Owner:  atagar
     Type:  defect   |         Status:  new
 Priority:  normal   |      Milestone:
Component:  arm      |        Version:
 Keywords:           |  Actual Points:
Parent ID:           |         Points:
---------------------+------------------------
 The stack trace is:

 {{{
 Traceback (most recent call last):
   File "./run_arm", line 49, in <module>
     main()
   File "./run_arm", line 18, in main
     arm.starter.main()
   File "/home/pmezard/dev/arm/arm/starter.py", line 94, in main
     curses.wrapper(arm.controller.start_arm)
   File "/usr/lib/python2.6/curses/wrapper.py", line 43, in wrapper
     return func(stdscr, *args, **kwds)
   File "/home/pmezard/dev/arm/arm/controller.py", line 640, in start_arm
     control.redraw(False)
   File "/home/pmezard/dev/arm/arm/controller.py", line 436, in redraw
     panel_impl.redraw(force)
   File "/home/pmezard/dev/arm/arm/util/panel.py", line 428, in redraw
     self.draw(self.max_x, self.max_y)
   File "/home/pmezard/dev/arm/arm/header_panel.py", line 254, in draw
     for label in (self.vals.nickname, " - " + my_address, ":" +
 self.vals.or_port, dir_port_label):
 TypeError: cannot concatenate 'str' and 'int' objects
 }}}


 A possible fix:

 {{{
 commit 57c20fed78a263930e6774f7de47747a1861728a
 Author: Patrick Mezard <patrick at mezard.eu>
 Date:   Sat Jun 7 23:20:06 2014 +0200

     Fix invalid or_port type formatting when making labels

 diff --git a/arm/header_panel.py b/arm/header_panel.py
 index 0c7e669..94cf893 100644
 --- a/arm/header_panel.py
 +++ b/arm/header_panel.py
 @@ -251,7 +251,7 @@ class HeaderPanel(panel.Panel, threading.Thread):

        dir_port_label = ", Dir Port: %s" % self.vals.dir_port if
 self.vals.dir_port != "0" else ""

 -      for label in (self.vals.nickname, " - " + my_address, ":" +
 self.vals.or_port, dir_port_label):
 +      for label in (self.vals.nickname, " - " + my_address, ":%d" %
 self.vals.or_port, dir_port_label):
          if x + len(label) <= left_width:
            self.addstr(1, x, label)
            x += len(label)

 }}}

 I suppose it comes from:

 {{{
 return [(addr, int(port)) for (addr, port) in proxy_addrs]
 }}}

 done when generating listeners lists in stem. But I understand nothing
 about the code.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12225>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list