Mystery of good term gone bad

Edwin Fine erlang-questions_efine@REDACTED
Tue Jul 28 18:06:08 CEST 2009


Can anyone tell me why the binary to term conversion shown below is "good"
on systems 1, 2, and 3, and bad in system 4, when the binaries are identical
across all of them? Surely R13B01 should be backward-compatible at the
binary level?

Systems 1 & 2: R13B
System 3: R12B-4
System 4: R13B01

All 64-bit, all Linux.

In the shell sessions below, I have included the binary data only the first
example. They are identical in all examples.

System 1:
Erlang R13B (erts-5.7.1) [source] [64-bit] [smp:2:2] [rq:2]
[async-threads:0] [kernel-poll:false]

Eshell V5.7.1  (abort with ^G)
(e7001@REDACTED)1> Bad =
<<131,104,4,97,6,103,78,131,0,20,119,99,116,112,103,119,
  95,114,101,108,64,108,111,99,97,108,104,111,115,116,0,0,
  0,12,0,0,0,0,2,78,5,0,0,78,110,0,18,103,108,111,98,97,
  108,95,110,97,109,101,95,115,101,114,118,101,114,131,
  104,2,78,248,0,9,36,103,101,110,95,99,97,115,116,104,4,
  78,65,0,12,105,110,105,116,95,99,111,110,110,101,99,116,
  104,2,97,5,104,3,98,0,0,4,224,98,0,12,35,221,98,0,14,79,
  143,67,131,104,4,78,76,0,6,108,111,99,107,101,114,78,77,
  0,15,110,111,95,108,111,110,103,101,114,95,97,95,112,
  105,100,106,103,67,131,0,0,0,13,0,0,0,0,2>>.
(e7001@REDACTED)2> binary_to_term(Bad).
{6,<6178.12.0>,'',global_name_server}

System 2:

Erlang R13B (erts-5.7.1) [source] [64-bit] [smp:4:4] [rq:4]
[async-threads:0] [kernel-poll:false]

Eshell V5.7.1  (abort with ^G)
...
(e10119@REDACTED)2> binary_to_term(Bad).
{6,<6178.12.0>,'',global_name_server}

System 3:

Erlang (BEAM) emulator version 5.6.4 [source] [64-bit] [smp:4]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.6.4  (abort with ^G)
...
(e8823@REDACTED)2> binary_to_term(Bad).
{6,<5920.12.0>,'',global_name_server}

System 4:

Erlang R13B01 (erts-5.7.2) [source] [64-bit] [smp:4:4] [rq:4]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
(e17785@REDACTED)2> binary_to_term(Bad).
** exception error: bad argument
     in function  binary_to_term/1
        called as
binary_to_term(<<131,104,4,97,6,103,78,131,0,20,119,99,116,112,103,119,

95,114,101,108,64,108,111,99,97,108,104,111,...>>)


More information about the erlang-questions mailing list