aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@FreeBSD.org>2020-11-13 21:24:25 +0000
committerChristian Weisgerber <naddy@FreeBSD.org>2020-11-13 21:24:25 +0000
commit615c49618034822d1a670f0f9a5777191318f53b (patch)
treecd9db0274f7ae97444b19bae9e78fd36336e286d
parent573d99c3436ebb953b5c7b066f7d473d237f54f4 (diff)
downloadports-615c49618034822d1a670f0f9a5777191318f53b.tar.gz
ports-615c49618034822d1a670f0f9a5777191318f53b.zip
Fix tog(1)'s log view: backspace, ^L, 'B' would cause the program
to exit immediately with an error. This bug went unnoticed because OpenBSD's pthread_cond_destroy() can be called twice in a row on the same condition variable. FreeBSD is less forgiving.
Notes
Notes: svn path=/head/; revision=555052
-rw-r--r--devel/got/Makefile1
-rw-r--r--devel/got/files/patch-regress_cmdline_common.sh4
-rw-r--r--devel/got/files/patch-tog_tog.c48
3 files changed, 51 insertions, 2 deletions
diff --git a/devel/got/Makefile b/devel/got/Makefile
index 26714bc61a62..08330d67f187 100644
--- a/devel/got/Makefile
+++ b/devel/got/Makefile
@@ -2,6 +2,7 @@
PORTNAME= got
PORTVERSION= 0.44
+PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= https://gameoftrees.org/releases/
diff --git a/devel/got/files/patch-regress_cmdline_common.sh b/devel/got/files/patch-regress_cmdline_common.sh
index 5b367c8d97bf..4c491a070b89 100644
--- a/devel/got/files/patch-regress_cmdline_common.sh
+++ b/devel/got/files/patch-regress_cmdline_common.sh
@@ -1,6 +1,6 @@
---- regress/cmdline/common.sh.orig 2020-09-13 18:20:00 UTC
+--- regress/cmdline/common.sh.orig 2020-10-13 22:33:10 UTC
+++ regress/cmdline/common.sh
-@@ -24,6 +24,20 @@ export GOT_LOG_DEFAULT_LIMIT=0
+@@ -25,6 +25,20 @@ export GOT_TEST_ROOT="/tmp"
export MALLOC_OPTIONS=S
diff --git a/devel/got/files/patch-tog_tog.c b/devel/got/files/patch-tog_tog.c
new file mode 100644
index 000000000000..fc6ae1b5e7f0
--- /dev/null
+++ b/devel/got/files/patch-tog_tog.c
@@ -0,0 +1,48 @@
+-----------------------------------------------
+commit 276b94a1f9ff915aab767e558957527ccddf43e9 (main)
+from: Christian Weisgerber <naddy@mips.inka.de>
+date: Fri Nov 13 21:09:10 2020 UTC
+
+ Call pthread_cond_destroy(cond) exactly once when closing a view.
+
+ This moves the pthread_cond_destroy(need_commits) from stop_log_thread(),
+ which can be called twice, to close_log_view(), which is called
+ once. It also destroys the commit_loaded condition variable, which
+ is created in open_log_view() but was never destroyed.
+
+ ok stsp
+
+blob - 3895e44e1cc2bd3dcc96dbcbd7369ecad839c9b0
+blob + 200352838ae37181b0bce33796fd9bfa11c66d34
+--- tog/tog.c.orig 2020-11-13 21:13:34 UTC
++++ tog/tog.c
+@@ -2035,10 +2035,6 @@ stop_log_thread(struct tog_log_view_state *s)
+ s->thread = NULL;
+ }
+
+- errcode = pthread_cond_destroy(&s->thread_args.need_commits);
+- if (errcode && err == NULL)
+- err = got_error_set_errno(errcode, "pthread_cond_destroy");
+-
+ if (s->thread_args.repo) {
+ got_repo_close(s->thread_args.repo);
+ s->thread_args.repo = NULL;
+@@ -2057,8 +2053,18 @@ close_log_view(struct tog_view *view)
+ {
+ const struct got_error *err = NULL;
+ struct tog_log_view_state *s = &view->state.log;
++ int errcode;
+
+ err = stop_log_thread(s);
++
++ errcode = pthread_cond_destroy(&s->thread_args.need_commits);
++ if (errcode && err == NULL)
++ err = got_error_set_errno(errcode, "pthread_cond_destroy");
++
++ errcode = pthread_cond_destroy(&s->thread_args.commit_loaded);
++ if (errcode && err == NULL)
++ err = got_error_set_errno(errcode, "pthread_cond_destroy");
++
+ free_commits(&s->commits);
+ free(s->in_repo_path);
+ s->in_repo_path = NULL;