id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
3449	"Segfault on ""Find file"" with ""Search for content"" on and ""Regular expression"" off"	zaytsev	zaytsev	"Hi,

I've installed 4.8.14 and realized that now basically any search with ""Find file"" dialog for normal search strings (non-regexps) leads to a segfault. Interestingly, when run under gdb, the segfault doesn't happen, so I suspected a non-initialized variable first. However, valgrind didn't show anything obvious and I've bisected between 4.8.13 & 4.8.13 with the following result:

{{{
933fd255d07f8bdb9ffe020bda259102890e971a is the first bad commit
commit 933fd255d07f8bdb9ffe020bda259102890e971a
Author: Boris Savelev <boris.savelev@gmail.com>
Date:   Tue Feb 24 16:05:38 2015 +0300

    Ticket #2743: File selection by patterns uses bytes instead of (unicode) characters
    
    Using the ""?"" pattern in the file selection dialog brought up with '+',
    mc uses the file name length in bytes instead of characters.
    
    Signed-off-by: Slava Zanko <slavazanko@gmail.com>

:040000 040000 5e7732736764d6413acf6a0732e5f3349459d532 9e5c4d502f7d1229fb73645a76ee2bfbd4f777fa M	lib
:040000 040000 bd65e3f59c6140ccbc355355a35762e79a344285 95be9c62d5270b041d96a0f72d1c58069e58799d M	tests
}}}

Therefore, I suspect that it's a regression introduced by #2743, which effectively removes G_REGEX_RAW for my case (UTF-8 locale), but I'm not sure of what's the right way to fix it.

Backtraces are as follows:

{{{
(gdb) bt
#0  0x00007f6be1fe05c3 in _pcre_xclass () from /lib/x86_64-linux-gnu/libpcre.so.3
#1  0x00007f6be1fce762 in ?? () from /lib/x86_64-linux-gnu/libpcre.so.3
#2  0x00007f6be1fcd5e2 in ?? () from /lib/x86_64-linux-gnu/libpcre.so.3
#3  0x00007f6be1fdd221 in pcre_exec () from /lib/x86_64-linux-gnu/libpcre.so.3
#4  0x00007f6be31d7e68 in g_match_info_next () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f6be31d94df in g_regex_match_full () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x000000000046161a in mc_search__regex_found_cond_one (search_str=<optimized out>, search_str=<optimized out>, regex=<optimized out>, lc_mc_search=<optimized out>) at regex.c:259
#7  mc_search__regex_found_cond (search_str=<optimized out>, lc_mc_search=<optimized out>) at regex.c:305
#8  mc_search__run_regex (lc_mc_search=0x27a7980, user_data=0x2797be0, start_search=3, end_search=140101329816960, found_len=0x7f6be1fe4b80 <_pcre_ucd_stage2>) at regex.c:880
#9  0x000000000049063f in search_content (filename=<optimized out>, directory=0x27970c0 ""/home/zaytsev/opt/clion-eap/bin/cmake/share/cmake-3.1/Modules"", h=0x27946e0) at find.c:1034
#10 do_search (h=0x27946e0) at find.c:1305
#11 0x00000000004908dd in find_callback (w=0x27946e0, sender=<optimized out>, msg=<optimized out>, parm=<optimized out>, data=<optimized out>) at find.c:1448
#12 0x00000000004185fc in send_message (data=0x0, parm=0, msg=MSG_IDLE, sender=0x0, w=0x27946e0) at ../../lib/widget/widget-common.h:167
#13 frontend_dlg_run (h=0x27946e0) at dialog.c:556
#14 dlg_run (h=0x27946e0) at dialog.c:1266
#15 0x0000000000491ac7 in run_process () at find.c:1604
#16 do_find (filename=<optimized out>, dirname=<optimized out>, content=<optimized out>, pattern=<optimized out>, ignore_dirs=<optimized out>, start_dir_len=<optimized out>, start_dir=<optimized out>)
    at find.c:1645
#17 find_file () at find.c:1780
#18 0x0000000000486e85 in find_cmd () at cmd.c:930
#19 0x000000000042f365 in midnight_execute_cmd (sender=0x0, command=105) at midnight.c:1210
#20 0x000000000042f92a in midnight_callback (w=<optimized out>, sender=0x0, msg=<optimized out>, parm=8255, data=<optimized out>) at midnight.c:1560
#21 0x0000000000418014 in send_message (data=0x0, parm=8255, msg=MSG_UNHANDLED_KEY, sender=0x0, w=0x2765fb0) at ../../lib/widget/widget-common.h:167
#22 dlg_key_event (d_key=8255, h=0x2765fb0) at dialog.c:518
#23 dlg_process_event (h=0x2765fb0, key=8255, event=<optimized out>) at dialog.c:1235
#24 0x000000000041863f in frontend_dlg_run (h=0x2765fb0) at dialog.c:569
#25 dlg_run (h=0x2765fb0) at dialog.c:1266
#26 0x00000000004307be in create_panels_and_run_mc () at midnight.c:960
#27 do_nc () at midnight.c:1763
#28 0x000000000040b392 in main (argc=1, argv=0x7ffd365bbca8) at main.c:418
}}}

{{{
(gdb) bt full
#0  0x00007f6be1fe05c3 in _pcre_xclass () from /lib/x86_64-linux-gnu/libpcre.so.3
No symbol table info available.
#1  0x00007f6be1fce762 in ?? () from /lib/x86_64-linux-gnu/libpcre.so.3
No symbol table info available.
#2  0x00007f6be1fcd5e2 in ?? () from /lib/x86_64-linux-gnu/libpcre.so.3
No symbol table info available.
#3  0x00007f6be1fdd221 in pcre_exec () from /lib/x86_64-linux-gnu/libpcre.so.3
No symbol table info available.
#4  0x00007f6be31d7e68 in g_match_info_next () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#5  0x00007f6be31d94df in g_regex_match_full () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#6  0x000000000046161a in mc_search__regex_found_cond_one (search_str=<optimized out>, search_str=<optimized out>, regex=<optimized out>, lc_mc_search=<optimized out>) at regex.c:259
        mcerror = 0x0
#7  mc_search__regex_found_cond (search_str=<optimized out>, lc_mc_search=<optimized out>) at regex.c:305
        loop1 = 41581000
#8  mc_search__run_regex (lc_mc_search=0x27a7980, user_data=0x2797be0, start_search=3, end_search=140101329816960, found_len=0x7f6be1fe4b80 <_pcre_ucd_stage2>) at regex.c:880
        ret = 41581000
        start_pos = 0
        end_pos = 0
#9  0x000000000049063f in search_content (filename=<optimized out>, directory=0x27970c0 ""/home/zaytsev/opt/clion-eap/bin/cmake/share/cmake-3.1/Modules"", h=0x27946e0) at find.c:1034
        ch = 0 '\000'
        i = 85
        line = <optimized out>
        strbuf = 0x27a7f50 ""\220\377\a?Vt\213\231\235\234\234\201\235\204\236\200\237\200\236\200\240\005\242\242\241\242\242\243\200\244\002\243\246\246\200\245\200\247,\250\202hYI;2,+''-7:DX`gjhLFD?;64311469<R_p\213\241\255\240\221{]3\217""
        pos = <optimized out>
        n_read = <optimized out>
        found = <optimized out>
        found_len = 41536624
        result = "" \237i\002\000\000\000\000\020_w\002\000\000\000\000\t\000\000\000\000\000\000\000 \237i\002\000\000\000\000`\246[6\375\177\000\000\270\266[6\375\177\000\000ȥ[6\375\177\000\000p\351\033\343k\177\000\000\001"", '\000' <repeats 15 times>, ""\001\b\000\000\000\000\000\000h\031\006\000\000\000\000\000\001\000\000\000\000\000\000\000\200\201\000\000\350\003\000\000\350\003"", '\000' <repeats 14 times>, ""\367+\000\000\000\000\000\000\000\020\000\000\000\000\000\000\030\000\000\000\000\000\000\000\017\320,U\000\000\000\000\314,x\r\000\000\000\000\017\320,U\000\000\000\000\314,x\r\000\000\000\000\017\320,U\000\000\000\000\314,x\r"", '\000' <repeats 28 times>...
        strbuf_size = <optimized out>
        buffer = ""icns\000\000\262\253it32\000\000r\233\000\000\000\000\377\377\377\377\232\377\230\021\000\020\203\017\213\020\004\017\020\022\023\022\222\021\001\020\020\220\021\222\377\003HXUX\200Z\201X\213V\220c\200a\022_VJC=81+'%\""##(/>A%%\200(\021*+,-07>GKXccllcbUL\221\000\220\377\a?Vt\213\231\235\234\234\201\235\204\236\200\237\200\236\200\240\005\242\242\241\242\242\243\200\244\002\243\246\246\200\245\200\247,\250\202hYI;2,+''-7:DX`gjhLFD?;64311469<R_p\213\241\255\240\221{]3\217\000\217\377\006\037U\201\242""...
        vpath = <optimized out>
        seconds = <optimized out>
        useconds = <optimized out>
        status_updated = <optimized out>
        file_fd = 101
        ret_val = 0
        s = {st_dev = 2049, st_ino = 542363, st_nlink = 1, st_mode = 33188, st_uid = 1000, st_gid = 1000, __pad0 = 0, st_rdev = 0, st_size = 45739, st_blksize = 4096, st_blocks = 96, st_atim = {
            tv_sec = 1428999873, tv_nsec = 608672654}, st_mtim = {tv_sec = 1427382262, tv_nsec = 0}, st_ctim = {tv_sec = 1427442754, tv_nsec = 28322291}, __glibc_reserved = {0, 0, 0}}
        tv = {tv_sec = 1429000207, tv_usec = 241806}
#10 do_search (h=0x27946e0) at find.c:1305
        search_ok = <optimized out>
        dp = 0x2779430
        dirp = 0x2771740
        directory = 0x27970c0 ""/home/zaytsev/opt/clion-eap/bin/cmake/share/cmake-3.1/Modules""
        tmp_stat = {st_dev = 2049, st_ino = 542363, st_nlink = 1, st_mode = 33188, st_uid = 1000, st_gid = 1000, __pad0 = 0, st_rdev = 0, st_size = 45739, st_blksize = 4096, st_blocks = 96, st_atim = {
            tv_sec = 1428999873, tv_nsec = 608672654}, st_mtim = {tv_sec = 1427382262, tv_nsec = 0}, st_ctim = {tv_sec = 1427442754, tv_nsec = 28322291}, __glibc_reserved = {0, 0, 0}}
        bytes_found = 24
        count = <optimized out>
#11 0x00000000004908dd in find_callback (w=0x27946e0, sender=<optimized out>, msg=<optimized out>, parm=<optimized out>, data=<optimized out>) at find.c:1448
        h = 0x27946e0
#12 0x00000000004185fc in send_message (data=0x0, parm=0, msg=MSG_IDLE, sender=0x0, w=0x27946e0) at ../../lib/widget/widget-common.h:167
        ret = MSG_NOT_HANDLED
#13 frontend_dlg_run (h=0x27946e0) at dialog.c:556
        d_key = <optimized out>
        event = {buttons = 0 '\000', modifiers = 0 '\000', vc = 0, dx = 0, dy = 0, x = -1, y = 67, type = (unknown: 0), clicks = 7385856, margin = (unknown: 0), wdx = 2200, wdy = 110}
#14 dlg_run (h=0x27946e0) at dialog.c:1266
No locals.
#15 0x0000000000491ac7 in run_process () at find.c:1604
No locals.
#16 do_find (filename=<optimized out>, dirname=<optimized out>, content=<optimized out>, pattern=<optimized out>, ignore_dirs=<optimized out>, start_dir_len=<optimized out>, start_dir=<optimized out>)
    at find.c:1645
        dir_tmp = 0x0
        file_tmp = 0x0
#17 find_file () at find.c:1780
        start_dir_len = 53
#18 0x0000000000486e85 in find_cmd () at cmd.c:930
No locals.
#19 0x000000000042f365 in midnight_execute_cmd (sender=0x0, command=105) at midnight.c:1210
        res = MSG_HANDLED
#20 0x000000000042f92a in midnight_callback (w=<optimized out>, sender=0x0, msg=<optimized out>, parm=8255, data=<optimized out>) at midnight.c:1560
        v = MSG_NOT_HANDLED
        command = <optimized out>
#21 0x0000000000418014 in send_message (data=0x0, parm=8255, msg=MSG_UNHANDLED_KEY, sender=0x0, w=0x2765fb0) at ../../lib/widget/widget-common.h:167
        ret = MSG_NOT_HANDLED
#22 dlg_key_event (d_key=8255, h=0x2765fb0) at dialog.c:518
        handled = <optimized out>
#23 dlg_process_event (h=0x2765fb0, key=8255, event=<optimized out>) at dialog.c:1235
No locals.
#24 0x000000000041863f in frontend_dlg_run (h=0x2765fb0) at dialog.c:569
        d_key = <optimized out>
        event = {buttons = 0 '\000', modifiers = 6 '\006', vc = 631, dx = 0, dy = 0, x = -1, y = 110, type = (unknown: 0), clicks = 7197696, margin = (unknown: 0), wdx = 14224, wdy = 110}
#25 dlg_run (h=0x2765fb0) at dialog.c:1266
No locals.
#26 0x00000000004307be in create_panels_and_run_mc () at midnight.c:960
No locals.
#27 do_nc () at midnight.c:1763
        ret = <optimized out>
#28 0x000000000040b392 in main (argc=1, argv=0x7ffd365bbca8) at main.c:418
        mcerror = 0x0
        config_migrated = <optimized out>
        config_migrate_msg = 0x7ffd365bbcb8 ""\271\302[6\375\177""
        exit_code = 1
}}}

Please let me know if there is any more info I can provide to help fixing this ASAP... it basically makes grepping (core functionality!) unusable for me.

Many thanks!"	defect	closed	critical	4.8.15	mc-search	4.8.14	fixed		egmont@… onlyjob@… mooffie@…			merged	committed-master
