lnav icon indicating copy to clipboard operation
lnav copied to clipboard

showing SQL error: near "77": syntax error (from xterm-palette.json) when switching to another logfile

Open olispeedy opened this issue 6 months ago • 4 comments

lnav version 0.12.4-1 on debian trixie

Description When switching the logfile I always get the following error SQL error: near "77": syntax error
;77;rgb:5f5f/d7d7/5f5f

The id 77 and the rgb color are defined in https://github.com/tstack/lnav/blob/9efadb1e883704b9f36937d064894cadc06f8825/src/xterm-palette.json#L1158

To Reproduce Steps to reproduce the behavior:

  1. start lnav
  2. config /ui/theme monocai (don't know if that is necessary)
  3. close lnav
  4. lnav /var/log/messages
  5. close lnav
  6. lnav /var/log/syslog

my config.json : { "ui": { "theme": "monocai", "theme-defs": { "default": { "highlights": { "colors": { "pattern": "(?:#[a-fA-F0-9]{6}|#[a-fA-F0-9]{3}\b)" }, "ipv4": { "pattern": "\b(?<!\d\.)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b(?!\.\d)" }, "xml": { "pattern": "</?([^ >=!]+)[^>]>" }, "xml-decl": { "pattern": "<!([^ >=!]+)[^>]>" } } } } }, "log": { "demux": { "container": { "pattern": "^(?:\x1b\[\dK)?(?<mux_id>[a-zA-Z0-9][\@a-zA-Z0-9_\.\-])\s+\| (?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{9}Z )?(?.)" }, "container-with-type": { "pattern": "^(?<mux_id>[a-zA-Z][\w\-]{3,}) (?<container_type>[a-zA-Z][\w\-]{3,}) (?.)" }, "recv-with-pod": { "pattern": "^(?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}(?:Z|[+\-]\d{2}:\d{2})) source=[a-zA-Z0-9][a-zA-Z0-9_\.\-]* (?.) kubernetes_host=(?<k8s_host>[a-zA-Z0-9][a-zA-Z0-9_\.\-]) kubernetes_pod_name=(?<mux_id>[a-zA-Z0-9][a-zA-Z0-9_\.\-]*)", "control-pattern": "^===== (?:START|END) =====$" } } } }

olispeedy avatar Aug 08 '25 11:08 olispeedy

The ;77;rgb:5f5f/d7d7/5f5f stuff is an escape sequence that wasn't processed properly. The terminal is sending it to lnav and instead of handling it properly, it's mistaken as being user input. Since the semi-colon opens the SQL prompt and "77" is not valid SQL, SQLite complains with the given error message.

What terminal are you using?

tstack avatar Aug 10 '25 03:08 tstack

I'm using https://apps.kde.org/yakuake/ that is based on kde's konsole.

echo $TERM xterm-256color

olispeedy avatar Aug 10 '25 10:08 olispeedy

Hmm, I can't seem to replicate the issue in yakuake yet. Will go through the code more and see if I can find anything. There is a v0.13.1-beta3 release, can you try that and see if it's still a problem? Thanks

tstack avatar Aug 14 '25 18:08 tstack

The error appears to be related to how sessions are saved and restored. Specifically, the error occurs after a view-info-.json file is created for a log file. If I open a log file that doesn't have a corresponding view-info-.json file, the error doesn't appear. However, after closing lnav and reopening the same log, the error is present.

I've found that resetting the session with Ctrl+r sometimes resolves the issue temporarily.

I've attached a view-info-*.json file where the error consistently occurs, as well as my environment variables, which I hope will be helpful.

I understand that the beta version might address this, but I am currently on vacation with limited access and am unable to compile it at this time.

view-info-f2f914dda0bf33660dcffac4df225683.ts1755247586.ppid8703.json

environment.txt

olispeedy avatar Aug 15 '25 09:08 olispeedy