Skip to content

sudo lnav creates files owned by root in the user directory leading to crash (was: Crash on MacOS Tahoe 26.5.2 (25F84) when using "filter" feature) #1730

Description

@ershov

UPDATE: this has been root-caused, see in the bottom.

lnav version
0.14.0 and 0.14.1

Describe the bug
lnav crashes whenever I attempt to use "filter-in" or "filter-out" feature.

To Reproduce

  1. Open any log
  2. Try to filter-in or filter-out
  3. crash

Crash logs

0.14.0 and 0.14.1 crash slightly differently but they both crash in curses text input:

1575:2026-07-22T09:28:53.684297+10:00 E t0 [59336::user_input-6] lnav_log.cc:647 Received signal: 6
1576-0   lnav                                0x000000010131bb94 _ZL7sigabrtiP9__siginfoPv + 256
1577-1   lnav                                0x000000010145dda8 fatal_handler + 312
1578-2   libsystem_platform.dylib            0x0000000183477744 _sigtramp + 56
1579-3   libsystem_pthread.dylib             0x000000018346d8d8 pthread_kill + 296
1580-4   libsystem_c.dylib                   0x000000018333d014 raise + 32
1581-5   lnav                                0x000000010131bf50 _Z9log_abortv + 16
1582-6   lnav                                0x00000001011dc9f8 _ZN4lnav9textinputL9create_dbEv + 612
1583-7   lnav                                0x000000010200d8e0 _ZN4lnav9textinputL6get_dbEv.cold.1 + 12
1584-8   lnav                                0x00000001011dbe4c _ZN4lnav9textinputL6get_dbEv + 60
1585-9   lnav                                0x00000001011db9f0 _ZN4lnav9textinput7history8op_guardD2Ev + 136
1586-10  lnav                                0x000000010114d6d8 _Z11rl_callbackR16textinput_curses + 2488
1587-11  lnav                                0x00000001011d6030 _ZN16textinput_curses10handle_keyERK7ncinput + 5936
1588-12  lnav                                0x0000000100ec0e64 _ZL10handle_keyP9notcursesRK7ncinputPKc + 260
1589-13  lnav                                0x0000000100edc818 _ZNKSt3__18functionIFbP9notcursesRK7ncinputPKcEEclES2_S5_S7_ + 44
1590-14  lnav                                0x0000000100ffd6a0 _ZN16input_dispatcher9new_inputERK7timevalP9notcursesR7ncinput + 732
1591-15  lnav                                0x0000000100e91344 _ZL6looperv + 15416
1592-16  lnav                                0x0000000100e82e18 main + 26244
1593-17  dyld                                0x00000001830afe00 start + 6992
1866:2026-07-22T09:29:28.097741+10:00 E t0 [59434::user_input-44] lnav_log.cc:647 Received signal: 6
1867-0   lnav                                0x00000001050391d0 _ZL7sigabrtiP9__siginfoPv + 256
1868-1   lnav                                0x00000001051f6150 fatal_handler + 276
1869-2   libsystem_platform.dylib            0x0000000183477744 _sigtramp + 56
1870-3   libsystem_pthread.dylib             0x000000018346d8d8 pthread_kill + 296
1871-4   libsystem_c.dylib                   0x000000018333d014 raise + 32
1872-5   lnav                                0x0000000105039598 _Z9log_abortv + 16
1873-6   lnav                                0x0000000104e98de4 _ZN4lnav9textinputL9create_dbEv + 648
1874-7   lnav                                0x0000000104e97a64 _ZN4lnav9textinput7history8op_guardD2Ev + 1736
1875-8   lnav                                0x0000000104dd0054 _Z11rl_callbackR16textinput_curses + 2364
1876-9   lnav                                0x0000000104e8c928 _ZN16textinput_curses10handle_keyERK7ncinput + 4964
1877-10  lnav                                0x0000000104a3ceb0 _ZL10handle_keyP9notcursesRK7ncinputPKc + 268
1878-11  lnav                                0x0000000104bfa628 _ZNKSt3__18functionIFbP9notcursesRK7ncinputPKcEEclES2_S5_S7_ + 44
1879-12  lnav                                0x0000000104bfa560 _ZN16input_dispatcher9new_inputERK7timevalP9notcursesR7ncinput + 768
1880-13  lnav                                0x00000001049fadf4 _ZL6looperv + 19444
1881-14  lnav                                0x00000001049e7c6c main + 40140
1882-15  dyld                                0x00000001830afe00 start + 6992

Other diagnostics:

0.14.0 from homebrew:

$ otool -L /opt/homebrew/Cellar/lnav/0.14.0/bin/lnav
/opt/homebrew/Cellar/lnav/0.14.0/bin/lnav:
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 4424.1.255)
        /opt/homebrew/opt/sqlite/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0)
        /opt/homebrew/opt/libarchive/lib/libarchive.13.dylib (compatibility version 22.0.0, current version 22.6.0)
        /usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
        /opt/homebrew/opt/libunistring/lib/libunistring.5.dylib (compatibility version 8.0.0, current version 8.1.0)
        /usr/lib/libpcre2-8.0.dylib (compatibility version 12.0.0, current version 12.2.0)
        /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.8)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1356.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 2100.43.0)

0.14.1 from GutHub Release:

$ otool -L lnav
lnav:
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 2503.1.0)
        /usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.120.2)
        /usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 8.0.0)
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.8)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.5)

Logs preceeding crash:

2026-07-22T09:24:14.203130+10:00 D t0 [57836::user_input-7] readline_callbacks.cc:501 apair pattern [0:3) -- Wir
2026-07-22T09:24:14.203135+10:00 D t0 [57836::user_input-7] textinput_curses.cc:1972 repl sel [12:0) - cursor [13:0)
2026-07-22T09:24:14.203137+10:00 D t0 [57836::user_input-7] textinput_curses.cc:2002 extending undo range [12:0] - [13:0]
2026-07-22T09:24:14.292344+10:00 D t0 [57836::user_input-8] input_dispatcher.cc:87 new input 0 101/65(e)/e/65 evtype=0
2026-07-22T09:24:14.292352+10:00 D t0 [57836::user_input-8] textinput_curses.cc:1692  eff 65
2026-07-22T09:24:14.292354+10:00 D t0 [57836::user_input-8] textinput_curses.cc:1692  eff 0
2026-07-22T09:24:14.292356+10:00 D t0 [57836::user_input-8] textinput_curses.cc:1852 sel_range y=0 [13:13)
2026-07-22T09:24:14.292357+10:00 D t0 [57836::user_input-8] textinput_curses.cc:1885 partial line change
2026-07-22T09:24:14.292360+10:00 D t0 [57836::user_input-8] textinput_curses.cc:1923 last line 'e'
2026-07-22T09:24:14.292361+10:00 D t0 [57836::user_input-8] textinput_curses.cc:1928 repl_cols => 1
2026-07-22T09:24:14.292404+10:00 D t0 [57836::user_input-8] readline_callbacks.cc:1040 rl_change
2026-07-22T09:24:14.292479+10:00 W t0 [57836::user_input-8] view_helpers.cc:1200 Not executing example: dhclient
2026-07-22T09:24:14.292480+10:00 W t0 [57836::user_input-8] view_helpers.cc:1200 Not executing example: dhclient
2026-07-22T09:24:14.292506+10:00 D t0 [57836::user_input-8] cmd.parser.cc:76 BEGIN arg_at
2026-07-22T09:24:14.292507+10:00 D t0 [57836::user_input-8] cmd.parser.cc:88   arg pattern[1]
2026-07-22T09:24:14.292508+10:00 D t0 [57836::user_input-8] cmd.parser.cc:97     val [0:4) 'Wire' -> 'Wire'
2026-07-22T09:24:14.292511+10:00 D t0 [57836::user_input-8] cmd.parser.cc:176 cap b:0  x:4  e:4 word
2026-07-22T09:24:14.292512+10:00 D t0 [57836::user_input-8] cmd.parser.cc:191   in token word
2026-07-22T09:24:14.292513+10:00 D t0 [57836::user_input-8] readline_callbacks.cc:501 apair pattern [0:4) -- Wire
2026-07-22T09:24:14.292516+10:00 D t0 [57836::user_input-8] textinput_curses.cc:1972 repl sel [13:0) - cursor [14:0)
2026-07-22T09:24:14.292517+10:00 D t0 [57836::user_input-8] textinput_curses.cc:2002 extending undo range [12:0] - [14:0]
2026-07-22T09:24:14.514322+10:00 D t0 [57836::user_input-9] input_dispatcher.cc:87 new input 0 100/64(d)/d/64 evtype=0
2026-07-22T09:24:14.514332+10:00 D t0 [57836::user_input-9] textinput_curses.cc:1692  eff 64
2026-07-22T09:24:14.514335+10:00 D t0 [57836::user_input-9] textinput_curses.cc:1692  eff 0
2026-07-22T09:24:14.514338+10:00 D t0 [57836::user_input-9] textinput_curses.cc:1852 sel_range y=0 [14:14)
2026-07-22T09:24:14.514340+10:00 D t0 [57836::user_input-9] textinput_curses.cc:1885 partial line change
2026-07-22T09:24:14.514345+10:00 D t0 [57836::user_input-9] textinput_curses.cc:1923 last line 'd'
2026-07-22T09:24:14.514347+10:00 D t0 [57836::user_input-9] textinput_curses.cc:1928 repl_cols => 1
2026-07-22T09:24:14.514397+10:00 D t0 [57836::user_input-9] readline_callbacks.cc:1040 rl_change
2026-07-22T09:24:14.514507+10:00 W t0 [57836::user_input-9] view_helpers.cc:1200 Not executing example: dhclient
2026-07-22T09:24:14.514510+10:00 W t0 [57836::user_input-9] view_helpers.cc:1200 Not executing example: dhclient
2026-07-22T09:24:14.514549+10:00 D t0 [57836::user_input-9] cmd.parser.cc:76 BEGIN arg_at
2026-07-22T09:24:14.514551+10:00 D t0 [57836::user_input-9] cmd.parser.cc:88   arg pattern[1]
2026-07-22T09:24:14.514553+10:00 D t0 [57836::user_input-9] cmd.parser.cc:97     val [0:5) 'Wired' -> 'Wired'
2026-07-22T09:24:14.514557+10:00 D t0 [57836::user_input-9] cmd.parser.cc:176 cap b:0  x:5  e:5 word
2026-07-22T09:24:14.514559+10:00 D t0 [57836::user_input-9] cmd.parser.cc:191   in token word
2026-07-22T09:24:14.514562+10:00 D t0 [57836::user_input-9] readline_callbacks.cc:501 apair pattern [0:5) -- Wired
2026-07-22T09:24:14.514566+10:00 D t0 [57836::user_input-9] textinput_curses.cc:1972 repl sel [14:0) - cursor [15:0)
2026-07-22T09:24:14.514568+10:00 D t0 [57836::user_input-9] textinput_curses.cc:2002 extending undo range [12:0] - [15:0]
2026-07-22T09:24:14.778621+10:00 D t0 [57836::user_input-10] input_dispatcher.cc:87 new input 0 1115121/1103f1( )//1103f1 evtype=0
2026-07-22T09:24:14.778630+10:00 D t0 [57836::user_input-10] input_dispatcher.cc:116 nckey n4201761
2026-07-22T09:24:14.778671+10:00 I t0 [57836::user_input-10] view_helpers.cc:1743 changing mode from COMMAND to PAGING
2026-07-22T09:24:14.778694+10:00 I t0 [57836::user_input-10::execute_command-2] command_executor.cc:146 Executing command: filter-in Wired
2026-07-22T09:24:14.778758+10:00 D t0 [57836::user_input-10::execute_command-2] cmds.filtering.cc:268 filter-in [1] Wired
2026-07-22T09:24:14.778764+10:00 D t0 [57836::user_input-10::execute_command-2::text_filters_changed-0] logfile_sub_source.cc:1613 filtering files
2026-07-22T09:24:14.782053+10:00 D t0 [57836::user_input-10::execute_command-2::text_filters_changed-0] logfile_sub_source.cc:1686 reloading view
2026-07-22T09:24:14.782097+10:00 D t0 [57836::user_input-10::execute_command-2::text_filters_changed-0] logfile_sub_source.cc:1690 finished filter update
2026-07-22T09:24:14.782929+10:00 D t0 [57836::user_input-10] sql_util.cc:1400 retcode 0  0x104622610 0x1046227e2
2026-07-22T09:24:14.782952+10:00 D t0 [57836::user_input-10] sql_util.cc:1400 retcode 0  0x1046227e4 0x10462283c
2026-07-22T09:24:14.782968+10:00 D t0 [57836::user_input-10] sql_util.cc:1400 retcode 0  0x10462283d 0x10462288a
2026-07-22T09:24:14.782997+10:00 D t0 [57836::user_input-10] sql_util.cc:1400 retcode 0  0x10462288c 0x1046228b8
2026-07-22T09:24:14.783001+10:00 E t0 [57836::user_input-10] sql_util.cc:1127 (8) statement aborts at 14: attempt to write a readonly database; [DROP TRIGGER IF EXISTS lnav_history_cleanup;]
2026-07-22T09:24:14.784787+10:00 E t0 [57836::user_input-10] sql_util.cc:1127 (1) trigger lnav_history_cleanup already exists in "CREATE TRIGGER lnav_history_cleanup AFTER INSERT ON lnav_history

All logs are uploaded with lnav -m crash upload.


UPDATE:

I noticed this line in logs about "readonly databade" and looking into ~/.config/lnav/, I discovered some files owned by root.
I chowned them to my user and it fixed.

I don't remember copying or creating these files intentionally but I do remember running sudo lnav. Most probably, lnav created these files in the real user's $HOME rather than using current user's directory.

So I see a few separate issues here:

  1. lnav should use effective user's home directory for its .config/lnav thing rather than real user's.
  2. Improve error handling: display an error message explaining what's wrong rather than crashing.
  3. When something fails, degrade the functionality gracefully and gradually. For example, if history storage is not accessible - don't use history.

When these files already exist, sudo lnav will update them. But if sudo lnav is the first thing the user runs after installation, the files get created owned by root and regular lnav will crash trying to update them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions