Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
BridgeDB
BridgeDB
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 37
    • Issues 37
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 2
    • Merge Requests 2
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • The Tor Project
  • Anti-censorship
  • BridgeDBBridgeDB
  • Issues
  • #23043

Closed
Open
Opened Jul 27, 2017 by Samdney@Samdney

leekspin's except/error code handling in generator.py is strange

In /leekspin/generator.py you have in "def createRelayOrBridgeDescriptors(...)"

Code highlighting:
  {{{#!python
  def createRelayOrBridgeDescriptors(count, bridge=True, **kwargs):
    ...
    try:
      ...
    except KeyboardInterrupt as keyint:
      logging.warn("Received keyboard interrupt.")
      logging.warn("Stopping descriptor creation and exiting.")
      code = 1515
    finally:
      ...
      logging.info("Done.")
      code = 0
      sys.exit(code)
  }}}

The same in a similiar way also in "def createHiddenServiceDescriptors(...)"

I think your way of handling the code-variable isn't right. If you have an Keyboard exception if follows: code = 1515. But the "try ... except ... finally" - block always "finally" execute the code within the finally block. So it will always exit with code = 0, sys.exit(0)!

In generally, the execution of (some) parts of the finally block after an keyboard interruption makes no sense for me.

(I haven't found time to examinate the full source code until now. Hence, for the case that all has a good reason, please ignore me :)

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: tpo/anti-censorship/bridgedb#23043