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

From:
James Cook <falsifian@falsifian.org>
Subject:
strange behaviour when unstaging missing file
To:
gameoftrees@openbsd.org
Date:
Mon, 12 Feb 2024 03:57:49 +0000

Download raw body.

Thread
  • James Cook:

    strange behaviour when unstaging missing file

1. Make a new file
2. got stage (the file)
3. rm
4. got unstage (the file)

I've seen the above four steps do three different things:
a) segfault
b) say got: mkstemps: (path to directory containing file)/got-merge-blob-deriv-y1qCp2Ggtr: No such file or directory
c) say got: open: (path to file): No such file or directory

I haven't been able to reproduce the segfault, but here's a script 
which reproduces (b).

	mkdir bug; cd bug

	gotadmin init r.git
	mkdir init; touch init/f
	got im -r r.git -m init init

	got co r.git; cd r
	mkdir d
	echo hello > d/y
	got add d/y
	got stage d/y
	rm -r d
	got unstage d/y

As for getting a segfault, I seem to no longer have the repo which 
did that, but here's a backtrace from egdb from before I lost it:

#0  0x00000b92543c036c in digest_to_str (digest=0x0, len=20, buf=0x77e6f4749e10 "\b")
     at /home/falsifian/co/got/got/../lib/hash.c:117            
#1  0x00000b92543c02df in got_sha1_digest_to_str (digest=0x0, buf=0x77e6f4749e10 "\b", size=41)                               
     at /home/falsifian/co/got/got/../lib/hash.c:130
#2  0x00000b92543c0176 in got_object_id_hex (id=0x0, buf=0x77e6f4749e10 "\b", len=41)
     at /home/falsifian/co/got/got/../lib/hash.c:158
#3  0x00000b9254394c82 in got_error_no_obj (id=0x0) at /home/falsifian/co/got/got/../lib/error.c:377
#4  0x00000b92543bb2d9 in got_repo_search_packidx (packidx=0x77e6f4749fa8, idx=0x77e6f4749fa4, repo=0xb9456969450, id=0x0)
     at /home/falsifian/co/got/got/../lib/repository.c:1406
#5  0x00000b9254408b3f in open_blob (blob=0x77e6f474a210, repo=0xb9456969450, id=0x0, blocksize=8192, outfd=72)
     at /home/falsifian/co/got/got/../lib/object_open_privsep.c:946
#6  0x00000b92544089e6 in got_object_open_as_blob (blob=0x77e6f474a210, repo=0xb9456969450, id=0x0, blocksize=8192, outfd=72)
     at /home/falsifian/co/got/got/../lib/object_open_privsep.c:1035
#7  0x00000b92543ce5b9 in unstage_path (arg=0x77e6f474a698, status=33 '!', staged_status=65 'A', 
     relpath=0xb95019db7d0 "d/x", blob_id=0x77e6f474a2f0, staged_blob_id=0x0, commit_id=0x77e6f474a2d8, dirfd=-1, de_name=0x0)
     at /home/falsifian/co/got/got/../lib/worktree.c:9665
#8  0x00000b92543d7364 in status_old (arg=0x77e6f474a588, ie=0xb94569645a0, parent_path=0xb95019a8f60 "d")
     at /home/falsifian/co/got/got/../lib/worktree.c:3711
#9  0x00000b9254398316 in diff_fileindex_dir (fileindex=0xb95019a8b80, ie=0x77e6f474a490, dirlist=0x77e6f474a480, dirfd=70, 
     rootpath=0xb95019cc5e0 "/home/falsifian/tmp/d/r", path=0xb95019a8f60 "d", repo=0xb9456969450, cb=0x77e6f474a5e0, 
     cb_arg=0x77e6f474a588) at /home/falsifian/co/got/got/../lib/fileindex.c:1163
#10 0x00000b9254397cdf in got_fileindex_diff_dir (fileindex=0xb95019a8b80, fd=69, 
     rootpath=0xb95019cc5e0 "/home/falsifian/tmp/d/r", path=0xb95019a8f60 "d", repo=0xb9456969450, cb=0x77e6f474a5e0, 
     cb_arg=0x77e6f474a588) at /home/falsifian/co/got/got/../lib/fileindex.c:1225
#11 0x00000b92543c39b0 in worktree_status (worktree=0xb95019abf00, path=0xb95019a8f60 "d", fileindex=0xb95019a8b80, 
     repo=0xb9456969450, status_cb=0xb92543ce1b0 <unstage_path>, status_arg=0x77e6f474a698, cancel_cb=0x0, cancel_arg=0x0, 
     no_ignores=1, report_unchanged=0) at /home/falsifian/co/got/got/../lib/worktree.c:4210
#12 0x00000b92543ce0d3 in got_worktree_unstage (worktree=0xb95019abf00, paths=0x77e6f474a7c8, 
     progress_cb=0xb925437be50 <update_progress>, progress_arg=0x77e6f474a7a0, patch_cb=0x0, patch_arg=0x77e6f474a780, 
     repo=0xb9456969450) at /home/falsifian/co/got/got/../lib/worktree.c:9779
#13 0x00000b9254376ddf in cmd_unstage (argc=1, argv=0x77e6f474a8d8) at /home/falsifian/co/got/got/got.c:13911
#14 0x00000b9254362cd7 in main (argc=2, argv=0x77e6f474a8d0) at /home/falsifian/co/got/got/got.c:262

-- 
James