opengit
opengit copied to clipboard
Segfault on clone
The new clone code causes segfaults on OpenBSD.
/home/brian/opengit $ ./src/obj/ogit clone https://github.com/ibara/shuf.git
Cannot create shuf/.git/objects
Segmentation fault (core dumped)
Backtrace:
GNU gdb (GDB) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-openbsd6.4".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./src/obj/ogit...done.
[New process 486951]
Core was generated by `ogit'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000001c8ed01099f in write_hash_count (idxfd=3, index_entry=0x1cb539414c0, idxctx=0x7f7ffffd6498) at /home/brian/opengit/lib/pack.c:293
293 while (index_entry[hashnum].digest[0] == x)
(gdb) bt full
#0 0x000001c8ed01099f in write_hash_count (idxfd=3, index_entry=0x1cb539414c0, idxctx=0x7f7ffffd6498) at /home/brian/opengit/lib/pack.c:293
hashnum = 90
reversed = 1476395008
x = 254
#1 0x000001c8ed010d70 in pack_build_index (idxfd=3, packfileinfo=0x7f7ffffd6d80, index_entry=0x1cb539414c0, idxctx=0x7f7ffffd6498) at /home/brian/opengit/lib/pack.c:354
No locals.
#2 0x000001c8ed016971 in clone_http (uri=0x7f7ffffd7535 "https://github.com/ibara/shuf.git", repodir=0x1cb7cc209d0 "shuf", smart_head=0x7f7ffffd7298) at /home/brian/opengit/src/clone_http.c:356
packfd = 3
offset = 24243
idxfd = 3
packfileinfo = {version = 2, nobjects = 90, sha = "\304 \317\026\264\255\227\234r\266\244j\320\005\334\357\070\207]\035", ctx = "\241*\247[\340m\375\377\177\177\000\000\233^\001\355\310\001\000"}
index_entry = 0x1cb539414c0
path = "shuf/.git/objects/pack/_tmp.idx", '\000' <repeats 992 times>
srcpath = "shuf\313\001\000\000\360_\375\377\177\177\000\000\314.\000\000\020", '\000' <repeats 19 times>, "r/\000\000\020", '\000' <repeats 19 times>, "z/\000\000\020", '\000' <repeats 19 times>, "\201/\000\000\020", '\000' <repeats 19 times>, "\206/\000\000\020", '\000' <repeats 19 times>, "\214/\000\000\020", '\000' <repeats 19 times>, "\231/\000\000\020", '\000' <repeats 19 times>, "\246/\000\000\020", '\000' <repeats 19 times>...
pathlen = 4
ret = 0
fetch_uri = 0x7f7ffffd7535 "https://github.com/ibara/shuf.git"
suffix = 0x7f7ffffd6974 "/.git/objects/pack/_tmp.idx"
packctx = {state = {0, 0, 0, 0, 0}, count = 0, buffer = '\000' <repeats 63 times>}
idxctx = {state = {4162611116, 3506059701, 2308756083, 441042767, 1224622383}, count = 8192,
buffer = "\000\000\000U\000\000\000U\000\000\000V\000\000\000V\000\000\000V\000\000\000V\000\000\000V\000\000\000V\000\000\000W\000\000\000W\000\000\000W\000\000\000W\000\000\000X\000\000\000X\000\000\000X\000\000\000X"}
#3 0x000001c8ed015c3d in clone_main (argc=2, argv=0x7f7ffffd73d0) at /home/brian/opengit/src/clone.c:430
smart_head = {sha = "2d1745967275049bb57809c89081adbe84a8ac50\001", cap = 16349, refcount = 9, refs = 0x1cb33f3d000, symrefs = {tqh_first = 0x1cb64f65800, tqh_last = 0x1cb64f65810}}
repodir = 0x1cb7cc209d0 "shuf"
repopath = 0x7f7ffffd7535 "https://github.com/ibara/shuf.git"
treesha = "\200\030\272a\313\001\000\000PvbZ\313\001\000\000\350s\375\377\177\177\000\000\310s\375\377\177\177\000\000\000\000\000\000\000\000\000"
chandler = 0x1c8ed0193f0 <clone_handlers+16>
nch = 1
ret = 0
ch = -1
q = 0
found = true
inodepath = "Pc\026\000\000\000\000\000\021\000\000\000\000\000\000\000\233\323\000\000\022\000\v\000@\220\030\000\000\000\000\000\060\000\000\000\000\000\000\000\032\340\000\000\022\000\v\000p<\031\000\000\000\000\000\220\000\000\000\000\000\000\000\261\353\000\000\022\000\v\000\220\022\032\000\000\000\000\000\\\003\000\000\000\000\000\000\337Q\000\000\022\000\v\000P\270\030\000\000\000\000\000\021\000\000\000\000\000\000\000\026\267\000\000\022\000\v\000\320^\026\000\000\000\000\000\060\000\000\000\000\000\000\000\336\366\000\000\022\000\v\000\020\210\032\000\000\000\000\000\320\000\000\000\000\000\000\000\202\b\000\000\022\000\v\000@\331\f\000\000\000\000\000\021\000\000\000\000\000\000\000\272\f\000\000\022\000\v\000\260t\031\000\000\000\000\000"...
#4 0x000001c8ed00d593 in main (argc=3, argv=0x7f7ffffd73c8) at /home/brian/opengit/src/ogit.c:95
ch = 6
(gdb) q
Darn...acknowledged.
It seems to work for me on FreeBSD. I presume this was on OpenBSD. Can you confirm which commit ID you were working off of? I suspect it wast last night's hastily removed strncat().
Nope. It's far earlier than that. It looks like it goes back to the June 9 commits.