JDevlieghere planned changes to this revision. JDevlieghere marked an inline comment as done. JDevlieghere added a comment.
In D71825#1809825 <https://reviews.llvm.org/D71825#1809825>, @labath wrote: > I think this needs more discussion. The current method of appending to > `package.path` seems to be completely broken. `package.path` contains > patterns (e.g. `/?.lua;/usr/share/lua/5.1/?.lua;...`). Adding an absolute > path to this variable will cause that file to be loaded for _any_ value one > passes to the `require` function: > > $ cat /tmp/a.lua > print("hello from a.lua") > return {} > $ lua > Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio > > require "a" > stdin:1: module 'a' not found: > no field package.preload['a'] > no file './a.lua' > no file '/usr/share/lua/5.1/a.lua' > no file '/usr/share/lua/5.1/a/init.lua' > no file '/usr/lib64/lua/5.1/a.lua' > no file '/usr/lib64/lua/5.1/a/init.lua' > no file '/usr/share/lua/5.1/a.lua' > no file '/usr/share/lua/5.1/a/init.lua' > no file './a.so' > no file '/usr/lib64/lua/5.1/a.so' > no file '/usr/lib64/lua/5.1/a.so' > no file '/usr/lib64/lua/5.1/loadall.so' > stack traceback: > [C]: in function 'require' > stdin:1: in main chunk > [C]: ? > > package.path = package.path .. ';/tmp/a.lua' > > require "a" > hello from a.lua > > require "b" > hello from a.lua > > require "huh?" > hello from a.lua > > require "@$#%^@#%@#%@#%@#" > hello from a.lua > > > I'm afraid we will need to do something more elaborate (and fiddly, > unfortunately) to implement this. I see a couple of options, though none are > really ideal. I'm not sure I'll have time to go into them in detail (I'll try > to get back to it this evening), but I'm interested in hearing your thoughts > about this... Seems like the solution is to use the `?.lua` which is also what's used for picking up files in the current directory. Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio > package.path = package.path .. ';/tmp/?.lua' > require "a" hello from a.lua table: 0x7fbd13401a60 > require "b" stdin:1: module 'b' not found: no field package.preload['b'] no file '/usr/local/share/lua/5.3/b.lua' no file '/usr/local/share/lua/5.3/b/init.lua' no file '/usr/local/lib/lua/5.3/b.lua' no file '/usr/local/lib/lua/5.3/b/init.lua' no file './b.lua' no file './b/init.lua' no file '/tmp/b.lua' no file '/usr/local/lib/lua/5.3/b.so' no file '/usr/local/lib/lua/5.3/loadall.so' no file './b.so' stack traceback: [C]: in function 'require' stdin:1: in main chunk [C]: in ? FWIW I just followed the instructions from http://lua-users.org/wiki/ModulesTutorial. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71825/new/ https://reviews.llvm.org/D71825 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits