Skip to content

Conversation

petertodd
Copy link
Owner

Allegedly this fixes OpenSSL-related crashes on OSX and Arch Linux, a persistent problem for those users. (see #30)

Unfortunately I don't have a OSX, or Arch Linux, machine to test with, so I can't reproduce the problem. But if some other users could chime in as to whether this fixes the issues seen before that'd be great; I'll make a new release if this gets merged.

CC: @casey @gavinandresen @dasmithii @jamespedwards42 @posita @HelloZeroNet

Credit goes to Casey Rodarmor for the fix, which is copied from a
MIT-licensed QA tests pull-req for Bitcoin Core that was written by him:

https://github.com/casey/bitcoin/blob/fullblocktest/qa/rpc-tests/test_framework/key.py
@bitstein
Copy link
Contributor

I am still experiencing a segmentation fault on OS X 10.9.5.

(venv) python-bitcoinlib git:(dd93193) $ python -m unittest discover && python3 -m unittest discover
..........................................................................[1]    11478 segmentation fault  python -m unittest discover

@petertodd
Copy link
Owner Author

Thanks!

Mind running those in verbose mode? -v switch.

On 18 August 2015 15:55:15 GMT-07:00, Michael Goldstein notifications@github.com wrote:

I am still experiencing a segmentation fault on OS X 10.9.5.

(venv) python-bitcoinlib git:(dd93193) $ python -m unittest discover &&
python3 -m unittest discover
..........................................................................[1]
  11478 segmentation fault  python -m unittest discover

Reply to this email directly or view it on GitHub:
#77 (comment)

@bitstein
Copy link
Contributor

Sure!

(venv) python-bitcoinlib git:(dd93193) $ python -m unittest discover -v
test_from_data (bitcoin.tests.test_base58.Test_CBase58Data) ... ok
test_invalid_base58_exception (bitcoin.tests.test_base58.Test_CBase58Data) ... ok
test_encode_decode (bitcoin.tests.test_base58.Test_base58) ... ok
test_bloom_create_insert_key (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test_create_insert_serialize (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test_create_insert_serialize_with_tweak (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test (bitcoin.tests.test_bloom.Test_MurmurHash3) ... ok
test_checkblock_invalid (bitcoin.tests.test_checkblock.Test_CheckBlock) ... ok
test_checkblock_valid (bitcoin.tests.test_checkblock.Test_CheckBlock) ... ok
test_GetHash (bitcoin.tests.test_core.Test_CBlock) ... ok
test_calc_merkle_root (bitcoin.tests.test_core.Test_CBlock) ... ok
test_calc_merkle_root_of_empty_block (bitcoin.tests.test_core.Test_CBlock)
CBlock.calc_merkle_root() fails if vtx empty ... ok
test_serialization (bitcoin.tests.test_core.Test_CBlock) ... ok
test_GetHash (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_calc_difficulty (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_serialization (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_MoneyRange (bitcoin.tests.test_core.Test_Money) ... ok
test_MoneyRangeCustomParams (bitcoin.tests.test_core.Test_Money) ... ok
test (bitcoin.tests.test_core.Test_str_value) ... ok
test (bitcoin.tests.test_key.Test_CPubKey) ... ok
test_fail_invalid_message (bitcoin.tests.test_messages.Test_messages) ... ok
test_msg_verack_to_bytes (bitcoin.tests.test_messages.Test_messages) ... ok
test_read_msg_verack (bitcoin.tests.test_messages.Test_messages) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_addr) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_alert) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_block) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getaddr) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getblocks) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getdata) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getheaders) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_headers) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_inv) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_mempool) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_notfound) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_ping) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_pong) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_reject) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_tx) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_verack) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_version) ... ok
test_serializationDiff (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationIPv4 (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationIPv6 (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationSimple (bitcoin.tests.test_net.Test_CAddress) ... ok
test_add (bitcoin.tests.test_script.Test_CScript) ... ok
test_equality (bitcoin.tests.test_script.Test_CScript) ... ok
test_has_canonical_pushes (bitcoin.tests.test_script.Test_CScript) ... ok
test_has_canonical_pushes_with_invalid_truncated_script (bitcoin.tests.test_script.Test_CScript) ... ok
test_invalid_scripts (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_p2sh (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_push_only (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_push_only_on_invalid_pushdata (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_unspendable (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_valid (bitcoin.tests.test_script.Test_CScript) ... ok
test_repr (bitcoin.tests.test_script.Test_CScript) ... ok
test_to_p2sh_scriptPubKey (bitcoin.tests.test_script.Test_CScript) ... ok
test_tokenize_roundtrip (bitcoin.tests.test_script.Test_CScript) ... ok
test_encode_decode_op_n (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_is_singleton (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_pushdata (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_high_s_value (bitcoin.tests.test_script.Test_IsLowDERSignature) ... ok
test_low_s_value (bitcoin.tests.test_script.Test_IsLowDERSignature) ... ok
test_script_invalid (bitcoin.tests.test_scripteval.Test_EvalScript) ... ok
test_script_valid (bitcoin.tests.test_scripteval.Test_EvalScript) ... ok
test (bitcoin.tests.test_serialize.Test_BytesSerializer) ... ok
test_truncated (bitcoin.tests.test_serialize.Test_BytesSerializer) ... ok
test_from_compact_negative_zero (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_from_compact_zero (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_from_uint256 (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_twelve (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_extra_data (bitcoin.tests.test_serialize.Test_Serializable)
Serializable.deserialize() fails if extra data is present ... ok
test (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_non_optimal (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_truncated (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_sign_message_simple (bitcoin.tests.test_signmessage.Test_SignVerifyMessage) ... [1]    11794 segmentation fault  python -m unittest discover -v

@posita
Copy link
Contributor

posita commented Aug 18, 2015

I can verify @bitstein's results on OS X 10.9.5 for each of Python 2.7, Python 3.4, and PyPy 2.6.0 (all up-to-date compiled from sources via MacPorts). They all seg. fault in bitcoin.tests.test_signmessage.Test_SignVerifyMessage.test_sign_message_simple.

UPDATE: It also seg. faults in the same test when using OS X's native Python (version 2.7.5 from /usr/bin/python on 10.9.5), which links to a a different (older) version of OpenSSL.

@petertodd
Copy link
Owner Author

Thanks!

What about without this patch, where does it segfault?

@bitstein
Copy link
Contributor

It is segfaulting at the same place.

(venv) python-bitcoinlib git:(master) $ python -m unittest discover -v
test_from_data (bitcoin.tests.test_base58.Test_CBase58Data) ... ok
test_invalid_base58_exception (bitcoin.tests.test_base58.Test_CBase58Data) ... ok
test_encode_decode (bitcoin.tests.test_base58.Test_base58) ... ok
test_bloom_create_insert_key (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test_create_insert_serialize (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test_create_insert_serialize_with_tweak (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test (bitcoin.tests.test_bloom.Test_MurmurHash3) ... ok
test_checkblock_invalid (bitcoin.tests.test_checkblock.Test_CheckBlock) ... ok
test_checkblock_valid (bitcoin.tests.test_checkblock.Test_CheckBlock) ... ok
test_GetHash (bitcoin.tests.test_core.Test_CBlock) ... ok
test_calc_merkle_root (bitcoin.tests.test_core.Test_CBlock) ... ok
test_calc_merkle_root_of_empty_block (bitcoin.tests.test_core.Test_CBlock)
CBlock.calc_merkle_root() fails if vtx empty ... ok
test_serialization (bitcoin.tests.test_core.Test_CBlock) ... ok
test_GetHash (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_calc_difficulty (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_serialization (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_MoneyRange (bitcoin.tests.test_core.Test_Money) ... ok
test_MoneyRangeCustomParams (bitcoin.tests.test_core.Test_Money) ... ok
test (bitcoin.tests.test_core.Test_str_value) ... ok
test (bitcoin.tests.test_key.Test_CPubKey) ... ok
test_fail_invalid_message (bitcoin.tests.test_messages.Test_messages) ... ok
test_msg_verack_to_bytes (bitcoin.tests.test_messages.Test_messages) ... ok
test_read_msg_verack (bitcoin.tests.test_messages.Test_messages) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_addr) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_alert) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_block) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getaddr) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getblocks) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getdata) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getheaders) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_headers) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_inv) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_mempool) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_notfound) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_ping) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_pong) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_reject) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_tx) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_verack) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_version) ... ok
test_serializationDiff (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationIPv4 (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationIPv6 (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationSimple (bitcoin.tests.test_net.Test_CAddress) ... ok
test_add (bitcoin.tests.test_script.Test_CScript) ... ok
test_equality (bitcoin.tests.test_script.Test_CScript) ... ok
test_has_canonical_pushes (bitcoin.tests.test_script.Test_CScript) ... ok
test_has_canonical_pushes_with_invalid_truncated_script (bitcoin.tests.test_script.Test_CScript) ... ok
test_invalid_scripts (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_p2sh (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_push_only (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_push_only_on_invalid_pushdata (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_unspendable (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_valid (bitcoin.tests.test_script.Test_CScript) ... ok
test_repr (bitcoin.tests.test_script.Test_CScript) ... ok
test_to_p2sh_scriptPubKey (bitcoin.tests.test_script.Test_CScript) ... ok
test_tokenize_roundtrip (bitcoin.tests.test_script.Test_CScript) ... ok
test_encode_decode_op_n (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_is_singleton (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_pushdata (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_high_s_value (bitcoin.tests.test_script.Test_IsLowDERSignature) ... ok
test_low_s_value (bitcoin.tests.test_script.Test_IsLowDERSignature) ... ok
test_script_invalid (bitcoin.tests.test_scripteval.Test_EvalScript) ... ok
test_script_valid (bitcoin.tests.test_scripteval.Test_EvalScript) ... ok
test (bitcoin.tests.test_serialize.Test_BytesSerializer) ... ok
test_truncated (bitcoin.tests.test_serialize.Test_BytesSerializer) ... ok
test_from_compact_negative_zero (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_from_compact_zero (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_from_uint256 (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_twelve (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_extra_data (bitcoin.tests.test_serialize.Test_Serializable)
Serializable.deserialize() fails if extra data is present ... ok
test (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_non_optimal (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_truncated (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_sign_message_simple (bitcoin.tests.test_signmessage.Test_SignVerifyMessage) ... [1]    12409 segmentation fault  python -m unittest discover -v

@petertodd
Copy link
Owner Author

Hmm, well, the sign message code is at least somewhat niche; what if you disable that test? Does it still segfault anywhere?

@bitstein
Copy link
Contributor

I commented out that class:

(venv) python-bitcoinlib git:(dd93193) $ python -m unittest discover -v
test_from_data (bitcoin.tests.test_base58.Test_CBase58Data) ... ok
test_invalid_base58_exception (bitcoin.tests.test_base58.Test_CBase58Data) ... ok
test_encode_decode (bitcoin.tests.test_base58.Test_base58) ... ok
test_bloom_create_insert_key (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test_create_insert_serialize (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test_create_insert_serialize_with_tweak (bitcoin.tests.test_bloom.Test_CBloomFilter) ... ok
test (bitcoin.tests.test_bloom.Test_MurmurHash3) ... ok
test_checkblock_invalid (bitcoin.tests.test_checkblock.Test_CheckBlock) ... ok
test_checkblock_valid (bitcoin.tests.test_checkblock.Test_CheckBlock) ... ok
test_GetHash (bitcoin.tests.test_core.Test_CBlock) ... ok
test_calc_merkle_root (bitcoin.tests.test_core.Test_CBlock) ... ok
test_calc_merkle_root_of_empty_block (bitcoin.tests.test_core.Test_CBlock)
CBlock.calc_merkle_root() fails if vtx empty ... ok
test_serialization (bitcoin.tests.test_core.Test_CBlock) ... ok
test_GetHash (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_calc_difficulty (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_serialization (bitcoin.tests.test_core.Test_CBlockHeader) ... ok
test_MoneyRange (bitcoin.tests.test_core.Test_Money) ... ok
test_MoneyRangeCustomParams (bitcoin.tests.test_core.Test_Money) ... ok
test (bitcoin.tests.test_core.Test_str_value) ... ok
test (bitcoin.tests.test_key.Test_CPubKey) ... ok
test_fail_invalid_message (bitcoin.tests.test_messages.Test_messages) ... ok
test_msg_verack_to_bytes (bitcoin.tests.test_messages.Test_messages) ... ok
test_read_msg_verack (bitcoin.tests.test_messages.Test_messages) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_addr) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_alert) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_block) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getaddr) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getblocks) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getdata) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_getheaders) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_headers) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_inv) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_mempool) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_notfound) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_ping) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_pong) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_reject) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_tx) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_verack) ... ok
test_serialization (bitcoin.tests.test_messages.Test_msg_version) ... ok
test_serializationDiff (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationIPv4 (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationIPv6 (bitcoin.tests.test_net.Test_CAddress) ... ok
test_serializationSimple (bitcoin.tests.test_net.Test_CAddress) ... ok
test_add (bitcoin.tests.test_script.Test_CScript) ... ok
test_equality (bitcoin.tests.test_script.Test_CScript) ... ok
test_has_canonical_pushes (bitcoin.tests.test_script.Test_CScript) ... ok
test_has_canonical_pushes_with_invalid_truncated_script (bitcoin.tests.test_script.Test_CScript) ... ok
test_invalid_scripts (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_p2sh (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_push_only (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_push_only_on_invalid_pushdata (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_unspendable (bitcoin.tests.test_script.Test_CScript) ... ok
test_is_valid (bitcoin.tests.test_script.Test_CScript) ... ok
test_repr (bitcoin.tests.test_script.Test_CScript) ... ok
test_to_p2sh_scriptPubKey (bitcoin.tests.test_script.Test_CScript) ... ok
test_tokenize_roundtrip (bitcoin.tests.test_script.Test_CScript) ... ok
test_encode_decode_op_n (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_is_singleton (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_pushdata (bitcoin.tests.test_script.Test_CScriptOp) ... ok
test_high_s_value (bitcoin.tests.test_script.Test_IsLowDERSignature) ... ok
test_low_s_value (bitcoin.tests.test_script.Test_IsLowDERSignature) ... ok
test_script_invalid (bitcoin.tests.test_scripteval.Test_EvalScript) ... ok
test_script_valid (bitcoin.tests.test_scripteval.Test_EvalScript) ... ok
test (bitcoin.tests.test_serialize.Test_BytesSerializer) ... ok
test_truncated (bitcoin.tests.test_serialize.Test_BytesSerializer) ... ok
test_from_compact_negative_zero (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_from_compact_zero (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_from_uint256 (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_twelve (bitcoin.tests.test_serialize.Test_Compact) ... ok
test_extra_data (bitcoin.tests.test_serialize.Test_Serializable)
Serializable.deserialize() fails if extra data is present ... ok
test (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_non_optimal (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_truncated (bitcoin.tests.test_serialize.Test_VarIntSerializer) ... ok
test_GetHash (bitcoin.tests.test_transactions.Test_CMutableOutPoint)
CMutableOutPoint.GetHash() is not cached ... ok
test_GetHash (bitcoin.tests.test_transactions.Test_CMutableTxIn)
CMutableTxIn.GetHash() is not cached ... ok
test_is_null (bitcoin.tests.test_transactions.Test_COutPoint) ... ok
test_repr (bitcoin.tests.test_transactions.Test_COutPoint) ... ok
test_str (bitcoin.tests.test_transactions.Test_COutPoint) ... ok
test_is_coinbase (bitcoin.tests.test_transactions.Test_CTransaction) ... ok
test_tx_invalid (bitcoin.tests.test_transactions.Test_CTransaction) ... ok
test_tx_valid (bitcoin.tests.test_transactions.Test_CTransaction) ... ok
test_is_final (bitcoin.tests.test_transactions.Test_CTxIn) ... ok
test_repr (bitcoin.tests.test_transactions.Test_CTxIn) ... ok
test_create_from_string (bitcoin.tests.test_wallet.Test_CBitcoinAddress)
Create CBitcoinAddress's from strings ... ok
test_from_invalid_scriptPubKey (bitcoin.tests.test_wallet.Test_CBitcoinAddress)
CBitcoinAddress.from_scriptPubKey() with invalid scriptPubKeys ... ok
test_from_nonstd_scriptPubKey (bitcoin.tests.test_wallet.Test_CBitcoinAddress)
CBitcoinAddress.from_scriptPubKey() with non-standard scriptPubKeys ... ok
test_from_scriptPubKey (bitcoin.tests.test_wallet.Test_CBitcoinAddress) ... ok
test_to_scriptPubKey (bitcoin.tests.test_wallet.Test_CBitcoinAddress)
CBitcoinAddress.to_scriptPubKey() works ... ok
test_wrong_nVersion (bitcoin.tests.test_wallet.Test_CBitcoinAddress)
Creating a CBitcoinAddress from a unknown nVersion fails ... ok
test (bitcoin.tests.test_wallet.Test_CBitcoinSecret) ... ok
test_sign (bitcoin.tests.test_wallet.Test_CBitcoinSecret) ... [1]    12837 segmentation fault  python -m unittest discover -v

@petertodd
Copy link
Owner Author

@bitstein Bah, sounds like it doesn't fit the issue then. :(

@posita
Copy link
Contributor

posita commented Aug 19, 2015

@petertodd, it looks like you're missing specs for quite a few OpenSSL calls. This patch contains what I think are the bare minimum to get tests passing again, but there are yet more OpenSSL functions called from bitcoin/core/key.py that aren't yet spec'ed (i.e., by setting the restype/argtypes properties), even with my patch. I tried to compile a complete list with some grep/sed-fu. I think the following is what's still missing (after my patch is applied), but I haven't validated this:

% comm -2 -3 <( grep '_ssl\.' bitcoin/core/key.py | grep -E -v '\.(argtypes|errcheck|restype)' | sed -E -e 's%^.*_ssl\.([^(]+)\(.*$%\1%' | sort | uniq ) <( grep -E '_ssl\..*\.(argtypes|errcheck|restype)' bitcoin/core/key.py | sed -E -e 's%^.*_ssl\.([^.]+)\.(argtypes|errcheck|restype).*$%\1%' | sort | uniq )
BN_zero
ECDSA_size
ERR_error_string_n
ERR_get_error
d2i_ECDSA_SIG
d2i_ECPrivateKey
i2d_ECPrivateKey
o2i_ECPublicKey

Let me know if you want this in a PR.

@wizardofozzie
Copy link

I don't suppose this PR is helpful?

Not too familiar with Macs, but I know similar issues (on an old Win7 64bit laptop) were ameliorated by using OpenSSL 32bit 1.0.1p. I'll try it on Arch Linux myself ASAP

@posita
Copy link
Contributor

posita commented Aug 19, 2015

@simcity4242, is that the correct PR? It doesn't look like it addresses segfaults. You might be right about using 32-bit libraries, but I don't think this is a viable option for OS X (which I believe has been 64-bit only since 10.7).

@posita
Copy link
Contributor

posita commented Aug 19, 2015

@bitstein, @petertodd: check out #79. I don't get any segfaults with that branch.

@wizardofozzie
Copy link

@posita yeah, correct PR; I thought it may be tangentially related because I had similar issues with the code not finding the NIST SECP256K1 (I forget the exact param name). I raised it in case it helped as I eventually got it working but it was a combination of a few things and I didn't isolate which one

@petertodd
Copy link
Owner Author

Closing, obsoleted by #79

@petertodd petertodd closed this Sep 7, 2015
@petertodd petertodd deleted the fix_osx_and_arch_crashes branch September 26, 2016 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants