Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.68k stars 234 forks source link

token search broken under default directory (~) #504

Open evanescente-ondine opened 2 years ago

evanescente-ondine commented 2 years ago

Hi, yet another bug to report, yes sire !

when on my root repertory /home/drm/, and typing nt/imm broot crashes with this Image this bug is totally reproductive and consistent. Again, sorry I can't seem to get the trace in any other way ! token searching works as long as I'm elsewhere than /home/drm/. Or, well, it ain't as reproductive and I don't remember or it didn't show up yet. I can provide bettre traces, if someone explains how :smile: The white boxes are my editing.

Canop commented 2 years ago

Please indicate your OS and console and provide the debug log of the crashing session.

evanescente-ondine commented 2 years ago

12:02:51.674 [INFO] cli_log::init: Starting broot v1.9.2 with log level DEBUG 12:02:51.674 [DEBUG] broot: env::args(): [ "broot", "--outcmd", "/tmp/tmp.FKLE1D750S", ] 12:02:51.680 [DEBUG] broot::cli: Conf::from_default_location() took 4.988359ms 12:02:51.680 [DEBUG] broot::cli: config: Conf { files: [ "/home/drm/.config/broot/conf.hjson", ], default_flags: Some( "h", ), date_time_format: None, verbs: [ VerbConf { invocation: Some( "touch {new_file}", ), internal: None, external: None, execution: Some( String( "touch {directory}/{new_file}", ), ), cmd: None, cmd_separator: None, key: None, keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "edit", ), internal: None, external: Some( String( "micro +{line} {file}", ), ), execution: None, cmd: None, cmd_separator: None, key: None, keys: [], shortcut: Some( "e", ), leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "enter", ), internal: None, external: Some( String( "handlr open {file}", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "enter", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "file", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "names", ), internal: None, external: Some( String( "bash -r -c wl-copy $(basename -a {file})", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "ctrl-n", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "any", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "enter_folder", ), internal: Some( ":open_stay_filter", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "enter", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "directory", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "enter_without_maintaining_focus", ), internal: Some( ":focus", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "shift-enter", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "directory", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "delete", ), internal: None, external: Some( String( "rm -r {file}", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "ctrl-del", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "any", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: None, external: None, execution: None, cmd: Some( ":toggle_stage {file};:line_down;", ), cmd_separator: None, key: Some( "tab", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: Some( ":clear_stage", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "alt-c", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "create {subpath}", ), internal: None, external: Some( String( "micro {directory}/{subpath}", ), ), execution: None, cmd: None, cmd_separator: None, key: None, keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "git_diff", ), internal: None, external: Some( String( "git difftool -y {file}", ), ), execution: None, cmd: None, cmd_separator: None, key: None, keys: [], shortcut: Some( "gd", ), leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "home", ), internal: Some( ":focus ~", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "ctrl-H", ), keys: [], shortcut: None, leave_broot: None, from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: Some( ":line_down", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "alt-j", ), keys: [], shortcut: None, leave_broot: None, from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "backup {version}", ), internal: None, external: None, execution: Some( String( "cp -r {file} {parent}/{file-stem}-{version}{file-dot-extension}", ), ), cmd: None, cmd_separator: None, key: Some( "ctrl-b", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: Some( false, ), }, VerbConf { invocation: Some( "terminal", ), internal: None, external: None, execution: Some( String( "$SHELL", ), ), cmd: None, cmd_separator: None, key: Some( "ctrl-t", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: Some( true, ), working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: None, external: Some( String( "cp -R {file} {other-panel-directory}", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "F5", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: None, external: Some( String( "mv {file} {other-panel-directory}", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "F6", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, ], skin: Some( { "default": SkinEntry { focused: CompoundStyle { object_style: ContentStyle { foreground_color: None, background_color: None, attributes: Attributes( 0, ), }, }, unfocused: Some( CompoundStyle { object_style: ContentStyle { foreground_color: Some( Green, ), background_color: None, attributes: Attributes( 0, ), }, }, ), }, }, ), special_paths: {}, search_modes: None, disable_mouse_capture: None, cols_order: None, show_selection_mark: Some( true, ), ext_colors: {}, syntax_theme: None, true_colors: Some( true, ), icon_theme: None, modal: None, max_panels_count: None, quit_on_last_cancel: None, file_sum_threads_count: None, } 12:02:51.708 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 108ns 12:02:51.710 [DEBUG] broot::tree_build::builder: blines before trimming: 91 12:02:51.710 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted 12:02:51.731 [DEBUG] broot::app::app: display panel took 11.917583ms 12:02:51.731 [INFO] broot::app::app: pending_tasks took 1.535µs 12:02:52.549 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60871, tv_nsec: 710740225 }, event: Key(KeyEvent { code: Char('n'), modifiers: NONE }), double_click: false } 12:02:52.550 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "n", expr: BeTree { atoms: [PatternParts { parts: ["n"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 12:02:52.551 [DEBUG] broot::app::app: display panel took 307.332µs 12:02:52.551 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 132ns 12:02:52.576 [DEBUG] broot::tree_build::builder: blines before trimming: 294 12:02:52.576 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted 12:02:52.577 [INFO] broot::browser::browser_state: tree filtering on "n" took 25.352542ms 12:02:52.579 [DEBUG] broot::app::app: display panel took 1.844662ms 12:02:52.579 [INFO] broot::app::app: pending_tasks took 27.780149ms 12:02:52.652 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60871, tv_nsec: 813662470 }, event: Key(KeyEvent { code: Char('t'), modifiers: NONE }), double_click: false } 12:02:52.653 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt", expr: BeTree { atoms: [PatternParts { parts: ["nt"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 12:02:52.655 [DEBUG] broot::app::app: display panel took 1.10261ms 12:02:52.655 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 132ns 12:02:52.740 [DEBUG] broot::tree_build::builder: blines before trimming: 370 12:02:52.740 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted 12:02:52.741 [INFO] broot::browser::browser_state: tree filtering on "nt" took 86.024521ms 12:02:52.743 [DEBUG] broot::app::app: display panel took 1.872385ms 12:02:52.744 [INFO] broot::app::app: pending_tasks took 88.644812ms 12:02:53.056 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60872, tv_nsec: 217540423 }, event: Key(KeyEvent { code: Char('/'), modifiers: NONE }), double_click: false } 12:02:53.057 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/", expr: BeTree { atoms: [PatternParts { parts: ["nt", ""] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 12:02:53.058 [DEBUG] broot::app::app: display panel took 648.003µs 12:02:53.059 [INFO] broot::app::app: pending_tasks took 600ns 12:02:53.435 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60872, tv_nsec: 596431020 }, event: Key(KeyEvent { code: Char('i'), modifiers: NONE }), double_click: false } 12:02:53.436 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/i", expr: BeTree { atoms: [PatternParts { parts: ["nt", "i"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 12:02:53.437 [DEBUG] broot::app::app: display panel took 625.414µs 12:02:53.437 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 120ns 12:02:53.442 [DEBUG] broot::tree_build::builder: blines before trimming: 68 12:02:53.443 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted 12:02:53.456 [INFO] broot::browser::browser_state: tree filtering on "nt/i" took 18.21111ms 12:02:53.458 [DEBUG] broot::app::app: display panel took 1.819691ms 12:02:53.458 [INFO] broot::app::app: pending_tasks took 20.566735ms 12:02:53.588 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60872, tv_nsec: 749377095 }, event: Key(KeyEvent { code: Char('m'), modifiers: NONE }), double_click: false } 12:02:53.589 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/im", expr: BeTree { atoms: [PatternParts { parts: ["nt", "im"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 12:02:53.591 [DEBUG] broot::app::app: display panel took 1.757251ms 12:02:53.591 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 132ns 12:02:53.611 [DEBUG] broot::tree_build::builder: blines before trimming: 85 12:02:53.612 [INFO] broot::browser::browser_state: tree filtering on "nt/im" took 20.551139ms 12:02:53.613 [DEBUG] broot::app::app: display panel took 867.535µs 12:02:53.614 [INFO] broot::app::app: pending_tasks took 22.208028ms 12:02:53.781 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60872, tv_nsec: 942280655 }, event: Key(KeyEvent { code: Char('m'), modifiers: NONE }), double_click: false } 12:02:53.782 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/imm", expr: BeTree { atoms: [PatternParts { parts: ["nt", "imm"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 12:02:53.783 [DEBUG] broot::app::app: display panel took 1.156813ms 12:02:53.784 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 132ns

By the way, I'm sorry, when I past in the editing panel the text is formatted normally, but in the preview and final post, all line feeds disappear !

Canop commented 2 years ago

Don't worry for the formatting, I can read it.


12:02:51.674 [INFO] cli_log::init: Starting broot v1.9.2 with log level DEBUG 
12:02:51.674 [DEBUG] broot: env::args(): [ "broot", "--outcmd", "/tmp/tmp.FKLE1D750S", ] 
12:02:51.680 [DEBUG] broot::cli: Conf::from_default_location() took 4.988359ms 
12:02:51.680 [DEBUG] broot::cli: config: Conf { files: [ "/home/drm/.config/broot/conf.hjson", ], default_flags: Some( "h", ), date_time_format: None, verbs: [ VerbConf { invocation: Some( "touch {new_file}", ), internal: None, external: None, execution: Some( String( "touch {directory}/{new_file}", ), ), cmd: None, cmd_separator: None, key: None, keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "edit", ), internal: None, external: Some( String( "micro +{line} {file}", ), ), execution: None, cmd: None, cmd_separator: None, key: None, keys: [], shortcut: Some( "e", ), leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "enter", ), internal: None, external: Some( String( "handlr open {file}", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "enter", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "file", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "names", ), internal: None, external: Some( String( "bash -r -c wl-copy $(basename -a {file})", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "ctrl-n", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "any", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "enter_folder", ), internal: Some( ":open_stay_filter", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "enter", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "directory", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "enter_without_maintaining_focus", ), internal: Some( ":focus", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "shift-enter", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "directory", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "delete", ), internal: None, external: Some( String( "rm -r {file}", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "ctrl-del", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: Some( "any", ), set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: None, external: None, execution: None, cmd: Some( ":toggle_stage {file};:line_down;", ), cmd_separator: None, key: Some( "tab", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: Some( ":clear_stage", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "alt-c", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "create {subpath}", ), internal: None, external: Some( String( "micro {directory}/{subpath}", ), ), execution: None, cmd: None, cmd_separator: None, key: None, keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "git_diff", ), internal: None, external: Some( String( "git difftool -y {file}", ), ), execution: None, cmd: None, cmd_separator: None, key: None, keys: [], shortcut: Some( "gd", ), leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "home", ), internal: Some( ":focus ~", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "ctrl-H", ), keys: [], shortcut: None, leave_broot: None, from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: Some( ":line_down", ), external: None, execution: None, cmd: None, cmd_separator: None, key: Some( "alt-j", ), keys: [], shortcut: None, leave_broot: None, from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "backup {version}", ), internal: None, external: None, execution: Some( String( "cp -r {file} {parent}/{file-stem}-{version}{file-dot-extension}", ), ), cmd: None, cmd_separator: None, key: Some( "ctrl-b", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: Some( false, ), }, VerbConf { invocation: Some( "terminal", ), internal: None, external: None, execution: Some( String( "$SHELL", ), ), cmd: None, cmd_separator: None, key: Some( "ctrl-t", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: Some( true, ), working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: None, external: Some( String( "cp -R {file} {other-panel-directory}", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "F5", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: None, internal: None, external: Some( String( "mv {file} {other-panel-directory}", ), ), execution: None, cmd: None, cmd_separator: None, key: Some( "F6", ), keys: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, ], skin: Some( { "default": SkinEntry { focused: CompoundStyle { object_style: ContentStyle { foreground_color: None, background_color: None, attributes: Attributes( 0, ), }, }, unfocused: Some( CompoundStyle { object_style: ContentStyle { foreground_color: Some( Green, ), background_color: None, attributes: Attributes( 0, ), }, }, ), }, }, ), special_paths: {}, search_modes: None, disable_mouse_capture: None, cols_order: None, show_selection_mark: Some( true, ), ext_colors: {}, syntax_theme: None, true_colors: Some( true, ), icon_theme: None, modal: None, max_panels_count: None, quit_on_last_cancel: None, file_sum_threads_count: None, } 
12:02:51.708 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 108ns 
12:02:51.710 [DEBUG] broot::tree_build::builder: blines before trimming: 91 
12:02:51.710 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted 
12:02:51.731 [DEBUG] broot::app::app: display panel took 11.917583ms 
12:02:51.731 [INFO] broot::app::app: pending_tasks took 1.535µs 
12:02:52.549 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60871, tv_nsec: 710740225 }, event: Key(KeyEvent { code: Char('n'), modifiers: NONE }), double_click: false } 
12:02:52.550 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "n", expr: BeTree { atoms: [PatternParts { parts: ["n"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 
12:02:52.551 [DEBUG] broot::app::app: display panel took 307.332µs 
12:02:52.551 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 132ns 
12:02:52.576 [DEBUG] broot::tree_build::builder: blines before trimming: 294 
12:02:52.576 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted 
12:02:52.577 [INFO] broot::browser::browser_state: tree filtering on "n" took 25.352542ms 
12:02:52.579 [DEBUG] broot::app::app: display panel took 1.844662ms 
12:02:52.579 [INFO] broot::app::app: pending_tasks took 27.780149ms 
12:02:52.652 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60871, tv_nsec: 813662470 }, event: Key(KeyEvent { code: Char('t'), modifiers: NONE }), double_click: false } 
12:02:52.653 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt", expr: BeTree { atoms: [PatternParts { parts: ["nt"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 
12:02:52.655 [DEBUG] broot::app::app: display panel took 1.10261ms 
12:02:52.655 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 132ns 
12:02:52.740 [DEBUG] broot::tree_build::builder: blines before trimming: 370 
12:02:52.740 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted 
12:02:52.741 [INFO] broot::browser::browser_state: tree filtering on "nt" took 86.024521ms 
12:02:52.743 [DEBUG] broot::app::app: display panel took 1.872385ms 
12:02:52.744 [INFO] broot::app::app: pending_tasks took 88.644812ms 
12:02:53.056 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60872, tv_nsec: 217540423 }, event: Key(KeyEvent { code: Char('/'), modifiers: NONE }), double_click: false } 
12:02:53.057 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/", expr: BeTree { atoms: [PatternParts { parts: ["nt", ""] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 
12:02:53.058 [DEBUG] broot::app::app: display panel took 648.003µs 
12:02:53.059 [INFO] broot::app::app: pending_tasks took 600ns 
12:02:53.435 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60872, tv_nsec: 596431020 }, event: Key(KeyEvent { code: Char('i'), modifiers: NONE }), double_click: false } 
12:02:53.436 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/i", expr: BeTree { atoms: [PatternParts { parts: ["nt", "i"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 
12:02:53.437 [DEBUG] broot::app::app: display panel took 625.414µs 
12:02:53.437 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 120ns 
12:02:53.442 [DEBUG] broot::tree_build::builder: blines before trimming: 68 
12:02:53.443 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted 
12:02:53.456 [INFO] broot::browser::browser_state: tree filtering on "nt/i" took 18.21111ms 
12:02:53.458 [DEBUG] broot::app::app: display panel took 1.819691ms 
12:02:53.458 [INFO] broot::app::app: pending_tasks took 20.566735ms 
12:02:53.588 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60872, tv_nsec: 749377095 }, event: Key(KeyEvent { code: Char('m'), modifiers: NONE }), double_click: false } 
12:02:53.589 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/im", expr: BeTree { atoms: [PatternParts { parts: ["nt", "im"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 
12:02:53.591 [DEBUG] broot::app::app: display panel took 1.757251ms 
12:02:53.591 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 132ns 
12:02:53.611 [DEBUG] broot::tree_build::builder: blines before trimming: 85 
12:02:53.612 [INFO] broot::browser::browser_state: tree filtering on "nt/im" took 20.551139ms 
12:02:53.613 [DEBUG] broot::app::app: display panel took 867.535µs 
12:02:53.614 [INFO] broot::app::app: pending_tasks took 22.208028ms 
12:02:53.781 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 60872, tv_nsec: 942280655 }, event: Key(KeyEvent { code: Char('m'), modifiers: NONE }), double_click: false } 
12:02:53.782 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/imm", expr: BeTree { atoms: [PatternParts { parts: ["nt", "imm"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 
12:02:53.783 [DEBUG] broot::app::app: display panel took 1.156813ms 
12:02:53.784 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 132ns
FedericoStra commented 2 years ago

I can replicate the same panic and provide additional information. Here is what I did.

I compiled Broot (current master at 3474c157ec41cc9fc17b4923903737faddcc87d8) in dev mode after enabling the debug info in Cargo.toml:

[profile.dev]
debug = true

Then I ran

BROOT_LOG=trace RUST_BACKTRACE=full ./broot 2> backtrace.txt

from the home directory and blindly typed nt/imm (the TUI doesn't show up as I redirected stderr).

This way I managed to capture both the Broot log and the Rust panic backtrace. Here is their content.

broot.log ```text 23:10:32.782 [INFO] cli_log::init: Starting broot v1.14.3-dev with log level TRACE 23:10:32.783 [DEBUG] broot: env::args(): [ "./broot", ] 23:10:32.791 [DEBUG] broot::shell_install: No 'installed' : we ask if we can install 23:10:32.792 [DEBUG] broot::shell_install: User already refused the installation 23:10:32.792 [DEBUG] broot::shell_install: User refuses the installation. Doing nothing. 23:10:32.792 [DEBUG] broot::conf::conf: reading conf file: "/home/fstra/.config/broot/conf.hjson" 23:10:32.797 [DEBUG] broot::cli: Conf::from_default_location() took 5.119045ms 23:10:32.798 [DEBUG] broot::cli: config: Conf { files: [ "/home/fstra/.config/broot/conf.hjson", ], default_flags: None, date_time_format: None, verbs: [ VerbConf { invocation: Some( "edit", ), internal: None, external: None, execution: Some( String( "$EDITOR +{line} {file}", ), ), cmd: None, cmd_separator: None, key: None, keys: [], extensions: [], shortcut: Some( "e", ), leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "create {subpath}", ), internal: None, external: None, execution: Some( String( "$EDITOR {directory}/{subpath}", ), ), cmd: None, cmd_separator: None, key: None, keys: [], extensions: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "git_diff", ), internal: None, external: None, execution: Some( String( "git difftool -y {file}", ), ), cmd: None, cmd_separator: None, key: None, keys: [], extensions: [], shortcut: Some( "gd", ), leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: None, }, VerbConf { invocation: Some( "backup {version}", ), internal: None, external: None, execution: Some( String( "cp -r {file} {parent}/{file-stem}-{version}{file-dot-extension}", ), ), cmd: None, cmd_separator: None, key: Some( "ctrl-b", ), keys: [], extensions: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: None, working_dir: None, description: None, auto_exec: Some( false, ), }, VerbConf { invocation: Some( "terminal", ), internal: None, external: None, execution: Some( String( "$SHELL", ), ), cmd: None, cmd_separator: None, key: Some( "ctrl-t", ), keys: [], extensions: [], shortcut: None, leave_broot: Some( false, ), from_shell: None, apply_to: None, set_working_dir: Some( true, ), working_dir: None, description: None, auto_exec: None, }, ], skin: None, special_paths: {}, search_modes: None, disable_mouse_capture: None, capture_mouse: None, cols_order: None, show_selection_mark: Some( true, ), ext_colors: {}, syntax_theme: None, true_colors: None, icon_theme: None, modal: None, max_panels_count: None, quit_on_last_cancel: None, file_sum_threads_count: None, max_staged_count: None, imports: [], } 23:10:32.815 [DEBUG] broot::app::app_context: COLORTERM env variable = "truecolor" 23:10:32.816 [DEBUG] broot::app::app_context: true colors are available 23:10:32.816 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 334ns 23:10:32.821 [DEBUG] broot::tree_build::builder: blines before trimming: 54 23:10:32.828 [TRACE] mio::poll: registering event source with poller: token=Token(0), interests=READABLE 23:10:32.828 [TRACE] mio::poll: registering event source with poller: token=Token(1), interests=READABLE 23:10:32.830 [DEBUG] broot::app::app: display panel took 2.073753ms 23:10:32.830 [INFO] broot::app::app: pending_tasks took 2.77µs 23:10:34.121 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 1571, tv_nsec: 116361968 }, event: Key(KeyEvent { code: Char('n'), modifiers: NONE }), double_click: false } 23:10:34.123 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "n", expr: BeTree { atoms: [PatternParts { parts: ["n"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 23:10:34.127 [DEBUG] broot::app::app: display panel took 2.354304ms 23:10:34.127 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 395ns 23:10:34.197 [DEBUG] broot::tree_build::builder: blines before trimming: 631 23:10:34.201 [INFO] broot::browser::browser_state: tree filtering on "n" took 73.632338ms 23:10:34.204 [DEBUG] broot::app::app: display panel took 2.270308ms 23:10:34.204 [INFO] broot::app::app: pending_tasks took 76.406615ms 23:10:34.330 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 1571, tv_nsec: 325415349 }, event: Key(KeyEvent { code: Char('t'), modifiers: NONE }), double_click: false } 23:10:34.332 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt", expr: BeTree { atoms: [PatternParts { parts: ["nt"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 23:10:34.344 [DEBUG] broot::app::app: display panel took 9.601178ms 23:10:34.344 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 1.109µs 23:10:34.439 [DEBUG] broot::tree_build::builder: blines before trimming: 762 23:10:34.447 [INFO] broot::browser::browser_state: tree filtering on "nt" took 102.624735ms 23:10:34.450 [DEBUG] broot::app::app: display panel took 2.604391ms 23:10:34.450 [INFO] broot::app::app: pending_tasks took 106.099035ms 23:10:34.673 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 1571, tv_nsec: 668547684 }, event: Key(KeyEvent { code: Char('/'), modifiers: NONE }), double_click: false } 23:10:34.675 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/", expr: BeTree { atoms: [PatternParts { parts: ["nt", ""] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 23:10:34.683 [DEBUG] broot::app::app: display panel took 6.132177ms 23:10:34.684 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 1.63µs 23:10:34.705 [DEBUG] broot::tree_build::builder: blines before trimming: 54 23:10:34.720 [INFO] broot::browser::browser_state: tree filtering on "nt/" took 35.336426ms 23:10:34.722 [DEBUG] broot::app::app: display panel took 2.274865ms 23:10:34.722 [INFO] broot::app::app: pending_tasks took 38.687164ms 23:10:35.085 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 1572, tv_nsec: 81289937 }, event: Key(KeyEvent { code: Char('i'), modifiers: NONE }), double_click: false } 23:10:35.088 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/i", expr: BeTree { atoms: [PatternParts { parts: ["nt", "i"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 23:10:35.092 [DEBUG] broot::app::app: display panel took 2.321621ms 23:10:35.092 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 350ns 23:10:35.099 [DEBUG] broot::tree_build::builder: blines before trimming: 80 23:10:35.105 [INFO] broot::browser::browser_state: tree filtering on "nt/i" took 12.104072ms 23:10:35.108 [DEBUG] broot::app::app: display panel took 2.962939ms 23:10:35.108 [INFO] broot::app::app: pending_tasks took 15.59432ms 23:10:35.305 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 1572, tv_nsec: 300742041 }, event: Key(KeyEvent { code: Char('m'), modifiers: NONE }), double_click: false } 23:10:35.307 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/im", expr: BeTree { atoms: [PatternParts { parts: ["nt", "im"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 23:10:35.322 [DEBUG] broot::app::app: display panel took 12.723445ms 23:10:35.323 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 980ns 23:10:35.402 [DEBUG] broot::tree_build::builder: blines before trimming: 319 23:10:35.405 [INFO] broot::browser::browser_state: tree filtering on "nt/im" took 82.001893ms 23:10:35.408 [DEBUG] broot::app::app: display panel took 2.512504ms 23:10:35.408 [INFO] broot::app::app: pending_tasks took 85.394614ms 23:10:35.451 [INFO] broot::app::app: event: TimedEvent { time: Instant { tv_sec: 1572, tv_nsec: 446783466 }, event: Key(KeyEvent { code: Char('m'), modifiers: NONE }), double_click: false } 23:10:35.451 [DEBUG] broot::app::app: command after add_event: PatternEdit { raw: "nt/imm", expr: BeTree { atoms: [PatternParts { parts: ["nt", "imm"] }], nodes: [Node { operator: None, parent: None, left: Atom(0), right: None, unary: false }], head: 0, tail: 0, last_pushed: Atom, op_count: 0, openess: 0 } } 23:10:35.455 [DEBUG] broot::app::app: display panel took 2.548544ms 23:10:35.455 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 368ns ```
backtrace.txt This is just the tail of the file, after lots of garbage composed of ANSI escape sequences which represent the TUI: ```text thread 'main' panicked at 'attempt to subtract with overflow', src/pattern/tok_pattern.rs:91:40 stack backtrace: 0: 0x5634d689f28d - std::backtrace_rs::backtrace::libunwind::trace::h8e036432725b1c57 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x5634d689f28d - std::backtrace_rs::backtrace::trace_unsynchronized::h4f83092254c85869 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x5634d689f28d - std::sys_common::backtrace::_print_fmt::h9728b5e056a3ece3 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:66:5 3: 0x5634d689f28d - ::fmt::h48bb4bd2928827d2 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:45:22 4: 0x5634d68c633c - core::fmt::write::h909e69a2c24f44cc at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/fmt/mod.rs:1196:17 5: 0x5634d689a521 - std::io::Write::write_fmt::h7f4b8ab8af89e9ef at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/io/mod.rs:1654:15 6: 0x5634d68a0a85 - std::sys_common::backtrace::_print::hff4838ebf14a2171 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:48:5 7: 0x5634d68a0a85 - std::sys_common::backtrace::print::h2499280374189ad9 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:35:9 8: 0x5634d68a0a85 - std::panicking::default_hook::{{closure}}::h8b270fc55eeb284e at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:295:22 9: 0x5634d68a06f9 - std::panicking::default_hook::h3217e229d6e9d13c at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:314:9 10: 0x5634d68a1058 - std::panicking::rust_panic_with_hook::h9acb8048b738d2e0 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:698:17 11: 0x5634d68a0ec9 - std::panicking::begin_panic_handler::{{closure}}::h70f3b839526af6dc at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:586:13 12: 0x5634d689f744 - std::sys_common::backtrace::__rust_end_short_backtrace::h1ecf2cee857fbe0a at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:138:18 13: 0x5634d68a0c39 - rust_begin_unwind at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5 14: 0x5634d59a05b3 - core::panicking::panic_fmt::h9f8393e7fd56d655 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14 15: 0x5634d59a047d - core::panicking::panic::h021666fc6a0f7b6b at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:48:5 16: 0x5634d59e4020 - broot::pattern::tok_pattern::TokPattern::find_ranges::h79558859f1d7fd96 at /home/fstra/Code/rust/broot/src/pattern/tok_pattern.rs:91:40 17: 0x5634d59e4265 - broot::pattern::tok_pattern::TokPattern::score_of::he8d7e1fb719ac148 at /home/fstra/Code/rust/broot/src/pattern/tok_pattern.rs:151:9 18: 0x5634d59f8905 - broot::pattern::pattern::Pattern::score_of::hf1eddce0691781e1 at /home/fstra/Code/rust/broot/src/pattern/pattern.rs:159:37 19: 0x5634d5ccbf94 - broot::tree_build::builder::TreeBuilder::make_line::h21bfee2d3941ac4e at /home/fstra/Code/rust/broot/src/tree_build/builder.rs:155:57 20: 0x5634d5cccd59 - broot::tree_build::builder::TreeBuilder::load_children::h6e934d507e5b981c at /home/fstra/Code/rust/broot/src/tree_build/builder.rs:220:41 21: 0x5634d5ccde4c - broot::tree_build::builder::TreeBuilder::gather_lines::ha7f8386a32e37567 at /home/fstra/Code/rust/broot/src/tree_build/builder.rs:330:43 22: 0x5634d5ccf8e0 - broot::tree_build::builder::TreeBuilder::build_tree::h145f53ef48ca5cad at /home/fstra/Code/rust/broot/src/tree_build/builder.rs:464:9 23: 0x5634d5c57d7c - ::do_pending_task::h31cce53a1ca0ddf3 at /home/fstra/Code/rust/broot/src/browser/browser_state.rs:629:25 24: 0x5634d5ce9113 - broot::app::panel::Panel::do_pending_task::h5bb89cb2df36ea55 at /home/fstra/Code/rust/broot/src/app/panel.rs:116:9 25: 0x5634d5cd8653 - broot::app::app::App::do_pending_task::h032b64708e80b837 at /home/fstra/Code/rust/broot/src/app/app.rs:652:20 26: 0x5634d5cd8212 - broot::app::app::App::do_pending_tasks::hb0bb6a9762ba6847 at /home/fstra/Code/rust/broot/src/app/app.rs:620:25 27: 0x5634d5cd94c0 - broot::app::app::App::run::h15d60f19c195f421 at /home/fstra/Code/rust/broot/src/app/app.rs:725:21 28: 0x5634d5c5b55a - broot::cli::run::he25dc7d0bd9065f0 at /home/fstra/Code/rust/broot/src/cli/mod.rs:129:13 29: 0x5634d59a0ae3 - broot::main::hc11306e1620b6c38 at /home/fstra/Code/rust/broot/src/main.rs:6:11 30: 0x5634d59a220b - core::ops::function::FnOnce::call_once::h7b86fb4e6d9ef34c at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:248:5 31: 0x5634d59a097e - std::sys_common::backtrace::__rust_begin_short_backtrace::h77ee278d4f5a6045 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:122:18 32: 0x5634d59a1fd1 - std::rt::lang_start::{{closure}}::hf5f0b2111b788cde at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:145:18 33: 0x5634d6893c2e - core::ops::function::impls:: for &F>::call_once::h5f1ba3b861cac230 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:280:13 34: 0x5634d6893c2e - std::panicking::try::do_call::h4febfdb770eca39d at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492:40 35: 0x5634d6893c2e - std::panicking::try::h8b0eac8a7d726dbf at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456:19 36: 0x5634d6893c2e - std::panic::catch_unwind::h11b83c489c0d8394 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137:14 37: 0x5634d6893c2e - std::rt::lang_start_internal::{{closure}}::h63502d2988634103 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128:48 38: 0x5634d6893c2e - std::panicking::try::do_call::h4be475cff12d2aae at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492:40 39: 0x5634d6893c2e - std::panicking::try::h1a3b25b8eaf9ba31 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456:19 40: 0x5634d6893c2e - std::panic::catch_unwind::h224588ada67b9b0b at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137:14 41: 0x5634d6893c2e - std::rt::lang_start_internal::h2807b375c1959759 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128:20 42: 0x5634d59a1fa0 - std::rt::lang_start::h4656fc904b1ee3bf at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:144:17 43: 0x5634d59a174c - main 44: 0x7fbc7b83feb0 - __libc_start_call_main 45: 0x7fbc7b83ff60 - __libc_start_main_alias_2 46: 0x5634d59a08a5 - _start 47: 0x0 - ```
FedericoStra commented 2 years ago

The offending instruction is

https://github.com/Canop/broot/blob/3474c157ec41cc9fc17b4923903737faddcc87d8/src/pattern/tok_pattern.rs#L91

which in my case get's called with

self = TokPattern { toks: [['i', 'm', 'm']], sum_len: 3 }
candidate = "😍"
cand_chars = ['😍']
cand_chars.len() = 1
l = 3

hence 1 + 1 - 3 causes underflow in unsigned subtraction.

Why the emoji? The emoji comes from a checkout of the [Byron/dua-cli](https://github.com/Byron/dua-cli/tree/main/tests/fixtures/emoji) repo.
FedericoStra commented 2 years ago

The source of the bug seems to stem from a confusion between indexing a &str as if it were a &[u8] vs. treating it as a sequence of Unicode codepoints. This leads to different and incompatible ways to measure the "length" of a str. The discrepancy is demonstrated by this playground. See also this question on StackOverflow.

In the specific case of the panic described above, the test https://github.com/Canop/broot/blob/3474c157ec41cc9fc17b4923903737faddcc87d8/src/pattern/tok_pattern.rs#L83 fails because 4 < 3, but then this does not imply that cand_chars.len() + 1 - l >= 0, because cand_chars.len() is merely 1 and not 4.

Canop commented 2 years ago

Thanks for the report. I'll have a look as fast as possible, but that might be in several days

Canop commented 2 years ago

BTW, I was thinking about deprecating tokens search, which is almost useless IMO (which doesn't mean I don't want to fix it).

evanescente-ondine commented 2 years ago

Then would we get the same feature as simply ? case-insensitive research is not automatic with regexp search so it's a pain in the behind to add /i each and everytime. I most only use nt/ to search, with bits of the file name.

Canop commented 2 years ago

Yes, there's an issue somewhere about a case insensitive regex search, and I'll do that before deprecating the tokens search.

You should also consider the fuzzy search: its rank algorithm ensures tokens are privileged.

evanescente-ondine commented 2 years ago

Couldn't you just translate for instance "nt/abc,cfg, ifp" into: nr/(abc.cfg)|(cfg.abc)|(cfg.ifp)|(ifp.cfg)|(ifp.abc)|(afp.ifp) ? I would be fine with fuzzy search, if it could display results like fzf ignoring tree hierarchy, possibly hiding paths. Otherwise, while the token mode is precise to show almost only the desired result, fuzzy mode isn't, and regexp mode requires a lot more keystrokes.

FedericoStra commented 2 years ago

BTW, I was thinking about deprecating tokens search, which is almost useless IMO (which doesn't mean I don't want to fix it).

I think the biggest problem is that the search for the tokens is not complete. For instance, the pattern abc,ca should match the name cabcabc like this

cabcabc
^^  ^^^
ca  abc

but instead the longest token abc is matched to the first occurrence

cabcabc
 ^^^
 abc

and then we cannot find a non-overlapping ca anymore.

You can verify this claim by adding

    #[test]
    fn test_match() {
        // ...
        check_match("abc,ca", "cabcabc", true);
    }

and watch it fail.