elixir-koans icon indicating copy to clipboard operation
elixir-koans copied to clipboard

Autoreload doesn’t work with unicode paths

Open Glutexo opened this issue 7 years ago • 3 comments

If the elixir-koans folder is located in a path with non-ASCII characters, the autoreloading doesn’t work. An error like this is raised every time a change is detected:

** (Code.LoadError) could not load /Users/stomsa/_dev/ň/elixir-koans/lib/koans/02_strings.ex
    (elixir) lib/code.ex:1147: Code.find_file/2
    (elixir) lib/code.ex:713: Code.load_file/2

The path should be ~/_dev/ň/ and not ~/_dev/ň/.

Happens on macOS Mojave 10.14 (18A391) with zsh.

Glutexo avatar Dec 06 '18 10:12 Glutexo

I dug in a little bit on this. The error originates here. It ultimately seems that :elixir_utils.read_file_type doesn't handle these characters well. I don't have time to dig in any further right now, but overall it feels like an Elixir/Erlang issue more than this specific project. That is unless there is some escaping or something special that needs to happen in order to support paths like this.

I did, however, notice a deprecated call which is fixed in #229.

iamvery avatar Dec 06 '18 13:12 iamvery

Thanks for taking a look at this, @iamvery! I examined a bit too and I at least found out that the Watcher’s handle_info method already receive an already invalid path. Printing it out, the Unicode characters are already botched.

I wanted to dig deeper and see the actual result of file_system’s parse_line method for a Mac worker, but I wasn’t able to get my changes actually executed.

My impression is that the culprit lies somewhere there, not translating the platform-specific watcher result correctly. But maybe it’s even deeper.

Glutexo avatar Jan 01 '19 13:01 Glutexo

Fun times 😅

iamvery avatar Jan 02 '19 14:01 iamvery