From: Mark Jamsek Subject: gotd broken tree To: Game of Trees Date: Tue, 7 Feb 2023 00:08:40 +1100 The gotd build appears to be broken at the moment: ----8<-------- $ make server ... cc -O0 -g -o gotctl gotctl.o error.o imsg.o pollfd.o sha1.o -lutil -lz -lm -levent ld: error: undefined symbol: got_object_id_hex >>> referenced by error.c:374 (/home/mark/src/got/gotctl/../lib/error.c:374) >>> error.o:(got_error_no_obj) >>> referenced by error.c:391 (/home/mark/src/got/gotctl/../lib/error.c:391) >>> error.o:(got_error_checksum) cc: error: linker command failed with exit code 1 (use -v to see invocation) *** Error 1 in gotctl (:126 'gotctl') *** Error 2 in /home/mark/src/got (Makefile:49 'server') -------->8---- The below diff seems to produce a clean build, with both regress/cmdline and regress/gotd passing. diffstat /home/mark/src/got M gotctl/Makefile | 2+ 1- M gotsh/Makefile | 1+ 1- M lib/read_gitconfig.c | 33+ 14- 3 files changed, 36 insertions(+), 16 deletions(-) diff /home/mark/src/got commit - b0a0c9eda4b7f60ae432f321389f9c344b6c0fc2 path + /home/mark/src/got blob - de99e60620ea466b3e56f258e643d00a974595d6 file + gotctl/Makefile --- gotctl/Makefile +++ gotctl/Makefile @@ -3,7 +3,8 @@ SRCS= gotctl.c error.c imsg.c pollfd.c sha1.c .include "../got-version.mk" PROG= gotctl -SRCS= gotctl.c error.c imsg.c pollfd.c sha1.c +SRCS= gotctl.c error.c imsg.c inflate.c object_parse.c path.c \ + pollfd.c sha1.c MAN = ${PROG}.8 blob - c4456b3590ca82fd05071e3b28f8372a45371af0 file + gotsh/Makefile --- gotsh/Makefile +++ gotsh/Makefile @@ -4,7 +4,7 @@ SRCS= gotsh.c error.c pkt.c sha1.c serve.c path.c git PROG= gotsh SRCS= gotsh.c error.c pkt.c sha1.c serve.c path.c gitproto.c \ - imsg.c pollfd.c reference_parse.c + imsg.c inflate.c object_parse.c pollfd.c reference_parse.c MAN = ${PROG}.1 blob - d46762d0f8fd908e9beebe23dd87ff3740db4068 file + lib/read_gitconfig.c --- lib/read_gitconfig.c +++ lib/read_gitconfig.c @@ -54,8 +54,8 @@ got_repo_read_gitconfig(int *gitconfig_repository_form got_repo_read_gitconfig(int *gitconfig_repository_format_version, char **gitconfig_author_name, char **gitconfig_author_email, struct got_remote_repo **remotes, int *nremotes, - char **gitconfig_owner, char ***extensions, int *nextensions, - const char *gitconfig_path) + char **gitconfig_owner, char ***extnames, char ***extvals, + int *nextensions, const char *gitconfig_path) { const struct got_error *err = NULL; struct got_gitconfig *gitconfig = NULL; @@ -65,8 +65,10 @@ got_repo_read_gitconfig(int *gitconfig_repository_form const char *author, *email, *owner; *gitconfig_repository_format_version = 0; - if (extensions) - *extensions = NULL; + if (extnames) + *extnames = NULL; + if (extvals) + *extvals = NULL; if (nextensions) *nextensions = 0; *gitconfig_author_name = NULL; @@ -93,7 +95,7 @@ got_repo_read_gitconfig(int *gitconfig_repository_form "core", "repositoryformatversion", 0); tags = got_gitconfig_get_tag_list(gitconfig, "extensions"); - if (extensions && nextensions && tags) { + if (extnames && extvals && nextensions && tags) { size_t numext = 0; TAILQ_FOREACH(node, &tags->fields, link) { char *ext = node->field; @@ -102,22 +104,35 @@ got_repo_read_gitconfig(int *gitconfig_repository_form if (get_boolean_val(val)) numext++; } - *extensions = calloc(numext, sizeof(char *)); - if (*extensions == NULL) { + *extnames = calloc(numext, sizeof(char *)); + if (*extnames == NULL) { err = got_error_from_errno("calloc"); goto done; } + *extvals = calloc(numext, sizeof(char *)); + if (*extvals == NULL) { + err = got_error_from_errno("calloc"); + goto done; + } TAILQ_FOREACH(node, &tags->fields, link) { char *ext = node->field; char *val = got_gitconfig_get_str(gitconfig, "extensions", ext); if (get_boolean_val(val)) { - char *extstr = strdup(ext); + char *extstr = NULL, *valstr = NULL; + + extstr = strdup(ext); if (extstr == NULL) { err = got_error_from_errno("strdup"); goto done; } - (*extensions)[(*nextensions)] = extstr; + valstr = strdup(val); + if (valstr == NULL) { + err = got_error_from_errno("strdup"); + goto done; + } + (*extnames)[(*nextensions)] = extstr; + (*extvals)[(*nextensions)] = valstr; (*nextensions)++; } } @@ -250,11 +265,15 @@ done: if (gitconfig) got_gitconfig_close(gitconfig); if (err) { - if (extensions && nextensions) { - for (i = 0; i < (*nextensions); i++) - free((*extensions)[i]); - free(*extensions); - *extensions = NULL; + if (extnames && extvals && nextensions) { + for (i = 0; i < (*nextensions); i++) { + free((*extnames)[i]); + free((*extvals)[i]); + } + free(*extnames); + *extnames = NULL; + free(*extvals); + *extvals = NULL; *nextensions = 0; } if (remotes && nremotes) { -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68