benoitc / erlang-idna

Erlang IDNA lib
MIT License
43 stars 29 forks source link

undefined function unicode_util_compat:lowercase #39

Closed gdt closed 3 years ago

gdt commented 3 years ago

I ended up here after a package upgrade, wtih ejabberd complaining that plain-ASCII domains (for s2s) were not valid IDN. Beware that I know very little about erlang.

I'm using erlang 23.3.4 (V11.2.2 from erl +V) on NetBSD 9. I have been successfully running ejabberd, so things are at least 99% ok.

With erlang-idna 6.1.1 (the latest release, as I read the tags), I get exceptions running the example from the README:

4> idna:decode("xn--wgv71a119e.xn--jp-").
** exception error: undefined function unicode_util_compat:lowercase/1
     in function  idna:lowercase_list/2 (/tmp/work/net/erlang-idna/work/erlang-idna-6.1.1/src/idna.erl, line 340)
     in call from idna:lowercase_list/2 (/tmp/work/net/erlang-idna/work/erlang-idna-6.1.1/src/idna.erl, line 334)
     in call from idna:lowercase/1 (/tmp/work/net/erlang-idna/work/erlang-idna-6.1.1/src/idna.erl, line 319)
     in call from idna:decode/2 (/tmp/work/net/erlang-idna/work/erlang-idna-6.1.1/src/idna.erl, line 100)

And indeed I do not have that module. The README for idna doesn't mention it, and it seems that it is needed for older erlang. Given that unicode_util seems to be normal in up-to-date erlang, I don't follow why that isn't used, with the compat used as compat if necessary.

benoitc commented 3 years ago

did you have an error during the build? unicode_util_compat is used as an abstraction so it should be there.

Next version won’t include it. See 230a9175a5edb1b1a47fb09af2f4341eab93b1b0 but in hte version yoûre using it should be there which version of unicode_compat did you install?

gdt commented 3 years ago

I didn't install any version of unicode_utils_compat because the package (in pkgsrc) doesn't depend on it, which is I think because the README.md doesn't say anything about it being needed.

However, the compat build objects didn't get installed because the build recipe wasn't expecting them. With that adjusted, the examples work. I am unclear on whether there is the equivalent of "make install" for erlang/rebar; from looking at how pkgsrc handles erlang modules it seems there isn't. But that's not an erlang-idna issue.

It's good unicode-utils_compat won't be included. In pkgsrc, we don't allow builds to use the network. A new release would be much appreciated.

gdt commented 3 years ago

With the package build adjusted to include the unicode compat build products, ejabberd s2s and startup is working again. Thanks for explaining.