Sqlite3 has problem with arrow keys

I have started sqlite3 and pressed up arrow over ssh session (RPI 4):

osmc@rpi4:~$ sqlite3
-- Loading resources from /home/osmc/.sqliterc
SQLite version 3.28.0 2019-04-16 19:49:53
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> ^[[A

As you can se I have got “^[[A” instead of previous command from history.
Why?

If I exit sqlite3, while still in ssh shell session, up arrow works as expected (I can get bash history).

So far I found this: putty - Strange keyboard when using sqlite shell on linux - Super User

What do you suggest as a solution?

Hi,

Doesn’t look like sqlite3 is complied with readline support. A google search would indicate that compiling with support, isn’t as straight as it should be.

I can get it to work as expected with rlwrap as suggested in the link.

sudo apt-get install rlwrap
rlwrap sqlite3

Thanks Tom.

Tom was faster, my suggestion was to force it in your ssh-client instead, but it’s better to do it in the remote OS, and define to which apps. Since what ever client setting you set, the server (osmc device in this case) can override it. But setting it in the “server os” well that solves the issue.

1 Like

How come that sqlite3 (in osmc) isn’t compiled with readline support?
On raspbian up arrow works as usual.

Hi,

@sam_nazarko will need to answer that one.

Regards Tom.

If it was a one time occurrence, it could be a lag spike in the connection too. ( more common in Serial connections. but can occur in modern network too.)

No , it is not one off occurance.

@sam_nazarko Can you please ensure that sqlite3 is compiled with readline support for the next release?

We can certainly build the support, but it may be time to use the upstream version again. We only carry it downstream for two performance patches.

https://raw.githubusercontent.com/osmc/osmc/master/package/libsqlite-osmc/patches/all-000-prepopulate-mmap-db.patch

https://raw.githubusercontent.com/osmc/osmc/master/package/libsqlite-osmc/patches/all-001-improve-firefox-performance.patch