Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#42070 closed defect (fixed)

lua @5.2.2_1 arrow keys don't work in interpreter

Reported by: maxheinrich1988@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: pawrsccouk@…, merkste@…, meowsqueak@…, dbevans (David B. Evans)
Port: lua

Description

I can't use the arrow keys (left, right, up, down) in the lua interpreter. I installed it with

ip220:~ max$ sudo port install lua

Pressing the arrow keys, I get the following output (left, up, right, down pressed)

ip220:~ max$ lua
Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
> ^[[D^[[A^[[C^[[B

Attachments (1)

patch-src-Makefile.diff (1.8 KB) - added by meowsqueak@… 7 years ago.
Replacement patch for Lua 5.3.1, incorporating the fix previously mentioned.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 9 years ago by Veence (Vincent)

Something is wrong with readline?

comment:2 Changed 9 years ago by ryandesign (Ryan Schmidt)

Keywords: lua arrow keys removed

You could invoke lua with rlwrap in the meantime.

comment:3 in reply to:  2 Changed 9 years ago by maxheinrich1988@…

Replying to ryandesign@…:

You could invoke lua with rlwrap in the meantime.

This works for me. Thanks!

sudo port install rlwrap
rlwrap lua

comment:4 Changed 9 years ago by pawrsccouk@…

I am getting the same issue with lua 5.2.3 as of 7th July 2014.

Looking at the build, it appears that readline is invoked when building the object files for the lua library (liblua.dylib) but is not invoked when building the lua executable. In the makefile at /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_lua/lua/work/lua-5.2.3/src The line building the final executable is

$(LUA_T): $(LUA_O) $(LUA_A)
 	$(CC) -o $@ -L. $(MYLDFLAGS) $(MYCFLAGS) $(LIBS) -llua lua.c

If I change this to

$(LUA_T): $(LUA_O) $(LUA_A)
 	$(CC) -o $@ -L. $(SYSCFLAGS) $(MYLDFLAGS) $(MYCFLAGS) $(LIBS) -llua lua.c

and recompile, then it uses the readline library as expected. This is at line 69 of the Makefile. It appears that SYSCFLAGS is not passed to the compiler. This is the variable that includes the header definitions for the macosx platform, which causes readline to be selected in luaconf.h.

comment:5 Changed 9 years ago by pawrsccouk@…

Cc: pawrsccouk@… added

Cc Me!

comment:6 Changed 7 years ago by merkste@…

Apparently, this bug is still present in 2.3.1. Is there any reason not to include the makefile fix above?

comment:7 Changed 7 years ago by merkste@…

Cc: merkste@… added

Cc Me!

comment:8 Changed 7 years ago by merkste@…

Cc: merkste@… removed

Cc Me!

comment:9 Changed 7 years ago by merkste@…

Cc: merkste@… added

Cc Me!

comment:10 Changed 7 years ago by meowsqueak@…

Cc: meowsqueak@… added

Cc Me!

comment:11 Changed 7 years ago by dbevans (David B. Evans)

Cc: devans@… added

Cc Me!

Changed 7 years ago by meowsqueak@…

Attachment: patch-src-Makefile.diff added

Replacement patch for Lua 5.3.1, incorporating the fix previously mentioned.

comment:12 Changed 7 years ago by meowsqueak@…

I've put the fix proposed by pawrsccouk@… into a replacement patch (see attached). This should replace the existing patch file of the same name.

comment:13 Changed 7 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: newclosed

Replacement patch committed in r148879 and revision incremented to force the rebuild. Arrow keys now work as expected when using lua interactively. Thanks for helping to close this ticket.

Last edited 7 years ago by dbevans (David B. Evans) (previous) (diff)
Note: See TracTickets for help on using tickets.