Closed facundobatista closed 8 years ago
Thanks for the bug report!
To me this looks like the verification_id
is being generated with a non-ascii value. That value comes from the secret_box
method in libsodium; could you tell me what version of libsodium you're running?
I'm having trouble reproducing it so any more information would be helpful. Does it happen every time you run or only sometimes? (The secret_box method generates a random nonce every time, it's possible that's the culprit).
Also just to mention, there is a passing unit test for this case.
Thanks for the fast response!
The libsodium lib I have installed in the system (I guess that this is the one pymacaroon uses, even if pymacaroon is installed in a venv is):
$ apt-cache policy libsodium13
libsodium13:
Installed: 1.0.3-1
It happens every time. The call that makes convert_to_string() crash is passing this as string_or_bytes:
b'\xaa\xa1\x14\xfa\x99\xc3\x83\xe4by\xb5>\x8f\xf2.\x18\x07A/\xf1\xc6\x10\xee\xf4Q{a\x1c\xe8/\xc9e\xf4\xbe\x9b[\xd1\x8e\xcb\x12\xfc\xdc\x89\x8cp=\x8e\xdd\xec4f\xcd\xb4\xf2\xd2\xbb\xb8\xdc\xfe\x87\x03\x99\xeb\xd2\xab\xda\x98\x1d\xe9\x1cG%'
I'm happy to debug anything and help you to fix this.
Regards,
@facundobatista I realized that the fixes that were on master for inspect were not in 0.9.0
on pypi!
I've released a new version, 0.9.1
, which should fix the problems you're seeing. Could you try with 0.9.1 and see?
Solved!!
$ fades -d pymacaroons==0.9.1
*** fades *** 2016-02-11 15:46:39,055 INFO Need to install a dependency with pip, but no builtin, doing it manually (just wait a little, all should go well)
*** fades *** 2016-02-11 15:46:41,923 INFO Installing dependency: pymacaroons==0.9.1
Python 3.4.3 (default, Oct 14 2015, 20:33:09)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymacaroons
>>> m = pymacaroons.Macaroon(location="location", identifier="identifier", key="key")
>>> m.add_third_party_caveat("other location", "caveat key", "identifier")
<pymacaroons.macaroon.Macaroon object at 0xb707e80c>
>>> m.inspect()
'location location\nidentifier identifier\ncid identifier\nvid vLcWEYbQDJxlpohwSc6QHVqGbGL9OPjU9bfUan88VbkccJin6hVYDL1ZfXYVhumS+5A+lxrS0hGy5JIWBm+ZiHCnZ6ippn8X\ncl other location\nsignature a857f71e833772bd31beeb3b2aaf37c4a602be52547fc8cf76e69dfff4e8b868'
>>> print(_)
location location
identifier identifier
cid identifier
vid vLcWEYbQDJxlpohwSc6QHVqGbGL9OPjU9bfUan88VbkccJin6hVYDL1ZfXYVhumS+5A+lxrS0hGy5JIWBm+ZiHCnZ6ippn8X
cl other location
signature a857f71e833772bd31beeb3b2aaf37c4a602be52547fc8cf76e69dfff4e8b868
And thanks for this work!!
See: