{"thread":{"id":"61195","subject":"segfault with git rebase --abort","startedAt":"2024-03-24T18:38:26Z","lastAt":"2024-04-06T20:28:28Z","messageCount":5,"participants":["Wolfgang Rohdewald","Junio C Hamano","Marcel Röthke"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"491374","messageId":"88a694de4a7f767613475ef1d19292a69eaccb07.camel@rohdewald.de","threadId":"61195","inReplyTo":null,"subject":"segfault with git rebase --abort","fromName":"Wolfgang Rohdewald","fromEmail":"wolfgang@rohdewald.de","sentAt":"2024-03-24T18:28:21Z","receivedAt":"2024-03-24T18:38:26Z","isPatch":false,"sender":{"key":"wolfgang@rohdewald.de","avatar":null},"body":"git rebase -i\n\ngit rebase --abort # boom\n\ngit status only shows changes to be committed\nI can mail or upload the git archive, that would be 230MB\n\ngit fsck;git repack;git prune;git gc does not help\n\nHappens with git 2.39 and with latest git commit 11c821f2f2a31e70fb5cc449f9a29401c333aad2, compiled with -g -O0\n\ngdb:\n\nStarting program: /home/wr/bin/git rebase --abort\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library \"/lib/x86_64-linux-gnu/libthread_db.so.1\".\n\nProgram received signal SIGSEGV, Segmentation fault.\n0x00005555557ef89a in has_rerere_resolution (id=0x5555559f5950) at rerere.c:167\n167             return ((id->collection->status[variant] & both) == both);\n(gdb) bt\n#0  0x00005555557ef89a in has_rerere_resolution (id=0x5555559f5950) at rerere.c:167\n#1  0x00005555557f249c in rerere_clear (r=0x5555559ea220 <the_repo>, merge_rr=0x7fffffffc0a0) at rerere.c:1249\n#2  0x000055555562388e in cmd_rebase (argc=0, argv=0x7fffffffd8b0, prefix=0x0) at builtin/rebase.c:1315\n#3  0x0000555555574b71 in run_builtin (p=0x5555559b6010 <commands+2256>, argc=2, argv=0x7fffffffd8b0) at git.c:469\n#4  0x0000555555574f8c in handle_builtin (argc=2, argv=0x7fffffffd8b0) at git.c:724\n#5  0x00005555555751b0 in run_argv (argcp=0x7fffffffd71c, argv=0x7fffffffd710) at git.c:788\n#6  0x0000555555575724 in cmd_main (argc=2, argv=0x7fffffffd8b0) at git.c:923\n#7  0x0000555555673c7a in main (argc=3, argv=0x7fffffffd8a8) at common-main.c:62\n(gdb) p id->collection->status\n$2 = (unsigned char *) 0x0\n(gdb) p *(id->collection)\n$3 = {status_alloc = 0, status_nr = 0, status = 0x0, name = 0x5555559f5e80 \"a8ec6f624ee23ef2e37148a8172ebac3c6639f93\"}\n\nthere is no file named a8ec6f624ee23ef2e37148a8172ebac3c6639f93\n\n\n[System Info]\ngit version:\ngit version 2.44.GIT\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 6.6.22-25 #1 SMP PREEMPT_DYNAMIC Sun Mar 17 12:35:12 CET 2024 x86_64\ncompiler info: gnuc: 12.2\nlibc info: glibc: 2.36\n$SHELL (typically, interactive shell): /bin/bash\n\n\n[Enabled Hooks]\n\n-- \nmit freundlichen Grüssen\n\nWolfgang Rohdewald\n"},{"id":"491380","messageId":"xmqqle67pa7a.fsf@gitster.g","threadId":"61195","inReplyTo":"88a694de4a7f767613475ef1d19292a69eaccb07.camel@rohdewald.de","subject":"Re: segfault with git rebase --abort","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-03-24T21:54:33Z","receivedAt":"2024-03-24T21:54:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Wolfgang Rohdewald <wolfgang@rohdewald.de> writes:\n\n> git rebase -i\n>\n> git rebase --abort # boom\n>\n> git status only shows changes to be committed\n> I can mail or upload the git archive, that would be 230MB\n>\n> git fsck;git repack;git prune;git gc does not help\n\nThis thread _might_ be relevant.\n\n  https://lore.kernel.org/git/20240218114936.1121077-1-marcel@roethke.info/\n\nThe \"might\" is because the symptom is a sign of corruption of the\nrerere database but the discussion or the patch in there do not know\nhow such a corruption happened in the first place.\n\nIf you rebuild Git with Marcel's patch (there is v2 downthread, and\nwe have been waiting for a v3) and it improves the situation, please\ndo let us know.\n\nThanks.\n"},{"id":"491386","messageId":"7df26e3813ef76ee90c1fb02847bbb4b9bad630d.camel@rohdewald.de","threadId":"61195","inReplyTo":"xmqqle67pa7a.fsf@gitster.g","subject":"Re: segfault with git rebase --abort","fromName":"Wolfgang Rohdewald","fromEmail":"wolfgang@rohdewald.de","sentAt":"2024-03-24T22:56:28Z","receivedAt":"2024-03-24T23:03:26Z","isPatch":false,"sender":{"key":"wolfgang@rohdewald.de","avatar":null},"body":"Am Sonntag, dem 24.03.2024 um 14:54 -0700 schrieb Junio C Hamano:\n> Wolfgang Rohdewald <wolfgang@rohdewald.de> writes:\n> \n> > git rebase -i\n> > \n> > git rebase --abort # boom\n> > \n> This thread _might_ be relevant.\n> \n>   https://lore.kernel.org/git/20240218114936.1121077-1-marcel@roethke.info/\n> \n> The \"might\" is because the symptom is a sign of corruption of the\n> rerere database but the discussion or the patch in there do not know\n> how such a corruption happened in the first place.\n> \n> If you rebuild Git with Marcel's patch (there is v2 downthread, and\n> we have been waiting for a v3) and it improves the situation, please\n> do let us know.\n\nYes, the patch resolved my problem. Thanks a lot!\n\nFrom the bash history below, this might be the sequence:\n\n(git 2.39)\n\nI think I forgot to remove one line of \"<<<<<<< HEAD\" before doing the first git add.\n\nBecause git rebase --abort then told me about the lockfile, the segfault probably\nalready happened with the second git rebase --continue.\nand from then on all git rebase --abort segfaulted.\n\nOh - and I definitively did not mess around in .git\n\nI do have a backup of the repo, so if you want me to look up things ...\n\ngit checkout master\ngit rebase -i\nvi servertable.py\ngit add servertable.py  # here I probably left that <<<< HEAD line\ngit rebase --continue\nvi servertable.py \ngit add servertable.py\ngit rebase --continue   # I think this already segfaulted\ngit status\ndf                      # plenty of free space\ngit rebase --abort\nrm .git/MERGE_RR.lock\n\n\nSince the patch is about rerere, I now did:\n\nwrpc:~/tmp/kajongg (master|REBASE-i) git rerere status\nsrc/servertable.py\nwrpc:~/tmp/kajongg (master|REBASE-i) git rerere diff\nerror: Could not stat .git/rr-cache/a8ec6f624ee23ef2e37148a8172ebac3c6639f93/preimage: No such file or directory\nfatal: unable to generate diff for '.git/rr-cache/a8ec6f624ee23ef2e37148a8172ebac3c6639f93'\n\nwrpc:~/tmp/kajongg/.git/rr-cache (GIT_DIR!|REBASE-i) ls -lrt | tail -3\ndrwxr-xr-x 2 wr wr 4096 Mar 24 16:19 e6c7ce944f313fa718cad6875d4ee784c098868c\ndrwxr-xr-x 2 wr wr 4096 Mar 24 16:19 d0a20608fa0aafd2b234cce432ce7af567c1a94a\ndrwxr-xr-x 2 wr wr 4096 Mar 24 16:43 a8ec6f624ee23ef2e37148a8172ebac3c6639f93\nwrpc:~/tmp/kajongg/.git/rr-cache (GIT_DIR!|REBASE-i) ls -l a8ec6f624ee23ef2e37148a8172ebac3c6639f93/\ntotal 0\n\n\n-- \nmit freundlichen Grüssen\n\nWolfgang Rohdewald\n"},{"id":"491509","messageId":"xmqqfrwehweg.fsf@gitster.g","threadId":"61195","inReplyTo":"7df26e3813ef76ee90c1fb02847bbb4b9bad630d.camel@rohdewald.de","subject":"Re: segfault with git rebase --abort","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-03-25T20:46:47Z","receivedAt":"2024-03-25T20:46:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Wolfgang Rohdewald <wolfgang@rohdewald.de> writes:\n\n> Am Sonntag, dem 24.03.2024 um 14:54 -0700 schrieb Junio C Hamano:\n>> Wolfgang Rohdewald <wolfgang@rohdewald.de> writes:\n>> \n>> > git rebase -i\n>> > \n>> > git rebase --abort # boom\n>> > \n>> This thread _might_ be relevant.\n>> \n>>  https://lore.kernel.org/git/20240218114936.1121077-1-marcel@roethke.info/\n>> \n>> The \"might\" is because the symptom is a sign of corruption of the\n>> rerere database but the discussion or the patch in there do not know\n>> how such a corruption happened in the first place.\n>> \n>> If you rebuild Git with Marcel's patch (there is v2 downthread, and\n>> we have been waiting for a v3) and it improves the situation, please\n>> do let us know.\n>\n> Yes, the patch resolved my problem. Thanks a lot!\n\nThanks for testing (and thanks, Marcel, for writing a fix).\n\n>\n> From the bash history below, this might be the sequence:\n>\n> (git 2.39)\n>\n> I think I forgot to remove one line of \"<<<<<<< HEAD\" before doing the first git add.\n>\n> Because git rebase --abort then told me about the lockfile, the segfault probably\n> already happened with the second git rebase --continue.\n> and from then on all git rebase --abort segfaulted.\n>\n> Oh - and I definitively did not mess around in .git\n>\n> I do have a backup of the repo, so if you want me to look up things ...\n>\n> git checkout master\n> git rebase -i\n> vi servertable.py\n> git add servertable.py  # here I probably left that <<<< HEAD line\n> git rebase --continue\n> vi servertable.py \n> git add servertable.py\n> git rebase --continue   # I think this already segfaulted\n> git status\n> df                      # plenty of free space\n> git rebase --abort\n> rm .git/MERGE_RR.lock\n>\n>\n> Since the patch is about rerere, I now did:\n>\n> wrpc:~/tmp/kajongg (master|REBASE-i) git rerere status\n> src/servertable.py\n> wrpc:~/tmp/kajongg (master|REBASE-i) git rerere diff\n> error: Could not stat .git/rr-cache/a8ec6f624ee23ef2e37148a8172ebac3c6639f93/preimage: No such file or directory\n> fatal: unable to generate diff for '.git/rr-cache/a8ec6f624ee23ef2e37148a8172ebac3c6639f93'\n>\n> wrpc:~/tmp/kajongg/.git/rr-cache (GIT_DIR!|REBASE-i) ls -lrt | tail -3\n> drwxr-xr-x 2 wr wr 4096 Mar 24 16:19 e6c7ce944f313fa718cad6875d4ee784c098868c\n> drwxr-xr-x 2 wr wr 4096 Mar 24 16:19 d0a20608fa0aafd2b234cce432ce7af567c1a94a\n> drwxr-xr-x 2 wr wr 4096 Mar 24 16:43 a8ec6f624ee23ef2e37148a8172ebac3c6639f93\n> wrpc:~/tmp/kajongg/.git/rr-cache (GIT_DIR!|REBASE-i) ls -l a8ec6f624ee23ef2e37148a8172ebac3c6639f93/\n> total 0\n"},{"id":"492407","messageId":"ZhGuyeJp28heaITM@roethke.info","threadId":"61195","inReplyTo":"xmqqfrwehweg.fsf@gitster.g","subject":"Re: segfault with git rebase --abort","fromName":"Marcel Röthke","fromEmail":"marcel@roethke.info","sentAt":"2024-04-06T20:21:29Z","receivedAt":"2024-04-06T20:28:28Z","isPatch":false,"sender":{"key":"marcel@roethke.info","avatar":"https://avatars.githubusercontent.com/u/21661035?v=4"},"body":"On 2024-03-25 13:46:47, Junio C Hamano wrote:\n> Wolfgang Rohdewald <wolfgang@rohdewald.de> writes:\n> I think I forgot to remove one line of \"<<<<<<< HEAD\" before doing the first git add.\n\nThis was the missing piece in my reproduction attempts!\nWhen you leave that line in and have another conflict in the same file\nlater in the rebase, rerere falls on its nose.\n\nI will do some more poking and update my patch accordingly.\n"}]}