"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: got-build-regress.sh regress failure
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 22 Apr 2023 02:37:03 +1000

Download raw body.

Thread
On 23-04-21 05:40PM, Omar Polo wrote:
> On 2023/04/21 17:11:46 +0200, Omar Polo <op@omarpolo.com> wrote:
> > ==== run-regress-fetch_test ====
> > /home/chiaki/w/got/regress/fetch/obj/fetch_test -q
> > 
> > ===> regress/tog
> > ==== log ====
> > ./log.sh -q -r "/home/chiaki/tmp/"
> > tog: fopen: /home/chiaki/tmp/tog-test-log_hsplit_diff-eLI9p4Ou/view: No such file or directory
> 
> It fails because the file pointed in the TOG_SCR_DUMP environment
> variable is not permitted by unveil(), but since the default
> GOT_TEST_ROOT dir is /tmp which is unveiled this wasn't noticed
> before.
> 
> Here's a possible way to fix it: open the screendump earlier and keep
> it open.  I've added a ftruncate call in screendump() just in case it
> gets called multiple times.
> 
> With this all tests are passing again on amd64 when ran as
> 
> 	$ mkdir -p ~/tmp/got-tmp
> 	$ make -C regress/tog GOT_TEST_ROOT=~/tmp/got-tmp

Could we unveil GOT_TEST_ROOT if it's set and it's a test run?

OTOH, it's unveiling another directory albeit only for tests. Either
way, I'm ok with your diff too.

diff /home/mark/src/got
commit - 69b9e75f5436338a9b5cddd5b8462929def12e8c
path + /home/mark/src/got
blob - 69803386ef3f054281b09871e9eb299e4c663e2b
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -4159,6 +4159,14 @@ apply_unveil(const char *repo_path, const char *worktr
 {
 	const struct got_error *error;
 
+	if (getenv("TOG_TEST_SCRIPT") != NULL) {
+		const char *got_test_root;
+
+		got_test_root = getenv("GOT_TEST_ROOT");
+		if (got_test_root && unveil(got_test_root, "rwc") != 0)
+			return got_error_from_errno2("unveil", got_test_root);
+	}
+
 #ifdef PROFILE
 	if (unveil("gmon.out", "rwc") != 0)
 		return got_error_from_errno2("unveil", "gmon.out");

-- 
Mark Jamsek <fnc.bsdbox.org|got.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68