{"thread":{"id":"62667","subject":"git-bugreport: core dump in git-difftool when there are no diffs","startedAt":"2024-12-18T18:29:55Z","lastAt":"2024-12-19T05:48:02Z","messageCount":2,"participants":["Matt Riben","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"509310","messageId":"CAJgEbBfca_tFmLm1JojL+JPwvCz96-VJbuQ5xT8iBos8h8QTVA@mail.gmail.com","threadId":"62667","inReplyTo":null,"subject":"git-bugreport: core dump in git-difftool when there are no diffs","fromName":"Matt Riben","fromEmail":"matt.riben@hashgraph.com","sentAt":"2024-12-18T18:29:41Z","receivedAt":"2024-12-18T18:29:55Z","isPatch":false,"sender":{"key":"matt.riben@hashgraph.com","avatar":null},"body":"Hello,\n\nI get a core dump running `git difftool` when there are no diffs. It is\neasy for me to reproduce this core dump. The attached bug report includes a\nstack trace.\n\nBest regards,\nMatt\n\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\nI ran `git difftool`.\n\nWhat did you expect to happen? (Expected behavior)\n\nI expected to see no diffs.\n\nWhat happened instead? (Actual behavior)\n\nCore dump generated (SIGSEGV).\n\nWhat's different between what you expected and what actually happened?\n\nI did not expect the core dump.\n\nAnything else you want to add:\n\n--- begin ---\n⬢ [devenv@toolbx git]$ git diff\n⬢ [devenv@toolbx git]$ git difftool --dir-diff -x echo\nSegmentation fault (core dumped)\n⬢ [devenv@toolbx git]$ coredumpctl debug /usr/bin/git\nHint: You are currently not seeing messages from other users and the system.\n      Users in groups '4294967295', 'systemd-journal' can see all messages.\n      Pass -q to turn off this notice.\n           PID: 5719 (git)\n           UID: 1000 (devenv)\n           GID: 1000 (devenv)\n        Signal: 11 (SEGV)\n     Timestamp: Wed 2024-12-18 12:05:51 CST (8s ago)\n  Command Line: git difftool --dir-diff -x echo\n    Executable: /usr/bin/git\n Control Group: /user.slice/user-1000.slice/user@1000.service/user.slice/libpod-e39b0c074f66c6e76f339f5c9357f4c38ea39a7753d11cc57320be2220182f21.scope/container\n          Unit: user@1000.service\n     User Unit: libpod-e39b0c074f66c6e76f339f5c9357f4c38ea39a7753d11cc57320be2220182f21.scope\n         Slice: user-1000.slice\n     Owner UID: 1000 (devenv)\n       Boot ID: 17325c4533ab4a278e85bb97a94cd3de\n    Machine ID: e6a7c524d21a41868bd9d5773b00278e\n      Hostname: toolbx\n       Storage: /var/lib/systemd/coredump/core.git.1000.17325c4533ab4a278e85bb97a94cd3de.5719.1734545151000000.zst (present)\n  Size on Disk: 48K\n       Package: git/2.47.1-1.fc41\n      build-id: 7623d17d0af420c0f1280a13d32b0bb528ab673c\n       Message: Process 5719 (git) of user 1000 dumped core.\n                \n                Module libz.so.1 from rpm zlib-ng-2.1.7-3.fc41.aarch64\n                Module libpcre2-8.so.0 from rpm pcre2-10.44-1.fc41.1.aarch64\n                Module git from rpm git-2.47.1-1.fc41.aarch64\n                Stack trace of thread 5719:\n                #0  0x0000ffff9a3eec50 free (libc.so.6 + 0x9ec50)\n                #1  0x0000aaaae8aab484 hashmap_clear_.part.0 (git + 0x1ab484)\n                #2  0x0000aaaae8956284 cmd_difftool (git + 0x56284)\n                #3  0x0000aaaae890a640 handle_builtin.lto_priv.0 (git + 0xa640)\n                #4  0x0000aaaae890ab84 run_argv.lto_priv.0 (git + 0xab84)\n                #5  0x0000aaaae8905e00 main (git + 0x5e00)\n                #6  0x0000ffff9a37629c __libc_start_call_main (libc.so.6 + 0x2629c)\n                #7  0x0000ffff9a37637c __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x2637c)\n                #8  0x0000aaaae8906270 _start (git + 0x6270)\n                ELF object binary architecture: AARCH64\n\nGNU gdb (Fedora Linux) 15.2-3.fc41\nCopyright (C) 2024 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 \"aarch64-redhat-linux-gnu\".\nType \"show configuration\" for configuration details.\nFor bug reporting instructions, please see:\n<https://www.gnu.org/software/gdb/bugs/>.\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 /usr/bin/git...\n\nThis GDB supports auto-downloading debuginfo from the following URLs:\n  <https://debuginfod.fedoraproject.org/>\nEnable debuginfod for this session? (y or [n]) y\nDebuginfod has been enabled.\nTo make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.\nReading symbols from /var/home/devenv/.cache/debuginfod_client/7623d17d0af420c0f1280a13d32b0bb528ab673c/debuginfo...\n[New LWP 5719]\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library \"/lib64/libthread_db.so.1\".\nCore was generated by `git difftool --dir-diff -x echo'.\nProgram terminated with signal SIGSEGV, Segmentation fault.\n#0  __GI___libc_free (mem=<optimized out>) at malloc.c:3375\n3375\t  if (chunk_is_mmapped (p))                       /* release mmapped memory. */\n(gdb) bt\n#0  __GI___libc_free (mem=<optimized out>) at malloc.c:3375\n#1  0x0000aaaae8aab484 [PAC] in hashmap_clear_ (map=0xffffead71538, entry_offset=<optimized out>) at /usr/src/debug/git-2.47.1-1.fc41.aarch64/hashmap.c:208\n#2  0x0000aaaae8956284 [PAC] in hashmap_clear_ (map=0xffffead71538, entry_offset=0) at /usr/src/debug/git-2.47.1-1.fc41.aarch64/hashmap.c:204\n#3  run_dir_diff (extcmd=<optimized out>, symlinks=1, prefix=<optimized out>, child=0xffffead714c0) at builtin/difftool.c:667\n#4  cmd_difftool (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>, repo=<optimized out>) at builtin/difftool.c:801\n#5  0x0000aaaae890a640 [PAC] in run_builtin (p=0xaaaae8d003f0 <commands.lto_priv+912>, argc=4, argv=0xffffead723c0, repo=0xaaaae8d107d8 <the_repo.lto_priv>)\n    at /usr/src/debug/git-2.47.1-1.fc41.aarch64/git.c:483\n#6  handle_builtin (argc=4, argv=0xffffead723c0) at /usr/src/debug/git-2.47.1-1.fc41.aarch64/git.c:749\n#7  0x0000aaaae890ab84 [PAC] in run_argv (argcp=0xffffead7210c, argv=0xffffead72128) at /usr/src/debug/git-2.47.1-1.fc41.aarch64/git.c:819\n#8  0x0000aaaae8905e00 [PAC] in cmd_main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/git-2.47.1-1.fc41.aarch64/git.c:954\n#9  main (argc=5, argv=<optimized out>) at /usr/src/debug/git-2.47.1-1.fc41.aarch64/common-main.c:64\n--- end ---\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.47.1\ncpu: aarch64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nlibcurl: 8.9.1\nOpenSSL: OpenSSL 3.2.2 4 Jun 2024\nzlib: 1.3.1.zlib-ng\nuname: Linux 6.12.4-200.fc41.aarch64 #1 SMP PREEMPT_DYNAMIC Mon Dec  9 20:24:04 UTC 2024 aarch64\ncompiler info: gnuc: 14.2\nlibc info: glibc: 2.40\n$SHELL (typically, interactive shell): /bin/bash\n\n\n[Enabled Hooks]\nprepare-commit-msg\n"},{"id":"509324","messageId":"20241219054801.GA2311098@coredump.intra.peff.net","threadId":"62667","inReplyTo":"CAJgEbBfca_tFmLm1JojL+JPwvCz96-VJbuQ5xT8iBos8h8QTVA@mail.gmail.com","subject":"Re: git-bugreport: core dump in git-difftool when there are no diffs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2024-12-19T05:48:01Z","receivedAt":"2024-12-19T05:48:02Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Dec 18, 2024 at 12:29:41PM -0600, Matt Riben wrote:\n\n> I get a core dump running `git difftool` when there are no diffs. It is\n> easy for me to reproduce this core dump. The attached bug report includes a\n> stack trace.\n\nThanks for a thorough bug report.\n\nThis was fixed by 98e4015593 (builtin/difftool: intialize some hashmap\nvariables, 2024-11-12), which should be in the upcoming v2.48.0 release.\n\n-Peff\n"}]}