{"thread":{"id":"51955","subject":"git crash in range-diff","startedAt":"2019-10-02T08:21:43Z","lastAt":"2019-10-02T14:16:22Z","messageCount":3,"participants":["Michal Suchánek","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"383263","messageId":"20190923101929.GA18205@kitsune.suse.cz","threadId":"51955","inReplyTo":null,"subject":"git crash in range-diff","fromName":"Michal Suchánek","fromEmail":"msuchanek@suse.de","sentAt":"2019-10-02T08:21:37Z","receivedAt":"2019-10-02T08:21:43Z","isPatch":false,"sender":{"key":"msuchanek@suse.de","avatar":"https://avatars.githubusercontent.com/u/787652?v=4"},"body":"Hello,\n\nI get a crash in range-diff. It used to work in the past but I don't use\nit often so can't really say if this is a regression or a particular\ndata triggering the crash.\n\nIt is not 100% broken - it woks on some other ranges.\n\nThanks\n\nMichal\n\n\nScript started on 2019-09-23 12:15:54+0200\n\u001b[0;32m✔\u001b[0;0m \u001b[0;33m~/kernel-source\u001b[0;0m [\u001b[0;35mSLE15-SP2\u001b[0;0m ↑·82\u001b[0;0m|\u001b[0;36m…17791\u001b[0;0m\u001b[1;34m⚑ 9\u001b[0;0m\u001b[0;0m] \n\u001b[0;37m12:15\u001b[0;0m $ gdb --args git range-diff 76ac02e3549..cd5f86d59a73 76ac02e3549..3b77e5866178\nGNU gdb (GDB; openSUSE Leap 15.0) 8.2\nCopyright (C) 2018 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\nType \"show copying\" and \"show warranty\" for details.\nThis GDB was configured as \"x86_64-suse-linux\".\nType \"show configuration\" for configuration details.\nFor bug reporting instructions, please see:\n<http://bugs.opensuse.org/>.\nFind the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>.\n\nFor help, type \"help\".\nType \"apropos word\" to search for commands related to \"word\"...\nReading symbols from git...Reading symbols from /usr/lib/debug/usr/lib/git/git-2.23.0-lp150.2.2.x86_64.debug...done.\ndone.\n(gdb) r\nStarting program: /usr/bin/git range-diff 76ac02e3549..cd5f86d59a73 76ac02e3549..3b77e5866178\nMissing separate debuginfo for /usr/lib64/libpcre2-8.so.0\nTry: zypper install -C \"debuginfo(build-id)=fc416d8eaba5b7885c5042011cee1dc1ce3e5b10\"\nMissing separate debuginfo for /lib64/libz.so.1\nTry: zypper install -C \"debuginfo(build-id)=e7ce95ccdb1c6c047ea33e32c0ae3a2f12b6d00e\"\nMissing separate debuginfo for /usr/lib64/libsha1detectcoll.so.1\nTry: zypper install -C \"debuginfo(build-id)=c64e737e69cc4b1498976d7d56c8962715199280\"\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library \"/lib64/libthread_db.so.1\".\n[Detaching after fork from child process 3067]\n[Detaching after fork from child process 3068]\n\u001b[?1049h\u001b[22;0;0t\u001b[?1h\u001b=\nProgram received signal SIGSEGV, Segmentation fault.\n__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:62\n62\t\tVPCMPEQ (%rdi), %ymm0, %ymm1\n(gdb) bt full\n#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:62\nNo locals.\n#1  0x00005555556cf00f in strbuf_addstr (s=<optimized out>, sb=0x7fffffffd2d0) at strbuf.h:292\nNo locals.\n#2  read_patches (range=range@entry=0x555555a69340 \"76ac02e3549..cd5f86d59a73\", list=list@entry=0x7fffffffd640) at range-diff.c:126\n        patch = {new_name = 0x0, old_name = 0x0, def_name = 0x0, old_mode = 33188, new_mode = 0, is_new = 0, is_delete = 0, rejected = 0, \n          ws_rule = 0, lines_added = 0, lines_deleted = 0, score = 0, extension_linenr = 0, is_toplevel_relative = 0, inaccurate_eof = 0, \n          is_binary = 0, is_copy = 0, is_rename = 0, recount = 0, conflicted_threeway = 0, direct_to_threeway = 0, crlf_in_old = 0, \n          fragments = 0x0, result = 0x0, resultsize = 0, old_oid_prefix = \"c452d7c1308d\", '\\000' <repeats 52 times>, \n          new_oid_prefix = \"dd7b242a4c00\", '\\000' <repeats 52 times>, next = 0x0, threeway_stage = {{hash = '\\000' <repeats 31 times>}, {\n              hash = '\\000' <repeats 31 times>}, {hash = '\\000' <repeats 31 times>}}}\n        root = {alloc = 0, len = 0, buf = 0x555555a64920 <strbuf_slopbuf> \"\"}\n        linenr = 4\n        p = <optimized out>\n        cp = {argv = 0x555555a6a390, args = {argv = 0x555555a6a390, argc = 12, alloc = 24}, env_array = {\n            argv = 0x555555a2f760 <empty_argv>, argc = 0, alloc = 0}, pid = 3068, trace2_child_id = 0, trace2_child_us_start = 0, \n          trace2_child_class = 0x0, trace2_hook_name = 0x0, in = 0, out = 3, err = 0, dir = 0x0, env = 0x555555a2f760 <empty_argv>, \n          no_stdin = 1, no_stdout = 0, no_stderr = 0, git_cmd = 1, silent_exec_failure = 0, stdout_to_stderr = 0, use_shell = 0, \n          clean_on_exit = 0, wait_after_clean = 0, clean_on_exit_handler = 0x0, clean_on_exit_handler_cbdata = 0x0}\n        buf = {alloc = 6816, len = 5924, \n          buf = 0x555555a864c0 \" ## Metadata ##\\nAuthor: Michal Suchanek <msuchanek@suse.de>\\n\\n ## Commit message ##\\n    Refresh sorted section.\\n\\n    - Refresh patches.suse/powerpc-dump-kernel-log-before-carrying-out-fadump-o.patch wi\"...}\n        contents = {alloc = 947512, len = 679767, buf = 0x7ffff7e69010 \"commit 999192044274522b2d5820f40cd1a7436cce31b9\"}\n        util = 0x555555a6a600\n        in_header = 0\n        line = 0x7ffff7e6aea0 \"diff --git series.conf series.conf\\nindex c452d7c1308d..dd7b242a4c00 100644\\n--- series.conf\\n+++ series.conf\\n@@ -47,17 +47,14 @@\\n#\\t\", '#' <repeats 56 times>, \"\\n#\\t# sorted pat\"...\n        current_filename = 0x555555a6b010 \"scsi-cxlflash-Mark-expected-switch-fall-throughs.patch\"\n        offset = <optimized out>\n        len = 107\n        size = 671943\n#3  0x00005555556cf304 in show_range_diff (range1=0x555555a69340 \"76ac02e3549..cd5f86d59a73\", \n    range2=0x555555a6a360 \"76ac02e3549..3b77e5866178\", creation_factor=60, dual_color=1, diffopt=diffopt@entry=0x7fffffffda60)\n    at range-diff.c:505\n        res = 0\n        branch1 = {items = 0x0, nr = 0, alloc = 0, strdup_strings = 1, cmp = 0x0}\n--Type <RET> for more, q to quit, c to continue without paging--c\n        branch2 = {items = 0x0, nr = 0, alloc = 0, strdup_strings = 1, cmp = 0x0}\n#4  0x00005555555de7c8 in cmd_range_diff (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>) at builtin/range-diff.c:80\n        creation_factor = 60\n        diffopt = {orderfile = 0x0, pickaxe = 0x0, single_follow = 0x0, a_prefix = 0x5555557b3780 \"\", b_prefix = 0x5555557b3780 \"\", line_prefix = 0x0, line_prefix_length = 0, flags = {recursive = 0, tree_in_recursive = 0, binary = 0, text = 0, full_index = 0, silent_on_remove = 0, find_copies_harder = 0, follow_renames = 0, rename_empty = 1, has_changes = 0, quick = 0, no_index = 0, allow_external = 0, exit_with_status = 0, reverse_diff = 0, check_failed = 0, relative_name = 0, ignore_submodules = 0, dirstat_cumulative = 0, dirstat_by_file = 0, allow_textconv = 0, textconv_set_via_cmdline = 0, diff_from_contents = 0, dirty_submodules = 0, ignore_untracked_in_submodules = 0, ignore_dirty_submodules = 0, override_submodule_config = 0, dirstat_by_line = 0, funccontext = 0, default_follow_renames = 0, stat_with_summary = 0, suppress_diff_headers = 0, dual_color_diffed_diffs = 0, suppress_hunk_header_line_count = 0}, filter = 0, use_color = -1, context = 3, interhunkcontext = 0, break_opt = -1, detect_rename = 0, irreversible_delete = 0, skip_stat_unmatch = 0, line_termination = 10, output_format = 0, pickaxe_opts = 0, rename_score = 0, rename_limit = -1, needed_rename_limit = 0, degraded_cc_to_c = 0, show_rename_progress = 0, dirstat_permille = 30, setup = 0, abbrev = 12, ita_invisible_in_index = 0, ws_error_highlight = 4096, prefix = 0x0, prefix_length = 0, stat_sep = 0x0, xdl_opts = 8388608, anchors = 0x0, anchors_nr = 0, anchors_alloc = 0, stat_width = 0, stat_name_width = 0, stat_graph_width = 0, stat_count = 0, word_regex = 0x0, word_diff = DIFF_WORDS_NONE, submodule_format = DIFF_SUBMODULE_SHORT, objfind = 0x0, found_changes = 0, found_follow = 0, set_default = 0x0, file = 0x7ffff7309720 <_IO_2_1_stdout_>, close_file = 0, output_indicators = \"+- \", pathspec = {nr = 0, has_wildcard = 0, recursive = 0, recurse_submodules = 0, magic = 0, max_depth = 0, items = 0x0}, pathchange = 0x0, change = 0x55555566a3a0 <diff_change>, add_remove = 0x55555566a8b0 <diff_addremove>, change_fn_data = 0x0, format_callback = 0x0, format_callback_data = 0x0, output_prefix = 0x0, output_prefix_data = 0x0, diff_path_counter = 0, emitted_symbols = 0x0, color_moved = COLOR_MOVED_NO, color_moved_ws_handling = 0, repo = 0x555555a53b20 <the_repo>, parseopts = 0x0}\n        simple_color = -1\n        range_diff_options = {{type = OPTION_INTEGER, short_name = 0, long_name = 0x555555785379 \"creation-factor\", value = 0x7fffffffd928, argh = 0x555555786937 \"n\", help = 0x55555578d0c0 \"Percentage by which creation is weighted\", flags = 0, callback = 0x0, defval = 0, ll_callback = 0x0, extra = 0}, {type = OPTION_SET_INT, short_name = 0, long_name = 0x55555578d05c \"no-dual-color\", value = 0x7fffffffd92c, argh = 0x0, help = 0x55555578d06a \"use simple diff colors\", flags = 2, callback = 0x0, defval = 1, ll_callback = 0x0, extra = 0}, {type = OPTION_END, short_name = 0, long_name = 0x0, value = 0x0, argh = 0x0, help = 0x0, flags = 0, callback = 0x0, defval = 0, ll_callback = 0x0, extra = 0}}\n        options = 0x0\n        res = 0\n        range1 = {alloc = 26, len = 25, buf = 0x555555a69340 \"76ac02e3549..cd5f86d59a73\"}\n        range2 = {alloc = 26, len = 25, buf = 0x555555a6a360 \"76ac02e3549..3b77e5866178\"}\n#5  0x000055555557146d in run_builtin (argv=<optimized out>, argc=<optimized out>, p=<optimized out>) at git.c:445\n        status = <optimized out>\n        help = <optimized out>\n        st = {st_dev = 93824997553696, st_ino = 140737336887026, st_nlink = 140737488347232, st_mode = 114, st_uid = 0, st_gid = 1436972576, __pad0 = 21845, st_rdev = 5522724075126890240, st_size = 93824997553824, st_blksize = 93824997553696, st_blocks = 140737488346480, st_atim = {tv_sec = 140737488350949, tv_nsec = 140737488347232}, st_mtim = {tv_sec = 93824997324640, tv_nsec = 140737488346640}, st_ctim = {tv_sec = 140737337196512, tv_nsec = 140737488346480}, __glibc_reserved = {93824994140141, 93824997552896, 93824993439848}}\n        prefix = <optimized out>\n        status = <optimized out>\n        help = <optimized out>\n        st = <optimized out>\n        prefix = <optimized out>\n        nongit_ok = <optimized out>\n#6  handle_builtin (argc=<optimized out>, argv=<optimized out>) at git.c:674\n        args = {argv = 0x555555a2f760 <empty_argv>, argc = 0, alloc = 0}\n        cmd = <optimized out>\n        builtin = 0x555555a13f70 <commands+1968>\n#7  0x0000555555572575 in run_argv (argv=0x7fffffffddd0, argcp=0x7fffffffdddc) at git.c:741\n        done_alias = 0\n        cmd_list = {items = 0x0, nr = 0, alloc = 0, strdup_strings = 0, cmp = 0x0}\n        seen = <optimized out>\n        done_alias = <optimized out>\n        cmd_list = <optimized out>\n        seen = <optimized out>\n        args = <optimized out>\n        i = <optimized out>\n        i = <optimized out>\n        sb = <optimized out>\n        item = <optimized out>\n#8  cmd_main (argc=<optimized out>, argv=<optimized out>) at git.c:872\n        was_alias = <optimized out>\n        cmd = 0x7fffffffe488 \"range-diff\"\n        done_help = <optimized out>\n#9  0x00005555555710a8 in main (argc=4, argv=0x7fffffffe068) at common-main.c:52\n        result = <optimized out>\n(gdb) l\n57\t\tandl\t$(2 * VEC_SIZE - 1), %ecx\n58\t\tcmpl\t$VEC_SIZE, %ecx\n59\t\tja\tL(cros_page_boundary)\n60\t\n61\t\t/* Check the first VEC_SIZE bytes.  */\n62\t\tVPCMPEQ (%rdi), %ymm0, %ymm1\n63\t\tvpmovmskb %ymm1, %eax\n64\t\ttestl\t%eax, %eax\n65\t\n66\t# ifdef USE_AS_STRNLEN\n(gdb) quit\nA debugging session is active.\n\n\tInferior 1 [process 3063] will be killed.\n\nQuit anyway? (y or n) y\n\r\u001b[K\u001b[7mlines ?-?/? (END)\u001b[27m\u001b[K\r\u001b[K\u001b[?1l\u001b>\u001b[?1049l\u001b[23;0;0t\u001b[0;32m✔\u001b[0;0m \u001b[0;33m~/kernel-source\u001b[0;0m [\u001b[0;35mSLE15-SP2\u001b[0;0m ↑·82\u001b[0;0m|\u001b[0;36m…17791\u001b[0;0m\u001b[1;34m⚑ 9\u001b[0;0m\u001b[0;0m] \n\u001b[0;37m12:16\u001b[0;0m $ gdb --args git range-diff 76ac02e3549..cd5f86d59a73 76ac02e3549..3b77e5866178\r\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[Cldd `which git`\u001b[K\n\tlinux-vdso.so.1 (0x00007ffe55bfd000)\n\tlibpcre2-8.so.0 => /usr/lib64/libpcre2-8.so.0 (0x00007f125f849000)\n\tlibz.so.1 => /lib64/libz.so.1 (0x00007f125f632000)\n\tlibsha1detectcoll.so.1 => /usr/lib64/libsha1detectcoll.so.1 (0x00007f125f428000)\n\tlibpthread.so.0 => /lib64/libpthread.so.0 (0x00007f125f20a000)\n\tlibrt.so.1 => /lib64/librt.so.1 (0x00007f125f002000)\n\tlibc.so.6 => /lib64/libc.so.6 (0x00007f125ec48000)\n\t/lib64/ld-linux-x86-64.so.2 (0x00007f125ffdc000)\n\u001b[0;32m✔\u001b[0;0m \u001b[0;33m~/kernel-source\u001b[0;0m [\u001b[0;35mSLE15-SP2\u001b[0;0m ↑·82\u001b[0;0m|\u001b[0;36m…17791\u001b[0;0m\u001b[1;34m⚑ 9\u001b[0;0m\u001b[0;0m] \n\u001b[0;37m12:16\u001b[0;0m $ exit\n\nScript done on 2019-09-23 12:16:17+0200\n"},{"id":"383267","messageId":"nycvar.QRO.7.76.6.1910021129010.46@tvgsbejvaqbjf.bet","threadId":"51955","inReplyTo":"20190923101929.GA18205@kitsune.suse.cz","subject":"Re: git crash in range-diff","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-10-02T09:41:53Z","receivedAt":"2019-10-02T09:42:13Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Michal,\n\nOn Wed, 2 Oct 2019, Michal Suchánek wrote:\n\n> I get a crash in range-diff. It used to work in the past but I don't use\n> it often so can't really say if this is a regression or a particular\n> data triggering the crash.\n\nIt would always be helpful to add a Minimal, Complete & Verifiable\nExample with your bug reports. If that is too much of a burden ;-) at\nleast try to give a Complete & Verifiable Example.\n\nOf course, the absence of this example leaves me totally free to say\nthat I cannot do much of anything about it and I kick it right back into\nyour court.\n\nNot without giving you a couple of hopefully useful hints, though:\n\n> [...]\n> Program received signal SIGSEGV, Segmentation fault.\n> __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:62\n> 62\t\tVPCMPEQ (%rdi), %ymm0, %ymm1\n> (gdb) bt full\n> #0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:62\n> No locals.\n> #1  0x00005555556cf00f in strbuf_addstr (s=<optimized out>, sb=0x7fffffffd2d0) at strbuf.h:292\n> No locals.\n> #2  read_patches (range=range@entry=0x555555a69340 \"76ac02e3549..cd5f86d59a73\", list=list@entry=0x7fffffffd640) at range-diff.c:126\n\nThe line 126 in `range-diff.c` wants to append `patch.new_name` to a\n`strbuf`, but that `patch.new_name` is `NULL`:\n\n>         patch = {new_name = 0x0, old_name = 0x0, def_name = 0x0, old_mode = 33188, new_mode = 0, is_new = 0, is_delete = 0, rejected = 0,\n                   ^^^^^^^^^^^^^^\n\nSo where should that have been populated? These are the lines 114--126\nof `range-diff.c:\n\n\tlen = parse_git_diff_header(&root, &linenr, 1, line,\n\t\t\t\t    len, size, &patch);\n\n\tif (len < 0)\n\t\tdie(_(\"could not parse git header '%.*s'\"), (int)len, line);\n\tstrbuf_addstr(&buf, \" ## \");\n\tif (patch.is_new > 0)\n\t\tstrbuf_addf(&buf, \"%s (new)\", patch.new_name);\n\telse if (patch.is_delete > 0)\n\t\tstrbuf_addf(&buf, \"%s (deleted)\", patch.old_name);\n\telse if (patch.is_rename)\n\t\tstrbuf_addf(&buf, \"%s => %s\", %patch.old_name, %patch.new_name);\n\telse\n\t\tstrbuf_addstr(&buf, patch.new_name);\n\nSo I think the problem is that `parse_git_diff_header()` (which is\nlocated in `apply.c`) fails to parse the new name correctly, but somehow\nstill reports success.\n\nAnd indeed, when I look at the variable `line`:\n\n>           ws_rule = 0, lines_added = 0, lines_deleted = 0, score = 0, extension_linenr = 0, is_toplevel_relative = 0, inaccurate_eof = 0,\n>           is_binary = 0, is_copy = 0, is_rename = 0, recount = 0, conflicted_threeway = 0, direct_to_threeway = 0, crlf_in_old = 0,\n>           fragments = 0x0, result = 0x0, resultsize = 0, old_oid_prefix = \"c452d7c1308d\", '\\000' <repeats 52 times>,\n>           new_oid_prefix = \"dd7b242a4c00\", '\\000' <repeats 52 times>, next = 0x0, threeway_stage = {{hash = '\\000' <repeats 31 times>}, {\n>               hash = '\\000' <repeats 31 times>}, {hash = '\\000' <repeats 31 times>}}}\n>         root = {alloc = 0, len = 0, buf = 0x555555a64920 <strbuf_slopbuf> \"\"}\n>         linenr = 4\n>         p = <optimized out>\n>         cp = {argv = 0x555555a6a390, args = {argv = 0x555555a6a390, argc = 12, alloc = 24}, env_array = {\n>             argv = 0x555555a2f760 <empty_argv>, argc = 0, alloc = 0}, pid = 3068, trace2_child_id = 0, trace2_child_us_start = 0,\n>           trace2_child_class = 0x0, trace2_hook_name = 0x0, in = 0, out = 3, err = 0, dir = 0x0, env = 0x555555a2f760 <empty_argv>,\n>           no_stdin = 1, no_stdout = 0, no_stderr = 0, git_cmd = 1, silent_exec_failure = 0, stdout_to_stderr = 0, use_shell = 0,\n>           clean_on_exit = 0, wait_after_clean = 0, clean_on_exit_handler = 0x0, clean_on_exit_handler_cbdata = 0x0}\n>         buf = {alloc = 6816, len = 5924,\n>           buf = 0x555555a864c0 \" ## Metadata ##\\nAuthor: Michal Suchanek <msuchanek@suse.de>\\n\\n ## Commit message ##\\n    Refresh sorted section.\\n\\n    - Refresh patches.suse/powerpc-dump-kernel-log-before-carrying-out-fadump-o.patch wi\"...}\n>         contents = {alloc = 947512, len = 679767, buf = 0x7ffff7e69010 \"commit 999192044274522b2d5820f40cd1a7436cce31b9\"}\n>         util = 0x555555a6a600\n>         in_header = 0\n>         line = 0x7ffff7e6aea0 \"diff --git series.conf series.conf\\nindex c452d7c1308d..dd7b242a4c00 100644\\n--- series.conf\\n+++ series.conf\\n@@ -47,17 +47,14 @@\\n#\\t\", '#' <repeats 56 times>, \"\\n#\\t# sorted pat\"...\n                                            ^^^^^^^^^^^ ^^^^^^^^^^^\n\nI see that neither old nor new name start with the expected `a/` and\n`b/`, respectively. But that `1` that was passed to\n`parse_git_diff_header()` is the `p_value`, i.e. the number of leading\ndirectories to strip from the file names.\n\nAnd when there is nothing to strip, but it was told to strip something,\nI guess `parse_git_diff_header()` just ignores it and leaves `new_name`\nunassigned.\n\nSo here is how you can chase this down further:\n\n- Why are those `a/` and `b/` prefixes missing? They should not be\n  missing, they should be generated by default, and `range-diff` expects\n  them.\n\n  Probably some funny config setting in your setup, something that\n  should probably be explicitly overridden by the `range-diff` machinery\n  when generating those patches that are then fed into `read_patches()`.\n\n- Why is `parse_git_diff_headers()` failing to report failure? You would\n  be in the best position to debug this, probably by wittling down the\n  example you have to something smaller so that you hit that snag right\n  away, then setting a breakpoint on `parse_git_diff_headers()` and/or\n  `git_header_name()` and single-step through it to find out where it\n  failed to parse the name, and then try to patch it so that it returns\n  failure in that case.\n\nGood luck,\nJohannes\n\n>         current_filename = 0x555555a6b010 \"scsi-cxlflash-Mark-expected-switch-fall-throughs.patch\"\n>         offset = <optimized out>\n>         len = 107\n>         size = 671943\n> #3  0x00005555556cf304 in show_range_diff (range1=0x555555a69340 \"76ac02e3549..cd5f86d59a73\",\n>     range2=0x555555a6a360 \"76ac02e3549..3b77e5866178\", creation_factor=60, dual_color=1, diffopt=diffopt@entry=0x7fffffffda60)\n>     at range-diff.c:505\n>         res = 0\n>         branch1 = {items = 0x0, nr = 0, alloc = 0, strdup_strings = 1, cmp = 0x0}\n> --Type <RET> for more, q to quit, c to continue without paging--c\n>         branch2 = {items = 0x0, nr = 0, alloc = 0, strdup_strings = 1, cmp = 0x0}\n> #4  0x00005555555de7c8 in cmd_range_diff (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>) at builtin/range-diff.c:80\n>         creation_factor = 60\n>         diffopt = {orderfile = 0x0, pickaxe = 0x0, single_follow = 0x0, a_prefix = 0x5555557b3780 \"\", b_prefix = 0x5555557b3780 \"\", line_prefix = 0x0, line_prefix_length = 0, flags = {recursive = 0, tree_in_recursive = 0, binary = 0, text = 0, full_index = 0, silent_on_remove = 0, find_copies_harder = 0, follow_renames = 0, rename_empty = 1, has_changes = 0, quick = 0, no_index = 0, allow_external = 0, exit_with_status = 0, reverse_diff = 0, check_failed = 0, relative_name = 0, ignore_submodules = 0, dirstat_cumulative = 0, dirstat_by_file = 0, allow_textconv = 0, textconv_set_via_cmdline = 0, diff_from_contents = 0, dirty_submodules = 0, ignore_untracked_in_submodules = 0, ignore_dirty_submodules = 0, override_submodule_config = 0, dirstat_by_line = 0, funccontext = 0, default_follow_renames = 0, stat_with_summary = 0, suppress_diff_headers = 0, dual_color_diffed_diffs = 0, suppress_hunk_header_line_count = 0}, filter = 0, use_color = -1, context = 3, interhunkcontext = 0, break_opt = -1, detect_rename = 0, irreversible_delete = 0, skip_stat_unmatch = 0, line_termination = 10, output_format = 0, pickaxe_opts = 0, rename_score = 0, rename_limit = -1, needed_rename_limit = 0, degraded_cc_to_c = 0, show_rename_progress = 0, dirstat_permille = 30, setup = 0, abbrev = 12, ita_invisible_in_index = 0, ws_error_highlight = 4096, prefix = 0x0, prefix_length = 0, stat_sep = 0x0, xdl_opts = 8388608, anchors = 0x0, anchors_nr = 0, anchors_alloc = 0, stat_width = 0, stat_name_width = 0, stat_graph_width = 0, stat_count = 0, word_regex = 0x0, word_diff = DIFF_WORDS_NONE, submodule_format = DIFF_SUBMODULE_SHORT, objfind = 0x0, found_changes = 0, found_follow = 0, set_default = 0x0, file = 0x7ffff7309720 <_IO_2_1_stdout_>, close_file = 0, output_indicators = \"+- \", pathspec = {nr = 0, has_wildcard = 0, recursive = 0, recurse_submodules = 0, magic = 0, max_depth = 0, items = 0x0}, pathchange = 0x0, change = 0x55555566a3a0 <diff_change>, add_remove = 0x55555566a8b0 <diff_addremove>, change_fn_data = 0x0, format_callback = 0x0, format_callback_data = 0x0, output_prefix = 0x0, output_prefix_data = 0x0, diff_path_counter = 0, emitted_symbols = 0x0, color_moved = COLOR_MOVED_NO, color_moved_ws_handling = 0, repo = 0x555555a53b20 <the_repo>, parseopts = 0x0}\n>         simple_color = -1\n>         range_diff_options = {{type = OPTION_INTEGER, short_name = 0, long_name = 0x555555785379 \"creation-factor\", value = 0x7fffffffd928, argh = 0x555555786937 \"n\", help = 0x55555578d0c0 \"Percentage by which creation is weighted\", flags = 0, callback = 0x0, defval = 0, ll_callback = 0x0, extra = 0}, {type = OPTION_SET_INT, short_name = 0, long_name = 0x55555578d05c \"no-dual-color\", value = 0x7fffffffd92c, argh = 0x0, help = 0x55555578d06a \"use simple diff colors\", flags = 2, callback = 0x0, defval = 1, ll_callback = 0x0, extra = 0}, {type = OPTION_END, short_name = 0, long_name = 0x0, value = 0x0, argh = 0x0, help = 0x0, flags = 0, callback = 0x0, defval = 0, ll_callback = 0x0, extra = 0}}\n>         options = 0x0\n>         res = 0\n>         range1 = {alloc = 26, len = 25, buf = 0x555555a69340 \"76ac02e3549..cd5f86d59a73\"}\n>         range2 = {alloc = 26, len = 25, buf = 0x555555a6a360 \"76ac02e3549..3b77e5866178\"}\n> #5  0x000055555557146d in run_builtin (argv=<optimized out>, argc=<optimized out>, p=<optimized out>) at git.c:445\n>         status = <optimized out>\n>         help = <optimized out>\n>         st = {st_dev = 93824997553696, st_ino = 140737336887026, st_nlink = 140737488347232, st_mode = 114, st_uid = 0, st_gid = 1436972576, __pad0 = 21845, st_rdev = 5522724075126890240, st_size = 93824997553824, st_blksize = 93824997553696, st_blocks = 140737488346480, st_atim = {tv_sec = 140737488350949, tv_nsec = 140737488347232}, st_mtim = {tv_sec = 93824997324640, tv_nsec = 140737488346640}, st_ctim = {tv_sec = 140737337196512, tv_nsec = 140737488346480}, __glibc_reserved = {93824994140141, 93824997552896, 93824993439848}}\n>         prefix = <optimized out>\n>         status = <optimized out>\n>         help = <optimized out>\n>         st = <optimized out>\n>         prefix = <optimized out>\n>         nongit_ok = <optimized out>\n> #6  handle_builtin (argc=<optimized out>, argv=<optimized out>) at git.c:674\n>         args = {argv = 0x555555a2f760 <empty_argv>, argc = 0, alloc = 0}\n>         cmd = <optimized out>\n>         builtin = 0x555555a13f70 <commands+1968>\n> #7  0x0000555555572575 in run_argv (argv=0x7fffffffddd0, argcp=0x7fffffffdddc) at git.c:741\n>         done_alias = 0\n>         cmd_list = {items = 0x0, nr = 0, alloc = 0, strdup_strings = 0, cmp = 0x0}\n>         seen = <optimized out>\n>         done_alias = <optimized out>\n>         cmd_list = <optimized out>\n>         seen = <optimized out>\n>         args = <optimized out>\n>         i = <optimized out>\n>         i = <optimized out>\n>         sb = <optimized out>\n>         item = <optimized out>\n> #8  cmd_main (argc=<optimized out>, argv=<optimized out>) at git.c:872\n>         was_alias = <optimized out>\n>         cmd = 0x7fffffffe488 \"range-diff\"\n>         done_help = <optimized out>\n> #9  0x00005555555710a8 in main (argc=4, argv=0x7fffffffe068) at common-main.c:52\n>         result = <optimized out>\n> (gdb) l\n> 57\t\tandl\t$(2 * VEC_SIZE - 1), %ecx\n> 58\t\tcmpl\t$VEC_SIZE, %ecx\n> 59\t\tja\tL(cros_page_boundary)\n> 60\n> 61\t\t/* Check the first VEC_SIZE bytes.  */\n> 62\t\tVPCMPEQ (%rdi), %ymm0, %ymm1\n> 63\t\tvpmovmskb %ymm1, %eax\n> 64\t\ttestl\t%eax, %eax\n> 65\n> 66\t# ifdef USE_AS_STRNLEN\n> (gdb) quit\n> A debugging session is active.\n>\n> \tInferior 1 [process 3063] will be killed.\n>\n> Quit anyway? (y or n) y\n>\n> \u001b[K\u001b[7mlines ?-?/? (END)\u001b[27m\u001b[K\n> \u001b[K\u001b[?1l\u001b>\u001b[?1049l\u001b[23;0;0t\u001b[0;32m✔\u001b[0;0m \u001b[0;33m~/kernel-source\u001b[0;0m [\u001b[0;35mSLE15-SP2\u001b[0;0m ↑·82\u001b[0;0m|\u001b[0;36m…17791\u001b[0;0m\u001b[1;34m⚑ 9\u001b[0;0m\u001b[0;0m]\n>\n> \u001b[0;37m12:16\u001b[0;0m $ gdb --args git range-diff 76ac02e3549..cd5f86d59a73 76ac02e3549..3b77e5866178\n> \u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[Cldd `which git`\u001b[K\n> \tlinux-vdso.so.1 (0x00007ffe55bfd000)\n> \tlibpcre2-8.so.0 => /usr/lib64/libpcre2-8.so.0 (0x00007f125f849000)\n> \tlibz.so.1 => /lib64/libz.so.1 (0x00007f125f632000)\n> \tlibsha1detectcoll.so.1 => /usr/lib64/libsha1detectcoll.so.1 (0x00007f125f428000)\n> \tlibpthread.so.0 => /lib64/libpthread.so.0 (0x00007f125f20a000)\n> \tlibrt.so.1 => /lib64/librt.so.1 (0x00007f125f002000)\n> \tlibc.so.6 => /lib64/libc.so.6 (0x00007f125ec48000)\n> \t/lib64/ld-linux-x86-64.so.2 (0x00007f125ffdc000)\n> \u001b[0;32m✔\u001b[0;0m \u001b[0;33m~/kernel-source\u001b[0;0m [\u001b[0;35mSLE15-SP2\u001b[0;0m ↑·82\u001b[0;0m|\u001b[0;36m…17791\u001b[0;0m\u001b[1;34m⚑ 9\u001b[0;0m\u001b[0;0m]\n>\n> \u001b[0;37m12:16\u001b[0;0m $ exit\n>\n> Script done on 2019-09-23 12:16:17+0200\n>\n"},{"id":"383275","messageId":"20191002141615.GB17916@kitsune.suse.cz","threadId":"51955","inReplyTo":"nycvar.QRO.7.76.6.1910021129010.46@tvgsbejvaqbjf.bet","subject":"Re: git crash in range-diff","fromName":"Michal Suchánek","fromEmail":"msuchanek@suse.de","sentAt":"2019-10-02T14:16:15Z","receivedAt":"2019-10-02T14:16:22Z","isPatch":false,"sender":{"key":"msuchanek@suse.de","avatar":"https://avatars.githubusercontent.com/u/787652?v=4"},"body":"On Wed, Oct 02, 2019 at 11:41:53AM +0200, Johannes Schindelin wrote:\n> Hi Michal,\n> \n> On Wed, 2 Oct 2019, Michal Suchánek wrote:\n> \n> > I get a crash in range-diff. It used to work in the past but I don't use\n> > it often so can't really say if this is a regression or a particular\n> > data triggering the crash.\n> \n> It would always be helpful to add a Minimal, Complete & Verifiable\n> Example with your bug reports. If that is too much of a burden ;-) at\n> least try to give a Complete & Verifiable Example.\n\nIt is not always clear what the minimal and verifiable example is. So I\nsent the report in case somebody can see something obviously broken try\nto suggest such examples, etc.\n\n> \n> And indeed, when I look at the variable `line`:\n> \n> >           ws_rule = 0, lines_added = 0, lines_deleted = 0, score = 0, extension_linenr = 0, is_toplevel_relative = 0, inaccurate_eof = 0,\n> >           is_binary = 0, is_copy = 0, is_rename = 0, recount = 0, conflicted_threeway = 0, direct_to_threeway = 0, crlf_in_old = 0,\n> >           fragments = 0x0, result = 0x0, resultsize = 0, old_oid_prefix = \"c452d7c1308d\", '\\000' <repeats 52 times>,\n> >           new_oid_prefix = \"dd7b242a4c00\", '\\000' <repeats 52 times>, next = 0x0, threeway_stage = {{hash = '\\000' <repeats 31 times>}, {\n> >               hash = '\\000' <repeats 31 times>}, {hash = '\\000' <repeats 31 times>}}}\n> >         root = {alloc = 0, len = 0, buf = 0x555555a64920 <strbuf_slopbuf> \"\"}\n> >         linenr = 4\n> >         p = <optimized out>\n> >         cp = {argv = 0x555555a6a390, args = {argv = 0x555555a6a390, argc = 12, alloc = 24}, env_array = {\n> >             argv = 0x555555a2f760 <empty_argv>, argc = 0, alloc = 0}, pid = 3068, trace2_child_id = 0, trace2_child_us_start = 0,\n> >           trace2_child_class = 0x0, trace2_hook_name = 0x0, in = 0, out = 3, err = 0, dir = 0x0, env = 0x555555a2f760 <empty_argv>,\n> >           no_stdin = 1, no_stdout = 0, no_stderr = 0, git_cmd = 1, silent_exec_failure = 0, stdout_to_stderr = 0, use_shell = 0,\n> >           clean_on_exit = 0, wait_after_clean = 0, clean_on_exit_handler = 0x0, clean_on_exit_handler_cbdata = 0x0}\n> >         buf = {alloc = 6816, len = 5924,\n> >           buf = 0x555555a864c0 \" ## Metadata ##\\nAuthor: Michal Suchanek <msuchanek@suse.de>\\n\\n ## Commit message ##\\n    Refresh sorted section.\\n\\n    - Refresh patches.suse/powerpc-dump-kernel-log-before-carrying-out-fadump-o.patch wi\"...}\n> >         contents = {alloc = 947512, len = 679767, buf = 0x7ffff7e69010 \"commit 999192044274522b2d5820f40cd1a7436cce31b9\"}\n> >         util = 0x555555a6a600\n> >         in_header = 0\n> >         line = 0x7ffff7e6aea0 \"diff --git series.conf series.conf\\nindex c452d7c1308d..dd7b242a4c00 100644\\n--- series.conf\\n+++ series.conf\\n@@ -47,17 +47,14 @@\\n#\\t\", '#' <repeats 56 times>, \"\\n#\\t# sorted pat\"...\n>                                             ^^^^^^^^^^^ ^^^^^^^^^^^\n> \n> I see that neither old nor new name start with the expected `a/` and\n> `b/`, respectively. But that `1` that was passed to\n> `parse_git_diff_header()` is the `p_value`, i.e. the number of leading\n> directories to strip from the file names.\n> \n> And when there is nothing to strip, but it was told to strip something,\n> I guess `parse_git_diff_header()` just ignores it and leaves `new_name`\n> unassigned.\n> \n> So here is how you can chase this down further:\n> \n> - Why are those `a/` and `b/` prefixes missing? They should not be\n>   missing, they should be generated by default,\n\nUnless you change the default so you get sane filenames (without those\ncrazy useless prefixes) that you can cut and paste into a text editor. I\neven tried to link a and b to . so I can access the files with the\nfilenames git gives by default but then git fails miserably.\n\n>   and `range-diff` expects\n>   them.\n\nSo it should set up the configuration so that it gets them.\n\n> \n>   Probably some funny config setting in your setup, something that\n>   should probably be explicitly overridden by the `range-diff` machinery\n>   when generating those patches that are then fed into `read_patches()`.\n\nSo the minimal verifiable example is I suppose\n\ndiff.noprefix=true\n\nThanks\n\nMichal\n"}]}