Commits


plug a memory leak in 'got blame' The leak is present in got_privsep_recv_traversed_commits. There is an edge case where it receives consecutive imsgs. The first behaves as normal and we got_object_id_dup the last commit id for changed_commit_id. The following imsg(s) then still allocates the last commit id, leaking the one(s) prior allocated. Patch by Kyle Ackerman


hide a pointless end-of-file error on imsg pipe in libexec helpers This error popped up in op's regress builder: got-fetch-pack: error 118 "test-repo: Permission denied": poll: unexpected end of file ok op@


adjust min_datalen in a few places Fix the computation of min_datalen that was forgotten in 8f137979fc5e284a136cf8950e8b3895d7ea208b. got_privsep_recv_imsg() already takes care of converting GOT_IMSG_ERROR to errors, so just how we didn't need to call recv_imsg_error() at all, we don't need to include it in the requested min_datalen.


swap the order of the checks to not hide an error If a libexec process returns an GOT_IMSG_ERROR that happens to be smaller than the requested min_datalen, got_privsep_recv_imsg() returns GOT_IMSG_PRIVSEP_LEN hiding the original error. ok stsp@


fix invalid imsg_free() in got_privsep_recv_printed_commits() Depending on the error got_privsep_recv_imsg() may leave imsg un-initialized, so change it to always free the imsg on error if needed, so callers don't have to. got_privsep_recv_printed_commits() and got-read-patch were the only places where we could end up calling imsg_free() on uninitialized imsg, fix them. ok stsp@


fix one error being ignored in got_privsep_recv_gitconfig_remotes


don't ignore err in got_privsep_recv_painted_commits


fix memory leak on error in got_privsep_recv_painted_commits() Diff from Kyle Ackerman, thank you! I've added a imsg_free() call before the break too.


use ibuf_fd_set() instead of reaching into the ibuf struct discussed with tb@


don't redundantly set wbuf->fd to -1 ibuf_dynamic() (called by imsg_create()) already initializes fd to -1.


fix some fd leaks in error paths and avoid some double close Sweep done after a few were spotted by tb@, thanks! ok stsp@


style


remove dependency of gitwrapper, gotctl, and gotsh on object_parse.c Move some functions from object_parse.c into hash.c. These functions either require hash.c code anyway or contain object ID implementation internals. Add a new file object_qid.c, for got_object_id_queue and got_object_qid. This new file must be linked to virtually every program.


fix GOT_IMSG_COMMIT_TRAVERSAL_REQUEST The sending and receiving side are sending the data differently. It works now by chance since a struct got_object_id is "just" a SHA1_DIGEST_LENGTH sized buffer, but will break in the future. Furthermore, the structure of the data as described in got_lib_privsep.h is not respected, as the path_len field is not transmitted. Change it to send/receive a whole struct got_object_id, the path without the NUL and the proper length. (The path is also actually mandatory, so assert it too.) improvements + ok stsp@


rename lib/sha1.c to lib/hash.c It will soon grow functions to deal with sha256 too. stsp@ agrees.