terracoin / sentinel

Terracoin Sentinel, required for Masternodes
MIT License
1 stars 6 forks source link

"#" in rpcpassword leads to "ValueError: invalid literal for int() with base 10" #6

Open q-src opened 6 years ago

q-src commented 6 years ago

If the rpcpassword contains a #, ./venv/bin/python bin/sentinel.py fails.

For example rpcpassword=AAAA#BBBBBBBB will result in:

File "bin/sentinel.py", line 265, in <module>
    main()
  File "bin/sentinel.py", line 164, in main
    if not is_terracoind_port_open(terracoind):
  File "bin/sentinel.py", line 151, in is_terracoind_port_open
    info = terracoind.rpc_command('getgovernanceinfo')
  File "lib/terracoind.py", line 42, in rpc_command
    return self.rpc_connection.__getattr__(params[0])(*params[1:])
  File "lib/terracoind.py", line 31, in rpc_connection
    return AuthServiceProxy("http://{0}:{1}@{2}:{3}".format(*self.creds))
  File "/opt/sentinel/venv/local/lib/python2.7/site-packages/bitcoinrpc/authproxy.py", line 87, in __init__
    if self.__url.port is None:
  File "/usr/lib/python2.7/urlparse.py", line 113, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'AAAA'

Based on the last line, I suspect that the script tries to parse the rpcpassword part in front of the # as an int.

Of course, this is not an urgent issue, as one can easily work around it by not using # in the rpcpassword. So the primary goal of creating this bug report is documenting the issue and helping others saving some time.

TheSin- commented 6 years ago

I believe this is a limitation of config file parsing, it think you have a password with a comment after it.

try \# instead of # see if that works.

q-src commented 6 years ago

@TheSin- Thanks for your response. I've tried \# but it didn't work. So I just removed the # completely.

I think people don't actually need the possiblity to use # in the password and therefore there is no real need to fix this bug. However, I'm sure it helps others if the behavior is mentioned somewhere. That's why I opened this issue - for documentation purposes ;-).