Skip to content

Conversation

smangelsdorf
Copy link
Contributor

Two issues were causing test failures for me:

  1. Ruby 2.x defaults to UTF-8 encoding for string literals, so the "expected" values for the BER tests were not being compared correctly. The new String#b method converts a string to ASCII-8BIT encoding without doing any actual translation.

  2. For some reason, OpenSSL::SSL::SSLSocket#sync_close is not working. I've tried this on two machines, across many Ruby versions and I see the same issue:

    • Ruby 1.9.3-p545 on Arch Linux (up-to-date this morning)
    • Ruby 2.1.1 on Arch Linux
    • Ruby 1.9.3-p545 on OS X 10.9.2
    • Ruby 2.0.0-p451 on OS X 10.9.2
    • Ruby 2.1.1 on OS X 10.9.2

    All have the same problem, and all are fixed by 839c50f. I've additionally added a timeout to the test case which was failing, as the failures were causing the test suite to block on pipe read until killed.

I've tested in JRuby 1.7.9 and these changes do not introduce any new failures, but the two existing failures remain.

Test output before these changes: https://gist.github.com/smangelsdorf/9987870

Strings with raw byte sequences misbehave in Ruby 2.0+ because the
default encoding for string literals is now UTF-8. The String#b method
resolves this, and was not previously available.
ssl_ber_spec showed failures on Ruby 1.9.3, 2.0.0 and 2.1.1 (OS X and
Linux) which could only be resolved by manually closing the underlying
connection. Changing the test to use a TCP socket did not help, so it
seems to be a bug in the SSLSocket class.
@smangelsdorf
Copy link
Contributor Author

schaary added a commit that referenced this pull request Aug 4, 2014
Fix for test failures due to String encoding and ruby-openssl issues
@schaary schaary merged commit 417f457 into ruby-ldap:master Aug 4, 2014
astratto pushed a commit to astratto/ruby-net-ldap that referenced this pull request Dec 18, 2015
Fix for test failures due to String encoding and ruby-openssl issues
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.

2 participants