elixir-inspector / ua_inspector

User agent parser library
Apache License 2.0
125 stars 23 forks source link

Error running mix task for downloading databases #2

Closed amokan closed 9 years ago

amokan commented 9 years ago

Running in Elixir 1.1.1 and getting this result when running the mix task for downloading the databases mix ua_inspector.download.databases

15:12:45.750 [error] Loading of /_build/dev/lib/ua_inspector/ebin/Elixir.Mix.Tasks.UAInspector.Download.Databases.beam failed: :badfile

15:12:45.750 [error] beam/beam_load.c(1278): Error loading module 'Elixir.Mix.Tasks.UAInspector.Download.Databases':
  module name in object code is Elixir.Mix.Tasks.UaInspector.Download.Databases

** (UndefinedFunctionError) undefined function: Mix.Tasks.UAInspector.Download.Databases.run/1 (module Mix.Tasks.UAInspector.Download.Databases is not available)
    Mix.Tasks.UAInspector.Download.Databases.run([])
    (mix) lib/mix/cli.ex:55: Mix.CLI.run_task/2
    (elixir) lib/code.ex:363: Code.require_file/2

I had the same issue with the shortcode mix task as well.

Any ideas? I've had this working in the past and just recently put it in a new project. I have the config setup per the README and all of that. Tried to clean and refetch/compile my deps as well.

mneudert commented 9 years ago

Hm... could you be using Windows?

Right now there is some sort of nasty hack to have the mix task available in Elixir 1.0.2 and older. The way the underscore gets treated was changed back then and I worked around it by having both an "Mix.Tasks.UaInspector.Download" AND "Mix.Tasks.UAInspector.Download" (notice the case change in the name) module available for Elixir 1.0.3 and newer.

Having not thought of case insensitive file systems is probably the root of the problem...

And if that is the case I will change these namings and release a new version asap.

amokan commented 9 years ago

@mneudert I'm running OSX 10.11.1

I noticed the work-arounds in the tasks you are mentioning. The real odd thing here is that it worked in the past and I dumped the ~/.mix/ua_inspector because I was fighting through the same issue with the short code db and now it fails for both

mneudert commented 9 years ago

I will change the task setup tomorrow and give you a ping for a test. This hack has to go now :D

The only thing you could try would be deleting the _build folder and recompiling from scratch. After that there should be two files in "/_build/dev/lib/ua_inspector/ebin" resembling the two required namings for the module.

If not then you might really have the case insensitive version of your filesystem.

According to 5 minutes of research it at least seems possible to format a HDD both ways (HFS+ vs HFSX). But that is just pure speculation and half-baked knowledge.

amokan commented 9 years ago

@mneudert i doubt its the case insensitive scenario. I would be burned too much by that on other dev. Its a fresh reinstall with HFS+. I'm trying to dump the beam files and will go from there. Prob wouldn't hurt to kill the hacks in the mix tasks, though

amokan commented 9 years ago

@mneudert Ha. Well, dumping the build folder got me back to working mostly. mix ua_inspector.download.databases is fine now.

mix ua_inspector.download.short_code_maps blows up, but i can deal without having devices for now.

It's basically the same error as before. Seems like there could be something going on with the hack for the task names.

I appreciate your help

16:47:29.276 [error] Loading of /_build/dev/lib/ua_inspector/ebin/Elixir.Mix.Tasks.UAInspector.Download.ShortCodeMaps.beam failed: :badfile

16:47:29.276 [error] beam/beam_load.c(1278): Error loading module 'Elixir.Mix.Tasks.UAInspector.Download.ShortCodeMaps':
  module name in object code is Elixir.Mix.Tasks.UaInspector.Download.ShortCodeMaps

** (UndefinedFunctionError) undefined function: Mix.Tasks.UAInspector.Download.ShortCodeMaps.run/1 (module Mix.Tasks.UAInspector.Download.ShortCodeMaps is not available)
    Mix.Tasks.UAInspector.Download.ShortCodeMaps.run([])
    (mix) lib/mix/cli.ex:55: Mix.CLI.run_task/2
    (elixir) lib/code.ex:363: Code.require_file/2
mneudert commented 9 years ago

Could that be a false positive from some "old file"?

The module it mentions should not exist anymore. Only the one with "UaIn" should exist.

mneudert commented 9 years ago

Or maybe your response was not targeted at the "fix commit". Then you should try that one and forget what I just said :D

amokan commented 9 years ago

@mneudert i'll try your new release

amokan commented 9 years ago

@mneudert your latest commit fixed it for me. Also note that I am running oh-my-zsh. Not sure if that is causing any issues here. It shouldn't, but thought I'd throw that out since it will do some things with case sensitivity in the shell.

mneudert commented 9 years ago

I also don't think the shell should be a problem.

But as the fix actually fixed it I will release a new version later on hex. Might get an option to test it with Windows and a Mac before.

Until then I could only poke around the filesystem. Could you open your Disk Utility (or what its called) and check whats there? Then the whole sensitivity issue could be discarded and it might be something completely different.

amokan commented 9 years ago

Filesystem is OS X Extended in Disk Util

On Mon, Nov 9, 2015 at 5:20 PM, Marc Neudert notifications@github.com wrote:

I also don't think the shell should be a problem.

But as the fix actually fixed it I will release a new version later on hex. Might get an option to test it with Windows and a Mac before.

Until then I could only poke around the filesystem. Could you open your Disk Utility (or what its called) and check whats there? Then the whole sensitivity issue could be discarded and it might be something completely different.

— Reply to this email directly or view it on GitHub https://github.com/elixytics/ua_inspector/issues/2#issuecomment-155241481 .

amokan commented 9 years ago

more details from the diskuti info command

File System Personality:  Journaled HFS+
Type (Bundle):            hfs
Name (User Visible):      Mac OS Extended (Journaled)
amokan commented 9 years ago

@mneudert I guess my machine is not case sensitive. Totally blows my mind that I've never noticed before in so many years developing on OSX. I guess I'm so used to being on servers that I just assumed it was case-sensitive and treated everything as such - but some tests (touch abC1 && touch abc1 && ls ab*) and further reading suggests the file system is traditionally insensitive on OSX due to some third-party GUI apps.

Running that same test on a ubuntu box I have results in both files, whereas the OSX machine is just one.

Thanks again man. I think your version bump is good to go to hex.

mneudert commented 9 years ago

Just released the new version on hex (~> 0.10).

Thank you for bringing this whole issue to my attention :+1: