Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handle a bug in unicode module in releases R14B04 and previous

The code points 16#FFFE and 16#FFFF (not assigned but valid) are considered as
invalid in releases R14B04 and previous. So for these releases, the websockets
testsuite always failed. This commit worked around the bug.

It was fixed in OTP with the commit 34db767655:
   erlang/otp@34db767
  • Loading branch information...
commit 5f04abe953363000594273bd6555bad731b02d6a 1 parent 26badd6
Christopher Faulet authored
Showing with 38 additions and 2 deletions.
  1. +22 −1 configure.ac
  2. +4 −0 include.mk
  3. +12 −1 test/t10/app_test.erl
View
23 configure.ac
@@ -184,11 +184,32 @@ ERLANG_CHECK_ERTS
ERLANG_CHECK_RELEASE
dnl Check for bitstring support, introduced in R12B-5 (ERTS 5.6.5)
+AC_MSG_CHECKING([for bits support])
AX_COMPARE_VERSION([${ERLANG_ERTS_VER}], [ge], [5.6.5],
[bits_support="yes"],
[bits_support="no"])
-AM_CONDITIONAL(BITS_SUPPORT, [test "x${bits_support}" = "xyes"])
+AC_MSG_RESULT([${bits_support}])
+BITS_SUPPORT=false
+if test "x${bits_support}" = "xyes"; then
+ BITS_SUPPORT=true
+fi
+AM_CONDITIONAL(BITS_SUPPORT, [test "x${BITS_SUPPORT}" = "xtrue"])
+AC_SUBST(BITS_SUPPORT)
+
+dnl Unicode module was buggy for R14B04 and previous (ERTS <= 5.8.5)
+AC_MSG_CHECKING([for buggy unicode module])
+AX_COMPARE_VERSION([${ERLANG_ERTS_VER}], [le], [5.8.5],
+ [bad_unicode="yes"],
+ [bad_unicode="no"])
+AC_MSG_RESULT([${bad_unicode}])
+
+HAVE_BAD_UNICODE=false
+if test "x${bad_unicode}" = "xyes"; then
+ HAVE_BAD_UNICODE=true
+fi
+AM_CONDITIONAL(HAVE_BAD_UNICODE, [test "x$HAVE_BAD_UNICODE" = "xtrue"])
+AC_SUBST(HAVE_BAD_UNICODE)
dnl Determine directories for installation.
if test "x${prefix}" != "xNONE" -a "x${ERLANG_INSTALL_LIB_DIR}" = "x"; then
View
4 include.mk
@@ -24,6 +24,10 @@ ifeq ($(HAVE_INET_PARSE_STRICT_ADDRESS),true)
ERLC_GENERIC_FLAGS += -DHAVE_INET_PARSE_STRICT_ADDRESS
endif
+ifeq ($(HAVE_BAD_UNICODE),true)
+ ERLC_GENERIC_FLAGS += -DHAVE_BAD_UNICODE
+endif
+
# Local Variables:
# tab-width: 8
# End:
View
13 test/t10/app_test.erl
@@ -976,6 +976,12 @@ test_advanced_unfragmented_valid_utf8_text(BlockSz) ->
do_test_unfragmented_valid_utf8("/websockets_autobahn_endpoint.yaws",
BlockSz).
+-ifdef(HAVE_BAD_UNICODE).
+-define(BAD_UNICODE, true).
+-else.
+-define(BAD_UNICODE, false).
+-endif.
+
do_test_unfragmented_valid_utf8(WSPath, BlockSz) ->
Key = "dGhlIHNhbXBsZSBub25jZQ==",
@@ -1004,7 +1010,12 @@ do_test_unfragmented_valid_utf8(WSPath, BlockSz) ->
Fun(<<16#f0,16#90,16#80,16#80>>),
Fun(<<16#7f>>),
Fun(<<16#df,16#bf>>),
- Fun(<<16#ef,16#bf,16#bf>>),
+
+ case ?BAD_UNICODE of
+ true -> ok;
+ false -> Fun(<<16#ef,16#bf,16#bf>>)
+ end,
+
Fun(<<16#f4,16#8f,16#bf,16#bf>>),
Fun(<<16#ed,16#9f,16#bf>>),
Fun(<<16#ee,16#80,16#80>>),
Please sign in to comment.
Something went wrong with that request. Please try again.