benoitc / erlang-idna

Erlang IDNA lib
MIT License
43 stars 29 forks source link

Unicodedata.txt location #3

Closed kxepal closed 10 years ago

kxepal commented 10 years ago

Actually, this issue raised for erica, but I feel that it also affected any other apps.

When you build erica it says:

Congratulations! You now have a self-contained script called 'erica'
in your current working directory. Place this script anywhere in your path
and you can use, build and push your docs and design docs with erica.

Hooray! As for me, I have ebuild file for it and it places erica to /usr/bin to make it accessible system-wide. However, in this case if I run erica create-app I'll get the next error:

=ERROR REPORT==== 30-Mar-2014::10:09:29 ===
** Generic server idna_unicode_data terminating 
** Last message in was load
** When Server state == undefined
** Reason for termination == 
** {{badmatch,{error,enoent}},
    [{idna_unicode_data,unicode_data,0,
                        [{file,"src/idna_unicode_data.erl"},{line,123}]},
     {idna_unicode_data,handle_info,2,
                        [{file,"src/idna_unicode_data.erl"},{line,105}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,604}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}

... 10 more error reports ...

=INFO REPORT==== 30-Mar-2014::10:09:29 ===
    application: idna
    exited: shutdown
    type: temporary
==> test (create-app)
Writing myapp/_id
Writing myapp/language
Writing myapp/.couchapprc
Writing myapp/views/by_type/map.js

Via strace command I'd found that idna tries to read the file /usr/bin/priv/UnicodeData.txt and certainly fails to do that.

This leads to the next thoughts:

  1. erica and any other app that has erlang-idna as dependency should took relative priv/Unicodedata.txt file with the binary - which isn't pretty nice solution.
  2. Make path to Unicodedata.txt configurable.
  3. Embed this file's data into erlang module for the great portability.
  4. Any other solution around?

Which one to pick?

benoitc commented 10 years ago

unicode data are now compiled as a beam in 09fec4b2fad4a56918795895d23ccd8fba1d5c7d