tarcieri / reia

Ruby-like hybrid OOP/functional programming language for BEAM, the Erlang VM
http://reia-lang.org
MIT License
775 stars 36 forks source link

building in a directory with '.' in the name causes reia to fail to initialize. #10

Open gregretkowski opened 14 years ago

gregretkowski commented 14 years ago

If you build Reia in a directory that contains dots '.' anywhere in the path Reia fails to run after building. I've verified on my system that if I build clean in a dir without dots it'll build cleanly, however if I build with dots in the path I get the output at the bottom of this bug.

I'm on a Fedora Core 11 system, 64bit, ruby 1.8.6, erlang R12B-5.8. I verified that it happens in the build step... If you build with a dotted path and then move the dir to a non-dotted path and run the tests it fails. If you build with a non-dotted path, then move to a dotted path the tests pass.

[10:35:50|greg@auger:reia.withdot]$ rake (in /var/tmp/reia.withdot) Checking Erlang version... 5.6.5 (ok) ... bunch of build lines skipped... bin/reia test/runner.re {"init terminating in do_boot",{undef,[{'/var/tmp/reia.reia_internal',loadsubmodule,['Dir',[{vsn,[247703181645891322018396214570681693886]},{code,[{module,9,'Dir',[{function,11,list,[{var,10,dir}],{var,1,''},[{case,11,{native_call,11,file,list_dir,[{remote_call,11,{var,11,dir},to_list,[],{nil,1}}]},[{clause,12,[{tuple,12,[{atom,12,ok},{var,12,filenames}]}],[{lc,13,{remote_call,13,{var,13,filename},tostring,[],{nil,1}},[{generate,13,{var,13,filename},{var,13,filenames}}]}]},{clause,14,[{tuple,14,[{atom,14,error},{var,14,reason}]}],[{throw,15,'RuntimeError',{var,15,reason}}]}]}]},{function,20,glob,[{var,19,path}],{var,1,''},[{lc,20,{remote_call,20,{var,20,filename},to_string,[],{nil,1}},[{generate,20,{var,20,filename},{native_call,20,filelib,wildcard,[{remote_call,20,{var,20,path},tolist,[],{nil,1}}]}}]}]},{function,24,create,[{var,23,dir}],{var,1,''},[{case,24,{native_call,24,file,make_dir,[{remote_call,24,{var,24,dir},tolist,[],{nil,1}}]},[{clause,25,[{atom,25,ok}],[{var,26,dir}]},{clause,27,[{tuple,27,[{atom,27,error},{var,27,reason}]}],[{throw,28,'RuntimeError',{var,28,reason}}]}]}]},{function,33,delete,[{var,32,dir}],{var,1,''},[{case,33,{native_call,33,file,del_dir,[{remote_call,33,{var,33,dir},tolist,[],{nil,1}}]},[{clause,34,[{atom,34,ok}],[{nil,1}]},{clause,35,[{tuple,35,[{atom,35,error},{var,35,reason}]}],[{throw,36,'RuntimeError',{var,36,reason}}]}]}]},{function,41,cd,[{var,40,dir}],{var,1,''},[{case,41,{native_call,41,file,set_cwd,[{remote_call,41,{var,41,dir},to_list,[],{nil,1}}]},[{clause,42,[{atom,42,ok}],[{localcall,43,getcwd,[],{nil,1}}]},{clause,44,[{tuple,44,[{atom,44,error},{var,44,reason}]}],[{throw,45,'RuntimeError',{var,45,reason}}]}]}]},{function,50,getcwd,[],{var,1,''},[{case,50,{native_call,50,file,get_cwd,[]},[{clause,51,[{tuple,51,[{atom,51,ok},{var,51,dir}]}],[{remote_call,52,{var,52,dir},tostring,[],{nil,1}}]},{clause,53,[{tuple,53,[{atom,53,error},{var,53,reason}]}],[{throw,54,'RuntimeError',{var,54,reason}}]}]}]},{function,59,mkdir,[{var,59,dir}],{var,1,''},[{localcall,59,create,[{var,59,dir}],{nil,1}}]},{function,60,rmdir,[{var,60,dir}],{var,1,''},[{localcall,60,delete,[{var,60,dir}],{nil,1}}]},{function,61,chdir,[{var,61,dir}],{var,1,''},[{localcall,61,cd,[{var,61,dir}],{nil,1}}]},{function,62,pwd,[],{var,1,''},[{local_call,62,getcwd,[],{nil,1}}]}]}]},{parent,['/var/tmp/reia.withdot/lib/dir']},{submodules,[{static,'Dir',<<6304 bytes>>}]}]]},{reia_bytecode,load,2},{reia_internal,'-load_stdlib/0-lc$^0/1-0-',1},{reia,init,0},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump init terminating in do_boot ()

gregretkowski commented 14 years ago

Also found, after compiling, that if I put my reia script in a directory with dots I got a similar behavior:

[11:08:41|greg@auger:dot.test]$ ./test.re exception error: undefined function '/tmp/dot.reia_internal':load_submodule/2 in function '/tmp/dot.test/test':toplevel/0 in call from reia_bytecode:load/2 in call from reia_internal:execute_file/1 in call from init:start_it/1 in call from init:start_em/1

tarcieri commented 13 years ago

This is likely an artifact of Erlang's "namespacing" functionality with .'s. I'm not really sure I can fix it easily.

tarcieri commented 13 years ago

This is affecting Reia builds under agner, which uses . characters in its directory names. Looks like it should probably get fixed!