lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

> On Mar 7, 2015, at 11:33 PM, Daurnimator <quae@daurnimator.com> wrote:
> 
> On 7 March 2015 at 17:02, Gary V. Vaughan <gary@vaughan.pe> wrote:
>>> On Mar 5, 2015, at 8:39 PM, Daurnimator <quae@daurnimator.com> wrote:
>>> The curses module seems to not be installed correctly:
>>> 
>>> $ luarocks show luaposix
>>> 
>>> luaposix 33.3.1-1 - Lua bindings for POSIX (including curses)
>>> 
>>> A library binding various POSIX APIs, including curses. POSIX is the IEEE
>>> Portable Operating System Interface standard. luaposix is based on lposix and
>>> lcurses.
>>> 
>>> License:        MIT/X11
>>> Homepage:       http://github.com/luaposix/luaposix/
>>> Installed in:   /usr
>>> 
>>> Modules:
>>>       curses (/usr/share/lua/5.2/curses.lua)
>>>       posix (/usr/share/lua/5.2/posix/init.lua)
>>>       posix._argcheck (/usr/share/lua/5.2/posix/_argcheck.lua)
>>>       posix.compat (/usr/share/lua/5.2/posix/compat.lua)
>>>       posix.deprecated (/usr/share/lua/5.2/posix/deprecated.lua)
>>>       posix.sys (/usr/share/lua/5.2/posix/sys.lua)
>>>       posix.util (/usr/share/lua/5.2/posix/util.lua)
>> 
>> With a completely clean install of lua-5.2.4 and luarocks-2.2.0, I have the same
>> output (after `luarocks install luaposix`.
> 
> Notice the lack of any C modules (i.e. ending in .so)
> This indicates it has not installed any C modules.

luaposix installs only posix.so, which is loaded by the standard loadall searcher, but
masked in the luarocks show output by posix/init.lua which provides the posix module.

>>> $ lua -l curses
>>> lua: /usr/share/lua/5.2/curses.lua:2: module 'posix.curses' not found:
>>>       no field package.preload['posix.curses']
>>>       no file './posix/curses/init.lua'
>>>       no file '/usr/share/lua/5.2/posix/curses.lua'
>>>       no file '/usr/share/lua/5.2/posix/curses/init.lua'
>>>       no file '/usr/lib/lua/5.2/posix/curses.lua'
>>>       no file '/usr/lib/lua/5.2/posix/curses/init.lua'
>>>       no file './posix/curses.lua'
>>>       no file '/usr/local/share/lua/5.2/posix/curses/init.lua'
>>>       no file '/usr/local/share/lua/5.2/posix/curses.lua'
>>>       no file '/usr/local/lib/lua/5.2/posix/curses.so'
>>>       no file '/usr/local/lib/lua/5.2/posix.so'
>>> stack traceback:
>>>       [C]: in function 'require'
>>>       /usr/share/lua/5.2/curses.lua:2: in main chunk
>>>       [C]: in function 'require'
>>>       [C]: in ?
>> 
>> But I can't reproduce the rest:
>> 
>> $ ~/lua52/bin/lua -l curses
>> Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
>>> for k in pairs (package.loaded.curses) do print (k) end
>> slk_touch
>> curs_set
>> cols
>> slk_attrset
>> endwin
>> has_colors
>> ...
>> isendwin
>> start_color
>> slk_clear
>> doupdate
>>> ^D
>> 
>> Do you have bits of the borked previous release in your path too?  What happens if
>> you build a new 5.2 + luarocks tree and try it from there?
> 
> Sounds like you have a C module sitting around elsewhere.

Still can't reproduce it.  I get the same output in a completely new docker container
(the easiest way to test on GNU/Linux from my Mac), with a fresh install of Lua 5.2.4
and no other Lua interpreters on modules anywhere else.

$ nm -B ~/lua52/lib/lua/5.2/posix.so | grep luaopen_ 
0000000000018440 T luaopen_posix_ctype               
00000000000186e0 T luaopen_posix_curses              
0000000000018490 T luaopen_posix_curses_chstr        
00000000000185e0 T luaopen_posix_curses_window       
0000000000018780 T luaopen_posix_dirent              
00000000000187d0 T luaopen_posix_errno               
0000000000019150 T luaopen_posix_fcntl               
00000000000195a0 T luaopen_posix_fnmatch             
0000000000019680 T luaopen_posix_getopt              
00000000000196d0 T luaopen_posix_glob                
0000000000019720 T luaopen_posix_grp                 
0000000000019770 T luaopen_posix_libgen              
00000000000197c0 T luaopen_posix_poll                
0000000000019810 T luaopen_posix_pwd                 
0000000000019860 T luaopen_posix_sched               
0000000000019910 T luaopen_posix_signal              
0000000000019dc0 T luaopen_posix_stdio               
0000000000019f00 T luaopen_posix_stdlib              
0000000000019f50 T luaopen_posix_sys_msg             
000000000001a070 T luaopen_posix_sys_resource        
000000000001a210 T luaopen_posix_sys_socket          
000000000001ab20 T luaopen_posix_sys_stat            
000000000001ae50 T luaopen_posix_sys_statvfs         
000000000001aef0 T luaopen_posix_sys_time            
000000000001af40 T luaopen_posix_sys_times           
000000000001af90 T luaopen_posix_sys_utsname         
000000000001afe0 T luaopen_posix_sys_wait            
000000000001b080 T luaopen_posix_syslog              
000000000001b4d0 T luaopen_posix_termio              
000000000001c390 T luaopen_posix_time                
000000000001c470 T luaopen_posix_unistd              
000000000001c7f0 T luaopen_posix_utime               
$

The home directory installation is because I lazily edited my luaposix .travis.yml
into a shell script to perform a source build and install of latest lua-5.2 and
luarocks-2.2.0. I then used that luarocks to install the latest luaposix rock from
the repo.



> Find out where your stray module is by running:
> 
> $ strace -e 'open' lua -lposix.curses
> 
> e.g. my output:
> 
> open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
> open("/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
> open("/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
> open("/usr/lib/libreadline.so.6", O_RDONLY|O_CLOEXEC) = 3
> open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
> open("/usr/lib/libncursesw.so.5", O_RDONLY|O_CLOEXEC) = 3
> open("./posix/curses/init.lua", O_RDONLY) = -1 ENOENT (No such file or
> directory)
> open("/usr/share/lua/5.2/posix/curses.lua", O_RDONLY) = -1 ENOENT (No
> such file or directory)
> open("/usr/share/lua/5.2/posix/curses/init.lua", O_RDONLY) = -1 ENOENT
> (No such file or directory)
> open("/usr/lib/lua/5.2/posix/curses.lua", O_RDONLY) = -1 ENOENT (No
> such file or directory)
> open("/usr/lib/lua/5.2/posix/curses/init.lua", O_RDONLY) = -1 ENOENT
> (No such file or directory)
> open("./posix/curses.lua", O_RDONLY)    = -1 ENOENT (No such file or directory)
> open("/usr/local/share/lua/5.2/posix/curses/init.lua", O_RDONLY) = -1
> ENOENT (No such file or directory)
> open("/usr/local/share/lua/5.2/posix/curses.lua", O_RDONLY) = -1
> ENOENT (No such file or directory)
> open("/usr/local/lib/lua/5.2/posix/curses.so", O_RDONLY) = -1 ENOENT
> (No such file or directory)
> open("/usr/local/lib/lua/5.2/posix.so", O_RDONLY) = -1 ENOENT (No such
> file or directory)
> lua: module 'posix.curses' not found:
>        no field package.preload['posix.curses']
>        no file './posix/curses/init.lua'
>        no file '/usr/share/lua/5.2/posix/curses.lua'
>        no file '/usr/share/lua/5.2/posix/curses/init.lua'
>        no file '/usr/lib/lua/5.2/posix/curses.lua'
>        no file '/usr/lib/lua/5.2/posix/curses/init.lua'
>        no file './posix/curses.lua'
>        no file '/usr/local/share/lua/5.2/posix/curses/init.lua'
>        no file '/usr/local/share/lua/5.2/posix/curses.lua'
>        no file '/usr/local/lib/lua/5.2/posix/curses.so'
>        no file '/usr/local/lib/lua/5.2/posix.so'
> stack traceback:
>        [C]: in function '_G.require'
>        [C]: in ?
> +++ exited with 1 +++

For me:

$ strace -e 'open' bin/lua5.2 -l curses -e 'os.exit (0)'
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libreadline.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3
open("/home/gary/.luarocks/share/lua/5.2/curses.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/gary/.luarocks/share/lua/5.2/curses/init.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/gary/lua52/share/lua/5.2/curses.lua", O_RDONLY) = 3
open("/home/gary/lua52/share/lua/5.2/curses.lua", O_RDONLY) = 3
open("/home/gary/.luarocks/share/lua/5.2/posix/curses.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/gary/.luarocks/share/lua/5.2/posix/curses/init.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/gary/lua52/share/lua/5.2/posix/curses.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/gary/lua52/share/lua/5.2/posix/curses/init.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/share/lua/5.2/posix/curses.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/share/lua/5.2/posix/curses/init.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.2/posix/curses.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.2/posix/curses/init.lua", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./posix/curses.lua", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/home/gary/.luarocks/lib/lua/5.2/posix/curses.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/gary/lua52/lib/lua/5.2/posix/curses.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.2/posix/curses.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.2/loadall.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./posix/curses.so", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/home/gary/.luarocks/lib/lua/5.2/posix.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/gary/lua52/lib/lua/5.2/posix.so", O_RDONLY) = 3
open("/home/gary/lua52/lib/lua/5.2/posix.so", O_RDONLY|O_CLOEXEC) = 3
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libncurses.so.5", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
$

HTH,
-- 
Gary V. Vaughan (gary AT vaughan DOT pe)