Commit 5f51cba
committed
Fix snmp:config() when run from Elixir
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]}
]}}
```1 parent 8ddda09 commit 5f51cba
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1678 | 1678 | | |
1679 | 1679 | | |
1680 | 1680 | | |
1681 | | - | |
| 1681 | + | |
1682 | 1682 | | |
1683 | 1683 | | |
1684 | 1684 | | |
| |||
1741 | 1741 | | |
1742 | 1742 | | |
1743 | 1743 | | |
1744 | | - | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
1745 | 1750 | | |
1746 | 1751 | | |
1747 | 1752 | | |
| |||
0 commit comments