Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Nov 2020 21:24:25 +0000 (UTC)
From:      Christian Weisgerber <naddy@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r555052 - in head/devel/got: . files
Message-ID:  <202011132124.0ADLOPj8027066@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: naddy
Date: Fri Nov 13 21:24:25 2020
New Revision: 555052
URL: https://svnweb.freebsd.org/changeset/ports/555052

Log:
  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.

Added:
  head/devel/got/files/patch-tog_tog.c   (contents, props changed)
Modified:
  head/devel/got/Makefile
  head/devel/got/files/patch-regress_cmdline_common.sh

Modified: head/devel/got/Makefile
==============================================================================
--- head/devel/got/Makefile	Fri Nov 13 20:33:48 2020	(r555051)
+++ head/devel/got/Makefile	Fri Nov 13 21:24:25 2020	(r555052)
@@ -2,6 +2,7 @@
 
 PORTNAME=	got
 PORTVERSION=	0.44
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	https://gameoftrees.org/releases/
 

Modified: head/devel/got/files/patch-regress_cmdline_common.sh
==============================================================================
--- head/devel/got/files/patch-regress_cmdline_common.sh	Fri Nov 13 20:33:48 2020	(r555051)
+++ head/devel/got/files/patch-regress_cmdline_common.sh	Fri Nov 13 21:24:25 2020	(r555052)
@@ -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
  

Added: head/devel/got/files/patch-tog_tog.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/got/files/patch-tog_tog.c	Fri Nov 13 21:24:25 2020	(r555052)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011132124.0ADLOPj8027066>