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

From:
Omar Polo <op@omarpolo.com>
Subject:
improve execv error message
To:
gameoftrees@openbsd.org
Date:
Fri, 16 Feb 2024 20:01:04 +0100

Download raw body.

Thread
I was playing with got on alpine and stumbled on this:

	~ # got clone ssh://anon@git.omarpolo.com/plass.git
	Connecting to ssh://anon@git.omarpolo.com/plass.git
	got: execv: No such file or directory
	got: unexpected end of file
	got: unexpected end of file

(please ignore the fact that i'm doing this as root... something
something containers...)

it fails to execute ssh.  While this could just considered an issue of
how got is packaged on alpine (could have a dependency on openssh), I
think we could still improve the error message to include what it is
trying to execute.

opinions?

diff /home/op/w/got
commit - 51f4d4cb56fbe32cd3511fb8d301525ef79483e0
path + /home/op/w/got
blob - 37f513651fb8783483a1bb2e446a59adf26cfda6
file + lib/dial.c
--- lib/dial.c
+++ lib/dial.c
@@ -298,7 +298,7 @@ got_dial_ssh(pid_t *newpid, int *newfd, const char *ho
 		if (strlcpy(cmd, command, sizeof(cmd)) >= sizeof(cmd))
 			err(1, "snprintf");
 		if (execv(GOT_DIAL_PATH_SSH, (char *const *)argv) == -1)
-			err(1, "execv");
+			err(1, "execv %s", GOT_DIAL_PATH_SSH);
 		abort(); /* not reached */
 	} else {
 		if (close(pfd[0]) == -1)
blob - a51d5610cd2c6be2596b758258e73b8c6ce621c4
file + lib/sigs.c
--- lib/sigs.c
+++ lib/sigs.c
@@ -124,7 +124,7 @@ got_sigs_sign_tag_ssh(pid_t *newpid, int *in_fd, int *
 		if (dup2(out_pfd[1], 1) == -1)
 			err(1, "dup2");
 		if (execv(GOT_TAG_PATH_SSH_KEYGEN, (char **const)argv) == -1)
-			err(1, "execv");
+			err(1, "execv %s", GOT_TAG_PATH_SSH_KEYGEN);
 		abort(); /* not reached */
 	}
 	if (close(in_pfd[0]) == -1)
@@ -350,7 +350,7 @@ got_sigs_verify_tag_ssh(char **msg, struct got_tag_obj
 		if (dup2(out_pfd[1], 1) == -1)
 			err(1, "dup2");
 		if (execv(GOT_TAG_PATH_SSH_KEYGEN, (char **const)argv) == -1)
-			err(1, "execv");
+			err(1, "execv %s", GOT_TAG_PATH_SSH_KEYGEN);
 		abort(); /* not reached */
 	}
 	if (close(in_pfd[0]) == -1) {