"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
"Johannes Thyssen Tishman" <johannes@thyssentishman.com>
Subject:
segfault when recursively unstaging removed file
To:
<gameoftrees@openbsd.org>
Date:
Mon, 07 Oct 2024 12:56:25 +0200

Download raw body.

Thread
I know this is a very weird scenario and probably something that
shouldn't be done. Nevertheless I thought I'd report this. Please find
the backtrace attached.

Steps to reproduce:

mkdir -p foo/bar
touch foo/bar/file
got init foobar.git
got import -r foobar.git -m 'test' foo
got checkout foobar.git
cd foobar
echo 'blah' > bar/file
got stage bar/file
mv bar/file bar/new_file
got unstage bar

$ got -V
got 0.104-current
Script started on Mon Oct  7 12:51:27 2024
Reading symbols from got...
[New process 444543]
Core was generated by `got'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000067db43c5df9 in got_object_id_hex (id=0x0, buf=0x75491396de50 "\246\370\224\033", len=65) at /home/johannes/downloads/got/got/../lib/hash.c:175
175             if (id->algo == GOT_HASH_SHA1)
(gdb) bt
#0  0x0000067db43c5df9 in got_object_id_hex (id=0x0, buf=0x75491396de50 "\246\370\224\033", len=65) at /home/johannes/downloads/got/got/../lib/hash.c:175
#1  0x0000067db4399ab2 in got_error_no_obj (id=0x0) at /home/johannes/downloads/got/got/../lib/error.c:379
#2  0x0000067db43c0dee in got_repo_search_packidx (packidx=0x75491396dff8, idx=0x75491396dff4, repo=0x680ac21e450, id=0x0) at /home/johannes/downloads/got/got/../lib/repository.c:1430
#3  0x0000067db440f9d1 in open_blob (blob=0x75491396e258, repo=0x680ac21e450, id=0x0, blocksize=8192, outfd=72) at /home/johannes/downloads/got/got/../lib/object_open_privsep.c:945
#4  0x0000067db440f876 in got_object_open_as_blob (blob=0x75491396e258, repo=0x680ac21e450, id=0x0, blocksize=8192, outfd=72) at /home/johannes/downloads/got/got/../lib/object_open_privsep.c:1034
#5  0x0000067db43d4aba in unstage_path (arg=0x75491396e708, status=33 '!', staged_status=77 'M', relpath=0x67ff2e5e300 "bar/file", blob_id=0x75491396e340, staged_blob_id=0x0, commit_id=0x75491396e318, dirfd=-1, de_name=0x0) at /home/johannes/downloads/got/got/../lib/worktree.c:9828
#6  0x0000067db43dd92b in status_old (arg=0x75491396e5f0, ie=0x67ff2e6d0e0, parent_path=0x67ff2e3bf80 "bar") at /home/johannes/downloads/got/got/../lib/worktree.c:3709
#7  0x0000067db439d3fb in diff_fileindex_dir (fileindex=0x67ff2e71140, ie=0x75491396e4f0, dirlist=0x75491396e4e0, dirfd=70, rootpath=0x67ff2e43140 "/home/johannes/downloads/foobar", path=0x67ff2e3bf80 "bar", repo=0x680ac21e450, cb=0x75491396e648, cb_arg=0x75491396e5f0) at /home/johannes/downloads/got/got/../lib/fileindex.c:1207
#8  0x0000067db439cee1 in got_fileindex_diff_dir (fileindex=0x67ff2e71140, fd=69, rootpath=0x67ff2e43140 "/home/johannes/downloads/foobar", path=0x67ff2e3bf80 "bar", repo=0x680ac21e450, cb=0x75491396e648, cb_arg=0x75491396e5f0) at /home/johannes/downloads/got/got/../lib/fileindex.c:1284
#9  0x0000067db43c97c7 in worktree_status (worktree=0x67ff2e44b40, path=0x67ff2e3bf80 "bar", fileindex=0x67ff2e71140, repo=0x680ac21e450, status_cb=0x67db43d46c0 <unstage_path>, status_arg=0x75491396e708, cancel_cb=0x0, cancel_arg=0x0, no_ignores=1, report_unchanged=0) at /home/johannes/downloads/got/got/../lib/worktree.c:4212
#10 0x0000067db43d45e1 in got_worktree_unstage (worktree=0x67ff2e44b40, paths=0x75491396e838, progress_cb=0x67db43802a0 <update_progress>, progress_arg=0x75491396e810, patch_cb=0x0, patch_arg=0x75491396e7f0, repo=0x680ac21e450) at /home/johannes/downloads/got/got/../lib/worktree.c:9943
#11 0x0000067db437b0b2 in cmd_unstage (argc=1, argv=0x75491396e948) at /home/johannes/downloads/got/got/got.c:14146
#12 0x0000067db43666ee in main (argc=2, argv=0x75491396e940) at /home/johannes/downloads/got/got/got.c:269
(gdb) quit
Script done on Mon Oct  7 12:52:09 2024