Skip to content

Conversation

@mneumann
Copy link
Contributor

A device read in Elixir returns a binary, not a char list (as in Erlang).

Quoting Jose Valim: "Any device may return a binary on read, therefore, all Erlang/Elixir code needs to be aware of this possibility and handle it accordingly."

See: elixir-lang/elixir#14757

How to reproduce the bug:

~ % iex
Erlang/OTP 28 [erts-16.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.18.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :snmp.config()

Simple SNMP configuration tool (version 5.19)
------------------------------------------------
Note: Non-trivial configurations still has to be
      done manually. IP addresses may be entered
      as dront.ericsson.se (UNIX only) or
      123.12.13.23
------------------------------------------------

y
{:error,
 {:function_clause,
  [
    {:lists, :delete, [10, "y\n"], [file: ~c"lists.erl", line: 725]},
    {:snmp_config, :ask, 3, [file: ~c"snmp_config.erl", line: 1683]},
    {:snmp_config, :snmp_agent2, 0, [file: ~c"snmp_config.erl", line: 173]},
    {:snmp_config, :config_agent, 0, [file: ~c"snmp_config.erl", line: 159]},
    {:snmp_config, :config2, 0, [file: ~c"snmp_config.erl", line: 130]},
    {:snmp_config, :config, 0, [file: ~c"snmp_config.erl", line: 117]},
    {:elixir, :eval_external_handler, 3, [file: ~c"src/elixir.erl", line: 386]},
    {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 924]}
  ]}}

A device read in Elixir returns a binary, not a char list (as in Erlang).

Quoting Jose Valim: "Any device may return a binary on read, therefore,
all Erlang/Elixir code needs to be aware of this possibility and handle
it accordingly."

See: elixir-lang/elixir#14757

How to reproduce the bug:

```
~ % iex
Erlang/OTP 28 [erts-16.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.18.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :snmp.config()

Simple SNMP configuration tool (version 5.19)
------------------------------------------------
Note: Non-trivial configurations still has to be
      done manually. IP addresses may be entered
      as dront.ericsson.se (UNIX only) or
      123.12.13.23
------------------------------------------------

y
{:error,
 {:function_clause,
  [
    {:lists, :delete, [10, "y\n"], [file: ~c"lists.erl", line: 725]},
    {:snmp_config, :ask, 3, [file: ~c"snmp_config.erl", line: 1683]},
    {:snmp_config, :snmp_agent2, 0, [file: ~c"snmp_config.erl", line: 173]},
    {:snmp_config, :config_agent, 0, [file: ~c"snmp_config.erl", line: 159]},
    {:snmp_config, :config2, 0, [file: ~c"snmp_config.erl", line: 130]},
    {:snmp_config, :config, 0, [file: ~c"snmp_config.erl", line: 117]},
    {:elixir, :eval_external_handler, 3, [file: ~c"src/elixir.erl", line: 386]},
    {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 924]}
  ]}}
```
@github-actions
Copy link
Contributor

github-actions bot commented Oct 26, 2025

CT Test Results

  2 files   24 suites   47m 54s ⏱️
496 tests 468 ✅  28 💤 0 ❌
652 runs  516 ✅ 136 💤 0 ❌

Results for commit 5f51cba.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Oct 27, 2025
@Whaileee Whaileee added the testing currently being tested, tag is used by OTP internal CI label Nov 3, 2025
@Whaileee Whaileee added the bug Issue is reported as a bug label Nov 3, 2025
@Whaileee
Copy link
Contributor

Whaileee commented Nov 3, 2025

Hi, thanks for the contribution. This will be fixed in next release, but if you want to use it now you can set your io in iex to return list instead with :io.setopts(:standard_io, [{:binary, false}]).
Best regards,
Konrad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is reported as a bug team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants